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. ...@@ -347,7 +347,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 android:name=".revalidasi.notifikasi.MyFirebaseMessagingService"> <service 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;
......
...@@ -46,7 +46,6 @@ public class SplashScreenActivity extends AppCompatActivity { ...@@ -46,7 +46,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) {
...@@ -54,8 +53,6 @@ public class SplashScreenActivity extends AppCompatActivity { ...@@ -54,8 +53,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();
......
...@@ -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();
......
...@@ -38,7 +38,6 @@ import timber.log.Timber; ...@@ -38,7 +38,6 @@ import timber.log.Timber;
public class CapiLoginActivity extends AppCompatActivity public class CapiLoginActivity extends AppCompatActivity
implements View.OnClickListener, GetUuidTask.LoginListener { implements View.OnClickListener, GetUuidTask.LoginListener {
private TextView serverText;
private Button loginBtn; private Button loginBtn;
private EditText username, password; private EditText username, password;
private GetUuidTask loginTask; private GetUuidTask loginTask;
...@@ -49,7 +48,7 @@ public class CapiLoginActivity extends AppCompatActivity ...@@ -49,7 +48,7 @@ public class CapiLoginActivity extends AppCompatActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.capi_activity_login); 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); loginBtn = (Button) findViewById(R.id.btn_login);
username = (EditText) findViewById(R.id.username); username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password); password = (EditText) findViewById(R.id.password);
...@@ -92,14 +91,20 @@ public class CapiLoginActivity extends AppCompatActivity ...@@ -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.setText("Proses login");
loginBtn.setBackgroundColor(Color.GRAY); loginBtn.setBackgroundColor(Color.GRAY);
//create dialog
dialog = new ProgressDialog(this); dialog = new ProgressDialog(this);
dialog.setMessage("Login, mohon tunggu. . ."); dialog.setMessage("Login, mohon tunggu. . .");
dialog.setIndeterminate(true); dialog.setIndeterminate(true);
dialog.setCancelable(false); dialog.setCancelable(false);
dialog.show(); dialog.show();
//execute login task
loginTask = new GetUuidTask(this); loginTask = new GetUuidTask(this);
loginTask.execute(username, password); loginTask.execute(username, password);
} }
...@@ -157,6 +162,7 @@ public class CapiLoginActivity extends AppCompatActivity ...@@ -157,6 +162,7 @@ public class CapiLoginActivity extends AppCompatActivity
private void onLoginSucceed() { private void onLoginSucceed() {
dialog.dismiss(); dialog.dismiss();
loginBtn.setClickable(true);
loginBtn.setText("LOGIN"); loginBtn.setText("LOGIN");
loginBtn.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); loginBtn.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
......
...@@ -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");
......
...@@ -4,7 +4,6 @@ import android.app.ProgressDialog; ...@@ -4,7 +4,6 @@ import android.app.ProgressDialog;
import android.content.ContentValues; import android.content.ContentValues;
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;
...@@ -324,13 +323,6 @@ public class CapiFormFragment extends Fragment ...@@ -324,13 +323,6 @@ public class CapiFormFragment extends Fragment
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { 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: case R.id.action_sort:
//show dialog sort //show dialog sort
showDialogSortOptions(); showDialogSortOptions();
...@@ -339,91 +331,10 @@ public class CapiFormFragment extends Fragment ...@@ -339,91 +331,10 @@ public class CapiFormFragment extends Fragment
Toast.makeText(getContext(), "Refreshing..", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Refreshing..", Toast.LENGTH_SHORT).show();
onRefresPage(); onRefresPage();
break; break;
case R.id.action_setting_map:
startActivity(new Intent(getActivity(), KonfigurasiPeta.class));
break;
} }
return super.onOptionsItemSelected(item); 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() { private void showDialogSortOptions() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Sort Options"); builder.setTitle("Sort Options");
...@@ -559,6 +470,7 @@ public class CapiFormFragment extends Fragment ...@@ -559,6 +470,7 @@ public class CapiFormFragment extends Fragment
* Called when the form list has finished downloading. results will either contain a set of * 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. * <formname, formdetails> tuples, or one tuple of DL.ERROR.MSG and the associated message.
*/ */
@Override
public void formListDownloadingComplete(HashMap<String, FormDetails> result) { public void formListDownloadingComplete(HashMap<String, FormDetails> result) {
downloadFormListTask.setDownloaderListener(null); downloadFormListTask.setDownloaderListener(null);
downloadFormListTask = null; downloadFormListTask = null;
......
...@@ -21,6 +21,7 @@ import android.widget.Toast; ...@@ -21,6 +21,7 @@ import android.widget.Toast;
import org.odk.collect.android.R; import org.odk.collect.android.R;
import org.odk.collect.android.capi.ParseXml; import org.odk.collect.android.capi.ParseXml;
import org.odk.collect.android.dao.FormsDao; 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.PreferenceKeys;
import org.odk.collect.android.preferences.PreferencesActivity; import org.odk.collect.android.preferences.PreferencesActivity;
import org.odk.collect.android.provider.FormsProviderAPI; import org.odk.collect.android.provider.FormsProviderAPI;
...@@ -34,7 +35,8 @@ public class CapiInstancePreferences extends AppCompatActivity ...@@ -34,7 +35,8 @@ public class CapiInstancePreferences extends AppCompatActivity
private LinearLayout primaryHolder; private LinearLayout primaryHolder;
private LinearLayout secondaryHolder; private LinearLayout secondaryHolder;
private LinearLayout constraintOption; private LinearLayout constraintOption;
private LinearLayout advancedSetting; private TextView advancedSetting;
private TextView petaWbSetting;
private TextView primaryTextSummary, secondaryTextSummary, constraintValue; private TextView primaryTextSummary, secondaryTextSummary, constraintValue;
private Switch showTableSwitch, showGroupInOneScreenSwitch; private Switch showTableSwitch, showGroupInOneScreenSwitch;
private String formIds = ""; private String formIds = "";
...@@ -62,7 +64,7 @@ public class CapiInstancePreferences extends AppCompatActivity ...@@ -62,7 +64,7 @@ public class CapiInstancePreferences extends AppCompatActivity
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.collectiva_activity_preferences); setContentView(R.layout.capi_activity_preferences);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setTitle("Quick Preferences"); getSupportActionBar().setTitle("Quick Preferences");
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
...@@ -74,7 +76,8 @@ public class CapiInstancePreferences extends AppCompatActivity ...@@ -74,7 +76,8 @@ public class CapiInstancePreferences extends AppCompatActivity
secondaryTextSummary = (TextView) findViewById(R.id.secondary_text_summary); secondaryTextSummary = (TextView) findViewById(R.id.secondary_text_summary);
showTableSwitch = (Switch) findViewById(R.id.switch_show_table); showTableSwitch = (Switch) findViewById(R.id.switch_show_table);
showGroupInOneScreenSwitch = (Switch) findViewById(R.id.switch_show_onscreen); 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); constraintOption = (LinearLayout) findViewById(R.id.constraint_option);
constraintValue = (TextView) findViewById(R.id.constraint_value); constraintValue = (TextView) findViewById(R.id.constraint_value);
...@@ -91,6 +94,7 @@ public class CapiInstancePreferences extends AppCompatActivity ...@@ -91,6 +94,7 @@ public class CapiInstancePreferences extends AppCompatActivity
constraintOption.setOnClickListener(this); constraintOption.setOnClickListener(this);
advancedSetting.setOnClickListener(this); advancedSetting.setOnClickListener(this);
petaWbSetting.setOnClickListener(this);
primaryHolder.setOnClickListener(this); primaryHolder.setOnClickListener(this);
secondaryHolder.setOnClickListener(this); secondaryHolder.setOnClickListener(this);
showTableSwitch.setOnCheckedChangeListener(this); showTableSwitch.setOnCheckedChangeListener(this);
...@@ -129,15 +133,25 @@ public class CapiInstancePreferences extends AppCompatActivity ...@@ -129,15 +133,25 @@ public class CapiInstancePreferences extends AppCompatActivity
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if(v == primaryHolder){ switch (v.getId()){
selectPrimaryText(); case R.id.primary_text_holder:
}else if(v==secondaryHolder){ selectPrimaryText();
selectSecondaryText(); break;
}else if(v==constraintOption){ case R.id.secondary_text_holder:
selectConstraintType(); selectSecondaryText();
} else if(v==advancedSetting){ break;
// showAdvancedSettingWithPassword(); case R.id.constraint_option:
startActivity(new Intent(CapiInstancePreferences.this, PreferencesActivity.class)); 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 { ...@@ -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);
......