@Override protected void onResume() { mDiskSyncTask.setDiskSyncListener(this); super.onResume(); if (mDiskSyncTask.getStatus() == AsyncTask.Status.FINISHED) { SyncComplete(mDiskSyncTask.getStatusMessage()); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // must be at the beginning of any activity that can be called from an external intent try { Collect.createODKDirs(); } catch (RuntimeException e) { createErrorDialog(e.getMessage(), EXIT); return; } setContentView(R.layout.chooser_list_layout); setTitle(getString(R.string.enter_data)); String sortOrder = FormsColumns.DISPLAY_NAME + " ASC, " + FormsColumns.JR_VERSION + " DESC"; Cursor c = managedQuery(FormsColumns.CONTENT_URI, null, null, null, sortOrder); String[] data = new String[] { FormsColumns.DISPLAY_NAME, FormsColumns.DISPLAY_SUBTEXT, FormsColumns.JR_VERSION }; int[] view = new int[] {R.id.text1, R.id.text2, R.id.text3}; // render total instance view SimpleCursorAdapter instances = new VersionHidingCursorAdapter( FormsColumns.JR_VERSION, this, R.layout.two_item, c, data, view); setListAdapter(instances); if (savedInstanceState != null && savedInstanceState.containsKey(syncMsgKey)) { TextView tv = (TextView) findViewById(R.id.status_text); tv.setText(savedInstanceState.getString(syncMsgKey)); } // DiskSyncTask checks the disk for any forms not already in the content provider // that is, put here by dragging and dropping onto the SDCard mDiskSyncTask = (DiskSyncTask) getLastNonConfigurationInstance(); if (mDiskSyncTask == null) { Log.i(t, "Starting new disk sync task"); mDiskSyncTask = new DiskSyncTask(); mDiskSyncTask.setDiskSyncListener(this); mDiskSyncTask.setReloadForms(true); mDiskSyncTask.execute((Void[]) null); } }
@Override protected void onPause() { mDiskSyncTask.setDiskSyncListener(null); super.onPause(); }