Commit 896f7c87 authored by Rahadi Jalu's avatar Rahadi Jalu

Resolved Conflicts

parents 7d68cfc1 7616b8b9
......@@ -347,7 +347,7 @@ the specific language governing permissions and limitations under the License.
<provider
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" />
<service android:name=".revalidasi.notifikasi.MyFirebaseMessagingService">
......
......@@ -1864,6 +1864,9 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
return false;
}
/**
* modifikasi untuk CAPI-STIS menu log error dan hirarki swipe
*/
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
......@@ -1903,29 +1906,49 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
beenSwiped = true;
if (velocityX > 0) {
if (e1.getX() > e2.getX()) {
Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX());
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
if (getSlidingMenu().isMenuShowing()) {
toggleLeftMenu();
beenSwiped = false;
} else {
Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX());
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
}
} else {
Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
if (getSlidingMenu().isSecondaryMenuShowing()) {
toggleRigthMenu();
beenSwiped = false;
} else {
Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
}
}
} else {
if (e1.getX() < e2.getX()) {
Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX());
Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
if (getSlidingMenu().isSecondaryMenuShowing()) {
toggleRigthMenu();
beenSwiped = false;
} else {
Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX());
Collect.getInstance()
.getActivityLogger()
.logInstanceAction(this, "onFling",
"showPrevious");
showPreviousView();
}
} else {
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
if (getSlidingMenu().isMenuShowing()) {
toggleLeftMenu();
beenSwiped = false;
} else {
Collect.getInstance().getActivityLogger()
.logInstanceAction(this, "onFling", "showNext");
showNextView(false);
}
}
}
return true;
......
......@@ -46,7 +46,6 @@ public class SplashScreenActivity extends AppCompatActivity {
private static final boolean EXIT = true;
GeneralSharedPreferences preferences;
private SharedPreferences collectPreferences;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -54,8 +53,6 @@ public class SplashScreenActivity extends AppCompatActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash_screen);
collectPreferences = getSharedPreferences(CapiInstancePreferences.COLLECTIVA_PREFERENCES_KEY, MODE_PRIVATE);
// get the shared preferences object
preferences = GeneralSharedPreferences.getInstance();
......
......@@ -57,6 +57,7 @@ import org.odk.collect.android.dao.InstancesDao;
import org.odk.collect.android.dto.Instance;
import org.odk.collect.android.listeners.DeleteInstancesListener;
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.provider.FormsProviderAPI;
import org.odk.collect.android.provider.InstanceProviderAPI;
......@@ -151,12 +152,17 @@ public class CapiInstanceActivity extends AppCompatActivity
recycleView.setLayoutManager(new LinearLayoutManager(this));
recycleView.setHasFixedSize(true);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fillBlankForm();
}
});
if (GeneralSharedPreferences.getInstance().get(PreferenceKeys.KEY_USERGROUP)
.toString().trim().equals("PML")) {
fab.setVisibility(View.GONE);
} else {
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fillBlankForm();
}
});
}
instanceSyncTask = new InstanceSyncTask();
instanceSyncTask.setDiskSyncListener(this);
instanceSyncTask.execute();
......
......@@ -38,7 +38,6 @@ import timber.log.Timber;
public class CapiLoginActivity extends AppCompatActivity
implements View.OnClickListener, GetUuidTask.LoginListener {
private TextView serverText;
private Button loginBtn;
private EditText username, password;
private GetUuidTask loginTask;
......@@ -49,7 +48,7 @@ public class CapiLoginActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
setContentView(R.layout.capi_activity_login);
serverText = (TextView) findViewById(R.id.server_config_text);
TextView serverText = (TextView) findViewById(R.id.server_config_text);
loginBtn = (Button) findViewById(R.id.btn_login);
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
......@@ -92,14 +91,20 @@ public class CapiLoginActivity extends AppCompatActivity
}
}
public void login(final String username, final String password) {
public void login(final String username, final String password){
//disable login button
loginBtn.setClickable(false);
loginBtn.setText("Proses login");
loginBtn.setBackgroundColor(Color.GRAY);
//create dialog
dialog = new ProgressDialog(this);
dialog.setMessage("Login, mohon tunggu. . .");
dialog.setIndeterminate(true);
dialog.setCancelable(false);
dialog.show();
//execute login task
loginTask = new GetUuidTask(this);
loginTask.execute(username, password);
}
......@@ -157,6 +162,7 @@ public class CapiLoginActivity extends AppCompatActivity
private void onLoginSucceed() {
dialog.dismiss();
loginBtn.setClickable(true);
loginBtn.setText("LOGIN");
loginBtn.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
......
......@@ -54,6 +54,10 @@ import static android.app.Activity.RESULT_OK;
public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapter.InstanceViewHolder>
implements Filterable {
public static final int MENU_UPLOAD = 0;
public static final int MENU_DELETE = 1;
private Activity context;
//list setelah filter
private List<CapiInstance> dataSet;
......@@ -61,13 +65,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
private List<CapiInstance> dataSetOri;
//nama form
private String formname = "";
//allow upload on selected item
private boolean allowUpload = true;
//callback menu select
public interface MenuListener{
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 MenuListener menuListener;
private ActionMode actionMode;
......@@ -88,6 +92,12 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()){
case R.id.action_upload:
if (!allowUpload) {
Toast.makeText(context, "Terdapat isian yang belum difinalisasi",
Toast.LENGTH_SHORT).show();
break;
}
long[] instancesId = getSelectedItemsId();
if (ArrayUtils.isNotEmpty(instancesId))
menuListener.onMenuSelect(MENU_UPLOAD, instancesId);
......@@ -148,7 +158,7 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
@Override
public InstanceViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
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);
}
......@@ -217,13 +227,13 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
class InstanceViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener, View.OnLongClickListener {
TextView title, subtitle, status;
ImageView iconInstance, iconStatus, iconSelected;
LinearLayout statusHolder, holderDescription;
ImageView selection, btnEdit;
CardView cardView;
View divider;
String instanceStatus;
InstanceViewHolder(final View itemView) {
......@@ -425,18 +435,16 @@ public class CapiInstanceAdapter extends RecyclerView.Adapter<CapiInstanceAdapte
}
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
if (!InstanceProviderAPI.STATUS_COMPLETE.equals(instanceStatus)
&& !InstanceProviderAPI.STATUS_SUBMISSION_FAILED.equals(instanceStatus)){
Toast.makeText(context, "Tidak dapat memilih form yang belum difinalisasi",
Toast.LENGTH_SHORT).show();
return;
allowUpload = isSelected;
}
boolean isSelected = selectedItem.contains(layoutPosition);
if (isSelected) selectedItem.remove(layoutPosition);
else selectedItem.add(layoutPosition);
if (selectedItem.size() == 0) actionMode.finish();
else {
actionMode.setTitle(selectedItem.size() + " isian terpilih");
......
......@@ -4,7 +4,6 @@ import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.ConnectivityManager;
......@@ -324,13 +323,6 @@ public class CapiFormFragment extends Fragment
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_map:
showModal();
break;
case R.id.action_preferences:
startActivity(new Intent(getActivity(), PreferencesActivity.class));
// startActivity(new Intent(getActivity(), CapiInstancePreferences.class));
break;
case R.id.action_sort:
//show dialog sort
showDialogSortOptions();
......@@ -339,91 +331,10 @@ public class CapiFormFragment extends Fragment
Toast.makeText(getContext(), "Refreshing..", Toast.LENGTH_SHORT).show();
onRefresPage();
break;
case R.id.action_setting_map:
startActivity(new Intent(getActivity(), KonfigurasiPeta.class));
break;
}
return super.onOptionsItemSelected(item);
}
private void showModal() {
final ArrayList<BlokSensus> listBs = ItemsetDbAdapter.getInstance(getContext()).getListBlokSensus();
if (listBs != null && listBs.size() > 0) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final String[] idSelectedBs = {""};
idSelectedBs[0] = listBs.get(0).getIdBs();
final String[] namaListBs = new String[listBs.size()];
Log.d(VAR.DEBUG, "size bs : " + listBs.size());
for (int n = 0; n < listBs.size(); n++) {
namaListBs[n] = listBs.get(n).getNamaBs();
}
builder.setTitle("Pilih Blok Sensus");
builder.setSingleChoiceItems(
namaListBs, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
idSelectedBs[0] = listBs.get(i).getIdBs();
}
}
);
builder.setPositiveButton("Lihat", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AksesDataOdk aksesDataOdk = new AksesDataOdk();
final ArrayList<Form> arform = aksesDataOdk.getKeteranganForm();
String[] items = new String[arform.size()];
for (int i = 0; i < arform.size(); i++) {
items[i] = arform.get(i).getDisplayName();
}
final int[] kuesselected = {0};
final String[] idKuesioner = {""};
android.app.AlertDialog dialog2 = new android.app.AlertDialog.Builder(getActivity())
.setTitle("Pilih Form Kuesioner")
.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog2, int which2) {
kuesselected[0] = which2;
}
})
.setPositiveButton("Pilih", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog2, int id2) {
idKuesioner[0] = arform.get(kuesselected[0]).getIdForm();
Log.d(VAR.DEBUG, "kuesioner : " + idKuesioner[0]);
Intent intent = new Intent(getActivity(), GeoPointMapboxRevoActivity.class);
intent.putExtra("idBs", idSelectedBs[0]);
intent.putExtra("idKuesioner", idKuesioner[0]);
intent.putExtra("question", false);
startActivity(intent);
}
})
.setNegativeButton("Batal", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog2, int id) {
dialog2.dismiss();
}
}).create();
dialog.dismiss();
dialog2.show();
}
});
builder.setNegativeButton("Batal", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
} else {
Toast.makeText(getActivity(), "Belum ada data blok sensus", Toast.LENGTH_SHORT).show();
}
}
private void showDialogSortOptions() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Sort Options");
......@@ -559,6 +470,7 @@ public class CapiFormFragment extends Fragment
* Called when the form list has finished downloading. results will either contain a set of
* <formname, formdetails> tuples, or one tuple of DL.ERROR.MSG and the associated message.
*/
@Override
public void formListDownloadingComplete(HashMap<String, FormDetails> result) {
downloadFormListTask.setDownloaderListener(null);
downloadFormListTask = null;
......
......@@ -21,6 +21,7 @@ import android.widget.Toast;
import org.odk.collect.android.R;
import org.odk.collect.android.capi.ParseXml;
import org.odk.collect.android.dao.FormsDao;
import org.odk.collect.android.petawbdigital.activities.KonfigurasiPeta;
import org.odk.collect.android.preferences.PreferenceKeys;
import org.odk.collect.android.preferences.PreferencesActivity;
import org.odk.collect.android.provider.FormsProviderAPI;
......@@ -34,7 +35,8 @@ public class CapiInstancePreferences extends AppCompatActivity
private LinearLayout primaryHolder;
private LinearLayout secondaryHolder;
private LinearLayout constraintOption;
private LinearLayout advancedSetting;
private TextView advancedSetting;
private TextView petaWbSetting;
private TextView primaryTextSummary, secondaryTextSummary, constraintValue;
private Switch showTableSwitch, showGroupInOneScreenSwitch;
private String formIds = "";
......@@ -62,7 +64,7 @@ public class CapiInstancePreferences extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.collectiva_activity_preferences);
setContentView(R.layout.capi_activity_preferences);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setTitle("Quick Preferences");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......@@ -74,7 +76,8 @@ public class CapiInstancePreferences extends AppCompatActivity
secondaryTextSummary = (TextView) findViewById(R.id.secondary_text_summary);
showTableSwitch = (Switch) findViewById(R.id.switch_show_table);
showGroupInOneScreenSwitch = (Switch) findViewById(R.id.switch_show_onscreen);
advancedSetting = (LinearLayout) findViewById(R.id.advanced_setting);
advancedSetting = (TextView) findViewById(R.id.advanced_setting);
petaWbSetting = (TextView) findViewById(R.id.wb_peta_setting);
constraintOption = (LinearLayout) findViewById(R.id.constraint_option);
constraintValue = (TextView) findViewById(R.id.constraint_value);
......@@ -91,6 +94,7 @@ public class CapiInstancePreferences extends AppCompatActivity
constraintOption.setOnClickListener(this);
advancedSetting.setOnClickListener(this);
petaWbSetting.setOnClickListener(this);
primaryHolder.setOnClickListener(this);
secondaryHolder.setOnClickListener(this);
showTableSwitch.setOnCheckedChangeListener(this);
......@@ -129,15 +133,25 @@ public class CapiInstancePreferences extends AppCompatActivity
@Override
public void onClick(View v) {
if(v == primaryHolder){
selectPrimaryText();
}else if(v==secondaryHolder){
selectSecondaryText();
}else if(v==constraintOption){
selectConstraintType();
} else if(v==advancedSetting){
// showAdvancedSettingWithPassword();
startActivity(new Intent(CapiInstancePreferences.this, PreferencesActivity.class));
switch (v.getId()){
case R.id.primary_text_holder:
selectPrimaryText();
break;
case R.id.secondary_text_holder:
selectSecondaryText();
break;
case R.id.constraint_option:
selectConstraintType();
break;
case R.id.advanced_setting:
startActivity(new Intent(this, PreferencesActivity.class));
finish();
break;
case R.id.wb_peta_setting:
startActivity(new Intent(this, KonfigurasiPeta.class));
finish();
break;
}
}
......
......@@ -94,7 +94,7 @@ public final class PreferenceKeys {
hashMap.put(KEY_ANALYTICS, true);
hashMap.put(KEY_INSTANCE_SYNC, true);
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_USERNAME, "");
hashMap.put(KEY_METADATA_USERNAME, "");
......@@ -103,7 +103,7 @@ public final class PreferenceKeys {
hashMap.put(KEY_SERVER_URL, Collect.getInstance().getString(R.string.default_server_url));
hashMap.put(KEY_GOOGLE_SHEETS_URL, "");
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_CONSTRAINT_BEHAVIOR, "on_swipe");
hashMap.put(KEY_COMPLETED_DEFAULT, true);
......
......@@ -453,10 +453,12 @@ public class InstanceProvider extends ContentProvider {
InstanceColumns.DISPLAY_SUBTEXT);
sInstancesProjectionMap.put(InstanceColumns.DELETED_DATE, InstanceColumns.DELETED_DATE);
//modifikasi CAPI-STIS
sInstancesProjectionMap.put(InstanceColumns.INSTANCE_UUID, InstanceColumns.INSTANCE_UUID);
sInstancesProjectionMap.put(InstanceColumns.NOTIF_DATA_UUID, InstanceColumns.NOTIF_DATA_UUID);
sInstancesProjectionMap.put(InstanceColumns.LATEST, InstanceColumns.LATEST);
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
recyclerView.setAdapter(adapter);
setSupportActionBar(toolbar);
if (null != getSupportActionBar()){
getSupportActionBar().setTitle("Unduh Pembaruan");
getSupportActionBar().setTitle("Unduh Pengembalian");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
notifDataDao = new NotifDataDao();
cursorData = notifDataDao.getAdditinalCursor();
cursorData = notifDataDao.getNotifDataCursor();
adapter.changeCursor(cursorData);
}
......@@ -119,8 +119,8 @@ public class DataDownloadActivity extends AppCompatActivity
public void onPostDownload(boolean successDownload, NotifData notifData) {
progressDialog.dismiss();
if (successDownload)
Toast.makeText(this, "Gagal mengunduh", Toast.LENGTH_SHORT).show();
else
Toast.makeText(this, "Isian sukses diunduh", Toast.LENGTH_SHORT).show();
else
Toast.makeText(this, "Gagal mengunduh", Toast.LENGTH_SHORT).show();
}
}
......@@ -2,6 +2,7 @@ package org.odk.collect.android.revalidasi.adapter;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
......@@ -12,6 +13,8 @@ import android.widget.TextView;
import org.odk.collect.android.R;
import org.odk.collect.android.revalidasi.custom.NotifDataProviderAPI.NotifDataColumns;
import timber.log.Timber;
/**
* @author Mahendri Dwicahyo
*/
......@@ -45,7 +48,7 @@ public class DownAdapter extends RecyclerView.Adapter<DownAdapter.DownViewHolder
@Override
public void onBindViewHolder(DownAdapter.DownViewHolder holder, int position) {
if (!dataValid) throw new IllegalStateException("Cursor tidak valid");
cursor.moveToPosition(cursor.getPosition());
cursor.moveToPosition(position);
holder.setData(cursor);
}
......
......@@ -25,40 +25,49 @@ public class NotifDataDao {
String selectionArgs[] = {values.get(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID).toString(),
values.get(NotifDataProviderAPI.NotifDataColumns.LAST_UPDATE_DATE).toString()};
Cursor lebih = getAdditinalCursor(selection, selectionArgs);
Cursor lebih = getNotifDataCursor(selection, selectionArgs);
/*
* untuk menghindari isian lama yang di download tampil pada list notifikasi, maka
* isian lama tersebut harus ditandai 0 (bukan terbaru)
*/
if(lebih.getCount()==0){
lebih.close();
/*
* tandai isian yang tersimpan pada database menjadi bukan terbaru, jika data yang akan
* disimpan ternyata lebih baru
*/
String selection2 = NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID + " =? and " +
NotifDataProviderAPI.NotifDataColumns.LAST_UPDATE_DATE + " < ? ";
String selectionArgs2[] = {values.get(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID).toString(),
values.get(NotifDataProviderAPI.NotifDataColumns.LAST_UPDATE_DATE).toString()};
ContentValues valuesUpdate = new ContentValues();
valuesUpdate.put(NotifDataProviderAPI.NotifDataColumns.LATEST,"0");
valuesUpdate.put(NotifDataProviderAPI.NotifDataColumns.LATEST,NotifDataColumns.DATA_NOT_LATEST);
Collect.getInstance().getContentResolver().update(NotifDataProviderAPI.NotifDataColumns.CONTENT_URI,valuesUpdate, selection2, selectionArgs2);
if(values.containsKey(NotifDataProviderAPI.NotifDataColumns.LATEST)){
values.put(NotifDataProviderAPI.NotifDataColumns.LATEST,"1");
values.put(NotifDataProviderAPI.NotifDataColumns.LATEST, NotifDataColumns.DATA_LATEST);
}
return Collect.getInstance().getContentResolver().insert(NotifDataProviderAPI.NotifDataColumns.CONTENT_URI, values);
return Collect.getInstance().getContentResolver().insert(NotifDataColumns.CONTENT_URI, values);
}else{
lebih.close();
if(values.containsKey(NotifDataProviderAPI.NotifDataColumns.LATEST)){
values.put(NotifDataProviderAPI.NotifDataColumns.LATEST,"0");
values.put(NotifDataProviderAPI.NotifDataColumns.LATEST, NotifDataColumns.DATA_NOT_LATEST);
}
return Collect.getInstance().getContentResolver().insert(NotifDataProviderAPI.NotifDataColumns.CONTENT_URI, values);
}
}
//edit Mahendri
public Cursor getAdditinalCursor() {
public Cursor getNotifDataCursor() {
String selection = NotifDataColumns.LATEST + " =? ";
String[] selectionArgs = new String[]{String.valueOf(NotifDataColumns.IS_LATEST)};
String[] selectionArgs = new String[]{NotifDataColumns.DATA_LATEST};
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){
String selection = NotifDataProviderAPI.NotifDataColumns.NAME_INSTANCE + " LIKE ? and "
+ NotifDataProviderAPI.NotifDataColumns.LATEST+ " =? ";
......@@ -77,11 +86,11 @@ public class NotifDataDao {
}
}
public Cursor getAdditinalCursor(String sortOrder) {
public Cursor getNotifDataCursor(String 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);
}
......@@ -196,7 +205,7 @@ public class NotifDataDao {
return notifDataList;
}
public ContentValues getValuesFromAdditinalObject(NotifData notifData) {
public ContentValues getValuesFromNotifData(NotifData notifData) {
ContentValues values = new ContentValues();
values.put(NotifDataProviderAPI.NotifDataColumns.UUID, notifData.getUuid());
values.put(NotifDataProviderAPI.NotifDataColumns.INSTANCE_UUID, notifData.getInstanceuuid());
......
......@@ -249,10 +249,10 @@ public class NotifDataProvider extends ContentProvider {
static {
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "additional", ADDITIONAL);
sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "additional/#", ADDITIONAL_ID);
sUriMatcher.addURI(NotifDataProviderAPI.AUTHORITY, "notifdata", ADDITIONAL);
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(