pebble-notifier icon indicating copy to clipboard operation
pebble-notifier copied to clipboard

Show only one time notification

Open ploufs opened this issue 11 years ago • 3 comments

issue #28

ploufs avatar Dec 01 '13 01:12 ploufs

The formatting changes make it hard to see what you've changed - I'd suggest pulling those into a separate pull request.

Daniel15 avatar Dec 17 '13 06:12 Daniel15

res/values/strings.xml add line 86 : Don't repeat notification

res/xml/preferences.xml Add line 21-23 <CheckBoxPreference android:defaultValue="false" android:key="pref_dont_throw_many_time" android:title="@string/pref_dont_throw_many_time"/>

src/com/dattasmoon/pebble/plugin/Constants.java Add line 53 : public static final String PREFERENCE_DONT_THROW_MANY_TIME = "pref_dont_throw_many_time";

src/com/dattasmoon/pebble/plugin/NotificationService.java Add line 81 : private HashMap<String, String> previousNotification = null;

Add line 320-335 : // validate don't throw same notification

  •    try {
    
  •        if (dontThrowManyTime) {
    
  •            if (previousNotification == null) {
    
  •                previousNotification = new HashMap<String, String>();
    
  •            }
    
  •            if (previousNotification.containsKey(eventPackageName)
    
  •                    && previousNotification.get(eventPackageName).equalsIgnoreCase(notificationText)) {
    
  •                Log.i(Constants.LOG_TAG, "Notification many time =" + notificationText);
    
  •                return;
    
  •            }
    
  •        }
    
  •        previousNotification.put(eventPackageName, notificationText);
    
  •    } catch (Exception e) {
    
  •        e.printStackTrace();
    
  •    }
    

Add line 445-446 editor.putBoolean(Constants.PREFERENCE_DONT_THROW_MANY_TIME, sharedPreferences.getBoolean(Constants.LOG_TAG + ".dontThrowManyTime", false));

src/com/dattasmoon/pebble/plugin/SettingsActivity.java add line 72-73 editor.putBoolean(Constants.PREFERENCE_DONT_THROW_MANY_TIME, sharedPreferences.getBoolean(Constants.LOG_TAG + ".dontThrowManyTime", false));

ploufs avatar Dec 23 '13 20:12 ploufs

I suggest editing your branch to only have the changes you mentioned in the comment above.

Daniel15 avatar Dec 23 '13 21:12 Daniel15