diff --git a/app/src/main/java/horse/jaeil/microframe/FrameWidget.java b/app/src/main/java/horse/jaeil/microframe/FrameWidget.java
index d04d353..27b9752 100644
--- a/app/src/main/java/horse/jaeil/microframe/FrameWidget.java
+++ b/app/src/main/java/horse/jaeil/microframe/FrameWidget.java
@@ -14,10 +14,10 @@ public class FrameWidget extends AppWidgetProvider {
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
- CharSequence widgetText = FrameWidgetConfigureActivity.loadTitlePref(context, appWidgetId);
+// CharSequence widgetText = FrameWidgetConfigureActivity.loadTitlePref(context, appWidgetId);
// Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.frame_widget);
- views.setTextViewText(R.id.appwidget_text, widgetText);
+// views.setTextViewText(R.id.appwidget_text, widgetText);
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
@@ -35,7 +35,7 @@ public class FrameWidget extends AppWidgetProvider {
public void onDeleted(Context context, int[] appWidgetIds) {
// When the user deletes the widget, delete the preference associated with it.
for (int appWidgetId : appWidgetIds) {
- FrameWidgetConfigureActivity.deleteTitlePref(context, appWidgetId);
+// FrameWidgetConfigureActivity.deleteTitlePref(context, appWidgetId);
}
}
diff --git a/app/src/main/java/horse/jaeil/microframe/FrameWidgetConfigureActivity.java b/app/src/main/java/horse/jaeil/microframe/FrameWidgetConfigureActivity.java
index 10eb090..3119b4d 100644
--- a/app/src/main/java/horse/jaeil/microframe/FrameWidgetConfigureActivity.java
+++ b/app/src/main/java/horse/jaeil/microframe/FrameWidgetConfigureActivity.java
@@ -5,8 +5,10 @@ import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
+import android.widget.Button;
import android.widget.EditText;
/**
@@ -17,19 +19,34 @@ public class FrameWidgetConfigureActivity extends Activity {
private static final String PREFS_NAME = "horse.jaeil.microframe.FrameWidget";
private static final String PREF_PREFIX_KEY = "appwidget_";
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
- EditText mAppWidgetText;
- View.OnClickListener mOnClickListener = new View.OnClickListener() {
+
+ View.OnClickListener mSelectClickListener = new View.OnClickListener() {
public void onClick(View v) {
- final Context context = FrameWidgetConfigureActivity.this;
- // When the button is clicked, store the string locally
- String widgetText = mAppWidgetText.getText().toString();
- saveTitlePref(context, mAppWidgetId, widgetText);
+ // Test function: change background color
+ Button selectButton = (Button) findViewById(R.id.select_image_button);
+ selectButton.setBackgroundColor(Color.GREEN);
- // It is the responsibility of the configuration activity to update the app widget
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
- FrameWidget.updateAppWidget(context, appWidgetManager, mAppWidgetId);
+// final Context context = FrameWidgetConfigureActivity.this;
+//
+// // When the button is clicked, store the string locally
+// String widgetText = mAppWidgetText.getText().toString();
+// saveTitlePref(context, mAppWidgetId, widgetText);
+//
+// // It is the responsibility of the configuration activity to update the app widget
+// AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
+// FrameWidget.updateAppWidget(context, appWidgetManager, mAppWidgetId);
+// // Make sure we pass back the original appWidgetId
+// Intent resultValue = new Intent();
+// resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
+// setResult(RESULT_OK, resultValue);
+// finish();
+ }
+ };
+
+ View.OnClickListener mFinishClickListener = new View.OnClickListener() {
+ public void onClick(View v) {
// Make sure we pass back the original appWidgetId
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
@@ -42,30 +59,30 @@ public class FrameWidgetConfigureActivity extends Activity {
super();
}
- // Write the prefix to the SharedPreferences object for this widget
- static void saveTitlePref(Context context, int appWidgetId, String text) {
- SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
- prefs.putString(PREF_PREFIX_KEY + appWidgetId, text);
- prefs.apply();
- }
+// // Write the prefix to the SharedPreferences object for this widget
+// static void saveTitlePref(Context context, int appWidgetId, String text) {
+// SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
+// prefs.putString(PREF_PREFIX_KEY + appWidgetId, text);
+// prefs.apply();
+// }
- // Read the prefix from the SharedPreferences object for this widget.
- // If there is no preference saved, get the default from a resource
- static String loadTitlePref(Context context, int appWidgetId) {
- SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
- String titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null);
- if (titleValue != null) {
- return titleValue;
- } else {
- return context.getString(R.string.appwidget_text);
- }
- }
+// // Read the prefix from the SharedPreferences object for this widget.
+// // If there is no preference saved, get the default from a resource
+// static String loadTitlePref(Context context, int appWidgetId) {
+// SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
+// String titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null);
+// if (titleValue != null) {
+// return titleValue;
+// } else {
+// return context.getString(R.string.appwidget_text);
+// }
+// }
- static void deleteTitlePref(Context context, int appWidgetId) {
- SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
- prefs.remove(PREF_PREFIX_KEY + appWidgetId);
- prefs.apply();
- }
+// static void deleteTitlePref(Context context, int appWidgetId) {
+// SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
+// prefs.remove(PREF_PREFIX_KEY + appWidgetId);
+// prefs.apply();
+// }
@Override
public void onCreate(Bundle icicle) {
@@ -76,8 +93,8 @@ public class FrameWidgetConfigureActivity extends Activity {
setResult(RESULT_CANCELED);
setContentView(R.layout.frame_widget_configure);
- mAppWidgetText = (EditText) findViewById(R.id.appwidget_text);
- findViewById(R.id.add_button).setOnClickListener(mOnClickListener);
+ findViewById(R.id.select_image_button).setOnClickListener(mSelectClickListener);
+ findViewById(R.id.finish_button).setOnClickListener(mFinishClickListener);
// Find the widget id from the intent.
Intent intent = getIntent();
@@ -93,7 +110,7 @@ public class FrameWidgetConfigureActivity extends Activity {
return;
}
- mAppWidgetText.setText(loadTitlePref(FrameWidgetConfigureActivity.this, mAppWidgetId));
+// mAppWidgetText.setText(loadTitlePref(FrameWidgetConfigureActivity.this, mAppWidgetId));
}
}
diff --git a/app/src/main/res/layout/frame_widget_configure.xml b/app/src/main/res/layout/frame_widget_configure.xml
index b257147..d98f234 100644
--- a/app/src/main/res/layout/frame_widget_configure.xml
+++ b/app/src/main/res/layout/frame_widget_configure.xml
@@ -1,27 +1,37 @@
-
+ android:text="@string/select_an_image" />
-
+ android:layout_marginBottom="8dp"
+ app:srcCompat="@android:drawable/ic_menu_gallery"
+ android:id="@+id/imageView"
+ tools:ignore="ContentDescription" />
+ android:layout_marginBottom="8dp"
+ android:text="@string/finish" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d6624bc..de911b4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,7 @@
MicroFrame
EXAMPLE
- Configure
- Add widget
+ Select an Image
+ Finish
+ Version: 0.2.3\nAuthor: Tim Van Baak