Commit 7e656252 authored by Mahendri Dwicahyo's avatar Mahendri Dwicahyo

Merge branch 'aku' into 'master'

Fixing Small Error

See merge request mahendri.md/capi-stis!4
parents ab1884d7 5b8e2c40
...@@ -342,7 +342,7 @@ the specific language governing permissions and limitations under the License. ...@@ -342,7 +342,7 @@ the specific language governing permissions and limitations under the License.
<provider <provider
android:name=".revalidasi.custom.NotifDataProvider" android:name=".revalidasi.custom.NotifDataProvider"
android:authorities="org.odk.collect.android.provider.odk.briefdata" android:authorities="org.odk.collect.android.provider.odk.notifdata"
android:exported="false" /> android:exported="false" />
<service <service
android:name=".revalidasi.notifikasi.MyFirebaseMessagingService"> android:name=".revalidasi.notifikasi.MyFirebaseMessagingService">
......
...@@ -1864,6 +1864,9 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe ...@@ -1864,6 +1864,9 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
return false; return false;
} }
/**
* modifikasi untuk CAPI-STIS menu log error dan hirarki swipe
*/
@Override @Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) { float velocityY) {
...@@ -1903,29 +1906,49 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe ...@@ -1903,29 +1906,49 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
beenSwiped = true; beenSwiped = true;
if (velocityX > 0) { if (velocityX > 0) {
if (e1.getX() > e2.getX()) { if (e1.getX() > e2.getX()) {
Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX()); if (getSlidingMenu().isMenuShowing()) {
Collect.getInstance().getActivityLogger() toggleLeftMenu();
.logInstanceAction(this, "onFling", "showNext"); beenSwiped = false;
showNextView(false); } else {
Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX());
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
}
} else { } else {
Collect.getInstance() if (getSlidingMenu().isSecondaryMenuShowing()) {
.getActivityLogger() toggleRigthMenu();
.logInstanceAction(this, "onFling", beenSwiped = false;
"showPrevious"); } else {
showPreviousView(); Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
}
} }
} else { } else {
if (e1.getX() < e2.getX()) { if (e1.getX() < e2.getX()) {
Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX()); if (getSlidingMenu().isSecondaryMenuShowing()) {
Collect.getInstance() toggleRigthMenu();
.getActivityLogger() beenSwiped = false;
.logInstanceAction(this, "onFling", } else {
"showPrevious"); Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX());
showPreviousView(); Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
}
} else { } else {
Collect.getInstance().getActivityLogger() if (getSlidingMenu().isMenuShowing()) {
.logInstanceAction(this, "onFling", "showNext"); toggleLeftMenu();
showNextView(false); beenSwiped = false;
} else {
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
}
} }
} }
return true; return true;
......
...@@ -72,7 +72,6 @@ public class SplashScreenActivity extends AppCompatActivity { ...@@ -72,7 +72,6 @@ public class SplashScreenActivity extends AppCompatActivity {
private static final boolean EXIT = true; private static final boolean EXIT = true;
GeneralSharedPreferences preferences; GeneralSharedPreferences preferences;
private SharedPreferences collectPreferences;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
...@@ -80,8 +79,6 @@ public class SplashScreenActivity extends AppCompatActivity { ...@@ -80,8 +79,6 @@ public class SplashScreenActivity extends AppCompatActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash_screen); setContentView(R.layout.splash_screen);
collectPreferences = getSharedPreferences(CapiInstancePreferences.COLLECTIVA_PREFERENCES_KEY,MODE_PRIVATE);
// get the shared preferences object // get the shared preferences object
preferences = GeneralSharedPreferences.getInstance(); preferences = GeneralSharedPreferences.getInstance();
......
...@@ -68,9 +68,6 @@ public class Collect extends Application { ...@@ -68,9 +68,6 @@ public class Collect extends Application {
+ File.separator + "capi-stis"; + File.separator + "capi-stis";
public static final String FORMS_PATH = ODK_ROOT + File.separator + "forms"; public static final String FORMS_PATH = ODK_ROOT + File.separator + "forms";
public static final String INSTANCES_PATH = ODK_ROOT + File.separator + "instances"; public static final String INSTANCES_PATH = ODK_ROOT + File.separator + "instances";
public static final String INSTANCES_DOWNLOAD_PATH = ODK_ROOT + File.separator + "instances" + File.separator + "from aggregate";
public static final String INSTANCES_SAMPELTERPILIH_PATH = ODK_ROOT + File.separator + "instances" + File.separator + "sampel terpilih";
public static final String BRIEFCASE_PATH = ODK_ROOT + File.separator + "briefcase";
public static final String CACHE_PATH = ODK_ROOT + File.separator + ".cache"; public static final String CACHE_PATH = ODK_ROOT + File.separator + ".cache";
public static final String METADATA_PATH = ODK_ROOT + File.separator + "metadata"; public static final String METADATA_PATH = ODK_ROOT + File.separator + "metadata";
public static final String TMPFILE_PATH = CACHE_PATH + File.separator + "tmp.jpg"; public static final String TMPFILE_PATH = CACHE_PATH + File.separator + "tmp.jpg";
...@@ -79,6 +76,11 @@ public class Collect extends Application { ...@@ -79,6 +76,11 @@ public class Collect extends Application {
public static final String DEFAULT_FONTSIZE = "16"; public static final String DEFAULT_FONTSIZE = "16";
public static final String OFFLINE_LAYERS = ODK_ROOT + File.separator + "layers"; public static final String OFFLINE_LAYERS = ODK_ROOT + File.separator + "layers";
public static final String SETTINGS = ODK_ROOT + File.separator + "settings"; public static final String SETTINGS = ODK_ROOT + File.separator + "settings";
//modif CAPI
public static final String BRIEFCASE_PATH = ODK_ROOT + File.separator + "briefcase";
public static final String INSTANCES_DOWNLOAD_PATH = ODK_ROOT + File.separator + "instances" + File.separator + "from aggregate";
public static final String INSTANCES_SAMPELTERPILIH_PATH = ODK_ROOT + File.separator + "instances" + File.separator + "sampel terpilih";
private static Collect singleton = null; private static Collect singleton = null;
static { static {
...@@ -121,7 +123,7 @@ public class Collect extends Application { ...@@ -121,7 +123,7 @@ public class Collect extends Application {
} }
String[] dirs = { String[] dirs = {
ODK_ROOT, FORMS_PATH, INSTANCES_PATH, CACHE_PATH, METADATA_PATH, OFFLINE_LAYERS ODK_ROOT, FORMS_PATH, INSTANCES_PATH, CACHE_PATH, METADATA_PATH, OFFLINE_LAYERS, BRIEFCASE_PATH
}; };
for (String dirName : dirs) { for (String dirName : dirs) {
......
...@@ -57,6 +57,7 @@ import org.odk.collect.android.dao.InstancesDao; ...@@ -57,6 +57,7 @@ import org.odk.collect.android.dao.InstancesDao;
import org.odk.collect.android.dto.Instance; import org.odk.collect.android.dto.Instance;
import org.odk.collect.android.listeners.DeleteInstancesListener; import org.odk.collect.android.listeners.DeleteInstancesListener;
import org.odk.collect.android.listeners.DiskSyncListener; import org.odk.collect.android.listeners.DiskSyncListener;
import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceKeys; import org.odk.collect.android.preferences.PreferenceKeys;
import org.odk.collect.android.provider.FormsProviderAPI; import org.odk.collect.android.provider.FormsProviderAPI;
import org.odk.collect.android.provider.InstanceProviderAPI; import org.odk.collect.android.provider.InstanceProviderAPI;
...@@ -151,12 +152,17 @@ public class CapiInstanceActivity extends AppCompatActivity ...@@ -151,12 +152,17 @@ public class CapiInstanceActivity extends AppCompatActivity
recycleView.setLayoutManager(new LinearLayoutManager(this)); recycleView.setLayoutManager(new LinearLayoutManager(this));
recycleView.setHasFixedSize(true); recycleView.setHasFixedSize(true);
fab.setOnClickListener(new View.OnClickListener() { if (GeneralSharedPreferences.getInstance().get(PreferenceKeys.KEY_USERGROUP)
@Override .toString().trim().equals("PML")) {
public void onClick(View v) { fab.setVisibility(View.GONE);
fillBlankForm(); } else {
} fab.setOnClickListener(new View.OnClickListener() {
}); @Override
public void onClick(View v) {
fillBlankForm();
}
});
}
instanceSyncTask = new InstanceSyncTask(); instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this); instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute(); instanceSyncTask.execute();
......
...@@ -54,6 +54,10 @@ import static android.app.Activity.RESULT_OK; ...@@ -54,6 +54,10 @@ import static android.app.Activity.RESULT_OK;
public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapter.InstanceViewHolder> public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapter.InstanceViewHolder>
implements Filterable { implements Filterable {
public static final int MENU_UPLOAD = 0;
public static final int MENU_DELETE = 1;
private Activity context; private Activity context;
//list setelah filter //list setelah filter
private List<CapiInstance> dataSet; private List<CapiInstance> dataSet;
...@@ -61,13 +65,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte ...@@ -61,13 +65,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
private List<CapiInstance> dataSetOri; private List<CapiInstance> dataSetOri;
//nama form //nama form
private String formname = ""; private String formname = "";
//allow upload on selected item
private boolean allowUpload = true;
//callback menu select //callback menu select
public interface MenuListener{ public interface MenuListener{
void onMenuSelect(int mode, long[] instanceId); void onMenuSelect(int mode, long[] instanceId);
} }
public static final int MENU_UPLOAD = 0;
public static final int MENU_DELETE = 1;
private ArrayList<Integer> selectedItem = new ArrayList<>(); private ArrayList<Integer> selectedItem = new ArrayList<>();
private MenuListener menuListener; private MenuListener menuListener;
private ActionMode actionMode; private ActionMode actionMode;
...@@ -88,6 +92,12 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte ...@@ -88,6 +92,12 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()){ switch (item.getItemId()){
case R.id.action_upload: case R.id.action_upload:
if (!allowUpload) {
Toast.makeText(context, "Terdapat isian yang belum difinalisasi",
Toast.LENGTH_SHORT).show();
break;
}
long[] instancesId = getSelectedItemsId(); long[] instancesId = getSelectedItemsId();
if (ArrayUtils.isNotEmpty(instancesId)) if (ArrayUtils.isNotEmpty(instancesId))
menuListener.onMenuSelect(MENU_UPLOAD, instancesId); menuListener.onMenuSelect(MENU_UPLOAD, instancesId);
...@@ -148,7 +158,7 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte ...@@ -148,7 +158,7 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
@Override @Override
public InstanceViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public InstanceViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
Context context = parent.getContext(); Context context = parent.getContext();
View v = LayoutInflater.from(context).inflate(R.layout.capi_item_instance, null); View v = LayoutInflater.from(context).inflate(R.layout.capi_item_instance, parent, false);
return new InstanceViewHolder(v); return new InstanceViewHolder(v);
} }
...@@ -217,13 +227,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte ...@@ -217,13 +227,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
class InstanceViewHolder extends RecyclerView.ViewHolder class InstanceViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener, View.OnLongClickListener { implements View.OnClickListener, View.OnLongClickListener {
TextView title, subtitle, status; TextView title, subtitle, status;
ImageView iconInstance, iconStatus, iconSelected; ImageView iconInstance, iconStatus, iconSelected;
LinearLayout statusHolder, holderDescription; LinearLayout statusHolder, holderDescription;
ImageView selection, btnEdit; ImageView selection, btnEdit;
CardView cardView; CardView cardView;
View divider; View divider;
String instanceStatus; String instanceStatus;
InstanceViewHolder(final View itemView) { InstanceViewHolder(final View itemView) {
...@@ -425,18 +435,16 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte ...@@ -425,18 +435,16 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
} }
void selectItem(int layoutPosition){ void selectItem(int layoutPosition){
boolean isSelected = selectedItem.contains(layoutPosition);
if (isSelected) selectedItem.remove(layoutPosition);
else selectedItem.add(layoutPosition);
//check instance finalized or fail to upload //check instance finalized or fail to upload
if (!InstanceProviderAPI.STATUS_COMPLETE.equals(instanceStatus) if (!InstanceProviderAPI.STATUS_COMPLETE.equals(instanceStatus)
&& !InstanceProviderAPI.STATUS_SUBMISSION_FAILED.equals(instanceStatus)){ && !InstanceProviderAPI.STATUS_SUBMISSION_FAILED.equals(instanceStatus)){
Toast.makeText(context, "Tidak dapat memilih form yang belum difinalisasi", allowUpload = isSelected;
Toast.LENGTH_SHORT).show();
return;
} }
boolean isSelected = selectedItem.contains(layoutPosition);
if (isSelected) selectedItem.remove(layoutPosition);
else selectedItem.add(layoutPosition);
if (selectedItem.size() == 0) actionMode.finish(); if (selectedItem.size() == 0) actionMode.finish();
else { else {
actionMode.setTitle(selectedItem.size() + " isian terpilih"); actionMode.setTitle(selectedItem.size() + " isian terpilih");
......
...@@ -3,7 +3,6 @@ package org.odk.collect.android.capi.fragment; ...@@ -3,7 +3,6 @@ package org.odk.collect.android.capi.fragment;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
......
...@@ -94,7 +94,7 @@ public final class PreferenceKeys { ...@@ -94,7 +94,7 @@ public final class PreferenceKeys {
hashMap.put(KEY_ANALYTICS, true); hashMap.put(KEY_ANALYTICS, true);
hashMap.put(KEY_INSTANCE_SYNC, true); hashMap.put(KEY_INSTANCE_SYNC, true);
hashMap.put(KEY_APP_LANGUAGE, ""); hashMap.put(KEY_APP_LANGUAGE, "");
hashMap.put(KEY_PROTOCOL, Collect.getInstance().getString(R.string.protocol_odk_default)); hashMap.put(KEY_PROTOCOL, Collect.getInstance().getString(R.string.protocol_odk_capi));
hashMap.put(KEY_SELECTED_GOOGLE_ACCOUNT, ""); hashMap.put(KEY_SELECTED_GOOGLE_ACCOUNT, "");
hashMap.put(KEY_USERNAME, ""); hashMap.put(KEY_USERNAME, "");
hashMap.put(KEY_METADATA_USERNAME, ""); hashMap.put(KEY_METADATA_USERNAME, "");
...@@ -103,7 +103,7 @@ public final class PreferenceKeys { ...@@ -103,7 +103,7 @@ public final class PreferenceKeys {
hashMap.put(KEY_SERVER_URL, Collect.getInstance().getString(R.string.default_server_url)); hashMap.put(KEY_SERVER_URL, Collect.getInstance().getString(R.string.default_server_url));
hashMap.put(KEY_GOOGLE_SHEETS_URL, ""); hashMap.put(KEY_GOOGLE_SHEETS_URL, "");
hashMap.put(KEY_FORMLIST_URL, Collect.getInstance().getString(R.string.default_odk_formlist)); hashMap.put(KEY_FORMLIST_URL, Collect.getInstance().getString(R.string.default_odk_formlist));
hashMap.put(KEY_SUBMISSION_URL, Collect.getInstance().getString(R.string.default_odk_submission)); hashMap.put(KEY_SUBMISSION_URL, Collect.getInstance().getString(R.string.odk_capi_submit));
hashMap.put(KEY_NAVIGATION, "swipe"); hashMap.put(KEY_NAVIGATION, "swipe");
hashMap.put(KEY_CONSTRAINT_BEHAVIOR, "on_swipe"); hashMap.put(KEY_CONSTRAINT_BEHAVIOR, "on_swipe");
hashMap.put(KEY_COMPLETED_DEFAULT, true); hashMap.put(KEY_COMPLETED_DEFAULT, true);
......
...@@ -453,10 +453,12 @@ public class InstanceProvider extends ContentProvider { ...@@ -453,10 +453,12 @@ public class InstanceProvider extends ContentProvider {
InstanceColumns.DISPLAY_SUBTEXT); InstanceColumns.DISPLAY_SUBTEXT);
sInstancesProjectionMap.put(InstanceColumns.DELETED_DATE, InstanceColumns.DELETED_DATE); sInstancesProjectionMap.put(InstanceColumns.DELETED_DATE, InstanceColumns.DELETED_DATE);
//modifikasi CAPI-STIS
sInstancesProjectionMap.put(InstanceColumns.INSTANCE_UUID, InstanceColumns.INSTANCE_UUID); sInstancesProjectionMap.put(InstanceColumns.INSTANCE_UUID, InstanceColumns.INSTANCE_UUID);
sInstancesProjectionMap.put(InstanceColumns.NOTIF_DATA_UUID, InstanceColumns.NOTIF_DATA_UUID); sInstancesProjectionMap.put(InstanceColumns.NOTIF_DATA_UUID, InstanceColumns.NOTIF_DATA_UUID);
sInstancesProjectionMap.put(InstanceColumns.LATEST, InstanceColumns.LATEST); sInstancesProjectionMap.put(InstanceColumns.LATEST, InstanceColumns.LATEST);
sInstancesProjectionMap.put(InstanceColumns.LAST_UPDATE_DATE_SERVER, InstanceColumns.LAST_UPDATE_DATE_SERVER); sInstancesProjectionMap.put(InstanceColumns.LAST_UPDATE_DATE_SERVER, InstanceColumns.LAST_UPDATE_DATE_SERVER);
sInstancesProjectionMap.put(InstanceColumns.FROM_NOTIFICATION, InstanceColumns.FROM_NOTIFICATION);
} }
} }
...@@ -54,12 +54,12 @@ public class DataDownloadActivity extends AppCompatActivity ...@@ -54,12 +54,12 @@ public class DataDownloadActivity extends AppCompatActivity
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
if (null != getSupportActionBar()){ if (null != getSupportActionBar()){
getSupportActionBar().setTitle("Unduh Pembaruan"); getSupportActionBar().setTitle("Unduh Pengembalian");
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} }
notifDataDao = new NotifDataDao(); notifDataDao = new NotifDataDao();
cursorData = notifDataDao.getAdditinalCursor(); cursorData = notifDataDao.getNotifDataCursor();
adapter.changeCursor(cursorData); adapter.changeCursor(cursorData);
} }
......
...@@ -2,6 +2,7 @@ package org.odk.collect.android.revalidasi.adapter; ...@@ -2,6 +2,7 @@ package org.odk.collect.android.revalidasi.adapter;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.database.DatabaseUtils;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -12,6 +13,8 @@ import android.widget.TextView; ...@@ -12,6 +13,8 @@ import android.widget.TextView;
import org.odk.collect.android.R; import org.odk.collect.android.R;
import org.odk.collect.android.revalidasi.custom.NotifDataProviderAPI.NotifDataColumns; import org.odk.collect.android.revalidasi.custom.NotifDataProviderAPI.NotifDataColumns;
import timber.log.Timber;
/** /**
* @author Mahendri Dwicahyo * @author Mahendri Dwicahyo
*/ */
...@@ -45,7 +48,7 @@ public class DownAdapter extends RecyclerView.Adapter<DownAdapter.DownViewHolder ...@@ -45,7 +48,7 @@ public class DownAdapter extends RecyclerView.Adapter<DownAdapter.DownViewHolder
@Override @Override
public void onBindViewHolder(DownAdapter.DownViewHolder holder, int position) { public void onBindViewHolder(DownAdapter.DownViewHolder holder, int position) {
if (!dataValid) throw new IllegalStateException("Cursor tidak valid"); if (!dataValid) throw new IllegalStateException("Cursor tidak valid");
cursor.moveToPosition(cursor.getPosition()); cursor.moveToPosition(position);
holder.setData(cursor); holder.setData(cursor);
} }
......
...@@ -25,7 +25,7 @@ public class NotifDataDao { ...@@ -25,7 +25,7 @@ public class NotifDataDao {
String selectionArgs[] = {values.get(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID).toString(), String selectionArgs[] = {values.get(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID).toString(),
values.get(NotifDataProviderAPI.NotifDataColumns.LAST_UPDATE_DATE).toString()}; values.get(NotifDataProviderAPI.NotifDataColumns.LAST_UPDATE_DATE).toString()};
Cursor lebih = getAdditinalCursor(selection, selectionArgs); Cursor lebih = getNotifDataCursor(selection, selectionArgs);
if(lebih.getCount()==0){ if(lebih.getCount()==0){
lebih.close(); lebih.close();
String selection2 = NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID + " =? and " + String selection2 = NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID + " =? and " +
...@@ -51,14 +51,14 @@ public class NotifDataDao { ...@@ -51,14 +51,14 @@ public class NotifDataDao {
} }
//edit Mahendri //edit Mahendri
public Cursor getAdditinalCursor() { public Cursor getNotifDataCursor() {
String selection = NotifDataColumns.LATEST + " =? "; String selection = NotifDataColumns.LATEST + " =? ";
String[] selectionArgs = new String[]{String.valueOf(NotifDataColumns.IS_LATEST)}; String[] selectionArgs = new String[]{String.valueOf(NotifDataColumns.IS_LATEST)};
return getNotifDataCursor(null, selection, selectionArgs, null); return getNotifDataCursor(null, selection, selectionArgs, null);
} }
public Cursor getAdditinalCursor(CharSequence charSequence,String sortOrder, boolean viewMode) { public Cursor getNotifDataCursor(CharSequence charSequence, String sortOrder, boolean viewMode) {
if(viewMode){ if(viewMode){
String selection = NotifDataProviderAPI.NotifDataColumns.NAME_INSTANCE + " LIKE ? and " String selection = NotifDataProviderAPI.NotifDataColumns.NAME_INSTANCE + " LIKE ? and "
+ NotifDataProviderAPI.NotifDataColumns.LATEST+ " =? "; + NotifDataProviderAPI.NotifDataColumns.LATEST+ " =? ";
...@@ -77,11 +77,11 @@ public class NotifDataDao { ...@@ -77,11 +77,11 @@ public class NotifDataDao {
} }
} }
public Cursor getAdditinalCursor(String sortOrder) { public Cursor getNotifDataCursor(String sortOrder) {
return getNotifDataCursor(null, null, null, sortOrder); return getNotifDataCursor(null, null, null, sortOrder);
} }
public Cursor getAdditinalCursor(String selection, String[] selectionArgs) { public Cursor getNotifDataCursor(String selection, String[] selectionArgs) {
return getNotifDataCursor(null, selection, selectionArgs, null); return getNotifDataCursor(null, selection, selectionArgs, null);
} }
...@@ -196,7 +196,7 @@ public class NotifDataDao { ...@@ -196,7 +196,7 @@ public class NotifDataDao {
return notifDataList; return notifDataList;
} }
public ContentValues getValuesFromAdditinalObject(NotifData notifData) { public ContentValues getValuesFromNotifData(NotifData notifData) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(NotifDataProviderAPI.NotifDataColumns.UUID, notifData.getUuid()); values.put(NotifDataProviderAPI.NotifDataColumns.UUID, notifData.getUuid());
values.put(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID, notifData.getInstanceuuid()); values.put(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID, notifData.getInstanceuuid());
......
...@@ -249,10 +249,10 @@ public class NotifDataProvider extends ContentProvider { ...@@ -249,10 +249,10 @@ public class NotifDataProvider extends ContentProvider {
static { static {
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "additional", ADDITIONAL); sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "notifdata", ADDITIONAL);
sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "additional/#", ADDITIONAL_ID); sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "notifdata/#", ADDITIONAL_ID);
sAdditionalProjectionMap = new HashMap<String, String>(); sAdditionalProjectionMap = new HashMap<>();
sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns._ID, NotifDataProviderAPI.NotifDataColumns._ID); sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns._ID, NotifDataProviderAPI.NotifDataColumns._ID);
sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns.UUID, NotifDataProviderAPI.NotifDataColumns.UUID); sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns.UUID, NotifDataProviderAPI.NotifDataColumns.UUID);
sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID, NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID); sAdditionalProjectionMap.put(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID, NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID);
......
package org.odk.collect.android.revalidasi.notifikasi; package org.odk.collect.android.revalidasi.notifikasi;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
import com.google.firebase.messaging.FirebaseMessaging; import com.google.firebase.messaging.FirebaseMessaging;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject; import org.json.JSONObject;
import org.odk.collect.android.R;
import org.odk.collect.android.application.Collect; import org.odk.collect.android.application.Collect;
import org.odk.collect.android.preferences.GeneralSharedPreferences; import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceKeys; import org.odk.collect.android.preferences.PreferenceKeys;
import org.odk.collect.android.revalidasi.briefcase.util.WebUtils; import org.odk.collect.android.utilities.WebUtils;
import org.opendatakit.httpclientandroidlib.HttpEntity; import org.opendatakit.httpclientandroidlib.HttpEntity;
import org.opendatakit.httpclientandroidlib.HttpRequest;
import org.opendatakit.httpclientandroidlib.HttpResponse; import org.opendatakit.httpclientandroidlib.HttpResponse;
import org.opendatakit.httpclientandroidlib.HttpStatus; import org.opendatakit.httpclientandroidlib.HttpStatus;
import org.opendatakit.httpclientandroidlib.auth.AuthScope;
import org.opendatakit.httpclientandroidlib.auth.Credentials;
import org.opendatakit.httpclientandroidlib.auth.UsernamePasswordCredentials;
import org.opendatakit.httpclientandroidlib.client.CookieStore;
import org.opendatakit.httpclientandroidlib.client.CredentialsProvider;
import org.opendatakit.httpclientandroidlib.client.HttpClient; import org.opendatakit.httpclientandroidlib.client.HttpClient;
import org.opendatakit.httpclientandroidlib.client.config.AuthSchemes;
import org.opendatakit.httpclientandroidlib.client.config.RequestConfig;
import org.opendatakit.httpclientandroidlib.client.methods.HttpGet; import org.opendatakit.httpclientandroidlib.client.methods.HttpGet;
import org.opendatakit.httpclientandroidlib.client.methods.HttpPost; import org.opendatakit.httpclientandroidlib.protocol.HttpContext;
import org.opendatakit.httpclientandroidlib.client.protocol.HttpClientContext;
import org.opendatakit.httpclientandroidlib.client.utils.DateUtils;
import org.opendatakit.httpclientandroidlib.config.SocketConfig;
import org.opendatakit.httpclientandroidlib.impl.client.BasicCookieStore;
import org.opendatakit.httpclientandroidlib.impl.client.BasicCredentialsProvider;
import org.opendatakit.httpclientandroidlib.impl.client.HttpClientBuilder;
import org.opendatakit.httpclientandroidlib.util.EntityUtils; import org.opendatakit.httpclientandroidlib.util.EntityUtils;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import timber.log.Timber; import timber.log.Timber;
...@@ -95,16 +70,18 @@ public class GetUuidTask extends AsyncTask<String, String, String> { ...@@ -95,16 +70,18 @@ public class GetUuidTask extends AsyncTask<String, String, String> {
} }
// get shared HttpContext so that authentication and cookies are retained. // get shared HttpContext so that authentication and cookies are retained.
HttpClientContext localContext = WebUtils.createHttpContext(); HttpContext localContext = Collect.getInstance().getHttpContext();
HttpClient httpclient = WebUtils.createHttpClient(); HttpClient httpclient = WebUtils.createHttpClient(WebUtils.CONNECTION_TIMEOUT);
// set up request... // set up request...