Mi Band: for vibration settings, group navication types (email, sms, chat, social network, navigation)

This commit is contained in:
Andreas Shimokawa 2016-10-11 15:20:55 +02:00
parent cd195a5969
commit a094f0cc76
4 changed files with 36 additions and 59 deletions

View File

@ -23,4 +23,24 @@ public enum NotificationType {
public String getFixedValue() {
return name().toLowerCase();
}
public String getGenericType() {
switch (this) {
case GENERIC_EMAIL:
case GENERIC_NAVIGATION:
case GENERIC_SMS:
return getFixedValue();
case FACEBOOK:
case TWITTER:
return "generic_social";
case CONVERSATIONS:
case FACEBOOK_MESSENGER:
case SIGNAL:
case TELEGRAM:
return "generic_chat";
case UNKNOWN:
default:
return "generic";
}
}
}

View File

@ -534,26 +534,8 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
@Override
public void onNotification(NotificationSpec notificationSpec) {
String origin = notificationSpec.type.getFixedValue();
switch (notificationSpec.type) {
case GENERIC_SMS:
performPreferredNotification("sms received", origin, null);
break;
case GENERIC_EMAIL:
performPreferredNotification("email received", origin, null);
break;
case CONVERSATIONS:
case FACEBOOK:
case FACEBOOK_MESSENGER:
case SIGNAL:
case TELEGRAM:
case TWITTER:
performPreferredNotification("chat message received", origin, null);
break;
case UNKNOWN:
default:
performPreferredNotification("generic notification received", origin, null);
}
String origin = notificationSpec.type.getGenericType();
performPreferredNotification(origin + " received", origin, null);
}
@Override

View File

@ -184,12 +184,17 @@
<string name="vibration_profile_ring">Ring</string>
<string name="vibration_profile_alarm_clock">Alarm Clock</string>
<string name="miband_prefs_vibration">Vibration</string>
<string name="vibration_try">Try</string>
<string name="pref_screen_notification_profile_sms">SMS Notification</string>
<string name="pref_header_vibration_settings">Vibration Settings</string>
<string name="pref_screen_notification_profile_generic">Generic Notification</string>
<string name="pref_screen_notification_profile_pebblemsg">Pebble Notification</string>
<string name="pref_screen_notification_profile_email">Email Notification</string>
<string name="pref_screen_notification_profile_incoming_call">Incoming Call Notification</string>
<string name="pref_screen_notification_profile_generic_chat">Chat</string>
<string name="pref_screen_notification_profile_generic_navigation">Navigation</string>
<string name="pref_screen_notification_profile_generic_social">Social Network</string>
<string name="control_center_find_lost_device">Find lost Device</string>
<string name="control_center_cancel_to_stop_vibration">Cancel to stop vibration.</string>
<string name="title_activity_charts">Your Activity</string>
@ -333,9 +338,4 @@
<!-- Strings related to Vibration Activity -->
<string name="title_activity_vibration">Vibration</string>
<string name="vibration_try">Try</string>
<string name="pref_screen_notification_profile_chat">Chat</string>
<string name="pref_screen_notification_profile_facebook">Facebook</string>
<string name="pref_screen_notification_profile_twitter">Twitter</string>
<string name="pref_screen_notification_profile_telegram">Telegram</string>
</resources>

View File

@ -121,31 +121,6 @@
android:title="@string/vibration_try"/>
</PreferenceScreen>
<PreferenceScreen
android:key="vibration_profile_key"
android:title="@string/pref_screen_notification_profile_telegram"
android:persistent="false">
<ListPreference
android:defaultValue="@string/p_waterdrop"
android:entries="@array/vibration_profile"
android:entryValues="@array/vibration_profile_values"
android:key="mi_vibration_profile_telegram"
android:title="@string/miband_prefs_vibration"
android:summary="%s" />
<EditTextPreference
android:defaultValue="3"
android:inputType="number"
android:key="mi_vibration_count_telegram"
android:maxLength="1"
android:title="@string/pref_title_notifications_repetitions" />
<Preference
android:key="mi_try_telegram"
android:persistent="false"
android:title="@string/vibration_try"/>
</PreferenceScreen>
<PreferenceScreen
android:key="vibration_profile_key"
android:title="@string/pref_screen_notification_profile_chat"
@ -173,51 +148,51 @@
<PreferenceScreen
android:key="vibration_profile_key"
android:title="@string/pref_screen_notification_profile_twitter"
android:title="@string/pref_screen_notification_profile_generic_social"
android:persistent="false">
<ListPreference
android:defaultValue="@string/p_waterdrop"
android:entries="@array/vibration_profile"
android:entryValues="@array/vibration_profile_values"
android:key="mi_vibration_profile_twitter"
android:key="mi_vibration_profile_generic_social"
android:title="@string/miband_prefs_vibration"
android:summary="%s" />
<EditTextPreference
android:defaultValue="3"
android:inputType="number"
android:key="mi_vibration_count_twitter"
android:key="mi_vibration_count_generic_social"
android:maxLength="1"
android:title="@string/pref_title_notifications_repetitions" />
<Preference
android:key="mi_try_twitter"
android:key="mi_try_generic_social"
android:persistent="false"
android:title="@string/vibration_try"/>
</PreferenceScreen>
<PreferenceScreen
android:key="vibration_profile_key"
android:title="@string/pref_screen_notification_profile_facebook"
android:title="@string/pref_screen_notification_profile_generic_navigation"
android:persistent="false">
<ListPreference
android:defaultValue="@string/p_waterdrop"
android:entries="@array/vibration_profile"
android:entryValues="@array/vibration_profile_values"
android:key="mi_vibration_profile_facebook"
android:key="mi_vibration_profile_generic_navigation"
android:title="@string/miband_prefs_vibration"
android:summary="%s" />
<EditTextPreference
android:defaultValue="3"
android:inputType="number"
android:key="mi_vibration_count_facebook"
android:key="mi_vibration_count_generic_navigation"
android:maxLength="1"
android:title="@string/pref_title_notifications_repetitions" />
<Preference
android:persistent="false"
android:key="mi_try_facebook"
android:key="mi_try_generic_navigation"
android:title="@string/vibration_try"/>
</PreferenceScreen>