Commit 2ee4e7a9 authored by rahadi's avatar rahadi

Preferences modifications

parent 86045cd4
......@@ -378,7 +378,8 @@ the specific language governing permissions and limitations under the License.
<!-- android:name="id.ac.stis.capi.pemutakhiran.activities.DsrtActivity" -->
<!-- android:theme="@style/VsenAppTheme" /> -->
<activity android:name=".lessthink.activities.ListingInstanceActivity"></activity>
<activity android:name=".lessthink.activities.InstanceActivity"></activity>
<activity android:name=".lessthink.activities.InstancePreferenceActivity" />
</application>
</manifest>
\ No newline at end of file
......@@ -25,6 +25,7 @@ import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
......@@ -42,18 +43,33 @@ import android.widget.TextView;
import android.widget.Toast;
import org.apache.commons.lang3.ArrayUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import id.ac.stis.capi.R;
import id.ac.stis.capi.collectiva.CapiInstance;
import id.ac.stis.capi.collectiva.adapter.CapiInstanceAdapter;
import id.ac.stis.capi.collectiva.preferences.CapiInstancePreferences;
import id.ac.stis.capi.collectiva.preferences.Constants;
import id.ac.stis.capi.lessthink.activities.InstancePreferenceActivity;
import id.ac.stis.capi.lessthink.fragments.InstancePreferenceFragment;
import id.ac.stis.capi.lessthink.models.FormLabels;
import id.ac.stis.capi.lessthink.models.InstanceValues;
import id.ac.stis.capi.lessthink.preferences.PreferencesAPI;
import id.ac.stis.capi.lessthink.preferences.PreferencesManager;
import id.ac.stis.capi.lessthink.utils.XmlUtils;
import id.ac.stis.capi.odk.activities.FormEntryActivity;
import id.ac.stis.capi.odk.activities.GoogleSheetsUploaderActivity;
import id.ac.stis.capi.odk.activities.InstanceUploaderActivity;
import id.ac.stis.capi.odk.application.Collect;
import id.ac.stis.capi.collectiva.CapiInstance;
import id.ac.stis.capi.collectiva.preferences.CapiInstancePreferences;
import id.ac.stis.capi.collectiva.ParseXml;
import id.ac.stis.capi.collectiva.preferences.Constants;
import id.ac.stis.capi.collectiva.adapter.CapiInstanceAdapter;
import id.ac.stis.capi.odk.dao.FormsDao;
import id.ac.stis.capi.odk.dao.InstancesDao;
import id.ac.stis.capi.odk.dto.Form;
import id.ac.stis.capi.odk.dto.Instance;
import id.ac.stis.capi.odk.listeners.DeleteInstancesListener;
import id.ac.stis.capi.odk.listeners.DiskSyncListener;
......@@ -69,11 +85,6 @@ import id.ac.stis.capi.odk.utilities.ApplicationConstants;
import id.ac.stis.capi.odk.utilities.PlayServicesUtil;
import id.ac.stis.capi.odk.utilities.ToastUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import static id.ac.stis.capi.odk.utilities.ApplicationConstants.SortingOrder.BY_DATE_ASC;
import static id.ac.stis.capi.odk.utilities.ApplicationConstants.SortingOrder.BY_DATE_DESC;
import static id.ac.stis.capi.odk.utilities.ApplicationConstants.SortingOrder.BY_NAME_ASC;
......@@ -90,14 +101,17 @@ import static id.ac.stis.capi.odk.utilities.ApplicationConstants.SortingOrder.BY
public class CapiInstanceActivity extends AppCompatActivity
implements DiskSyncListener, DeleteInstancesListener,
CapiInstanceAdapter.MenuListener, SearchView.OnQueryTextListener {
private static final String INSTANCE_LIST_ACTIVITY_SORTING_ORDER = "instanceListActivitySortingOrder";
public static final String FORM_ID_KEY = "formid";
public static final String FORMNAME = "formname";
static final String TAG = CapiInstanceActivity.class.getSimpleName();
private static final String INSTANCE_LIST_ACTIVITY_SORTING_ORDER = "instanceListActivitySortingOrder";
private static final int INSTANCE_UPLOADER = 0;
protected String[] mSortingOptions;
String formName;
String formIDKey;
DeleteInstancesTask mDeleteInstancesTask = null;
private InstanceSyncTask instanceSyncTask;
private Integer mSelectedSortingOrder;
protected String[] mSortingOptions;
//modification
private RecyclerView recycleView;
private LinearLayout progressBarHolder, messageHolder;
......@@ -106,15 +120,6 @@ public class CapiInstanceActivity extends AppCompatActivity
private CapiInstanceAdapter adapter;
private SharedPreferences capiPref;
private static final String FORM_ID_KEY = "formid";
private static final String FORMNAME = "formname";
private static final int INSTANCE_UPLOADER = 0;
String formName;
String formIDKey;
DeleteInstancesTask mDeleteInstancesTask = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -135,11 +140,11 @@ public class CapiInstanceActivity extends AppCompatActivity
};
capiPref = getSharedPreferences(CapiInstancePreferences.COLLECTIVA_PREFERENCES_KEY, MODE_PRIVATE);
formName = getString(R.string.instance_list_title,getIntent().getStringExtra(FORMNAME));
formName = getString(R.string.instance_list_title, getIntent().getStringExtra(FORMNAME));
formIDKey = getIntent().getStringExtra(FORM_ID_KEY);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
if (null != getSupportActionBar()){
if (null != getSupportActionBar()) {
getSupportActionBar().setTitle(formName);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
......@@ -170,7 +175,6 @@ public class CapiInstanceActivity extends AppCompatActivity
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (resultCode == RESULT_CANCELED) {
......@@ -193,20 +197,20 @@ public class CapiInstanceActivity extends AppCompatActivity
super.onActivityResult(requestCode, resultCode, intent);
}
private void onStartLoading(){
Log.d(TAG,"on start loading");
private void onStartLoading() {
Log.d(TAG, "on start loading");
progressBarHolder.setVisibility(View.VISIBLE);
messageHolder.setVisibility(View.GONE);
}
private void onErrorLoading(String message){
private void onErrorLoading(String message) {
progressBarHolder.setVisibility(View.GONE);
messageError.setText(message);
messageHolder.setVisibility(View.VISIBLE);
}
private void onDoneLoading(){
Log.d("DEBUGCOLL","on done loading");
private void onDoneLoading() {
Log.d("DEBUGCOLL", "on done loading");
progressBarHolder.setVisibility(View.GONE);
messageHolder.setVisibility(View.GONE);
}
......@@ -253,7 +257,7 @@ public class CapiInstanceActivity extends AppCompatActivity
List<CapiInstance> dataInstances = getDataInstance();
adapter = new CapiInstanceAdapter(this, dataInstances, formName, this);
recycleView.setAdapter(adapter);
if(dataInstances.size()<1){
if (dataInstances.size() < 1) {
onErrorLoading("Belum ada respons untuk kuesioner \"" + formName + "\"");
}
}
......@@ -268,41 +272,63 @@ public class CapiInstanceActivity extends AppCompatActivity
private List<CapiInstance> getDataInstance() {
try {
String titleSelected = capiPref
.getString(formIDKey+"_"+ CapiInstancePreferences.TITLE_RESPONS_KEY, "");
HashSet<String> subtitles = (HashSet<String>)
capiPref.getStringSet(formIDKey+"_"+ CapiInstancePreferences.SUBTITLE_RESPONS_KEY,
new HashSet<String>());
PreferencesManager manager = PreferencesManager.getInstance();
String titleSelected = (String) manager.getByFormId(PreferencesAPI.KEY_TITLE, formIDKey);
// String titleSelected = capiPref
// .getString(formIDKey + "_" + CapiInstancePreferences.TITLE_RESPONS_KEY, "");
HashSet<String> subtitles = (HashSet<String>) manager.getByFormId(PreferencesAPI.KEY_SUBTITLE, formIDKey);
// HashSet<String> subtitles = (HashSet<String>)
// capiPref.getStringSet(formIDKey + "_" + CapiInstancePreferences.SUBTITLE_RESPONS_KEY,
// new HashSet<String>());
HashSet<String> arrays = new HashSet<>();
arrays.add(titleSelected);
arrays.addAll(subtitles);
Log.d("DEBUGCOLL","getting information for "+arrays);
Log.d("DEBUGCOLL", "getting information for " + arrays);
String selection = InstanceColumns.LATEST + " =? AND " +
InstanceColumns.JR_FORM_ID + " =?";
String[] selectionArgs = new String[]{InstanceProviderAPI.LATEST_VERSION,formIDKey};
String[] selectionArgs = new String[]{InstanceProviderAPI.LATEST_VERSION, formIDKey};
InstancesDao instancesDao = new InstancesDao();
Cursor data = instancesDao.getInstancesCursor(null, selection, selectionArgs, getSortingOrder());
List<Instance> instanceList = instancesDao.getInstancesFromCursor(data);
FormsDao formsDao = new FormsDao();
Form form = formsDao.getFormsFromCursor(formsDao.getFormsCursorForFormId(formIDKey)).get(0);
String formPath = form.getFormFilePath();
File formFile = new File(formPath);
List<String> xpaths = new ArrayList<>(arrays);
FormLabels labels = XmlUtils.getFormLabels(formIDKey, formFile, xpaths);
//filtered by form id
List<CapiInstance> newInstance = new ArrayList<>();
for (Instance instance : instanceList) {
CapiInstance capiInstance = new CapiInstance(instance);
if(arrays.size()>0) {
HashMap<String, String> informations = ParseXml
.getLoadedXmlValues(instance.getInstanceFilePath(), arrays);
if(!titleSelected.equals("")) {
capiInstance.setPrimaryTitle(informations.get(titleSelected));
informations.remove(titleSelected);
if (arrays.size() > 0) {
// HashMap<String, String> informations = ParseXml
// .getLoadedXmlValues(instance.getInstanceFilePath(), arrays);
HashMap<String, String> informations = new HashMap<>();
File file = new File(instance.getInstanceFilePath());
InstanceValues values = XmlUtils.getInstanceValues(instance.getInstanceUuid(), file, labels);
Set<String> parsedXpaths = values.getXPaths();
for(String parsed : parsedXpaths) {
if(parsed.equals(titleSelected)) {
capiInstance.setPrimaryTitle(values.getInstanceValue(parsed));
} else {
informations.put(labels.getFormLabel(parsed), values.getInstanceValue(parsed));
}
}
if(subtitles.size()>0) capiInstance.setInformation(informations);
if (subtitles.size() > 0) capiInstance.setInformation(informations);
}
newInstance.add(capiInstance);
}
return newInstance;
}catch (Exception e){
} catch (Exception e) {
Toast.makeText(this, "Trouble when getting data instance",
Toast.LENGTH_SHORT).show();
return new ArrayList<>();
......@@ -379,9 +405,23 @@ public class CapiInstanceActivity extends AppCompatActivity
else Toast.makeText(this, "Semua respon sudah diunggah", Toast.LENGTH_SHORT).show();
break;
case R.id.action_instance_preferences:
Intent intent = new Intent(this, CapiInstancePreferences.class);
intent.putExtra(FORM_ID_KEY, formIDKey);
// Intent intent = new Intent(this, CapiInstancePreferences.class);
Intent intent = new Intent(this, InstancePreferenceActivity.class);
Bundle extra = new Bundle();
extra.putString(InstancePreferenceActivity.KEY_FORM_ID, formIDKey);
extra.putString(InstancePreferenceActivity.KEY_FORM_NAME, getIntent().getStringExtra(FORMNAME));
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, InstancePreferenceFragment.class.getName());
intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, extra);
intent.putExtra(InstancePreferenceActivity.KEY_FORM_ID, formIDKey);
intent.putExtra(InstancePreferenceActivity.KEY_FORM_NAME, getIntent().getStringExtra(FORMNAME));
startActivity(intent);
finish();
break;
case android.R.id.home:
onBackPressed();
......@@ -410,6 +450,7 @@ public class CapiInstanceActivity extends AppCompatActivity
saveSelectedSortingOrder(position);
updateAdapter();
}
private void saveSelectedSortingOrder(int selectedStringOrder) {
mSelectedSortingOrder = selectedStringOrder;
PreferenceManager.getDefaultSharedPreferences(Collect.getInstance())
......@@ -431,36 +472,36 @@ public class CapiInstanceActivity extends AppCompatActivity
return mSelectedSortingOrder;
}
private void fillBlankForm(){
private void fillBlankForm() {
Cursor formslist = new FormsDao().getFormsCursor();
//getting id
long itemIdPosition = -1;
if(formslist.moveToFirst()){
if (formslist.moveToFirst()) {
do {
if(formslist.getString(formslist.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID)).equals(formIDKey)){
if (formslist.getString(formslist.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID)).equals(formIDKey)) {
itemIdPosition = formslist.getLong(formslist.getColumnIndex(FormsProviderAPI.FormsColumns._ID));
}
}while (formslist.moveToNext());
} while (formslist.moveToNext());
}
if(itemIdPosition>-1){
if (itemIdPosition > -1) {
// get uri to form
Uri formUri = ContentUris.withAppendedId(FormsProviderAPI.FormsColumns.CONTENT_URI, itemIdPosition);
// caller wants to view/edit a form, so launch formentryactivity
Intent intent = new Intent(Intent.ACTION_EDIT, formUri);
intent.putExtra("fillblankform",true);
intent.putExtra(Constants.CURRENT_FORMNAME,getIntent().getStringExtra(FORMNAME));
intent.putExtra("fillblankform", true);
intent.putExtra(Constants.CURRENT_FORMNAME, getIntent().getStringExtra(FORMNAME));
intent.putExtra(ApplicationConstants.BundleKeys.FORM_MODE, ApplicationConstants.FormModes.EDIT_SAVED);
startActivity(intent);
}else {
} else {
//xxxseharusnya tidak terjadi, tidak mungkin itemIdposition < 1
Toast.makeText(this, "Form not exist", Toast.LENGTH_SHORT).show();
}
}
//button function
public void uploadInstance(long[] instanceIds){
public void uploadInstance(long[] instanceIds) {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(
Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = connectivityManager.getActiveNetworkInfo();
......@@ -511,7 +552,7 @@ public class CapiInstanceActivity extends AppCompatActivity
@Override
public void onMenuSelect(int mode, long[] instanceId) {
switch (mode){
switch (mode) {
case CapiInstanceAdapter.MENU_UPLOAD:
uploadInstance(instanceId);
break;
......
......@@ -88,8 +88,6 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
private static final String FORM_VERSION_KEY = "formversion";
private static final String HAS_BEEN_DOWNLOADED = "hasbeendownloaded";
private static final String FORM_TYPE_KEY = "formtype";
private static final boolean EXIT = true;
private static final boolean DO_NOT_EXIT = false;
......@@ -210,12 +208,6 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
return v;
}
@Override
public void onResume() {
super.onResume();
onRefreshPage();
}
public void refreshAfterSync() {
setUpDownloadedFormsOffline();
}
......@@ -241,13 +233,11 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
String formName = c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.DISPLAY_NAME));
String formVersion = c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID));
String formId = c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID));
String formType = c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.FORM_TYPE));
item.put(FORMNAME, formName);
item.put(FORM_ID_KEY, formId);
item.put(FORM_VERSION_KEY, formVersion);
item.put(HAS_BEEN_DOWNLOADED, "true");
item.put(FORM_TYPE_KEY, formType);
downloadedFormsBefore.add(item);
......@@ -451,8 +441,6 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
if (item.get(HAS_BEEN_DOWNLOADED) != null && item.get(HAS_BEEN_DOWNLOADED).equals("true")) {
if (isFormInActiveSurvey(item)) {
item.put(FORM_TYPE_KEY, c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.FORM_TYPE)));
downloadedFilteredFormList.add(item);
}
} else {
......@@ -463,8 +451,6 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
} else {
//has been downloaded
item.put(HAS_BEEN_DOWNLOADED, "true");
item.put(FORM_TYPE_KEY, c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.FORM_TYPE)));
if (isFormInActiveSurvey(item)) downloadedFilteredFormList.add(item);
}
}
......@@ -529,11 +515,6 @@ public class CapiFormFragment extends Fragment implements FormListDownloaderList
item.put(FORM_ID_KEY, details.formID);
item.put(FORM_VERSION_KEY, details.formVersion);
// FormsDao formsDao = new FormsDao();
// Cursor c = formsDao.getFormsCursor(FormsProviderAPI.FormsColumns.JR_FORM_ID + "=?",
// new String[]{details.formID});
// item.put(FORM_TYPE_KEY, c.getString(c.getColumnIndex(FormsProviderAPI.FormsColumns.FORM_TYPE)));
if (!mFormListContain(details.formName)) {
// Insert the new form in alphabetical order.
if (mFormList.size() == 0) {
......
......@@ -54,7 +54,6 @@ public class CapiInstancePreferences extends AppCompatActivity
private View constraintOption;
private View advancedSetting;
private View petaWbSetting;
private View pemutakhiranSetting;
private TextView primaryTextSummary, secondaryTextSummary, constraintValue;
private Switch showTableSwitch, showGroupInOneScreenSwitch;
private String formIds = "";
......@@ -81,7 +80,6 @@ public class CapiInstancePreferences extends AppCompatActivity
showGroupInOneScreenSwitch = findViewById(R.id.switch_show_onscreen);
advancedSetting = findViewById(R.id.advanced_setting);
petaWbSetting = findViewById(R.id.wb_peta_setting);
pemutakhiranSetting = findViewById(R.id.updating_setting);
constraintOption = findViewById(R.id.constraint_option);
constraintValue = findViewById(R.id.constraint_value);
......@@ -99,7 +97,6 @@ public class CapiInstancePreferences extends AppCompatActivity
constraintOption.setOnClickListener(this);
advancedSetting.setOnClickListener(this);
petaWbSetting.setOnClickListener(this);
pemutakhiranSetting.setOnClickListener(this);
primaryHolder.setOnClickListener(this);
secondaryHolder.setOnClickListener(this);
showTableSwitch.setOnCheckedChangeListener(this);
......@@ -157,13 +154,6 @@ public class CapiInstancePreferences extends AppCompatActivity
startActivity(new Intent(this, KonfigurasiPeta.class));
finish();
break;
// case R.id.updating_setting:
// Intent i = new Intent(this, VsenPreferenceActivity.class);
// i.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, VsenPreferenceFragment.class.getName());
// i.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
// startActivity(i);
// finish();
// break;
}
}
......
......@@ -4,12 +4,22 @@ import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Toast;
import org.apache.commons.lang3.ArrayUtils;
import java.io.File;
import java.util.LinkedList;
import java.util.List;
......@@ -17,6 +27,7 @@ import java.util.List;
import id.ac.stis.capi.R;
import id.ac.stis.capi.collectiva.preferences.Constants;
import id.ac.stis.capi.lessthink.fragments.FormEntryDialogFragment;
import id.ac.stis.capi.lessthink.fragments.InstancePreferenceFragment;
import id.ac.stis.capi.lessthink.listeners.OnEntrySavedListener;
import id.ac.stis.capi.lessthink.listeners.OnTableAddButtonClickListener;
import id.ac.stis.capi.lessthink.models.FormLabels;
......@@ -25,16 +36,22 @@ import id.ac.stis.capi.lessthink.utils.XmlUtils;
import id.ac.stis.capi.lessthink.views.TableFooterView;
import id.ac.stis.capi.lessthink.views.TableHeaderView;
import id.ac.stis.capi.lessthink.views.TableRowView;
import id.ac.stis.capi.odk.application.Collect;
import id.ac.stis.capi.odk.dao.FormsDao;
import id.ac.stis.capi.odk.dao.InstancesDao;
import id.ac.stis.capi.odk.dto.Form;
import id.ac.stis.capi.odk.dto.Instance;
import id.ac.stis.capi.odk.listeners.DeleteInstancesListener;
import id.ac.stis.capi.odk.listeners.DiskSyncListener;
import id.ac.stis.capi.odk.provider.FormsProviderAPI;
import id.ac.stis.capi.odk.provider.InstanceProviderAPI;
import id.ac.stis.capi.odk.tasks.DeleteInstancesTask;
import id.ac.stis.capi.odk.tasks.InstanceSyncTask;
import id.ac.stis.capi.odk.utilities.ApplicationConstants;
import timber.log.Timber;
public class ListingInstanceActivity extends AppCompatActivity implements OnEntrySavedListener {
public class InstanceActivity extends AppCompatActivity implements OnEntrySavedListener, SearchView.OnQueryTextListener,
DiskSyncListener, DeleteInstancesListener{
private static final String FORM_ID_KEY = "formid";
private static final String FORMNAME = "formname";
......@@ -45,6 +62,9 @@ public class ListingInstanceActivity extends AppCompatActivity implements OnEntr
private String formId, formName;
private FormLabels labels;
private FormEntryDialogFragment entryDialogFragment;
private InstanceSyncTask instanceSyncTask;
private DeleteInstancesTask deleteInstancesTask;
private LinearLayout progressBarHolder;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -56,48 +76,101 @@ public class ListingInstanceActivity extends AppCompatActivity implements OnEntr
tableHeaderView = findViewById(R.id.header_view);
tableRowView = findViewById(R.id.row_view);
tableFooterView = findViewById(R.id.footer_view);
progressBarHolder = findViewById(R.id.loading_container);
formId = getIntent().getStringExtra(FORM_ID_KEY);
formName = getIntent().getStringExtra(FORMNAME);
FormsDao formsDao = new FormsDao();
List<Form> forms = formsDao.getFormsFromCursor(formsDao.getFormsCursorForFormId(formId));
if (null != getSupportActionBar()) {
getSupportActionBar().setTitle(formName);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
File file = new File(forms.get(0).getFormFilePath());
List<String> xPaths = XmlUtils.getInstanceXPathList(file);
labels = XmlUtils.getFormLabels(formId, file, xPaths);
instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute();
tableHeaderView.setColumns(labels);
onStartLoading();
}
refreshItem(true);
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onCreateOptionsMenu", "show");
getMenuInflater().inflate(R.menu.menu_updating_instance, menu);
// SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
// searchView.setMaxWidth(1000);
// searchView.setQueryHint("Search by title...");
// searchView.setOnQueryTextListener(this);
return true;
}
tableRowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(ListingInstanceActivity.this, "Click : " + view.getTag(), Toast.LENGTH_LONG).show();
@Override
protected void onResume() {
if (instanceSyncTask != null) {
instanceSyncTask.setDiskSyncListener(this);
onStartLoading();
}
super.onResume();
if (instanceSyncTask.getStatus() == AsyncTask.Status.FINISHED) {
syncComplete(instanceSyncTask.getStatusMessage());
}
String instanceUuid = view.getTag().toString();
// entryDialogFragment = FormEntryDialogFragment.newInstance(instanceUuid,
// FormEntryDialogFragment.MODE_EDIT, false);
entryDialogFragment = FormEntryDialogFragment.newInstance(instanceUuid,
FormEntryDialogFragment.MODE_EDIT, false);
entryDialogFragment.show(getSupportFragmentManager(), instanceUuid);
entryDialogFragment.setOnEntrySavedListener(ListingInstanceActivity.this);
//
// Intent i =new Intent(ListingInstanceActivity.this, ListingFormEntryActivity.class);
// i.putExtra("instanceUuid", view.getTag().toString());