Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ok button added to config screen

  • Loading branch information...
commit e4ed795bce873aa051d86946361737eeef2ad7e7 1 parent 6cbed61
@gregkh authored
View
BIN  bin/android-clock.apk
Binary file not shown
View
BIN  bin/classes.dex
Binary file not shown
View
BIN  bin/com/kroah/clock/Clock.class
Binary file not shown
View
BIN  bin/com/kroah/clock/Configure$1.class
Binary file not shown
View
BIN  bin/com/kroah/clock/Configure$2.class
Binary file not shown
View
BIN  bin/com/kroah/clock/Configure$3.class
Binary file not shown
View
BIN  bin/com/kroah/clock/Configure.class
Binary file not shown
View
BIN  bin/com/kroah/clock/MedAppWidget.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$id.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$layout.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$menu.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$string.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$style.class
Binary file not shown
View
BIN  bin/com/kroah/clock/R$xml.class
Binary file not shown
View
BIN  bin/resources.ap_
Binary file not shown
View
16 gen/com/kroah/clock/R.java
@@ -28,16 +28,18 @@
public static final int widget_bg_selected=0x7f020008;
}
public static final class id {
- public static final int delete_contact=0x7f090004;
- public static final int edit_contact=0x7f090003;
- public static final int exit=0x7f090005;
- public static final int loading=0x7f090002;
+ public static final int delete_contact=0x7f090005;
+ public static final int edit_contact=0x7f090004;
+ public static final int exit=0x7f090006;
+ public static final int loading=0x7f090003;
+ public static final int myButton=0x7f090001;
public static final int myListView=0x7f090000;
- public static final int widget=0x7f090001;
+ public static final int widget=0x7f090002;
}
public static final class layout {
- public static final int main=0x7f030000;
- public static final int widget_loading=0x7f030001;
+ public static final int config=0x7f030000;
+ public static final int main=0x7f030001;
+ public static final int widget_loading=0x7f030002;
}
public static final class menu {
public static final int menu=0x7f080000;
View
23 res/layout/config.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/hello"
+ />
+ <ListView
+ android:id="@+id/myListView"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+ <Button
+ android:id="@+id/myButton"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/ok"
+ />
+</LinearLayout>
View
21 src/com/kroah/clock/Configure.java
@@ -4,9 +4,12 @@
import android.app.Activity;
import android.os.Bundle;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.ListView;
import android.app.AlertDialog;
import android.appwidget.AppWidgetManager;
@@ -18,8 +21,10 @@
public class Configure extends Activity {
-
+
+ public static final String MODULE = "ConfigureScreen";
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
+ private Button okButton;
// Display a simple "About" dialog
final void about() {
@@ -85,7 +90,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ setContentView(R.layout.config);
// Find the widget id from the intent.
Intent intent = getIntent();
@@ -98,6 +103,18 @@ public void onCreate(Bundle savedInstanceState) {
finish();
}
+ okButton = (Button)findViewById(R.id.myButton);
+ okButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Log.d(MODULE, "button clicked");
+ Intent result = new Intent();
+ result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
+ setResult(RESULT_OK, result);
+ finish();
+ }
+ });
+
+
ListView myListView = (ListView)findViewById(R.id.myListView);
timezone_list = new ArrayList<String>();
View
7 src/com/kroah/clock/MedAppWidget.java
@@ -1,9 +1,11 @@
package com.kroah.clock;
+import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.widget.RemoteViews;
public class MedAppWidget extends AppWidgetProvider {
@@ -23,6 +25,11 @@ public void onUpdate(Context context,
// Create a remote view
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_loading);
+ // Tie clicking on the button to bring up our configure screen
+ Intent intent = new Intent(context, Configure.class);
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ views.setOnClickPendingIntent(R.id.loading, pendingIntent);
+
// TODO update the UI
appWidgetManager.updateAppWidget(appWidgetId, views);
Please sign in to comment.
Something went wrong with that request. Please try again.