Skip to content

Commit

Permalink
trailing whitespace removal
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkh committed Jun 10, 2010
1 parent dd97b33 commit 1b053fe
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/com/kroah/clock/Clock.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class Clock extends Activity {
public static final String MODULE = "GREGKHMainScreen";

// Display a simple "About" dialog
final void about() {
AlertDialog.Builder ad = new AlertDialog.Builder(Clock.this);
Expand Down Expand Up @@ -68,7 +68,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}

private Button okButton;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down
4 changes: 2 additions & 2 deletions src/com/kroah/clock/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Configure extends Activity {
public static final String MODULE = "GREGKHConfigureScreen";
public static int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
private Button okButton;

// Display a simple "About" dialog
final void about() {
AlertDialog.Builder ad = new AlertDialog.Builder(Configure.this);
Expand Down Expand Up @@ -77,7 +77,7 @@ public void onCreate(Bundle savedInstanceState) {
Log.d(MODULE, "onCreate:enter");
super.onCreate(savedInstanceState);
setContentView(R.layout.config);

// Find the widget id from the intent.
Intent intent = getIntent();
Bundle extras = intent.getExtras();
Expand Down
34 changes: 17 additions & 17 deletions src/com/kroah/clock/MedAppWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import android.widget.RemoteViews;

public class MedAppWidget extends AppWidgetProvider {

public static final String MODULE = "GREGKHWidget";

@Override
public void onUpdate(Context context,
AppWidgetManager appWidgetManager,
Expand All @@ -21,7 +21,7 @@ public void onUpdate(Context context,
if (appWidgetIds == null) {
appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, MedAppWidget.class));
}

// Tie clicking on the button to bring up our configure screen
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
if (views == null)
Expand All @@ -34,23 +34,23 @@ public void onUpdate(Context context,
if (pendingIntent == null)
Log.d(MODULE, "buildUpdate:pendingIntent == null");
views.setOnClickPendingIntent(R.id.time, pendingIntent);

// UpdateService.requestUpdate(appWidgetIds);
context.startService(new Intent(context, UpdateService.class));
Log.d(MODULE, "onUpdate:exit");
}

public static RemoteViews buildUpdate(Context context) {

Log.d(MODULE, "buildUpdate:enter");
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
if (views == null)
Log.d(MODULE, "buildUpdate:views == null");

// ContentResolver resolver = context.getContentResolver();
// Resources res = context.getResources();
// Cursor cursor = null;

// Tie clicking on the button to bring up our configure screen
Intent intent = new Intent(context, Configure.class);
if (intent == null)
Expand All @@ -63,32 +63,32 @@ public static RemoteViews buildUpdate(Context context) {

// Intent result = new Intent();
// result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);

Log.d(MODULE, "buildUpdate:exit");
return views;

}

// final int num_ids = appWidgetIds.length;
// for (int i = 0; i < num_ids; i++) {
//
//
// int appWidgetId = appWidgetIds[i];
//
//
// Timer timer = new Timer();
// timer.scheduleAtFixedRate(new myTime(context, appWidgetManager), 1, 10000);
//
//
// // Create a remote view
// RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_loading);
//

//
// // set the time
//// DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
//// views.setTextViewText(R.id.loading, format.format(new Date()));
// // TODO update the UI
//
//
// appWidgetManager.updateAppWidget(appWidgetId, views);
// }
// }

}

25 changes: 12 additions & 13 deletions src/com/kroah/clock/UpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

public class UpdateService extends Service implements Runnable {
private static final String MODULE = "GREGKHUpdateService";

private static final long UPDATE_INTERVAL = DateUtils.MINUTE_IN_MILLIS;

// Our lock for the list of times.
private static Object lock = new Object();
private static boolean thread_running;

public static final String ACTION_UPDATE_ALL = "com.kroah.clock.UPDATE_ALL";

@Override
public void onStart(Intent intent, int startId) {
Log.d(MODULE, "onStart:enter");
Expand All @@ -50,19 +50,18 @@ public void onStart(Intent intent, int startId) {
}
Log.d(MODULE, "onStart:exit");
}

public void run() {
Log.d(MODULE, "run:enter");

AppWidgetManager manager = AppWidgetManager.getInstance(this);
// ContentResolver resolve = getContentResolver();

RemoteViews updateViews = null;

updateViews = MedAppWidget.buildUpdate(this);

// Draw the updated time

// RemoteViews updateViews = new RemoteViews(this.getPackageName(), R.layout.widget_loading);
Date date = new Date();
DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
Expand All @@ -72,25 +71,25 @@ public void run() {

ComponentName thisWidget = new ComponentName(this, MedAppWidget.class);
manager.updateAppWidget(thisWidget, updateViews);

// Schedule our next update
Time time = new Time();
time.set(System.currentTimeMillis() + UPDATE_INTERVAL);
time.second = 0;
long nextUpdate = time.toMillis(false);

Intent updateIntent = new Intent(ACTION_UPDATE_ALL);
updateIntent.setClass(this, UpdateService.class);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, updateIntent, 0);

AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, nextUpdate, pendingIntent);

thread_running = false;
stopSelf();
Log.d(MODULE, "run:exit");
}

@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
Expand Down

0 comments on commit 1b053fe

Please sign in to comment.