Add option for transparent widget background

Closes #58
pull/253/head
Alex Baker 9 years ago
parent 805813c001
commit 3189182a93

@ -45,6 +45,7 @@ public class WidgetConfigActivity extends InjectingListActivity {
public static final String PREF_HIDE_CHECKBOXES = "widget-hide-checkboxes-";
public static final String PREF_DARK_THEME = "widget-dark-theme-";
public static final String PREF_HIDE_HEADER = "widget-hide-header-";
public static final String PREF_WIDGET_TRANSPARENT = "widget-transparent-";
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
@ -112,8 +113,10 @@ public class WidgetConfigActivity extends InjectingListActivity {
CheckBox darkTheme = (CheckBox) findViewById(R.id.darkTheme);
CheckBox hideCheckboxes = (CheckBox) findViewById(R.id.hideCheckboxes);
CheckBox hideHeader = (CheckBox) findViewById(R.id.hideHeader);
CheckBox transparent = (CheckBox) findViewById(R.id.transparentBackground);
saveConfiguration(adapter.getSelection(), !hideDueDate.isChecked(),
darkTheme.isChecked(), hideCheckboxes.isChecked(), hideHeader.isChecked());
darkTheme.isChecked(), hideCheckboxes.isChecked(), hideHeader.isChecked(),
transparent.isChecked());
updateWidget();
@ -147,7 +150,8 @@ public class WidgetConfigActivity extends InjectingListActivity {
}
private void saveConfiguration(FilterListItem filterListItem, boolean showDueDate,
boolean darkTheme, boolean hideCheckboxes, boolean hideHeader){
boolean darkTheme, boolean hideCheckboxes, boolean hideHeader,
boolean transparent){
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
@ -171,6 +175,7 @@ public class WidgetConfigActivity extends InjectingListActivity {
preferences.setBoolean(WidgetConfigActivity.PREF_DARK_THEME + mAppWidgetId, darkTheme);
preferences.setBoolean(WidgetConfigActivity.PREF_HIDE_CHECKBOXES + mAppWidgetId, hideCheckboxes);
preferences.setBoolean(WidgetConfigActivity.PREF_HIDE_HEADER + mAppWidgetId, hideHeader);
preferences.setBoolean(WidgetConfigActivity.PREF_WIDGET_TRANSPARENT + mAppWidgetId, transparent);
if(filterListItem instanceof FilterWithCustomIntent) {
String flattenedName = ((FilterWithCustomIntent)filterListItem).customTaskList.flattenToString();

@ -105,6 +105,10 @@ public class WidgetUpdateService extends InjectingService {
if (preferences.getBoolean(WidgetConfigActivity.PREF_HIDE_HEADER + widgetId, false)) {
views.setViewVisibility(R.id.widget_header, View.GONE);
}
if (preferences.getBoolean(WidgetConfigActivity.PREF_WIDGET_TRANSPARENT + widgetId, false)) {
views.setInt(R.id.widget_header, "setBackgroundColor", android.R.color.transparent);
views.setInt(R.id.taskbody, "setBackgroundColor", android.R.color.transparent);
}
int numberOfTasks = NUM_VISIBLE_TASKS;

@ -72,6 +72,11 @@ public class WidgetHelper {
if (preferences.getBoolean(WidgetConfigActivity.PREF_HIDE_HEADER + id, false)) {
remoteViews.setViewVisibility(R.id.widget_header, View.GONE);
}
if (preferences.getBoolean(WidgetConfigActivity.PREF_WIDGET_TRANSPARENT + id, false)) {
remoteViews.setInt(R.id.widget_header, "setBackgroundColor", android.R.color.transparent);
remoteViews.setInt(R.id.list_view, "setBackgroundColor", android.R.color.transparent);
remoteViews.setInt(R.id.empty_view, "setBackgroundColor", android.R.color.transparent);
}
remoteViews.setTextViewText(R.id.widget_title, filter.title);
remoteViews.setRemoteAdapter(R.id.list_view, rvIntent);
remoteViews.setEmptyView(R.id.list_view, R.id.empty_view);

@ -37,6 +37,16 @@
android:paddingTop="10dp"
android:paddingBottom="10dp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:checked="false"
android:id="@+id/transparentBackground"
android:text="@string/widget_transparent_background"
android:textSize="18sp"
android:paddingTop="10dp"
android:paddingBottom="10dp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"

@ -116,6 +116,7 @@
<string name="widget_hide_due_date">Hide due dates</string>
<string name="widget_hide_checkboxes">Hide checkboxes</string>
<string name="widget_hide_header">Hide header</string>
<string name="widget_transparent_background">Transparent background</string>
<string-array name="sync_SPr_interval_entries">
<!-- sync_SPr_interval_entries: Synchronization Intervals -->

Loading…
Cancel
Save