Skip to content

Commit

Permalink
Squashed commit of the discussed modifications
Browse files Browse the repository at this point in the history
Added trigger reason due to restart

Revert "Added trigger reason due to restart"

This reverts commit 44cd45f.

Partially restore 5f4e901, fixes dmfs#711 (dmfs#712)

Commit 5f4e901 contains a couple of changes which break the UI in that some elements don't respond to clicks anymore.
In particular the `focusable="true"` attribute seems to cause these issues. For now we simply revert the addition of these attributes.
In another story we should address the issue and fix the layout.

Update SDK target level to 26. Implements dmfs#703 (dmfs#719)

This also updates the support library version to 26.1.0.
Due to changes in Android 8 we had to limit some background service and broadcast functionality. There are no limitations to the user experience though, but some planned features may require a different solution now (mostly because implicit broadcasts no longer work).

Add signing config, implements dmfs#720 (dmfs#721)

Adds an optional signing config, which is ignored if no keystore property is present.

Add plugin to publish app, dmfs#718 (dmfs#722)

This adds a plugin which allows for publishing the app autimatically to Google Play.

Fix wrong ID being used. Fixes dmfs#723 (dmfs#724)

In an earlier commit we changed how the lists are loaded. Instead of loading them from the tasks table we now load them from the instances table. This was meant to prepare support for recurring tasks.

Unfortunately we missed on line where we were still using the `_id` column to get the task id (when we should actually use the `task_id` column now). This didn't cause any problem as long as the task id and the instance id where in sync (hence it wasn't an issue while testing). However, under certain circumstances this assumption is no longer true and caused an illegal Task URI to be loaded when clicking a task.

The list now uses the `task_id` column to create the task URI to show.

Add opentasks 1.1.14 to releases.

Auto-Determine release channel, implements dmfs#725 (dmfs#726)

Update the publish configuration to derive the publishing track form the version number.

Add OpenTasks 1.1.15 to releases

Request account visibility, implements dmfs#728 (dmfs#736)

This commit adds a workaround for sync apps which don't grant account visibility to OpenTasks. If a task list is inserted which belongs to an account which we can't see, the app asks for permission to see the account.
The `GET_ACCOUNTS` permission is no longer used on Android 8+ and the request for that permission will no longer be shown when the app starts.

Fix track selection, fixes dmfs#747 (dmfs#748)

The regular expression for the internal track didn't cover a revision descirption like `1.1.16-dirty` which is a release commit with changes.
The proposed fix makes the part between the version number and `-dirty` optional.

Reduce size of ProviderChangedBroadcast, fixes dmfs#744 (dmfs#749)

This commit removes the changelog we've sent with the ProviderChanged Broadcast. It's never really been used so far but may blow the IPC buffer size limit.
We need to find a better way to communicate changes efficiently to plugins once we support them. It's not a pressing concern though.

 fix recursive updateNotification calls  (dmfs#751)

* fix recursive updateNotification calls
* replace compile with implementation

Improve FTS performance, fixes dmfs#750 (dmfs#752)

The previous implementation tried to use the CONFLICT_IGNORE policy when inserting new ngrams and was falling back to a query in case it failed to find the id of the exiting ngram. This was very slow because it meant an expensive query for every ngram to insert.

The new solution goes over the existing ngrams and only inserts the ones which don't exist in the database. Similarily the ngram relations table is not cleared for the particular task, instead the existing ngrams are loaded and only new relations are inserted and obsolete relations are removed.

Detect state saved before FM commit, fixes dmfs#756 (dmfs#760)

Under certain conditions the task details fragment was about to be replaced after the fragment manager already saved its state. This caused a crash. This change checks whether the state has already been saved before committing the transaction.

Always create DetailView, fixes dmfs#755 (dmfs#761)

Instead of creating the details view lazily when the task is loaded, we create it in `onCreateView` so it always exist. Hopefully this fixes dmfs#755, but since the actual reason is still unclear we can't be sure. In any case the details view needs a refactoring which reduces mutable state and makes it more robust.

Add some simple profiling for provider operations. supports dmfs#738 (dmfs#762)

In order to evaluate the provider performance and its impact on the UX this commit adds some simple profiling statments which measure the execution time of certain operations and write them to logcat.
Hopefully this helps a but to detect slow operations and bottlenecks.

Update ContentPal to latest GitHub version, implements dmfs#763 (dmfs#764)

In addition to just updating the ContentPal version this also replaces usages of deprecated jems classes.

Early version of a Notification concept. dmfs#716

Update notification concept.

* Reorder sections
* distinguish between notification triggers and sources

Removed typos

Added title to notification relevant fields

Reason is if a sync process updates the name of a task, a notification
might already be showing. In this case the notification text should be
updated according to the new title.
The same holds true for all shown information in the notification. As the
exact graphical representation of the notification is not fixed, this is
thus not 100% fixed as well.
  • Loading branch information
christianlupus committed Feb 15, 2019
1 parent f1db012 commit 2b28178
Show file tree
Hide file tree
Showing 92 changed files with 1,296 additions and 656 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ android:
- tools
- platform-tools
- tools
- build-tools-26.0.2
- build-tools-27.0.1
- build-tools-28.0.3
- android-24
- android-25
- android-26
- extra
- extra-android-m2repository
- sys-img-armeabi-v7a-android-24

# Emulator Management: Create, Start and Wait
before_script:
- android list targets
- echo no | android create avd --force -n test --target android-24 --abi armeabi-v7a
- QEMU_AUDIO_DRV=none emulator -avd test -no-window &
- android-wait-for-emulator
Expand All @@ -26,3 +29,6 @@ before_script:
script:
- android list target
- ./gradlew check connectedAndroidTest

after_script:
- cat /home/travis/build/dmfs/opentasks/opentasks/build/reports/lint-results.xml
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath("com.github.triplet.gradle:play-publisher:2.0.0-rc1")
}
}

def gitVersion = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
commandLine 'git', 'describe', '--tags', '--always', '--dirty'
standardOutput = stdout
}
return stdout.toString().trim()
Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def support_lib_version = '25.4.0'
def jems_version = '1.15'
def contentpal_version = '9b087b2' // 9b087b2 -> 2017-12-12
def support_lib_version = '26.1.0'
def jems_version = '1.18'
def contentpal_version = 'a7fbc62eef' // a7fbc62eef -> 2018-08-19
def support_test_runner_version = '0.5'

ext.deps = [
Expand Down
107 changes: 84 additions & 23 deletions documentation/concepts/notifications/notification-concept.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,54 @@ https://developer.android.com/guide/topics/ui/notifiers/notifications[Notificati

We want to use this opportunity to rework and improve notification handling in general.

== Triggers
== Definition

At present there are six reasons for the notifications to be created or updated:
By "task notifification" we mean a visual or aural signal to inform the user
about a certain task property or state transition, using Android's notification
framework.


== Requirements

=== Legacy API level support

A large amount of devices still uses Android API levels < 26 and its crucial to support older
Android versions.

==== Legacy notification layout

Notifications may look different on older devices than on newer ones.

==== Notification settings

On Android 8+ the system provides the UI to change notification sound, heads up display and
vibration settings. On older Android versions we need to maintain our own settings page.

==== Foreground service management

On Android 8+ a foreground service must explicitly enter foreground mode by calling
`startForeground` right after the the service has been started.

=== Group support

Certain types of notifications should be grouped if supported by the device.

TODO: The details still need to be worked out.

=== Efficiency

Notifications should not be updated more often than necessary and should reduce database
queries to the bare minimum. Especially since any task update could trigger or update
a notification it's essential to keep the overhead low in order to now slow down provider
updates.


== Notification sources

A notification source means a condition which is based on one or multiple
task properties and which results in a notification when it occurs.

At present there are six sources for notifications:

A task starts::

Expand Down Expand Up @@ -68,39 +113,55 @@ A task geo fence entered::
A task may have a location based reminder. If the location is approached a notification
should be shown.

== Requirements

=== Legacy API level support
In later versions we may support other sources like state transitions.

A large amount of devices still uses Android API levels < 26 and its crucial to support older
Android versions.
== Notification triggers

==== Legacy notification layout
A notification trigger means an event which results in an update of the currently shown
notifications.

Notifications may look different on older devices than on newer ones.
Currently we have three:

==== Notification settings
A task provider operation::

On Android 8+ the system provides the UI to change notification sound, heads up display and
vibration settings. On older Android versions we need to maintain our own settings page.
We don't distinguish between UI operations and sync adapter operations. We should
check if a "notification relevant" field has been updated. This way we can avoid
notification updates in case only a field like "description" has been changed.

==== Foreground service management
The following fields are considered notification relevant:

On Android 8+ a foreground service must explicitly enter foreground mode by calling
`startForeground` right after the the service has been started.
* title
* dtstart
* due
* status
* pinned
* extended property for alarm
* extended property for geo fences
* [anything potentially showing in the notification, see open issues **Notification texts**]

=== Group support
In order to save precious resources we only update task notifications which
need to be updated.

Certain types of notifications should be grouped if supported by the device.

TODO: The details still need to be worked out.
The system has booted::

=== Efficiency
After booting the system no notifications are shown and we have to restore them.
Ideally we also restore start and due notifications which have not been
dismissed yet.

The app has been updated::

When the app is updated, it is first stopped, causing existing notifications to be
removed. In that case we also have to restore the notifications.

In addition there is one future source planned:

A geo fence has been crossed::

When the app is updated, it is first stopped, causing exiting notifications to be
removed. In that case we also have to restore the notifications.

Notifications should not be updated more often than necessary and should reduce database
queries to the bare minimum. Especially since any task update could trigger or update
a notification it's essential to keep the overhead low in order to now slow down provider
updates.

== Notification types

Expand All @@ -120,7 +181,7 @@ By default, this channel has a HIGH priority to show a heads up notification.
Pin board::

This channel contains notifications for pinned tasks.
By default, this channel has a HIGH priority to make a sound but not
By default, this channel has a MEDIUM priority to make a sound but not
show a heads up notification.

== State diagram
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMPILE_SDK_VERSION=25
COMPILE_SDK_VERSION=26
BUILD_TOOLS_VERSION=27.0.1
MIN_SDK_VERSION=15
TARGET_SDK_VERSION=25
TARGET_SDK_VERSION=26
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Thu Nov 08 02:52:41 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
1 change: 0 additions & 1 deletion opentasks-contract/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
buildToolsVersion BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion MIN_SDK_VERSION.toInteger()
Expand Down
1 change: 0 additions & 1 deletion opentasks-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
buildToolsVersion BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion MIN_SDK_VERSION.toInteger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.dmfs.ngrams;

import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
Expand Down Expand Up @@ -112,39 +113,23 @@ public NGramGenerator setLocale(Locale locale)
* @param data
* The String to analyze.
*
* @return A {@link Set} containing all N-grams.
* @return The {@link Set} containing the N-grams.
*/
public Set<String> getNgrams(String data)
{
Set<String> result = new HashSet<String>(128);

return getNgrams(result, data);
}

if (data == null)
{
return Collections.emptySet();
}

/**
* Get all N-grams contained in the given String.
*
* @param set
* The set to add all the N-grams to, or <code>null</code> to create a new set.
* @param data
* The String to analyze.
*
* @return The {@link Set} containing the N-grams.
*/
public Set<String> getNgrams(Set<String> set, String data)
{
if (mAllLowercase)
{
data = data.toLowerCase(mLocale);
}

String[] words = mReturnNumbers ? SEPARATOR_PATTERN.split(data) : SEPARATOR_PATTERN_NO_NUMBERS.split(data);

if (set == null)
{
set = new HashSet<String>(128);
}
Set<String> set = new HashSet<String>(128);

for (String word : words)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.util.Log;

Expand Down Expand Up @@ -183,6 +184,11 @@ private void sendBroadcast(Context context, String action, Uri uri, DateTime dat
intent.putExtra(TaskContract.EXTRA_TASK_TIMEZONE, datetime.getTimeZone().getID());
}
intent.putExtra(TaskContract.EXTRA_TASK_TITLE, title);
if (Build.VERSION.SDK_INT >= 26)
{
// for now only notify our own package
intent.setPackage(context.getPackageName());
}
context.sendBroadcast(intent);
}
}),
Expand Down
Loading

0 comments on commit 2b28178

Please sign in to comment.