From f1ef68fef2cee4ea274c059eb7e8ea6846206670 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Fri, 24 Oct 2014 05:10:49 +0200 Subject: [PATCH] WeatherInformation: widget configuration new layout WIP --- .../example/exampletdd/widget/WidgetConfigure.java | 16 +-- app/src/main/res/layout/appwidget_configure.xml | 146 +++++++++++++++------ 2 files changed, 107 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java b/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java index 878c1d3..711adf1 100644 --- a/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java +++ b/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java @@ -2,7 +2,6 @@ package de.example.exampletdd.widget; import android.app.ActionBar; import android.app.Activity; -import android.app.Fragment; import android.appwidget.AppWidgetManager; import android.content.Intent; import android.os.Bundle; @@ -11,7 +10,6 @@ import de.example.exampletdd.R; public class WidgetConfigure extends Activity { private int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; - private WidgetPreferences mPreferences; private View.OnClickListener mOnClickListener; @Override @@ -43,24 +41,12 @@ public class WidgetConfigure extends Activity { // Set the view layout resource to use. this.setContentView(R.layout.appwidget_configure); - - final Bundle args = new Bundle(); - args.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); - mPreferences = new WidgetPreferences(); - // Do not retain this fragment across configuration changes because I am tired for following - // the fragment lifecycle (I am going to loose the instance field values but I DON'T CARE!!!) - mPreferences.setRetainInstance(false); - mPreferences.setArguments(args); - this.getFragmentManager() - .beginTransaction() - .replace(R.id.weather_appwidget_configure_preferences, mPreferences) - .commit(); + mOnClickListener = new View.OnClickListener() { public void onClick(View v) { // Save to permanent storage - mPreferences.onSavePreferences(); // Push widget update to surface with newly set prefix final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance( diff --git a/app/src/main/res/layout/appwidget_configure.xml b/app/src/main/res/layout/appwidget_configure.xml index f5df9a0..489c010 100644 --- a/app/src/main/res/layout/appwidget_configure.xml +++ b/app/src/main/res/layout/appwidget_configure.xml @@ -1,47 +1,14 @@ + android:layout_width="fill_parent" + android:layout_height="fill_parent"> - - - - - - -