package com.farmerbb.taskbar.fragment;
import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
bindPreferenceSummaryToValue(findPreference(PREF_FULL_LENGTH));
bindPreferenceSummaryToValue(findPreference(PREF_CENTERED_ICONS));
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ findPreference(PREF_NOTIFICATION_COUNT).setOnPreferenceClickListener(this);
bindPreferenceSummaryToValue(findPreference(PREF_SYS_TRAY));
- else
+ } else {
+ getPreferenceScreen().removePreference(findPreference(PREF_NOTIFICATION_COUNT));
getPreferenceScreen().removePreference(findPreference(PREF_SYS_TRAY));
+ }
updateMaxNumOfRecents(false);
updateRefreshFrequency(false);
}
@SuppressLint("SetTextI18n")
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
@Override
public boolean onPreferenceClick(final Preference p) {
final SharedPreferences pref = U.getSharedPreferences(getActivity());
AlertDialog dialog2 = builder2.create();
dialog2.show();
break;
+ case PREF_NOTIFICATION_COUNT:
+ try {
+ startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));
+ } catch (ActivityNotFoundException e) {
+ U.showToast(getActivity(), R.string.tb_lock_device_not_supported);
+ }
+ break;
}
return super.onPreferenceClick(p);
};
private BroadcastReceiver notificationCountReceiver = new BroadcastReceiver() {
+ @SuppressLint("SetTextI18n")
@Override
public void onReceive(Context context, Intent intent) {
int count = intent.getIntExtra("count", 0);
public static final String PREF_MANAGE_APP_DATA = "manage_app_data";
public static final String PREF_MAX_NUM_OF_RECENTS = "max_num_of_recents";
public static final String PREF_NAVIGATION_BAR_BUTTONS = "navigation_bar_buttons";
+ public static final String PREF_NOTIFICATION_COUNT = "notification_count";
public static final String PREF_NOTIFICATION_SETTINGS = "notification_settings";
public static final String PREF_OPEN_TASKBAR_SETTINGS = "open_taskbar_settings";
public static final String PREF_PIN_APP = "pin_app";
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
\ No newline at end of file
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
\ No newline at end of file
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
\ No newline at end of file
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
\ No newline at end of file
<string name="tb_pref_dim_screen_description">Press the home button to manually activate</string>
<string name="tb_desktop_mode_is_active">Desktop mode is active</string>
- <string name="tb_pref_change_wallpaper_global">Apply to phone and desktop</string>
+ <string name="tb_pref_change_wallpaper_global">Apply to entire device</string>
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
- <string name="tb_pref_remove_desktop_wallpaper">Remove desktop wallpaper</string>
+ <string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
</resources>
\ No newline at end of file
<string name="tb_pref_change_wallpaper_desktop">Apply to desktop only</string>
<string name="tb_pref_remove_desktop_wallpaper">Use device wallpaper</string>
+ <string name="tb_pref_notification_count_title">Show notification count in status area</string>
+ <string name="tb_pref_notification_count_description">Requires notification access</string>
+
</resources>
android:title="@string/tb_pref_title_sys_tray"
android:summary="@string/tb_pref_description_sys_tray"/>
+ <Preference
+ android:key="notification_count"
+ android:dependency="sys_tray"
+ android:title="@string/tb_pref_notification_count_title"
+ android:summary="@string/tb_pref_notification_count_description"/>
+
<PreferenceCategory android:key="dummy" android:title="\n\n" />
</PreferenceScreen>