Commit 2191f420 authored by rahadi's avatar rahadi

Added Pemutakhiran Module

parent 5f5f24a5
......@@ -2,13 +2,14 @@ apply plugin: 'com.android.application'
apply from: '../config/quality.gradle'
import com.android.ddmlib.DdmPreferences
DdmPreferences.setTimeOut(60000)
ant.condition(property: 'os', value: 'windows') {
os(family: 'windows')
os(family: 'windows')
}
ant.condition(property: 'os', value: 'unix') {
os(family: 'unix')
ant.condition(property: 'os', value: 'unix') {
os(family: 'unix')
}
// Build numbers were manually set until 1067
......@@ -62,13 +63,13 @@ if (secretsFile.exists()) {
}
android {
compileSdkVersion(25)
compileSdkVersion(26)
buildToolsVersion('26.0.2')
defaultConfig {
applicationId('org.odk.collect.android')
minSdkVersion(16)
targetSdkVersion(25)
targetSdkVersion(26)
versionCode LEGACY_BUILD_NUMBER_OFFSET + getMasterCommitCount()
versionName getVersionName()
testInstrumentationRunner('android.support.test.runner.AndroidJUnitRunner')
......@@ -143,15 +144,15 @@ allprojects {
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile group: 'com.android.support', name: 'appcompat-v7', version: '25.3.1'
compile group: 'com.android.support', name: 'design', version: '25.3.1'
compile group: 'com.android.support', name: 'cardview-v7', version: '25.3.1'
compile group: 'com.android.support', name: 'appcompat-v7', version: '26.1.0'
compile group: 'com.android.support', name: 'design', version: '26.1.0'
compile group: 'com.android.support', name: 'cardview-v7', version: '26.1.0'
compile group: 'com.android.support', name: 'multidex', version: '1.0.1'
compile group: 'com.google.android.gms', name: 'play-services-analytics', version: '10.0.1'
compile group: 'com.google.android.gms', name: 'play-services-auth', version: '10.0.1'
compile group: 'com.google.android.gms', name: 'play-services-maps', version: '10.0.1'
compile group: 'com.google.android.gms', name: 'play-services-location', version: '10.0.1'
compile (group: 'com.google.code.gson', name: 'gson', version: '2.6.2' ){
compile(group: 'com.google.code.gson', name: 'gson', version: '2.6.2') {
exclude group: 'org.apache.httpcomponents'
}
compile group: 'com.google.firebase', name: 'firebase-core', version: '10.0.1'
......@@ -166,18 +167,24 @@ dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
compile group: 'net.sf.opencsv', name: 'opencsv', version: '2.3'
compile (group: 'org.opendatakit', name: 'opendatakit-javarosa', version: '2.6.1') {
compile(group: 'org.opendatakit', name: 'opendatakit-javarosa', version: '2.6.1') {
exclude module: 'joda-time'
}
compile group: 'org.osmdroid', name: 'osmdroid-android', version: '5.6.4'
compile group: 'org.slf4j', name: 'slf4j-android', version: '1.6.1-RC1'
compile group: 'pub.devrel', name: 'easypermissions', version: '0.2.1'
compile(group: 'com.google.api-client', name: 'google-api-client-android', version: '1.22.0') { exclude group: 'org.apache.httpcomponents' }
compile(group: 'com.google.apis', name: 'google-api-services-drive', version: 'v3-rev64-1.22.0') { exclude group: 'org.apache.httpcomponents' }
compile(group: 'com.google.apis', name: 'google-api-services-sheets', version: 'v4-rev463-1.22.0') { exclude group: 'org.apache.httpcomponents' }
compile(group: 'com.google.api-client', name: 'google-api-client-android', version: '1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile(group: 'com.google.apis', name: 'google-api-services-drive', version: 'v3-rev64-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile(group: 'com.google.apis', name: 'google-api-services-sheets', version: 'v4-rev463-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile group: 'com.jakewharton.timber', name: 'timber', version: '4.5.1'
compile group: 'com.android.support', name: 'customtabs', version: '25.3.1'
compile group: 'com.android.support', name: 'support-v13', version: '25.3.1'
compile group: 'com.android.support', name: 'customtabs', version: '26.1.0'
compile group: 'com.android.support', name: 'support-v13', version: '26.1.0'
compile group: 'com.google.zxing', name: 'core', version: '3.2.0'
compile group: 'com.journeyapps', name: 'zxing-android-embedded', version: '3.5.0'
compile group: 'net.danlew', name: 'android.joda', version: '2.9.9'
......@@ -202,7 +209,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestCompile(group: 'com.android.support.test.espresso', name: 'espresso-intents', version: '3.0.1') {
androidTestCompile(group: 'com.android.support.test.espresso', name: 'espresso-intents', version: '3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
......@@ -218,10 +225,11 @@ dependencies {
transitive = true
}
compile project(':slidingmenu')
compile project(':vsen_p')
compile 'org.apache.commons:commons-lang3:3.6'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.1.2'
......
......@@ -40,14 +40,16 @@ the specific language governing permissions and limitations under the License.
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<!-- Get permission for reliable local dispatching on non-Google Play devices. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus"
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature android:name="android.hardware.screen.portrait"
<uses-feature
android:name="android.hardware.screen.portrait"
android:required="false" />
<uses-feature
......@@ -124,8 +126,8 @@ the specific language governing permissions and limitations under the License.
android:taskAffinity="" />
<activity
android:name=".activities.DrawActivity"
android:screenOrientation="landscape"
android:label="@string/app_name" />
android:label="@string/app_name"
android:screenOrientation="landscape" />
<activity
android:name=".activities.OpenSourceLicensesActivity"
android:label="@string/all_open_source_licenses" />
......@@ -137,7 +139,7 @@ the specific language governing permissions and limitations under the License.
<activity
android:name=".activities.InstanceChooserList"
android:label="@string/app_name"
android:theme="@style/AppTheme.WithActionBar" >
android:theme="@style/AppTheme.WithActionBar">
<intent-filter android:scheme="http">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
......@@ -253,6 +255,7 @@ the specific language governing permissions and limitations under the License.
</activity>
<activity android:name=".activities.CaptureSelfieActivity" />
<activity android:name=".activities.CaptureSelfieActivityNewApi" />
<receiver
android:name=".receivers.NetworkReceiver"
android:enabled="true">
......@@ -293,21 +296,23 @@ the specific language governing permissions and limitations under the License.
android:required="false" />
<activity android:name=".activities.PermissionActivity" />
<!-- tambahan untuk CAPI-STIS -->
<provider
android:authorities="org.odk.collect.android.capi.CapiFileProvider"
android:name=".capi.CapiFileProvider"
android:authorities="org.odk.collect.android.capi.CapiFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/capi_file_paths" />
</provider>
<activity android:name=".capi.activity.CapiLoginActivity" />
<activity android:name=".capi.activity.CapiMainActivity"
android:launchMode="singleTop"/>
<activity
android:name=".capi.activity.CapiMainActivity"
android:launchMode="singleTop" />
<activity android:name=".capi.activity.CapiInstanceActivity">
<meta-data
android:name="android.app.searchable"
......@@ -322,43 +327,55 @@ the specific language governing permissions and limitations under the License.
<activity
android:name=".petawbdigital.activities.SettingTampilan"
android:label="Pengaturan Tampilan"
android:theme="@style/AppTheme"/>
android:theme="@style/VsenAppTheme" />
<activity
android:name=".petawbdigital.activities.PanduanActivity"
android:label="Penjelasan Fitur"
android:theme="@style/AppTheme"/>
android:theme="@style/VsenAppTheme" />
<activity
android:name=".petawbdigital.activities.ItemPanduanActivity"
android:label="Penjelasan Detail"
android:theme="@style/AppTheme"/>
android:theme="@style/VsenAppTheme" />
<activity
android:name=".petawbdigital.activities.KonfigurasiPeta"
android:label="Konfigurasi Peta"
android:theme="@style/AppTheme"/>
android:theme="@style/VsenAppTheme" />
<activity
android:name=".activities.GeoPointMapboxActivity"
android:label="Get Location"
android:theme="@style/AppTheme.WithCompatActionBar"/>
android:theme="@style/AppTheme.WithCompatActionBar" />
<provider
android:name=".revalidasi.custom.NotifDataProvider"
android:authorities="org.odk.collect.android.provider.odk.briefdata"
android:exported="false" />
<service
android:name=".revalidasi.notifikasi.MyFirebaseMessagingService">
<service android:name=".revalidasi.notifikasi.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".revalidasi.notifikasi.MyFirebaseInstanceIDService">
<service android:name=".revalidasi.notifikasi.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<activity android:name=".revalidasi.activities.DataDownloadActivity"
<activity
android:name=".revalidasi.activities.DataDownloadActivity"
android:label="Unduh Isian"
android:parentActivityName=".capi.activity.CapiMainActivity"/>
android:parentActivityName=".capi.activity.CapiMainActivity" />
<activity
android:name=".pemutakhiran.BlokSensusActivity"
android:theme="@style/VsenAppTheme" />
<activity
android:name=".pemutakhiran.RutaActivity"
android:theme="@style/VsenAppTheme" />
<activity
android:name=".pemutakhiran.DsrtActivity"
android:theme="@style/VsenAppTheme" />
</application>
......
......@@ -26,7 +26,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
......@@ -35,7 +34,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
......@@ -423,7 +421,7 @@ public class MainMenuActivity extends AppCompatActivity {
.logAction(this, "onCreateOptionsMenu", "show");
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.main_menu, menu);
getMenuInflater().inflate(R.menu.vsen_main_menu, menu);
return true;
}
......
......@@ -16,54 +16,29 @@ package org.odk.collect.android.activities;
import android.Manifest;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Window;
import android.widget.Toast;
import org.javarosa.core.services.IPropertyManager;
import org.javarosa.core.services.properties.IPropertyRules;
import com.rahadi.vsen.samples.BlokSensusSampleActivity;
import org.odk.collect.android.BuildConfig;
import org.odk.collect.android.R;
import org.odk.collect.android.application.Collect;
import org.odk.collect.android.capi.preferences.Constants;
import org.odk.collect.android.capi.preferences.CapiInstancePreferences;
import org.odk.collect.android.capi.activity.CapiMainActivity;
import org.odk.collect.android.capi.activity.CapiLoginActivity;
import org.odk.collect.android.database.ActivityLogger;
import org.odk.collect.android.logic.FormController;
import org.odk.collect.android.logic.PropertyManager;
import org.odk.collect.android.capi.preferences.CapiInstancePreferences;
import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceKeys;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import timber.log.Timber;
import static org.odk.collect.android.preferences.PreferenceKeys.KEY_METADATA_EMAIL;
import static org.odk.collect.android.preferences.PreferenceKeys.KEY_METADATA_PHONENUMBER;
import static org.odk.collect.android.preferences.PreferenceKeys.KEY_METADATA_USERGROUP;
import static org.odk.collect.android.preferences.PreferenceKeys.KEY_METADATA_USERNAME;
/**
* edit Muhammad Tohir
* edit Mahendri Dwicahyo
......@@ -80,7 +55,7 @@ public class SplashScreenActivity extends AppCompatActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash_screen);
collectPreferences = getSharedPreferences(CapiInstancePreferences.COLLECTIVA_PREFERENCES_KEY,MODE_PRIVATE);
collectPreferences = getSharedPreferences(CapiInstancePreferences.COLLECTIVA_PREFERENCES_KEY, MODE_PRIVATE);
// get the shared preferences object
preferences = GeneralSharedPreferences.getInstance();
......@@ -106,7 +81,8 @@ public class SplashScreenActivity extends AppCompatActivity {
}
if (preferences.getBoolean(PreferenceKeys.KEY_LOGIN_STATUS, false)) {
startActivity(new Intent(this, CapiMainActivity.class));
// startActivity(new Intent(this, CapiMainActivity.class));
startActivity(new Intent(this, BlokSensusSampleActivity.class));
} else {
startActivity(new Intent(this, CapiLoginActivity.class));
}
......@@ -115,14 +91,14 @@ public class SplashScreenActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode){
switch (requestCode) {
case 1:
boolean allGranted = true;
for (int grantResult : grantResults) {
if (grantResult != PackageManager.PERMISSION_GRANTED) allGranted = false;
}
if(allGranted){
if (allGranted) {
endSplashScreen();
} else {
AlertDialog dialog = new AlertDialog.Builder(this)
......@@ -138,7 +114,7 @@ public class SplashScreenActivity extends AppCompatActivity {
}
private void requestPermission() {
Log.d("DEBUGCOLL","request permission");
Log.d("DEBUGCOLL", "request permission");
ActivityCompat.requestPermissions(this,
new String[]{
Manifest.permission.READ_PHONE_STATE,
......@@ -148,10 +124,10 @@ public class SplashScreenActivity extends AppCompatActivity {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA
},1);
}, 1);
}
private boolean isAllPermissionGranted(){
private boolean isAllPermissionGranted() {
return !(ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(this, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED ||
......@@ -166,10 +142,10 @@ public class SplashScreenActivity extends AppCompatActivity {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if(isAllPermissionGranted()) endSplashScreen();
if (isAllPermissionGranted()) endSplashScreen();
else requestPermission();
}
},1000);
}, 1000);
}
private void createErrorDialog(String errorMsg, final boolean shouldExit) {
......
......@@ -29,6 +29,7 @@ import android.view.inputmethod.InputMethodManager;
import com.google.android.gms.analytics.Tracker;
import com.google.firebase.crash.FirebaseCrash;
import com.rahadi.vsen.contexts.Vsen;
import org.odk.collect.android.BuildConfig;
import org.odk.collect.android.R;
......@@ -256,6 +257,8 @@ public class Collect extends Application {
} else {
Timber.plant(new CrashReportingTree());
}
Vsen.plant(this);
}
//edit CAPI karena versi ODK tidak target Nougat, permission belum dilakukan saat runtime
......
package org.odk.collect.android.capi.activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.rahadi.vsen.samples.BlokSensusSampleActivity;
import org.odk.collect.android.R;
import org.odk.collect.android.application.Collect;
import org.odk.collect.android.capi.preferences.CapiInstancePreferences;
import org.odk.collect.android.capi.Helper;
import org.odk.collect.android.capi.ModelResponse;
import org.odk.collect.android.capi.preferences.Constants;
import org.odk.collect.android.pemutakhiran.BlokSensusActivity;
import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceKeys;
import org.odk.collect.android.preferences.PreferencesActivity;
import org.odk.collect.android.revalidasi.notifikasi.ConfigKey;
import org.odk.collect.android.revalidasi.notifikasi.GetUuidTask;
import org.odk.collect.android.utilities.WebUtils;
import java.util.Map;
/**
* @author Mahendri Dwicahyo
......@@ -70,19 +60,20 @@ public class CapiLoginActivity extends AppCompatActivity
@Override
public void onClick(View v) {
switch (v.getId()){
switch (v.getId()) {
case R.id.btn_login:
if(TextUtils.isEmpty(username.getText().toString())){
Toast.makeText(this, "Username can't be empty", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(password.getText().toString())){
Toast.makeText(this, "Pasword can't be empty", Toast.LENGTH_SHORT).show();
return;
}
login(username.getText().toString(), password.getText().toString());
// if (TextUtils.isEmpty(username.getText().toString())) {
// Toast.makeText(this, "Username can't be empty", Toast.LENGTH_SHORT).show();
// return;
// }
// if (TextUtils.isEmpty(password.getText().toString())) {
// Toast.makeText(this, "Password can't be empty", Toast.LENGTH_SHORT).show();
// return;
// }
//
// login(username.getText().toString(), password.getText().toString());
startActivity(new Intent(this, BlokSensusActivity.class));
break;
case R.id.server_config_text:
......@@ -91,7 +82,7 @@ public class CapiLoginActivity extends AppCompatActivity
}
}
public void login(final String username, final String password){
public void login(final String username, final String password) {
loginBtn.setText("Proses login");
loginBtn.setBackgroundColor(Color.GRAY);
dialog = new ProgressDialog(this);
......@@ -108,7 +99,7 @@ public class CapiLoginActivity extends AppCompatActivity
dialog.dismiss();
loginBtn.setText("LOGIN");
loginBtn.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
if (ConfigKey.LOGIN_SUCCESS.equals(result)){
if (ConfigKey.LOGIN_SUCCESS.equals(result)) {
GeneralSharedPreferences.getInstance().save(PreferenceKeys.KEY_LOGIN_STATUS, true);
Intent toMain = new Intent(this, CapiMainActivity.class);
startActivity(toMain);
......@@ -123,4 +114,9 @@ public class CapiLoginActivity extends AppCompatActivity
.show();
}
}
@Override
public void loginProgressUpdate(String status) {
dialog.setMessage(status);
}
}
\ No newline at end of file
package org.odk.collect.android.pemutakhiran;
import android.os.Bundle;
import com.rahadi.vsen.activities.BlokSensusImpActivity;
/**
* Created by Rahadi on 27/01/2018.
*/
public class BlokSensusActivity extends BlokSensusImpActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public Class getDsrtActivityClass() {
return DsrtActivity.class;
}
@Override
public Class getRutaActivityClass() {
return RutaActivity.class;
}
}
package org.odk.collect.android.pemutakhiran;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import com.rahadi.vsen.activities.DsrtImpActivity;
import com.rahadi.vsen.models.DsrtModel;
/**
* Created by Rahadi on 27/01/2018.
*/
public class DsrtActivity extends DsrtImpActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onDsrtActionButtonClick(View v, DsrtModel model, String mode, boolean isPml) {
}
}
package org.odk.collect.android.pemutakhiran;
import android.os.Bundle;
import android.view.MenuItem;
import com.rahadi.vsen.activities.RutaImpActivity;
/**
* Created by Rahadi on 27/01/2018.
*/
public class RutaActivity extends RutaImpActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
......@@ -43,7 +43,7 @@ public class AdminPreferencesFragment extends BasePreferenceFragment implements