Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minor cleanups

  • Loading branch information...
commit 12ef2dfab3e874c116930952f407265c59145c38 1 parent 02a0ed6
Mark Murphy authored
View
5 WIMM/QRCodeKeeper/AndroidManifest.xml
@@ -14,12 +14,11 @@
android:label="@string/app_name">
<uses-library
android:name="com.wimm.framework"
- android:required="false"/>
+ android:required="true"/>
<activity
android:name=".QRCodeKeeperActivity"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Light">
+ android:label="@string/app_name">
<meta-data
android:name="com.wimm.app.peekview"
android:resource="@layout/peekview"/>
View
6 WIMM/QRCodeKeeper/src/com/commonsware/android/qrck/ImageLoadTask.java
@@ -58,12 +58,6 @@ protected void onPostExecute(Bitmap bitmap) {
if (ex!=null) {
Log.e("ImageLoadTask", "Exception loading image", ex);
-// listener.handleError(ex);
}
}
-
- public interface Listener {
- void handleResult(Bitmap bitmap);
- void handleError(Exception ex);
- }
}
View
4 WIMM/QRCodeKeeper/src/com/commonsware/android/qrck/JSONLoadTask.java
@@ -29,9 +29,6 @@ public JSONLoadTask(Context ctxt, Listener listener) {
this.listener=listener;
}
- /**
- * Runs on a worker thread, loading in our data.
- */
@Override
public JSONObject doInBackground(String... path) {
JSONObject json=null;
@@ -66,7 +63,6 @@ protected void onPostExecute(JSONObject json) {
public interface Listener {
void handleResult(JSONObject json);
-
void handleError(Exception ex);
}
}
View
34 WIMM/QRCodeKeeper/src/com/commonsware/android/qrck/QRCodeKeeperActivity.java
@@ -54,25 +54,26 @@ public void onCreate(Bundle savedInstanceState) {
tray.setCanLoop(true);
NetworkService network=new NetworkService(this);
-
+
if (SyncService.iCanHasData(this)) {
loadEntries();
}
else {
noCanDo=true;
}
-
- if (SyncService.isSyncNeeded(this, prefs)
- && network.isNetworkAvailable()) {
- startService(new Intent(this, SyncService.class));
- }
- else {
- network.requestNetworkConnection();
+
+ if (SyncService.isSyncNeeded(this, prefs)) {
+ if (network.isNetworkAvailable()) {
+ startService(new Intent(this, SyncService.class));
+ }
+ else {
+ network.requestNetworkConnection();
+ }
}
-
+
if (noCanDo) {
AlertDialog dlg=new AlertDialog(this);
-
+
dlg.setButton(getText(R.string.close), this);
dlg.setMessage(getText(R.string.no_can_do));
dlg.show();
@@ -82,7 +83,7 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public void onResume() {
super.onResume();
-
+
if (!noCanDo) {
registerReceiver(statusReceiver,
new IntentFilter(SyncService.ACTION_SYNC_STATUS));
@@ -94,7 +95,7 @@ public void onPause() {
if (!noCanDo) {
unregisterReceiver(statusReceiver);
}
-
+
super.onPause();
}
@@ -127,16 +128,16 @@ public void handleError(Exception ex) {
@Override
public void onClick(DialogInterface dialog, int which) {
- finish();
+ finish();
}
private void loadEntries() {
- new JSONLoadTask(this, this).execute("codes.json");
+ new JSONLoadTask(this, this).execute(SyncService.SYNC_LOCAL_FILE);
}
-
+
private void goBlooey(Exception ex) {
AlertDialog dlg=new AlertDialog(this);
-
+
dlg.setButton(getText(R.string.close), this);
dlg.setMessage(ex.getMessage());
dlg.show();
@@ -170,7 +171,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
new File(getFilesDir(), getItem(position).getFilename());
new ImageLoadTask(qrCode).execute(image.getAbsolutePath());
- // qrCode.setImageBitmap(BitmapFactory.decodeFile(image.getAbsolutePath()));
}
catch (Exception ex) {
Log.e("QRCodeKeeper", "Exception interpreting JSON", ex);
View
3  WIMM/QRCodeKeeper/src/com/commonsware/android/qrck/SyncService.java
@@ -40,7 +40,7 @@
private static final String TAG="QRCodeKeeper-SyncService";
private static final String SYNC_URL=
"http://misc.commonsware.com/codes.json";
- private static final String SYNC_LOCAL_FILE="codes.json";
+ static final String SYNC_LOCAL_FILE="codes.json";
private static final String KEY_SYNC_TIME="sync_time";
private static final long SYNC_PERIOD=900000L; // 15 min
private AtomicBoolean inProgress=new AtomicBoolean(false);
@@ -140,7 +140,6 @@ protected void onHandleIntent(Intent intent) {
AppUtils.cleanup(this);
}
finally {
-
inProgress.set(false);
broadcastStatus();
syncCompleted();
Please sign in to comment.
Something went wrong with that request. Please try again.