From: Gustavo Martin Morcuende Date: Fri, 24 Oct 2014 03:10:49 +0000 (+0200) Subject: WeatherInformation: widget configuration new layout WIP X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=4d21c15949a1723164a59a6ae375754d97f9534a;p=JavaForFun WeatherInformation: widget configuration new layout WIP --- diff --git a/Android/WeatherInformation/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java b/Android/WeatherInformation/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java index 878c1d3..711adf1 100644 --- a/Android/WeatherInformation/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java +++ b/Android/WeatherInformation/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/Android/WeatherInformation/app/src/main/res/layout/appwidget_configure.xml b/Android/WeatherInformation/app/src/main/res/layout/appwidget_configure.xml index f5df9a0..489c010 100644 --- a/Android/WeatherInformation/app/src/main/res/layout/appwidget_configure.xml +++ b/Android/WeatherInformation/app/src/main/res/layout/appwidget_configure.xml @@ -1,47 +1,14 @@ + android:layout_width="fill_parent" + android:layout_height="fill_parent"> - - - - - - -