use of org.odk.collect.android.tasks.InstanceSyncTask in project collect by opendatakit.
the class DataManagerList method onViewCreated.
@Override
public void onViewCreated(View rootView, Bundle savedInstanceState) {
deleteButton.setOnClickListener(this);
toggleButton.setOnClickListener(this);
setupAdapter();
instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute();
super.onViewCreated(rootView, savedInstanceState);
}
use of org.odk.collect.android.tasks.InstanceSyncTask in project collect by opendatakit.
the class InstanceChooserList method onCreate.
@Override
public void onCreate(Bundle 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);
super.onCreate(savedInstanceState);
String formMode = getIntent().getStringExtra(ApplicationConstants.BundleKeys.FORM_MODE);
if (formMode == null || ApplicationConstants.FormModes.EDIT_SAVED.equalsIgnoreCase(formMode)) {
setTitle(getString(R.string.review_data));
editMode = true;
sortingOptions = new String[] { getString(R.string.sort_by_name_asc), getString(R.string.sort_by_name_desc), getString(R.string.sort_by_date_asc), getString(R.string.sort_by_date_desc), getString(R.string.sort_by_status_asc), getString(R.string.sort_by_status_desc) };
} else {
setTitle(getString(R.string.view_sent_forms));
sortingOptions = new String[] { getString(R.string.sort_by_name_asc), getString(R.string.sort_by_name_desc), getString(R.string.sort_by_date_asc), getString(R.string.sort_by_date_desc) };
((TextView) findViewById(android.R.id.empty)).setText(R.string.no_items_display_sent_forms);
}
setupAdapter();
instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute();
}
use of org.odk.collect.android.tasks.InstanceSyncTask in project collect by opendatakit.
the class InstanceUploaderList method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
Timber.i("onCreate");
setContentView(R.layout.instance_uploader_list);
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
showAllMode = savedInstanceState.getBoolean(SHOW_ALL_MODE);
}
instancesDao = new InstancesDao();
uploadButton = findViewById(R.id.upload_button);
uploadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = connectivityManager.getActiveNetworkInfo();
if (NetworkReceiver.running) {
ToastUtils.showShortToast(R.string.send_in_progress);
} else if (ni == null || !ni.isConnected()) {
logger.logAction(this, "uploadButton", "noConnection");
ToastUtils.showShortToast(R.string.no_connection);
} else {
int checkedItemCount = getCheckedCount();
logger.logAction(this, "uploadButton", Integer.toString(checkedItemCount));
if (checkedItemCount > 0) {
// items selected
uploadSelectedFiles();
setAllToCheckedState(listView, false);
toggleButtonLabel(findViewById(R.id.toggle_button), listView);
uploadButton.setEnabled(false);
} else {
// no items selected
ToastUtils.showLongToast(R.string.noselect_error);
}
}
}
});
final Button toggleSelsButton = findViewById(R.id.toggle_button);
toggleSelsButton.setLongClickable(true);
toggleSelsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ListView lv = listView;
boolean allChecked = toggleChecked(lv);
toggleButtonLabel(toggleSelsButton, lv);
uploadButton.setEnabled(allChecked);
if (!allChecked) {
selectedInstances.clear();
}
}
});
toggleSelsButton.setOnLongClickListener(this);
setupAdapter();
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setItemsCanFocus(false);
listView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
uploadButton.setEnabled(areCheckedItems());
}
});
// set title
setTitle(getString(R.string.send_data));
instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute();
sortingOptions = new String[] { getString(R.string.sort_by_name_asc), getString(R.string.sort_by_name_desc), getString(R.string.sort_by_date_asc), getString(R.string.sort_by_date_desc) };
}
Aggregations