widget: selectable background color
This commit is contained in:
parent
1658a91528
commit
c857f0c627
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.fox.ttrss"
|
||||
android:versionCode="418"
|
||||
android:versionName="1.184" >
|
||||
android:versionCode="419"
|
||||
android:versionName="1.185" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
|
@ -424,7 +424,7 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||
|
||||
int updateInterval = Integer.parseInt(prefs.getString("widget_update_interval", "15")) * 60 * 1000;
|
||||
|
||||
Log.d("setupWidgetUpdates", "setupWidgetUpdate: interval= " + updateInterval);
|
||||
Log.d("setupWidgetUpdates", "interval= " + updateInterval);
|
||||
|
||||
AlarmManager alarmManager = (AlarmManager)context.getSystemService(ALARM_SERVICE);
|
||||
|
||||
|
@ -21,7 +21,6 @@ public class SmallWidgetProvider extends AppWidgetProvider {
|
||||
|
||||
public static final String ACTION_REQUEST_UPDATE = "org.fox.ttrss.WIDGET_FORCE_UPDATE";
|
||||
public static final String ACTION_UPDATE_RESULT = "org.fox.ttrss.WIDGET_UPDATE_RESULT";
|
||||
public static final String ACTION_SETTINGS_CHANGED = "org.fox.ttrss.WIDGET_SETTINGS_CHANGED";
|
||||
|
||||
@Override
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
@ -34,12 +33,19 @@ public class SmallWidgetProvider extends AppWidgetProvider {
|
||||
views.setOnClickPendingIntent(R.id.widget_main, pendingIntent);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean darkMode = prefs.getBoolean("widget_dark_mode", false);
|
||||
String widgetBackground = prefs.getString("widget_background", "WB_LIGHT");
|
||||
|
||||
if (darkMode) {
|
||||
Log.d(TAG, "widget bg: " + widgetBackground);
|
||||
|
||||
if ("WB_LIGHT".equals(widgetBackground)) {
|
||||
views.setViewVisibility(R.id.widget_dark, View.INVISIBLE);
|
||||
views.setViewVisibility(R.id.widget_light, View.VISIBLE);
|
||||
} else if ("WB_DARK".equals(widgetBackground)) {
|
||||
views.setViewVisibility(R.id.widget_dark, View.VISIBLE);
|
||||
views.setViewVisibility(R.id.widget_light, View.INVISIBLE);
|
||||
} else {
|
||||
views.setViewVisibility(R.id.widget_dark, View.INVISIBLE);
|
||||
views.setViewVisibility(R.id.widget_light, View.INVISIBLE);
|
||||
}
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetIds, views);
|
||||
@ -69,11 +75,6 @@ public class SmallWidgetProvider extends AppWidgetProvider {
|
||||
Log.d(TAG, "onReceive: got update result from service: " + unread + " " + resultCode);
|
||||
|
||||
updateWidgetsText(context, appWidgetManager, appWidgetIds, unread, resultCode);
|
||||
} else if (ACTION_SETTINGS_CHANGED.equals(intent.getAction())) {
|
||||
Log.d(TAG, "onReceive: got settings changed");
|
||||
|
||||
// TODO
|
||||
|
||||
} else {
|
||||
super.onReceive(context, intent);
|
||||
}
|
||||
|
@ -37,4 +37,14 @@
|
||||
<item>45</item>
|
||||
<item>60</item>
|
||||
</string-array>
|
||||
<string-array name="pref_widget_bgs_values" translatable="false">
|
||||
<item>WB_LIGHT</item>
|
||||
<item>WB_DARK</item>
|
||||
<item>WB_TRANSPARENT</item>
|
||||
</string-array>
|
||||
<string-array name="pref_widget_bgs">
|
||||
<item>@string/widget_background_light</item>
|
||||
<item>@string/widget_background_dark</item>
|
||||
<item>@string/widget_background_transparent</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -248,5 +248,9 @@
|
||||
<string name="pref_headlines_swipe_to_dismiss">Swipe to dismiss</string>
|
||||
<string name="pref_headlines_swipe_to_dismiss_long">Disables headlines context menu</string>
|
||||
<string name="pref_widget_update_interval">Update interval (in minutes)</string>
|
||||
<string name="pref_widget_dark_background">Use dark background</string>
|
||||
|
||||
<string name="widget_background_light">Light</string>
|
||||
<string name="widget_background_dark">Dark</string>
|
||||
<string name="widget_background_transparent">Transparent</string>
|
||||
<string name="pref_widget_background">Background color</string>
|
||||
</resources>
|
||||
|
@ -196,10 +196,12 @@
|
||||
android:key="widget_update_interval"
|
||||
android:title="@string/pref_widget_update_interval" />
|
||||
|
||||
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="widget_dark_mode"
|
||||
android:title="@string/pref_widget_dark_background" />
|
||||
<ListPreference
|
||||
android:defaultValue="WB_LIGHT"
|
||||
android:entries="@array/pref_widget_bgs"
|
||||
android:entryValues="@array/pref_widget_bgs_values"
|
||||
android:key="widget_background"
|
||||
android:title="@string/pref_widget_background" />
|
||||
|
||||
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||
android:defaultValue="true"
|
||||
|
Loading…
Reference in New Issue
Block a user