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,10 +1906,19 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
beenSwiped = true;
if (velocityX > 0) {
if (e1.getX() > e2.getX()) {
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 {
if (getSlidingMenu().isSecondaryMenuShowing()) {
toggleRigthMenu();
beenSwiped = false;
} else {
Collect.getInstance()
.getActivityLogger()
......@@ -1914,20 +1926,31 @@ public class FormEntryActivity extends SlidingActivity implements AnimationListe
"showPrevious");
showPreviousView();
}
}
} else {
if (e1.getX() < e2.getX()) {
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 {
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();
......
......@@ -69,9 +69,6 @@ public class Collect extends Application {
+ File.separator + "capi-stis";
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_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 METADATA_PATH = ODK_ROOT + File.separator + "metadata";
public static final String TMPFILE_PATH = CACHE_PATH + File.separator + "tmp.jpg";
......@@ -81,6 +78,10 @@ public class Collect extends Application {
public static final String OFFLINE_LAYERS = ODK_ROOT + File.separator + "layers";
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";
public static final String EMPTY_INSTANCES_PATH = ODK_ROOT + File.separator + "instances" + File.separator + "empty";
private static Collect singleton = null;
......@@ -125,7 +126,7 @@ public class Collect extends Application {
}
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,
EMPTY_INSTANCES_PATH
};
......
......@@ -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);
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));
......
......@@ -17,6 +17,7 @@ import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.firebase.messaging.FirebaseMessaging;
import com.mikepenz.materialdrawer.AccountHeader;
......@@ -36,14 +37,22 @@ import org.odk.collect.android.R;
import org.odk.collect.android.activities.SplashScreenActivity;
import org.odk.collect.android.capi.fragment.CapiFormFragment;
import org.odk.collect.android.capi.preferences.CapiInstancePreferences;
import org.odk.collect.android.database.ItemsetDbAdapter;
import org.odk.collect.android.listeners.DiskSyncListener;
import org.odk.collect.android.pemutakhiran.activities.BSActivity;
import org.odk.collect.android.petawbdigital.activities.GeoPointMapboxRevoActivity;
import org.odk.collect.android.petawbdigital.assets.VAR;
import org.odk.collect.android.petawbdigital.externals.AksesDataOdk;
import org.odk.collect.android.petawbdigital.models.BlokSensus;
import org.odk.collect.android.petawbdigital.models.Form;
import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceKeys;
import org.odk.collect.android.revalidasi.activities.DataDownloadActivity;
import org.odk.collect.android.revalidasi.notifikasi.GetUuidTask;
import org.odk.collect.android.tasks.DiskSyncTask;
import java.util.ArrayList;
import timber.log.Timber;
/**
......@@ -57,6 +66,7 @@ public class CapiMainActivity extends AppCompatActivity implements DiskSyncListe
private static final int MENU_PEMUTAKHIRAN = 3;
private static final int MENUSURVEY = 4;
private static final int MENU_UPDATE = 5;
private static final int MENU_PETA_WB = 6;
private static final int MENUSETTING = 8;
private static final int MENULOGOUT = 9;
......@@ -191,10 +201,20 @@ public class CapiMainActivity extends AppCompatActivity implements DiskSyncListe
.addDrawerItems(
new PrimaryDrawerItem().withName("Pemutakhiran").withIcon(R.drawable.wb_ic_edit_bs).withIdentifier(MENU_PEMUTAKHIRAN),
new DividerDrawerItem(),
new PrimaryDrawerItem().withName("Daftar Kuesioner").withIcon(R.drawable.ic_survey).withIdentifier(MENUSURVEY),
new PrimaryDrawerItem().withName("Update Isian").withIcon(R.drawable.ic_assignment_done).withIdentifier(MENU_UPDATE),
new PrimaryDrawerItem()
.withName("Daftar Kuesioner")
.withIcon(R.drawable.ic_survey)
.withIdentifier(MENUSURVEY),
new PrimaryDrawerItem()
.withName("Isian Dikembalikan")
.withIcon(R.drawable.ic_assignment_done)
.withIdentifier(MENU_UPDATE),
new PrimaryDrawerItem()
.withName("Peta WB Digital")
.withIcon(R.drawable.wb_ic_map)
.withIdentifier(MENU_PETA_WB),
new DividerDrawerItem(),
new PrimaryDrawerItem().withName("Pengaturan CAPI").withIcon(R.drawable.ic_setting).withIdentifier(MENUSETTING),
new PrimaryDrawerItem().withName("Pengaturan").withIcon(R.drawable.ic_setting).withIdentifier(MENUSETTING),
new PrimaryDrawerItem().withName("Logout").withIcon(R.drawable.ic_logout).withIdentifier(MENULOGOUT)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
......@@ -215,6 +235,10 @@ public class CapiMainActivity extends AppCompatActivity implements DiskSyncListe
startActivity(toDownUpdate);
break;
case MENU_PETA_WB:
showModal();
break;
case MENULOGOUT:
AlertDialog.Builder builder = new AlertDialog.Builder(CapiMainActivity.this);
builder.setMessage("Are you sure to logout?");
......@@ -240,4 +264,83 @@ public class CapiMainActivity extends AppCompatActivity implements DiskSyncListe
result = builder.build();
result.setSelection(MENUSURVEY);
}
private void showModal() {
final ArrayList<BlokSensus> listBs = ItemsetDbAdapter.getInstance(this).getListBlokSensus();
if (listBs != null && listBs.size() > 0) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
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(CapiMainActivity.this)
.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(CapiMainActivity.this, 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(this, "Belum ada data blok sensus", Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
......@@ -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){
switch (v.getId()){
case R.id.primary_text_holder:
selectPrimaryText();
}else if(v==secondaryHolder){
break;
case R.id.secondary_text_holder:
selectSecondaryText();
}else if(v==constraintOption){
break;
case R.id.constraint_option:
selectConstraintType();
} else if(v==advancedSetting){
// showAdvancedSettingWithPassword();
startActivity(new Intent(CapiInstancePreferences.this, PreferencesActivity.class));
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);