Firebase implemented, loggin improved and trying to avoid all kind of NPE
This commit is contained in:
15
.idea/misc.xml
generated
15
.idea/misc.xml
generated
@@ -1,8 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
@@ -27,17 +24,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
13
app/app.iml
13
app/app.iml
@@ -120,8 +120,10 @@
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-crash-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:appcompat-v7-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.code.gson:gson:2.8.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-auth-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:design-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-iid-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-gcm-license-11.8.0" level="project" />
|
||||
@@ -138,10 +140,9 @@
|
||||
<orderEntry type="library" name="com.mikepenz:materialize-1.1.2" level="project" />
|
||||
<orderEntry type="library" name="com.mikepenz:fastadapter-extensions-expandable-3.2.4" level="project" />
|
||||
<orderEntry type="library" name="com.mikepenz:google-material-typeface-3.0.1.2.original" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:customtabs-27.0.2" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-plus-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-iid-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:cardview-v7-27.0.2" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-appindexing-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.twitter.sdk.android:twitter-core-1.4.1" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-ads-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-basement-11.8.0" level="project" />
|
||||
@@ -157,6 +158,7 @@
|
||||
<orderEntry type="library" name="com.google.zxing:core:3.3.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-ads-lite-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.facebook.android:facebook-share-4.31.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-auth-api-phone-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.mikepenz:fastadapter-3.2.4" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-base-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-analytics-impl-11.8.0" level="project" />
|
||||
@@ -168,12 +170,14 @@
|
||||
<orderEntry type="library" name="com.mcxiaoke.volley:library:1.0.19@jar" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-core-utils-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="android.arch.core:common:1.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-auth-api-phone-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-annotations:27.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-gass-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.parse.bolts:bolts-applinks:1.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-maps-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-analytics-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.beardedhen:androidbootstrap-2.3.2" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:customtabs-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-ads-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.facebook.android:facebook-android-sdk-4.31.0" level="project" />
|
||||
<orderEntry type="library" name="com.facebook.android:facebook-places-4.31.0" level="project" />
|
||||
@@ -181,15 +185,20 @@
|
||||
<orderEntry type="library" name="com.android.support:support-vector-drawable-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.facebook.android:facebook-login-4.31.0" level="project" />
|
||||
<orderEntry type="library" name="android.arch.lifecycle:common:1.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:cardview-v7-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-maps-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.parse.bolts:bolts-android:1.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-compat-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-core-ui-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-auth-base-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-auth-base-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="android.arch.lifecycle:livedata-core-1.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-location-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-media-compat-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-crash-license-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-gass-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.android.support:support-fragment-27.1.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-appindexing-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.android.gms:play-services-gcm-11.8.0" level="project" />
|
||||
<orderEntry type="library" name="com.google.maps.android:android-maps-utils-0.5" level="project" />
|
||||
<orderEntry type="library" name="com.google.firebase:firebase-analytics-license-11.8.0" level="project" />
|
||||
|
||||
@@ -9,8 +9,8 @@ android {
|
||||
applicationId "org.deke.risk.riskahead"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 43
|
||||
versionName "3.1"
|
||||
versionCode 44
|
||||
versionName "3.1.1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -35,6 +35,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.firebase:firebase-crash:11.8.0'
|
||||
implementation 'com.google.firebase:firebase-core:11.8.0'
|
||||
implementation 'com.google.firebase:firebase-appindexing:11.8.0'
|
||||
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
|
||||
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
|
||||
compile('com.twitter.sdk.android:twitter-core:1.4.1@aar') {
|
||||
@@ -48,10 +51,13 @@ dependencies {
|
||||
transitive = true
|
||||
}
|
||||
|
||||
implementation 'com.android.support:customtabs:27.1.0'
|
||||
implementation 'com.android.support:cardview-v7:27.1.0'
|
||||
compile 'com.android.support:appcompat-v7:27.1.0'
|
||||
compile 'com.android.support:support-v4:27.1.0'
|
||||
compile 'com.android.support:design:27.1.0'
|
||||
|
||||
compile 'com.google.android.gms:play-services-auth:11.8.0'
|
||||
compile 'com.google.android.gms:play-services-gcm:11.8.0'
|
||||
compile 'com.google.android.gms:play-services-plus:11.8.0'
|
||||
compile 'com.google.android.gms:play-services-location:11.8.0'
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":43},"path":"app-release.apk","properties":{"packageId":"org.deke.risk.riskahead","split":"","minSdkVersion":"15"}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":44},"path":"app-release.apk","properties":{"packageId":"org.deke.risk.riskahead","split":"","minSdkVersion":"15"}}]
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="org.deke.risk.riskahead.permission.MAPS_RECEIVE" />
|
||||
@@ -30,6 +29,9 @@
|
||||
android:theme="@style/MyRiskAheadTheme">
|
||||
|
||||
<!-- Google Maps Fragment API Key Data -->
|
||||
<meta-data
|
||||
android:name="asset_statements"
|
||||
android:resource="@string/asset_statements" />
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -56,7 +57,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity implements FacebookButtonFragment.OnFragmentInteractionListener, GooglePlusButtonFragment.OnFragmentInteractionListener, TwitterButtonFragment.OnFragmentInteractionListener{
|
||||
|
||||
private final static String TAG = LoginActivity.class.getSimpleName();
|
||||
|
||||
private TextView input_email;
|
||||
@@ -99,8 +99,15 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
|
||||
public void isNetworkAvailable() {
|
||||
NetworkInfo activeNetworkInfo = null;
|
||||
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
if(connectivityManager != null){
|
||||
activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get connectivityManager");
|
||||
}
|
||||
|
||||
if(activeNetworkInfo == null){
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(getString(R.string.alert_internetconnection_title))
|
||||
@@ -136,15 +143,15 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
private void initLoginView() {
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
input_email = (TextView) findViewById(R.id.input_register_email);
|
||||
inputLayoutEmail = (TextInputLayout) findViewById(R.id.input_layout_email);
|
||||
input_email = findViewById(R.id.input_register_email);
|
||||
inputLayoutEmail = findViewById(R.id.input_layout_email);
|
||||
|
||||
input_password = (TextView) findViewById(R.id.input_register_password);
|
||||
inputLayoutPassword = (TextInputLayout) findViewById(R.id.input_layout_password);
|
||||
input_password = findViewById(R.id.input_register_password);
|
||||
inputLayoutPassword = findViewById(R.id.input_layout_password);
|
||||
|
||||
TextView btn_requestPW = (TextView) findViewById(R.id.lbl_login_resendPW);
|
||||
TextView btn_requestPW = findViewById(R.id.lbl_login_resendPW);
|
||||
|
||||
BootstrapButton btn_gotoregistration = (BootstrapButton) findViewById(R.id.btn_switchtoregistration);
|
||||
BootstrapButton btn_gotoregistration = findViewById(R.id.btn_switchtoregistration);
|
||||
btn_gotoregistration.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -152,7 +159,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
});
|
||||
|
||||
BootstrapButton btn_login = (BootstrapButton) findViewById(R.id.btn_login);
|
||||
BootstrapButton btn_login = findViewById(R.id.btn_login);
|
||||
btn_login.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -202,14 +209,14 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
private void initRegisterView() {
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
input_username = (TextView) findViewById(R.id.input_register_name);
|
||||
final TextInputLayout inputLayoutUsername = (TextInputLayout) findViewById(R.id.input_layout_username);
|
||||
input_email = (TextView) findViewById(R.id.input_register_email);
|
||||
final TextInputLayout inputLayoutEmail = (TextInputLayout) findViewById(R.id.input_layout_email);
|
||||
input_password = (TextView) findViewById(R.id.input_register_password);
|
||||
final TextInputLayout inputLayoutPassword = (TextInputLayout) findViewById(R.id.input_layout_password);
|
||||
BootstrapButton btn_login = (BootstrapButton) findViewById(R.id.btn_register);
|
||||
TextView btn_switchtologin = (TextView) findViewById(R.id.lbl_register_switchtologin);
|
||||
input_username = findViewById(R.id.input_register_name);
|
||||
final TextInputLayout inputLayoutUsername = findViewById(R.id.input_layout_username);
|
||||
input_email = findViewById(R.id.input_register_email);
|
||||
final TextInputLayout inputLayoutEmail = findViewById(R.id.input_layout_email);
|
||||
input_password = findViewById(R.id.input_register_password);
|
||||
final TextInputLayout inputLayoutPassword = findViewById(R.id.input_layout_password);
|
||||
BootstrapButton btn_login = findViewById(R.id.btn_register);
|
||||
TextView btn_switchtologin = findViewById(R.id.lbl_register_switchtologin);
|
||||
|
||||
input_username.addTextChangedListener(new TextValidator(input_username, inputLayoutUsername, getApplicationContext()) {
|
||||
@Override
|
||||
@@ -302,7 +309,8 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@@ -357,7 +365,8 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@@ -375,7 +384,8 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
try {
|
||||
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
params.put("version", Integer.toString(versionCode));
|
||||
@@ -549,11 +559,12 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
finish();
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error at social media login (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error at social media login (Server returned error): " + errorMsg);
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login)+getResources().getString(R.string.txt_errormsg_suffix), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -561,7 +572,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Social Media Login Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Social Media Login Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login)+getResources().getString(R.string.txt_errormsg_suffix), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
}
|
||||
@@ -655,18 +666,19 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error at login (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error at login (Server returned error): " + errorMsg);
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Login Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Login Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
}
|
||||
@@ -706,18 +718,19 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error occured: "+errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Registration Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -755,18 +768,19 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error occured: "+errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Registration Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -919,12 +933,13 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
showMessage(getString(R.string.alert_passwordreset_confirmation));
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Reset PW returned error value: "+errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Reset PW returned error value: "+errorMsg);
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_getpwreset), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -932,7 +947,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "E-Mail pw resend Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "E-Mail pw resend Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_getpwreset), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -962,12 +977,13 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
boolean error = jObj.getBoolean("error");
|
||||
if (error) {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG,"Resend E-Mail returned error value: "+errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG,"Resend E-Mail returned error value: "+errorMsg);
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_getactivationlink) + ":"+errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -975,7 +991,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "E-Mail pw resend error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "E-Mail pw resend error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_getactivationlink), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -1021,18 +1037,19 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
.show();
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error occured: "+errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Registration Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -1098,7 +1115,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Log.d(TAG, "testest");
|
||||
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
||||
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnGP);
|
||||
fragment.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.TileOverlay;
|
||||
import com.google.android.gms.maps.model.TileOverlayOptions;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.google.maps.android.clustering.Cluster;
|
||||
import com.google.maps.android.clustering.ClusterManager;
|
||||
import com.google.maps.android.heatmaps.HeatmapTileProvider;
|
||||
@@ -215,7 +216,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
||||
}
|
||||
|
||||
addButton = (FloatingActionButton) findViewById(R.id.fab_reportwf_map);
|
||||
addButton = findViewById(R.id.fab_reportwf_map);
|
||||
addButton.setVisibility(View.VISIBLE);
|
||||
|
||||
if (getIntent().hasExtra(AppConfig.EXTRA_MAP_TYPE)) {
|
||||
@@ -375,7 +376,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
try {
|
||||
mClusterManager.addItem(new IncidentReport(incidents.getJSONObject(i)));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +399,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
try {
|
||||
heatMapPositions.add(new WeightedLatLng(new LatLng(incidents.getJSONObject(i).getDouble("latitude"), incidents.getJSONObject(i).getDouble("longitude")), 1.0));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,10 +435,11 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
addIncidentMarkersOnHeatMap(incidents);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting map heat map positions (server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting map heat map positions (server returned error): " + errorMsg);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -443,7 +447,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
hideProgress();
|
||||
Log.e(TAG, "Error getting map positions: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting map positions: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
}
|
||||
}) {
|
||||
@@ -479,10 +483,11 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
addIncidentMarkersOnMap(incidents);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting map positions (server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.INFO, TAG, "Error getting map positions (server returned error): " + errorMsg);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -490,7 +495,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
hideProgress();
|
||||
Log.e(TAG, "Error getting map positions: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting map positions: " + error.getMessage());
|
||||
showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||
}
|
||||
}) {
|
||||
@@ -558,8 +563,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
JSONObject incident = jObj.getJSONObject("msg");
|
||||
clickedClusterItem = new IncidentReport(incident);
|
||||
|
||||
TextView tvUsername = ((TextView) infoView.findViewById(R.id.txt_infowindow_fromuser));
|
||||
RatingBar rbScore = ((RatingBar) infoView.findViewById(R.id.rb_infowindow_rating));
|
||||
TextView tvUsername = infoView.findViewById(R.id.txt_infowindow_fromuser);
|
||||
RatingBar rbScore = infoView.findViewById(R.id.rb_infowindow_rating);
|
||||
|
||||
tvUsername.setText(String.format("%s %s", getString(R.string.lbl_mapsinfowindow_author), clickedClusterItem.getFromUsername()));
|
||||
rbScore.setRating(clickedClusterItem.getScoreStars());
|
||||
@@ -574,7 +579,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_getinfowindow));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -582,7 +588,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
hideProgress();
|
||||
Log.e(TAG, "Error getting incident details: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting incident details: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
}
|
||||
}) {
|
||||
@@ -614,13 +620,13 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
@Override
|
||||
public View getInfoWindow(Marker marker) {
|
||||
markerShowingInfoWindow = marker;
|
||||
LinearLayout layCategoryColor = ((LinearLayout) myContentsView.findViewById(R.id.lay_infowindow_color));
|
||||
LinearLayout layCategoryColor = myContentsView.findViewById(R.id.lay_infowindow_color);
|
||||
|
||||
TextView tvCategory = ((TextView) myContentsView.findViewById(R.id.txt_infowindow_category));
|
||||
TextView tvSubcategory = ((TextView) myContentsView.findViewById(R.id.txt_infowindow_subcategory));
|
||||
TextView tvVictim = ((TextView) myContentsView.findViewById(R.id.txt_infowindow_victim));
|
||||
TextView tvSuspect = ((TextView) myContentsView.findViewById(R.id.txt_infowindow_subject));
|
||||
TextView tvTime = ((TextView) myContentsView.findViewById(R.id.txt_infowindow_time));
|
||||
TextView tvCategory = myContentsView.findViewById(R.id.txt_infowindow_category);
|
||||
TextView tvSubcategory = myContentsView.findViewById(R.id.txt_infowindow_subcategory);
|
||||
TextView tvVictim = myContentsView.findViewById(R.id.txt_infowindow_victim);
|
||||
TextView tvSuspect = myContentsView.findViewById(R.id.txt_infowindow_subject);
|
||||
TextView tvTime = myContentsView.findViewById(R.id.txt_infowindow_time);
|
||||
|
||||
|
||||
if (clickedClusterItem != null) {
|
||||
@@ -731,13 +737,14 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int arg0, Bundle query) {
|
||||
CursorLoader cLoader = null;
|
||||
CursorLoader cLoader;
|
||||
|
||||
if (arg0 == 0)
|
||||
cLoader = new CursorLoader(getBaseContext(), PlaceProvider.SEARCH_URI, null, null, new String[]{query.getString("query")}, null);
|
||||
else if (arg0 == 1)
|
||||
else //if (arg0 == 1)
|
||||
cLoader = new CursorLoader(getBaseContext(), PlaceProvider.DETAILS_URI, null, null, new String[]{query.getString("query")}, null);
|
||||
return cLoader;
|
||||
|
||||
return cLoader;
|
||||
}
|
||||
|
||||
private class MyLocationListener implements LocationListener {
|
||||
@@ -827,9 +834,9 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(myLocation));
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,14 +866,18 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
getMenuInflater().inflate(R.menu.menu_common, menu);
|
||||
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.location_search).getActionView();
|
||||
SearchableInfo searchInfo = searchManager.getSearchableInfo(getComponentName());
|
||||
searchView.setSearchableInfo(searchInfo);
|
||||
if(searchManager != null){
|
||||
SearchableInfo searchInfo = searchManager.getSearchableInfo(getComponentName());
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.location_search).getActionView();
|
||||
searchView.setSearchableInfo(searchInfo);
|
||||
|
||||
EditText txtSearch = ((EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text));
|
||||
txtSearch.setHint(getResources().getString(R.string.search_hint));
|
||||
txtSearch.setHintTextColor(Color.DKGRAY);
|
||||
txtSearch.setTextColor(Color.BLACK);
|
||||
EditText txtSearch = searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
|
||||
txtSearch.setHint(getResources().getString(R.string.search_hint));
|
||||
txtSearch.setHintTextColor(Color.DKGRAY);
|
||||
txtSearch.setTextColor(Color.BLACK);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get searchManager");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -874,15 +885,14 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.d(TAG,"onPause executed: LM: "+(locationManager != null)+" LL: "+(locationListener!=null));
|
||||
|
||||
if(locationManager != null && locationListener != null) {
|
||||
locationManager.removeUpdates(locationListener);
|
||||
locationListener = null;
|
||||
locationManager = null;
|
||||
}
|
||||
|
||||
|
||||
super.onPause();
|
||||
|
||||
if (showAdd) showAd();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ProfileActivity extends BaseActivity{
|
||||
}
|
||||
|
||||
private void initProfileFromUserID(String userId) {
|
||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
||||
TabLayout tabLayout = findViewById(R.id.tab_layout);
|
||||
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getResources().getString(R.string.lbl_profile_stats)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getResources().getString(R.string.lbl_profile_reports)));
|
||||
@@ -52,7 +52,7 @@ public class ProfileActivity extends BaseActivity{
|
||||
}
|
||||
|
||||
private void initOwnProfileView() {
|
||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
||||
TabLayout tabLayout = findViewById(R.id.tab_layout);
|
||||
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getResources().getString(R.string.lbl_profile_stats)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getResources().getString(R.string.lbl_profile_top10)));
|
||||
@@ -64,12 +64,12 @@ public class ProfileActivity extends BaseActivity{
|
||||
}
|
||||
|
||||
private void initViewPager(TabLayout tabLayout, String userId) {
|
||||
final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
|
||||
final ViewPager viewPager = findViewById(R.id.pager);
|
||||
final PagerAdapter adapter = new ProfilePagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount(), userId);
|
||||
|
||||
viewPager.setAdapter(adapter);
|
||||
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
viewPager.setCurrentItem(tab.getPosition());
|
||||
@@ -101,6 +101,4 @@ public class ProfileActivity extends BaseActivity{
|
||||
return getResources().getString(R.string.title_activity_user_config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
@@ -29,6 +30,7 @@ import com.android.volley.toolbox.StringRequest;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.deke.risk.riskahead.fragment.BaseReportWFFragment;
|
||||
@@ -120,7 +122,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}
|
||||
|
||||
private void initButtonsAndElements() {
|
||||
btnContinue = (BootstrapButton) findViewById(R.id.btn_reportwf_next);
|
||||
btnContinue = findViewById(R.id.btn_reportwf_next);
|
||||
btnContinue.setEnabled(false);
|
||||
btnContinue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -130,7 +132,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}
|
||||
});
|
||||
|
||||
btnReportNow = (BootstrapButton) findViewById(R.id.btn_reportwf_reportnow);
|
||||
btnReportNow = findViewById(R.id.btn_reportwf_reportnow);
|
||||
btnReportNow.setEnabled(false);
|
||||
btnReportNow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -140,9 +142,9 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}
|
||||
});
|
||||
|
||||
siteIndicator = (TextView) findViewById(R.id.lbl_reportwf_site);
|
||||
siteIndicator = findViewById(R.id.lbl_reportwf_site);
|
||||
|
||||
btnMap = (FloatingActionButton) findViewById(R.id.fab_reportwf_map);
|
||||
btnMap = findViewById(R.id.fab_reportwf_map);
|
||||
btnMap.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -213,7 +215,8 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
incident.setIncidentPositionDescription("Latitude: " + latlngpos.latitude + "\nLongitude: " + latlngpos.longitude);
|
||||
}
|
||||
}
|
||||
@@ -328,11 +331,12 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
showShareDialog(incident);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error adding incident (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error adding incident (Server returned error): " + errorMsg);
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_createincident));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
hideDialog();
|
||||
@@ -340,7 +344,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error adding incident: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error adding incident: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
hideDialog();
|
||||
}
|
||||
@@ -390,7 +394,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case MY_PERMISSIONS_REQUEST_STORAGE: {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
@@ -14,10 +14,8 @@ import org.deke.risk.riskahead.helper.BaseActivity;
|
||||
*
|
||||
*/
|
||||
public class SettingsActivity extends BaseActivity {
|
||||
|
||||
private final static String TAG = SettingsActivity.class.getSimpleName();
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -27,8 +25,6 @@ public class SettingsActivity extends BaseActivity {
|
||||
Log.d(TAG, "SettingsActivity created");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.adapter.SubscriptionsPagerAdapter;
|
||||
import org.deke.risk.riskahead.fragment.SubscriptionItemFragment;
|
||||
@@ -45,7 +46,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
private final static String TAG = SubscriptionsActivity.class.getSimpleName();
|
||||
|
||||
IInAppBillingService mService;
|
||||
@@ -79,14 +79,14 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
|
||||
private void initViewPager() {
|
||||
subscriptionsViewPager = (ViewPager) findViewById(R.id.subs_viewpager);
|
||||
subscriptionsViewPager = findViewById(R.id.subs_viewpager);
|
||||
subscriptionsAdapter = new SubscriptionsPagerAdapter(getSupportFragmentManager(), 2);
|
||||
subscriptionsViewPager.setAdapter(subscriptionsAdapter);
|
||||
}
|
||||
|
||||
public void addDots() {
|
||||
dots = new ArrayList<>();
|
||||
LinearLayout dotsLayout = (LinearLayout)findViewById(R.id.dots);
|
||||
LinearLayout dotsLayout = findViewById(R.id.dots);
|
||||
|
||||
for(int i = 0; i < subscriptionsAdapter.getCount(); i++) {
|
||||
ImageView dot = new ImageView(this);
|
||||
@@ -103,7 +103,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
dots.add(dot);
|
||||
}
|
||||
|
||||
subscriptionsViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
subscriptionsViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
}
|
||||
@@ -193,7 +193,8 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "RemoteException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,17 +240,21 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
if (response == 0) {
|
||||
ArrayList<String> responseList= skuDetails.getStringArrayList("DETAILS_LIST");
|
||||
|
||||
for (String thisResponse : responseList) {
|
||||
JSONObject object = new JSONObject(thisResponse);
|
||||
if(responseList != null){
|
||||
for (String thisResponse : responseList) {
|
||||
JSONObject object = new JSONObject(thisResponse);
|
||||
|
||||
final String sku = object.getString("productId");
|
||||
final String price = object.getString("price");
|
||||
final String title = object.getString("title");
|
||||
final String description = object.getString("description");
|
||||
final String sku = object.getString("productId");
|
||||
final String price = object.getString("price");
|
||||
final String title = object.getString("title");
|
||||
final String description = object.getString("description");
|
||||
|
||||
purchaseMap.put(sku, object);
|
||||
purchaseMap.put(sku, object);
|
||||
|
||||
Log.d(TAG,"Product: "+sku+" Price: "+price+" Title: "+title+" Description: "+description);
|
||||
Log.d(TAG,"Product: "+sku+" Price: "+price+" Title: "+title+" Description: "+description);
|
||||
}
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get responseList");
|
||||
}
|
||||
|
||||
((SubscriptionItemFragment) subscriptionsAdapter.getItem(0)).initSubscription(purchaseMap.get("no_ads_03"));
|
||||
@@ -257,7 +262,8 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +278,8 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
startIntentSenderForResult(pendingIntent.getIntentSender(),1001, new Intent(), 0, 0, 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +302,8 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
}
|
||||
catch (JSONException e) {
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_subs));
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught while purchasing!");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,14 +328,15 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
if (error) {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error adding subscription (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error adding subscription (Server returned error): " + errorMsg);
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_subs));
|
||||
} else {
|
||||
gotoSubscriptionsActivity();
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
hideDialog();
|
||||
@@ -336,7 +345,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error adding subscription: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error adding subscription: " + error.getMessage());
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_subs));
|
||||
hideDialog();
|
||||
}
|
||||
@@ -391,14 +400,15 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
syncWithDatabase(ownedSkus);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting subscription: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting subscription: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
}
|
||||
}) {
|
||||
@@ -435,20 +445,21 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
|
||||
if (error) {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error deactivating subscription (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deactivating subscription (Server returned error): " + errorMsg);
|
||||
}else{
|
||||
Log.d(TAG,"Sub with uid: "+subscriptionId+" deactivated in DB");
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error deactivating subscription: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deactivating subscription: " + error.getMessage());
|
||||
}
|
||||
}) {
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.beardedhen.androidbootstrap.AwesomeTextView;
|
||||
import com.beardedhen.androidbootstrap.BootstrapLabel;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
import com.mikepenz.iconics.IconicsDrawable;
|
||||
|
||||
@@ -45,7 +46,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class ViewReportActivity extends BaseActivity {
|
||||
|
||||
private final static String TAG = ViewReportActivity.class.getSimpleName();
|
||||
|
||||
private EditText txtIncidentCategory;
|
||||
@@ -78,23 +78,23 @@ public class ViewReportActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void initViewsAndButtons() {
|
||||
txtIncidentCategory = (EditText) findViewById(R.id.txt_viewreport_incidentcategory);
|
||||
txtIncidentSubCategory = (EditText) findViewById(R.id.txt_viewreport_incidentsubcategory);
|
||||
txtPosition = (EditText) findViewById(R.id.txt_viewreport_position);
|
||||
txtTime = (EditText) findViewById(R.id.txt_viewreport_time);
|
||||
scorelabel = (BootstrapLabel) findViewById(R.id.txt_viewreport_points);
|
||||
txtSuspect = (EditText) findViewById(R.id.txt_viewreport_suspect);
|
||||
txtWeapons = (EditText) findViewById(R.id.txt_viewreport_suspectweapon);
|
||||
txtNumOfSuspects = (EditText) findViewById(R.id.txt_viewreport_suspectcount);
|
||||
txtVictim = (EditText) findViewById(R.id.txt_viewreport_victim);
|
||||
txtVictimOrigin = (EditText) findViewById(R.id.txt_viewreport_victimorigin);
|
||||
txtSuspectTransport = (EditText) findViewById(R.id.txt_viewreport_suspecttransport);
|
||||
txtVictimAffiliation = (EditText) findViewById(R.id.txt_viewreport_victimaff);
|
||||
txtSuspectRecognition = (EditText) findViewById(R.id.txt_viewreport_suspectrecon);
|
||||
txtEtcEtc = (EditText) findViewById(R.id.txt_viewreport_etcetc);
|
||||
txtReportedFrom = (EditText) findViewById(R.id.txt_viewreport_reportedfrom);
|
||||
btnUpvote = (AwesomeTextView) findViewById(R.id.btn_viewreport_upvote);
|
||||
btnDownvote = (AwesomeTextView) findViewById(R.id.btn_viewreport_downvote);
|
||||
txtIncidentCategory = findViewById(R.id.txt_viewreport_incidentcategory);
|
||||
txtIncidentSubCategory = findViewById(R.id.txt_viewreport_incidentsubcategory);
|
||||
txtPosition = findViewById(R.id.txt_viewreport_position);
|
||||
txtTime = findViewById(R.id.txt_viewreport_time);
|
||||
scorelabel = findViewById(R.id.txt_viewreport_points);
|
||||
txtSuspect = findViewById(R.id.txt_viewreport_suspect);
|
||||
txtWeapons = findViewById(R.id.txt_viewreport_suspectweapon);
|
||||
txtNumOfSuspects = findViewById(R.id.txt_viewreport_suspectcount);
|
||||
txtVictim = findViewById(R.id.txt_viewreport_victim);
|
||||
txtVictimOrigin = findViewById(R.id.txt_viewreport_victimorigin);
|
||||
txtSuspectTransport = findViewById(R.id.txt_viewreport_suspecttransport);
|
||||
txtVictimAffiliation = findViewById(R.id.txt_viewreport_victimaff);
|
||||
txtSuspectRecognition = findViewById(R.id.txt_viewreport_suspectrecon);
|
||||
txtEtcEtc = findViewById(R.id.txt_viewreport_etcetc);
|
||||
txtReportedFrom = findViewById(R.id.txt_viewreport_reportedfrom);
|
||||
btnUpvote = findViewById(R.id.btn_viewreport_upvote);
|
||||
btnDownvote = findViewById(R.id.btn_viewreport_downvote);
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
@@ -174,18 +174,19 @@ public class ViewReportActivity extends BaseActivity {
|
||||
gotoProfileActivity();
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error deleting incident (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deleting incident (Server returned error): " + errorMsg);
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_deleteincident));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error deleting incident: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deleting incident: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
hideDialog();
|
||||
}
|
||||
@@ -231,18 +232,19 @@ public class ViewReportActivity extends BaseActivity {
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error get incident (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error get incident (Server returned error): " + errorMsg);
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_getincidentdetail));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error get incident: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error get incident: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
hideDialog();
|
||||
}
|
||||
@@ -360,7 +362,7 @@ public class ViewReportActivity extends BaseActivity {
|
||||
private void initReport(IncidentReport incident) {
|
||||
Context tmpContext = getApplicationContext();
|
||||
|
||||
scorelabel.setText(String.format("%d", incident.getVotedScore()));
|
||||
scorelabel.setText(String.format(Locale.US, "%d", incident.getVotedScore()));
|
||||
txtIncidentCategory.setText(incident.getIncidentCategoryName(tmpContext));
|
||||
txtIncidentSubCategory.setText(checkIfTextEmptyAndReturnString(incident.getIncidentSubCategoryName(tmpContext)));
|
||||
txtTime.setText(checkIfTextEmptyAndReturnString(incident.getTimeString(tmpContext)));
|
||||
@@ -395,7 +397,8 @@ public class ViewReportActivity extends BaseActivity {
|
||||
txtPosition.setText(sb.toString());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "IOException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
final String latitude = Double.toString(incident.getPosition().latitude);
|
||||
@@ -463,18 +466,19 @@ public class ViewReportActivity extends BaseActivity {
|
||||
checkVotetypeAndSetVoteButtons(jPoints);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error voting incident (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error voting incident (Server returned error): " + errorMsg);
|
||||
showMessage(getResources().getString(R.string.txt_errormsg_couldnotvote));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error voting incident: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error voting incident: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
}
|
||||
}) {
|
||||
@@ -516,17 +520,18 @@ public class ViewReportActivity extends BaseActivity {
|
||||
checkVotetypeAndSetVoteButtons(jPoints);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error deleting voting incident (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deleting voting incident (Server returned error): " + errorMsg);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error deleting voting incident: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error deleting voting incident: " + error.getMessage());
|
||||
handleVolleyErrorResponse();
|
||||
}
|
||||
}) {
|
||||
|
||||
@@ -17,8 +17,8 @@ import org.deke.risk.riskahead.fragment.Top10Fragment;
|
||||
*
|
||||
*/
|
||||
public class ProfilePagerAdapter extends FragmentStatePagerAdapter {
|
||||
int mNumOfTabs;
|
||||
String userID;
|
||||
private int mNumOfTabs;
|
||||
private String userID;
|
||||
|
||||
public ProfilePagerAdapter(FragmentManager fm, int NumOfTabs, String userID) {
|
||||
super(fm);
|
||||
@@ -57,11 +57,10 @@ public class ProfilePagerAdapter extends FragmentStatePagerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return returnFragment;
|
||||
}
|
||||
|
||||
public static Fragment newProfileStatisticsInstance(String uid) {
|
||||
private static Fragment newProfileStatisticsInstance(String uid) {
|
||||
ProfileStatisticsFragment myFragment = new ProfileStatisticsFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
@@ -71,7 +70,7 @@ public class ProfilePagerAdapter extends FragmentStatePagerAdapter {
|
||||
return myFragment;
|
||||
}
|
||||
|
||||
public static Fragment newReportListInstance(String uid) {
|
||||
private static Fragment newReportListInstance(String uid) {
|
||||
ReportListFragment myFragment = new ReportListFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -13,6 +14,8 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
import org.json.JSONException;
|
||||
@@ -28,9 +31,10 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
public class ReportListAdapter extends BaseAdapter {
|
||||
private final static String TAG = ReportListAdapter.class.getSimpleName();
|
||||
|
||||
Context context;
|
||||
List<JSONObject> data;
|
||||
private Context context;
|
||||
private List<JSONObject> data;
|
||||
|
||||
private static LayoutInflater inflater = null;
|
||||
|
||||
@@ -61,12 +65,12 @@ public class ReportListAdapter extends BaseAdapter {
|
||||
View vi = convertView;
|
||||
if (vi == null) vi = inflater.inflate(R.layout.fragment_reportlist_row, null);
|
||||
|
||||
TextView itemText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_text);
|
||||
TextView titleText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_title);
|
||||
TextView categoryText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_category);
|
||||
LinearLayout ll = (LinearLayout) vi.findViewById(R.id.lay_reportlist_color);
|
||||
ImageView iv = (ImageView) vi.findViewById(R.id.ic_reportlist_row);
|
||||
LinearLayout bglayout = (LinearLayout) vi.findViewById(R.id.lay_reportlist_bgcolor);
|
||||
TextView itemText = vi.findViewById(R.id.txt_reportlist_lvrow_text);
|
||||
TextView titleText = vi.findViewById(R.id.txt_reportlist_lvrow_title);
|
||||
TextView categoryText = vi.findViewById(R.id.txt_reportlist_lvrow_category);
|
||||
LinearLayout ll = vi.findViewById(R.id.lay_reportlist_color);
|
||||
ImageView iv = vi.findViewById(R.id.ic_reportlist_row);
|
||||
LinearLayout bglayout = vi.findViewById(R.id.lay_reportlist_bgcolor);
|
||||
|
||||
boolean status = true;
|
||||
|
||||
@@ -75,7 +79,8 @@ public class ReportListAdapter extends BaseAdapter {
|
||||
status = false;
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
if(!status){
|
||||
@@ -89,7 +94,7 @@ public class ReportListAdapter extends BaseAdapter {
|
||||
|
||||
ll.setBackgroundColor(Color.argb(150, 255, 0, 0));
|
||||
iv.setVisibility(View.GONE);
|
||||
}else {
|
||||
}else{
|
||||
bglayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
||||
IncidentReport item = new IncidentReport(data.get(position));
|
||||
titleText.setText(item.getIncidentCategoryName(vi.getContext()));
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.deke.risk.riskahead.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DataSetObserver;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -14,10 +14,10 @@ import org.deke.risk.riskahead.fragment.SubscriptionItemFragment;
|
||||
*
|
||||
*/
|
||||
public class SubscriptionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
int mNumOfTabs;
|
||||
private int mNumOfTabs;
|
||||
|
||||
SubscriptionItemFragment frag1;
|
||||
SubscriptionItemFragment frag2;
|
||||
private SubscriptionItemFragment frag1;
|
||||
private SubscriptionItemFragment frag2;
|
||||
|
||||
public SubscriptionsPagerAdapter(FragmentManager fm, int NumOfTabs) {
|
||||
super(fm);
|
||||
@@ -26,7 +26,7 @@ public class SubscriptionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Fragment returnFragment = null;
|
||||
Fragment returnFragment;
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
@@ -41,12 +41,9 @@ public class SubscriptionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return returnFragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mNumOfTabs;
|
||||
|
||||
@@ -2,12 +2,15 @@ package org.deke.risk.riskahead.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -22,9 +25,10 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
public class Top10ListAdapter extends BaseAdapter {
|
||||
private final static String TAG = Top10ListAdapter.class.getSimpleName();
|
||||
|
||||
Context context;
|
||||
List<JSONObject> data;
|
||||
private Context context;
|
||||
private List<JSONObject> data;
|
||||
|
||||
private static LayoutInflater inflater = null;
|
||||
|
||||
@@ -55,11 +59,11 @@ public class Top10ListAdapter extends BaseAdapter {
|
||||
View vi = convertView;
|
||||
if (vi == null) vi = inflater.inflate(R.layout.fragment_top10list_row, null);
|
||||
|
||||
TextView rank = (TextView) vi.findViewById(R.id.txt_top10_rank);
|
||||
TextView name = (TextView) vi.findViewById(R.id.txt_top10_name);
|
||||
TextView numberOfIncidents = (TextView) vi.findViewById(R.id.txt_top10_numberOfIncidents);
|
||||
TextView memberSince = (TextView) vi.findViewById(R.id.txt_top10_membersince);
|
||||
TextView points = (TextView) vi.findViewById(R.id.txt_top10_points);
|
||||
TextView rank = vi.findViewById(R.id.txt_top10_rank);
|
||||
TextView name = vi.findViewById(R.id.txt_top10_name);
|
||||
TextView numberOfIncidents = vi.findViewById(R.id.txt_top10_numberOfIncidents);
|
||||
TextView memberSince = vi.findViewById(R.id.txt_top10_membersince);
|
||||
TextView points = vi.findViewById(R.id.txt_top10_points);
|
||||
|
||||
try {
|
||||
rank.setText("#"+data.get(position).getString("rank"));
|
||||
@@ -70,7 +74,8 @@ public class Top10ListAdapter extends BaseAdapter {
|
||||
numberOfIncidents.setText(data.get(position).getString("numberOfPosts")+" "+context.getResources().getString(R.string.txt_top10_reportedinc));
|
||||
memberSince.setText(context.getResources().getString(R.string.txt_top10_membersince)+" "+data.get(position).getString("created_at").split(" ")[0]);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
return vi;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,12 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*/
|
||||
public abstract class BaseReportWFFragment extends Fragment {
|
||||
|
||||
|
||||
public BaseReportWFFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return new TextView(getActivity());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package org.deke.risk.riskahead.fragment;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -16,12 +17,12 @@ import com.facebook.AccessToken;
|
||||
import com.facebook.CallbackManager;
|
||||
import com.facebook.FacebookCallback;
|
||||
import com.facebook.FacebookException;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.GraphRequest;
|
||||
import com.facebook.GraphResponse;
|
||||
import com.facebook.login.LoginBehavior;
|
||||
import com.facebook.login.LoginManager;
|
||||
import com.facebook.login.LoginResult;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.LoginActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -39,7 +40,8 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class FacebookButtonFragment extends Fragment {
|
||||
|
||||
private BootstrapButton btnLoginFB;
|
||||
private final static String TAG = FacebookButtonFragment.class.getSimpleName();
|
||||
|
||||
CallbackManager callbackManager;
|
||||
OnFragmentInteractionListener mListener;
|
||||
View view;
|
||||
@@ -58,9 +60,8 @@ public class FacebookButtonFragment extends Fragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.fragment_facebook_button, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -73,7 +74,6 @@ public class FacebookButtonFragment extends Fragment {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
FacebookSdk.sdkInitialize(getContext());
|
||||
callbackManager = CallbackManager.Factory.create();
|
||||
initFacebookButton();
|
||||
}
|
||||
@@ -86,17 +86,21 @@ public class FacebookButtonFragment extends Fragment {
|
||||
|
||||
public interface OnFragmentInteractionListener {
|
||||
void onFragmentInteraction(Uri uri);
|
||||
|
||||
}
|
||||
|
||||
private void initFacebookButton() {
|
||||
btnLoginFB = (BootstrapButton) view.findViewById(R.id.btn_login_fb);
|
||||
BootstrapButton btnLoginFB = view.findViewById(R.id.btn_login_fb);
|
||||
|
||||
btnLoginFB.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LoginManager.getInstance().setLoginBehavior(LoginBehavior.WEB_ONLY);
|
||||
LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "email"));
|
||||
Activity activity = getActivity();
|
||||
if(activity != null){
|
||||
LoginManager.getInstance().logInWithReadPermissions(activity, Arrays.asList("public_profile", "email"));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get activity when initializing the facebook button");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,13 +114,23 @@ public class FacebookButtonFragment extends Fragment {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
Log.d("FB","OnCancel");
|
||||
((LoginActivity) getActivity()).showMessage("Facebook LogIn canceled. Please use E-Mail instead.");
|
||||
LoginActivity activity = (LoginActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.showMessage("Facebook LogIn canceled. Please use E-Mail instead.");
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get activity for showing onCancel message");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(FacebookException exception) {
|
||||
Log.d("FB","OnError: " + exception.toString());
|
||||
((LoginActivity) getActivity()).showMessage("Could not log in with Facebook. Please use E-Mail instead or try again later.");
|
||||
LoginActivity activity = (LoginActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.showMessage("Could not log in with Facebook. Please use E-Mail instead or try again later.");
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get activity for showing onError message");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -126,9 +140,15 @@ public class FacebookButtonFragment extends Fragment {
|
||||
@Override
|
||||
public void onCompleted(JSONObject objects, GraphResponse response) {
|
||||
try {
|
||||
((LoginActivity) getActivity()).handleSocialMediaLogin(objects.getString("id"), "facebook", objects.getString("first_name"), objects.getString("email"));
|
||||
LoginActivity activity = (LoginActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.handleSocialMediaLogin(objects.getString("id"), "facebook", objects.getString("first_name"), objects.getString("email"));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get activity for handleSocialMediaLogin");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.android.gms.common.SignInButton;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.plus.Plus;
|
||||
import com.google.android.gms.plus.model.people.Person;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.LoginActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -37,42 +29,32 @@ import org.deke.risk.riskahead.R;
|
||||
* Date of Release: 10.02.2016
|
||||
*
|
||||
*/
|
||||
public class GooglePlusButtonFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
|
||||
public class GooglePlusButtonFragment extends Fragment{
|
||||
|
||||
public static final int RC_SIGN_IN = 0;
|
||||
private static final String TAG = "MainActivity";
|
||||
private static final int MY_PERMISSIONS_REQUEST_ACCOUNTS = 32;
|
||||
private static final String TAG = GooglePlusButtonFragment.class.getSimpleName();
|
||||
|
||||
private GoogleApiClient mGoogleApiClient;
|
||||
|
||||
private boolean mIntentInProgress;
|
||||
private boolean mSignInClicked;
|
||||
|
||||
private ConnectionResult mConnectionResult;
|
||||
GoogleSignInClient mGoogleSignInClient;
|
||||
|
||||
private Context mContext;
|
||||
private Activity mActivity;
|
||||
|
||||
|
||||
private LoginActivity mActivity;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mActivity = getActivity();
|
||||
mContext = getActivity().getApplicationContext();
|
||||
mActivity = (LoginActivity) getActivity();
|
||||
if(mActivity != null){
|
||||
mContext = mActivity.getApplicationContext();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve activity for Google+ onCreate Method");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_googleplus_button,container, false);
|
||||
|
||||
BootstrapButton btnSignIn = (BootstrapButton) view.findViewById(R.id.btn_login_gp);
|
||||
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(view.getContext())
|
||||
.addConnectionCallbacks(this)
|
||||
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
||||
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
||||
|
||||
BootstrapButton btnSignIn = view.findViewById(R.id.btn_login_gp);
|
||||
btnSignIn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -85,206 +67,51 @@ public class GooglePlusButtonFragment extends Fragment implements GoogleApiClien
|
||||
|
||||
private void performClickAction() {
|
||||
Log.d(TAG,"Click on Google+ Button performed");
|
||||
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
Log.d(TAG,"Permission not granted yet - request now");
|
||||
|
||||
// Should we show an explanation?
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
|
||||
alertDialog.setTitle("Request Permission");
|
||||
alertDialog.setMessage("Google needs permission to see your profile (Contact List) in order to enable log-in with Google+. However, if you do not grant permission, log in with Google+ will not be available.");
|
||||
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
requestPermissions(new String[]{Manifest.permission.GET_ACCOUNTS}, MY_PERMISSIONS_REQUEST_ACCOUNTS);
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
|
||||
|
||||
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(mContext);
|
||||
|
||||
if(account != null){
|
||||
Log.d(TAG, "User already logged in - handle social media login");
|
||||
mActivity.handleSocialMediaLogin(account.getId(),"google",account.getDisplayName(),account.getEmail());
|
||||
}else{
|
||||
Log.d(TAG,"Permission already granted");
|
||||
|
||||
if(mGoogleApiClient.isConnected()){
|
||||
Person currentPerson = getProfileInformation();
|
||||
((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
||||
}else{
|
||||
signInWithGplus();
|
||||
}
|
||||
Log.d(TAG, "User not logged in - log in to g+ now");
|
||||
signInWithGplus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
Log.d(TAG,"RequestCode: "+requestCode);
|
||||
|
||||
switch (requestCode) {
|
||||
case MY_PERMISSIONS_REQUEST_ACCOUNTS: {
|
||||
// If request is cancelled, the result arrays are empty.
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
Log.d(TAG,"Permission granted");
|
||||
|
||||
if(mGoogleApiClient.isConnected()){
|
||||
Person currentPerson = getProfileInformation();
|
||||
((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
||||
}else{
|
||||
signInWithGplus();
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.d(TAG,"Permission not granted - what now?");
|
||||
Toast.makeText(mContext, "Could not log in with Google+. Please use E-Mail instead or try again later.",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (mGoogleApiClient.isConnected()) {
|
||||
mGoogleApiClient.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int responseCode, Intent intent) {
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == RC_SIGN_IN) {
|
||||
if (responseCode != Activity.RESULT_OK) {
|
||||
mSignInClicked = false;
|
||||
}
|
||||
|
||||
mIntentInProgress = false;
|
||||
|
||||
if (!mGoogleApiClient.isConnecting()) {
|
||||
mGoogleApiClient.connect();
|
||||
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
||||
GoogleSignInAccount account = handleSignInResult(task);
|
||||
if(account != null){
|
||||
mActivity.handleSocialMediaLogin(account.getId(),"google",account.getDisplayName(),account.getEmail());
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG,"Could not handle G+ SignIn Result");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(ConnectionResult result) {
|
||||
if (!result.hasResolution()) {
|
||||
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(),
|
||||
mActivity, 0).show();
|
||||
Log.e(TAG, "" + result.getErrorCode());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIntentInProgress) {
|
||||
mConnectionResult = result;
|
||||
|
||||
if (mSignInClicked) {
|
||||
|
||||
Log.e(TAG, "" + result.getErrorCode());
|
||||
resolveSignInError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(Bundle arg0) {
|
||||
Person currentPerson = getProfileInformation();
|
||||
if(mSignInClicked) ((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
||||
|
||||
mSignInClicked = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionSuspended(int arg0) {
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign-in into google
|
||||
* */
|
||||
private void signInWithGplus() {
|
||||
if (!mGoogleApiClient.isConnecting()) {
|
||||
mSignInClicked = true;
|
||||
resolveSignInError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to resolve any signin errors
|
||||
* */
|
||||
private void resolveSignInError() {
|
||||
if (mConnectionResult.hasResolution()) {
|
||||
try {
|
||||
mIntentInProgress = true;
|
||||
mConnectionResult.startResolutionForResult(mActivity,RC_SIGN_IN);
|
||||
} catch (IntentSender.SendIntentException e) {
|
||||
mIntentInProgress = false;
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching user's information name, email, profile pic
|
||||
* */
|
||||
private Person getProfileInformation() {
|
||||
Person currentPerson = null;
|
||||
private GoogleSignInAccount handleSignInResult(Task<GoogleSignInAccount> completedTask) {
|
||||
try {
|
||||
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
|
||||
currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
|
||||
String personName = currentPerson.getDisplayName();
|
||||
String personPhotoUrl = currentPerson.getImage().getUrl();
|
||||
String personGooglePlusProfile = currentPerson.getUrl();
|
||||
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
|
||||
|
||||
Log.e(TAG, "Name: " + personName + ", plusProfile: "
|
||||
+ personGooglePlusProfile + ", email: " + email
|
||||
+ ", Image: " + personPhotoUrl + " user id:"
|
||||
+ currentPerson.getId());
|
||||
|
||||
} else {
|
||||
Toast.makeText(mContext, "Person information is null",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return currentPerson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign-out from google
|
||||
* */
|
||||
private void signOutFromGplus() {
|
||||
if (mGoogleApiClient.isConnected()) {
|
||||
mGoogleApiClient.clearDefaultAccountAndReconnect();
|
||||
return completedTask.getResult(ApiException.class);
|
||||
} catch (ApiException e) {
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "signInResult:failed code=" + e.getStatusCode());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void logoutFromGplus() {
|
||||
if (mGoogleApiClient.isConnected()) {
|
||||
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
|
||||
mGoogleApiClient.disconnect();
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
}
|
||||
private void signInWithGplus() {
|
||||
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
|
||||
.requestEmail()
|
||||
.requestId()
|
||||
.build();
|
||||
|
||||
mGoogleSignInClient = GoogleSignIn.getClient(mContext, gso);
|
||||
|
||||
protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) {
|
||||
for (int i = 0; i < signInButton.getChildCount(); i++) {
|
||||
View v = signInButton.getChildAt(i);
|
||||
if (v instanceof TextView) {
|
||||
TextView mTextView = (TextView) v;
|
||||
mTextView.setAllCaps(false);
|
||||
mTextView.setText(buttonText);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
|
||||
startActivityForResult(signInIntent, RC_SIGN_IN);
|
||||
}
|
||||
|
||||
public interface OnFragmentInteractionListener {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.ProfileActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -39,15 +40,15 @@ public class ProfileStatisticsFragment extends Fragment {
|
||||
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
||||
|
||||
private ProfileActivity parent;
|
||||
private String uid = "";
|
||||
private String uid;
|
||||
|
||||
private TextView points ;
|
||||
private TextView ranking ;
|
||||
private TextView posts ;
|
||||
private TextView txtMemberSince ;
|
||||
private TextView txtMemberSince ;
|
||||
|
||||
private TextView lblPoints;
|
||||
private TextView lblPosts;
|
||||
private TextView lblPosts;
|
||||
private TextView lblRanking;
|
||||
private TextView lblMemberSince;
|
||||
|
||||
@@ -58,31 +59,40 @@ public class ProfileStatisticsFragment extends Fragment {
|
||||
View view = inflater.inflate(R.layout.fragment_profile_stats, container, false);
|
||||
parent = (ProfileActivity)getActivity();
|
||||
|
||||
points = (TextView) view.findViewById(R.id.txt_profile_points);
|
||||
ranking = (TextView) view.findViewById(R.id.txt_profile_ranking);
|
||||
posts = (TextView) view.findViewById(R.id.txt_profile_numberposts);
|
||||
txtMemberSince = (TextView) view.findViewById(R.id.txt_profile_membersince);
|
||||
points = view.findViewById(R.id.txt_profile_points);
|
||||
ranking = view.findViewById(R.id.txt_profile_ranking);
|
||||
posts = view.findViewById(R.id.txt_profile_numberposts);
|
||||
txtMemberSince = view.findViewById(R.id.txt_profile_membersince);
|
||||
|
||||
lblPoints = (TextView) view.findViewById(R.id.lbl_profile_points);
|
||||
lblRanking = (TextView) view.findViewById(R.id.lbl_profile_ranking);
|
||||
lblPosts = (TextView) view.findViewById(R.id.lbl_profile_numberposts);
|
||||
lblMemberSince = (TextView) view.findViewById(R.id.lbl_profile_membersince);
|
||||
lblPoints = view.findViewById(R.id.lbl_profile_points);
|
||||
lblRanking = view.findViewById(R.id.lbl_profile_ranking);
|
||||
lblPosts = view.findViewById(R.id.lbl_profile_numberposts);
|
||||
lblMemberSince = view.findViewById(R.id.lbl_profile_membersince);
|
||||
|
||||
btnMembershipType = (BootstrapButton) view.findViewById(R.id.btn_profile_membershiptype);
|
||||
btnMembershipType = view.findViewById(R.id.btn_profile_membershiptype);
|
||||
|
||||
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
||||
|
||||
getProfileStatsForList();
|
||||
Bundle arguments = getArguments();
|
||||
if(arguments != null){
|
||||
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
||||
getProfileStatsForList();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve arguments");
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void getProfileStatsForList() {
|
||||
((ProfileActivity)getActivity()).showDialog();
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.showDialog();
|
||||
|
||||
StringRequest strReq = getStringRequestProfileStats();
|
||||
String tag_string_req = "req_profilestats";
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
StringRequest strReq = getStringRequestProfileStats();
|
||||
String tag_string_req = "req_profilestats";
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve activity for ProfileStats");
|
||||
}
|
||||
}
|
||||
|
||||
private StringRequest getStringRequestProfileStats() {
|
||||
@@ -109,22 +119,37 @@ public class ProfileStatisticsFragment extends Fragment {
|
||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.SUCCESS);
|
||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_free));
|
||||
}else{
|
||||
boolean no_ads = false;
|
||||
boolean premium = false;
|
||||
|
||||
for(int i = 0; i < jSubs.length();i++) {
|
||||
if(jSubs.getJSONObject(i).getString("productId").contains("no_ads")){
|
||||
no_ads = true;
|
||||
}
|
||||
if(jSubs.getJSONObject(i).getString("productId").contains("extra_functions")){
|
||||
premium = true;
|
||||
}
|
||||
}
|
||||
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
if(no_ads){
|
||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.PRIMARY);
|
||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_addfree));
|
||||
((ProfileActivity) getActivity()).session.setSubsNoAds(true);
|
||||
activity.session.setSubsNoAds(true);
|
||||
}else{
|
||||
((ProfileActivity) getActivity()).session.setSubsNoAds(false);
|
||||
activity.session.setSubsNoAds(false);
|
||||
}
|
||||
|
||||
if(jSubs.getJSONObject(i).getString("productId").contains("extra_functions")){
|
||||
if(premium){
|
||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.WARNING);
|
||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_premium));
|
||||
((ProfileActivity) getActivity()).session.setSubsPremium(true);
|
||||
activity.session.setSubsPremium(true);
|
||||
}else{
|
||||
((ProfileActivity) getActivity()).session.setSubsPremium(false);
|
||||
activity.session.setSubsPremium(false);
|
||||
}
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve activity for ProfileStatistics. Could not set statusLevel");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,23 +161,29 @@ public class ProfileStatisticsFragment extends Fragment {
|
||||
}
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting user stats (server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting user stats (server returned error): " + errorMsg);
|
||||
|
||||
parent.showMessage(getResources().getString(R.string.txt_errormsg_retrievestats));
|
||||
}
|
||||
|
||||
((ProfileActivity)getActivity()).hideDialog();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting user stats: " + error.getMessage());
|
||||
((ProfileActivity)getActivity()).hideDialog();
|
||||
((ProfileActivity)getActivity()).handleVolleyErrorResponse();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting user stats: " + error.getMessage());
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.hideDialog();
|
||||
activity.handleVolleyErrorResponse();
|
||||
}else {
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve activity for onErrorResponse");
|
||||
}
|
||||
}
|
||||
}) {
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.ProfileActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -38,7 +39,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class ReportListFragment extends Fragment{
|
||||
|
||||
private final static String TAG = ReportListFragment.class.getSimpleName();
|
||||
|
||||
private ProfileActivity parent;
|
||||
@@ -47,16 +47,21 @@ public class ReportListFragment extends Fragment{
|
||||
private ListAdapter myListAdapter;
|
||||
private List<JSONObject> resultList;
|
||||
|
||||
private String uid = "";
|
||||
private String uid;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_reportlist, container, false);
|
||||
|
||||
parent = (ProfileActivity)getActivity();
|
||||
Bundle arguments = getArguments();
|
||||
if(arguments != null && parent != null){
|
||||
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could either not get arguments or parent activity");
|
||||
}
|
||||
|
||||
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
||||
|
||||
myListView = (ListView) view.findViewById(R.id.lv_reportlist_list);
|
||||
myListView = view.findViewById(R.id.lv_reportlist_list);
|
||||
|
||||
if(resultList == null || resultList.size() == 0) getIncidentsForList();
|
||||
|
||||
@@ -67,9 +72,9 @@ public class ReportListFragment extends Fragment{
|
||||
if(resultList.get(position).getInt("status") == 1){
|
||||
parent.gotoViewReportActivity(resultList.get(position).getInt("id"));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Catched JSONException");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -78,11 +83,16 @@ public class ReportListFragment extends Fragment{
|
||||
}
|
||||
|
||||
private void getIncidentsForList() {
|
||||
((ProfileActivity)getActivity()).showDialog();
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.showDialog();
|
||||
|
||||
String tag_string_req = "getincidentswithpositionfromid";
|
||||
StringRequest strReq = getStringRequestGetIncidentsWithPositionFromUserID();
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
String tag_string_req = "getincidentswithpositionfromid";
|
||||
StringRequest strReq = getStringRequestGetIncidentsWithPositionFromUserID();
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
}
|
||||
|
||||
private StringRequest getStringRequestGetIncidentsWithPositionFromUserID() {
|
||||
@@ -114,20 +124,25 @@ public class ReportListFragment extends Fragment{
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting incident list (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting incident list (Server returned error): " + errorMsg);
|
||||
}
|
||||
|
||||
((ProfileActivity)getActivity()).hideDialog();
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.hideDialog();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Catched JSONException");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting incident list: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting incident list: " + error.getMessage());
|
||||
parent.handleVolleyErrorResponse();
|
||||
parent.hideDialog();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -12,6 +13,8 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
@@ -30,6 +33,8 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
||||
private final static int VIOLANCE_LIFETHREAT = 3;
|
||||
private final static int VIOLANCE_DISASTER = 4;
|
||||
|
||||
private final static String TAG = ReportWF_1_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner crimeCategory;
|
||||
@@ -69,16 +74,23 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
||||
}
|
||||
|
||||
private void initInputElements() {
|
||||
crimeCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_1_cat_main);
|
||||
crimeSubCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_1_cat_sub);
|
||||
crimeSubOther = (EditText) viewFragment.findViewById(R.id.txt_reportwf_1_cat_etc);
|
||||
timeLayout = (RelativeLayout) viewFragment.findViewById(R.id.ll_pos);
|
||||
txtPositionInformation = (TextView) viewFragment.findViewById(R.id.lbl_reportwf_position_detail);
|
||||
crimeCategory = viewFragment.findViewById(R.id.dd_reportwf_1_cat_main);
|
||||
crimeSubCategory = viewFragment.findViewById(R.id.dd_reportwf_1_cat_sub);
|
||||
crimeSubOther = viewFragment.findViewById(R.id.txt_reportwf_1_cat_etc);
|
||||
timeLayout = viewFragment.findViewById(R.id.ll_pos);
|
||||
txtPositionInformation = viewFragment.findViewById(R.id.lbl_reportwf_position_detail);
|
||||
|
||||
crimeSubCategory.setVisibility(View.INVISIBLE);
|
||||
crimeSubOther.setVisibility(View.INVISIBLE);
|
||||
timeLayout.setVisibility(View.INVISIBLE);
|
||||
((ReportWFActivity)getActivity()).setMapButtonVisibility(false);
|
||||
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setMapButtonVisibility(false);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
|
||||
|
||||
crimeCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
@@ -144,10 +156,15 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void setMainSpinnerValues(int stringId) {
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(),stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
crimeCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
crimeCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setSubSpinnerValues(int stringId) {
|
||||
@@ -179,7 +196,12 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidIncidentCategory() > 0){
|
||||
@@ -216,7 +238,12 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
||||
incident.setFidIncidentSubCategory(crimeSubCategory.getSelectedItemPosition());
|
||||
incident.setEtcIncidentCategory(crimeSubOther.getText().toString());
|
||||
|
||||
((ReportWFActivity) getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.support.v4.app.FragmentManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -21,6 +22,8 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
@@ -30,6 +33,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -44,6 +48,8 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
private final static int DATETIME = 3;
|
||||
private final static int DATETIMEAREA = 4;
|
||||
|
||||
private final static String TAG = ReportWF_2_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner timeCategory;
|
||||
@@ -95,8 +101,8 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
initLayoutFromDateTime();
|
||||
initLayoutToDateTime();
|
||||
|
||||
timeCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_2_time_main);
|
||||
timeSubCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_2_time_sub);
|
||||
timeCategory = viewFragment.findViewById(R.id.dd_reportwf_2_time_main);
|
||||
timeSubCategory = viewFragment.findViewById(R.id.dd_reportwf_2_time_sub);
|
||||
|
||||
timeSubCategory.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -111,8 +117,8 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
viewFragment.findViewById(R.id.ll_report_to_time).setVisibility(View.INVISIBLE);
|
||||
viewFragment.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE);
|
||||
|
||||
inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()));
|
||||
inputTimeFrom.setText(new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime()));
|
||||
inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Calendar.getInstance().getTime()));
|
||||
inputTimeFrom.setText(new SimpleDateFormat("HH:mm", Locale.US).format(Calendar.getInstance().getTime()));
|
||||
break;
|
||||
case PERIODIC:
|
||||
viewFragment.findViewById(R.id.ll_report_from_time).setVisibility(View.INVISIBLE);
|
||||
@@ -135,8 +141,8 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
viewFragment.findViewById(R.id.ll_report_to_time).setVisibility(View.INVISIBLE);
|
||||
viewFragment.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE);
|
||||
|
||||
inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()));
|
||||
inputTimeFrom.setText(new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime()));
|
||||
inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Calendar.getInstance().getTime()));
|
||||
inputTimeFrom.setText(new SimpleDateFormat("HH:mm", Locale.US).format(Calendar.getInstance().getTime()));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -163,23 +169,26 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
timeSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (((SpinnerHintAdapter) timeSubCategory.getAdapter()).isInInitialState()) {
|
||||
|
||||
} else {
|
||||
if (!((SpinnerHintAdapter) timeSubCategory.getAdapter()).isInInitialState()) {
|
||||
checkIfFinished();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setMainSpinnerValues(int stringId) {
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId , android.R.layout.simple_spinner_dropdown_item);
|
||||
timeCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId , android.R.layout.simple_spinner_dropdown_item);
|
||||
timeCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setSubSpinnerValues(int stringId) {
|
||||
@@ -190,11 +199,11 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initLayoutFromDateTime() {
|
||||
RelativeLayout rlFromTime = (RelativeLayout) viewFragment.findViewById(R.id.ll_report_from_time);
|
||||
RelativeLayout rlFromTime = viewFragment.findViewById(R.id.ll_report_from_time);
|
||||
rlFromTime.setVisibility(View.INVISIBLE);
|
||||
|
||||
inputDateFrom = ((EditText) viewFragment.findViewById(R.id.input_report_from_date));
|
||||
inputTimeFrom = ((EditText) viewFragment.findViewById(R.id.input_report_from_time));
|
||||
inputDateFrom = viewFragment.findViewById(R.id.input_report_from_date);
|
||||
inputTimeFrom = viewFragment.findViewById(R.id.input_report_from_time);
|
||||
|
||||
inputDateFrom.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -246,11 +255,11 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initLayoutToDateTime() {
|
||||
RelativeLayout rlFromTime = (RelativeLayout) viewFragment.findViewById(R.id.ll_report_to_time);
|
||||
RelativeLayout rlFromTime = viewFragment.findViewById(R.id.ll_report_to_time);
|
||||
rlFromTime.setVisibility(View.INVISIBLE);
|
||||
|
||||
inputDateTo = ((EditText) viewFragment.findViewById(R.id.input_report_to_date));
|
||||
inputTimeTo = ((EditText) viewFragment.findViewById(R.id.input_report_to_time));
|
||||
inputDateTo = viewFragment.findViewById(R.id.input_report_to_date);
|
||||
inputTimeTo = viewFragment.findViewById(R.id.input_report_to_time);
|
||||
|
||||
inputDateTo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -283,21 +292,23 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
tmpInput.setText(String.format("%02d:%02d",hourOfDay,minute));
|
||||
|
||||
//checkIfFinished();
|
||||
tmpInput.setText(String.format(Locale.US, "%02d:%02d", hourOfDay, minute));
|
||||
}
|
||||
}
|
||||
|
||||
public void showTimePickerDialog() {
|
||||
FragmentManager fm = getFragmentManager();
|
||||
timePickerFragment = (TimePickerFragment) fm.findFragmentByTag("Pick Time");
|
||||
if(fm != null){
|
||||
timePickerFragment = (TimePickerFragment) fm.findFragmentByTag("Pick Time");
|
||||
|
||||
if(timePickerFragment == null){
|
||||
timePickerFragment = new TimePickerFragment();
|
||||
if(timePickerFragment == null){
|
||||
timePickerFragment = new TimePickerFragment();
|
||||
}
|
||||
|
||||
timePickerFragment.show(fm, "Pick Time");
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get FragmentManager");
|
||||
}
|
||||
|
||||
timePickerFragment.show(fm, "Pick Time");
|
||||
}
|
||||
|
||||
public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
|
||||
@@ -309,40 +320,54 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
int month = c.get(Calendar.MONTH);
|
||||
int day = c.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
ReportWFActivity activity = null;
|
||||
|
||||
if(tmpIsToDate && inputDateFrom.getText().length() > 0){
|
||||
try {
|
||||
DatePickerDialog tmpDialog = new DatePickerDialog(getActivity(), this, year, month, day);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date tmpFromDate = simpleDateFormat.parse(inputDateFrom.getText().toString());
|
||||
tmpDialog.getDatePicker().setMinDate(tmpFromDate.getTime());
|
||||
tmpIsToDate = false;
|
||||
return tmpDialog;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
DatePickerDialog tmpDialog = new DatePickerDialog(activity, this, year, month, day);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
Date tmpFromDate = simpleDateFormat.parse(inputDateFrom.getText().toString());
|
||||
tmpDialog.getDatePicker().setMinDate(tmpFromDate.getTime());
|
||||
tmpIsToDate = false;
|
||||
return tmpDialog;
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
} catch (ParseException e) {
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
return new DatePickerDialog(getActivity(), this, year, month, day);
|
||||
if(activity != null) {
|
||||
return new DatePickerDialog(activity, this, year, month, day);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity and therefore trying again to retrieve parent");
|
||||
return new DatePickerDialog(getActivity(),this, year, month, day);
|
||||
}
|
||||
}
|
||||
|
||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||
tmpInput.setText(String.format("%04d-%02d-%02d",year,month + 1,day));
|
||||
|
||||
//checkIfFinished();
|
||||
tmpInput.setText(String.format(Locale.US, "%04d-%02d-%02d",year, month + 1, day));
|
||||
}
|
||||
}
|
||||
|
||||
public void showDatePickerDialog() {
|
||||
|
||||
FragmentManager fm = getFragmentManager();
|
||||
datePickerFragment = (DatePickerFragment) fm.findFragmentByTag("Pick Date");
|
||||
if(fm != null){
|
||||
datePickerFragment = (DatePickerFragment) fm.findFragmentByTag("Pick Date");
|
||||
|
||||
if(datePickerFragment == null){
|
||||
datePickerFragment = new DatePickerFragment();
|
||||
if(datePickerFragment == null){
|
||||
datePickerFragment = new DatePickerFragment();
|
||||
}
|
||||
|
||||
datePickerFragment.show(fm, "Pick Date");
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get FragmentManager");
|
||||
}
|
||||
|
||||
datePickerFragment.show(fm, "Pick Date");
|
||||
}
|
||||
|
||||
private void checkIfFinished(){
|
||||
@@ -384,7 +409,13 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve parent activity");
|
||||
}
|
||||
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidTimeCategory() != 0){
|
||||
@@ -446,7 +477,13 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
||||
incident.setToDate(inputDateTo.getText().toString());
|
||||
incident.setToTime(inputTimeTo.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
@@ -32,6 +35,8 @@ public class ReportWF_3_Fragment extends BaseReportWFFragment {
|
||||
private final static int DONTKNOW = 7;
|
||||
private final static int ETC = 8;
|
||||
|
||||
private final static String TAG = ReportWF_3_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner suspectCategory;
|
||||
@@ -68,9 +73,9 @@ public class ReportWF_3_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initInputElements() {
|
||||
suspectCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_3_suspect);
|
||||
suspectSubCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_3_suspect_sub);
|
||||
suspectEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_3_suspect_etc);
|
||||
suspectCategory = viewFragment.findViewById(R.id.dd_reportwf_3_suspect);
|
||||
suspectSubCategory = viewFragment.findViewById(R.id.dd_reportwf_3_suspect_sub);
|
||||
suspectEtcInput = viewFragment.findViewById(R.id.txt_reportwf_3_suspect_etc);
|
||||
|
||||
suspectSubCategory.setVisibility(View.INVISIBLE);
|
||||
suspectEtcInput.setVisibility(View.INVISIBLE);
|
||||
@@ -144,8 +149,14 @@ public class ReportWF_3_Fragment extends BaseReportWFFragment {
|
||||
|
||||
|
||||
private void setMainSpinnerValues(int stringId) {
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(),stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity,stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setSubSpinnerValues(int stringId) {
|
||||
@@ -173,7 +184,12 @@ public class ReportWF_3_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidSuspectCategory() != 0) suspectCategory.setSelection(incident.getFidSuspectCategory());
|
||||
@@ -196,7 +212,12 @@ public class ReportWF_3_Fragment extends BaseReportWFFragment {
|
||||
incident.setFidSuspectSubCategory(suspectSubCategory.getSelectedItemPosition());
|
||||
incident.setEtcSuspectCategory(suspectEtcInput.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
@@ -30,6 +33,8 @@ public class ReportWF_4_Fragment extends BaseReportWFFragment {
|
||||
private final static int ETC = 6;
|
||||
private final static int DONTKNOW = 5;
|
||||
|
||||
private final static String TAG = ReportWF_4_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner suspectWeapon;
|
||||
@@ -66,8 +71,8 @@ public class ReportWF_4_Fragment extends BaseReportWFFragment {
|
||||
|
||||
|
||||
private void initInputElements() {
|
||||
suspectWeapon = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_4_weapon);
|
||||
suspectWeaponEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_4_weapon_etc);
|
||||
suspectWeapon = viewFragment.findViewById(R.id.dd_reportwf_4_weapon);
|
||||
suspectWeaponEtcInput = viewFragment.findViewById(R.id.txt_reportwf_4_weapon_etc);
|
||||
|
||||
suspectWeaponEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -108,8 +113,14 @@ public class ReportWF_4_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectWeapon.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectWeapon.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +139,12 @@ public class ReportWF_4_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidSuspectWeaponCategory() != 0) suspectWeapon.setSelection(incident.getFidSuspectWeaponCategory());
|
||||
@@ -149,7 +165,12 @@ public class ReportWF_4_Fragment extends BaseReportWFFragment {
|
||||
incident.setFidSuspectWeaponCategory(suspectWeapon.getSelectedItemPosition());
|
||||
incident.setEtcSuspectWeaponCategory(suspectWeaponEtcInput.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
@@ -23,14 +26,14 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*
|
||||
*/
|
||||
public class ReportWF_5_Fragment extends BaseReportWFFragment {
|
||||
|
||||
|
||||
private final static int SINGLE_PERSON = 1;
|
||||
private final static int SMALL_GROUP = 2;
|
||||
private final static int BIG_GROUP = 3;
|
||||
private final static int ETC = 5;
|
||||
private final static int DONTKNOW = 4;
|
||||
|
||||
private final static String TAG = ReportWF_5_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner suspectCount;
|
||||
@@ -66,8 +69,8 @@ public class ReportWF_5_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initInputElements() {
|
||||
suspectCount = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_5_count);
|
||||
suspectCountEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_5_count_etc);
|
||||
suspectCount = viewFragment.findViewById(R.id.dd_reportwf_5_count);
|
||||
suspectCountEtcInput = viewFragment.findViewById(R.id.txt_reportwf_5_count_etc);
|
||||
|
||||
suspectCountEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -105,8 +108,13 @@ public class ReportWF_5_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectCount.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectCount.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +132,12 @@ public class ReportWF_5_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidSuspectCountCategory() != 0) suspectCount.setSelection(incident.getFidSuspectCountCategory());
|
||||
@@ -145,7 +158,13 @@ public class ReportWF_5_Fragment extends BaseReportWFFragment {
|
||||
incident.setFidSuspectCountCategory(suspectCount.getSelectedItemPosition());
|
||||
incident.setEtcSuspectCountCategory(suspectCountEtcInput.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -9,6 +10,8 @@ import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
@@ -22,19 +25,17 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*
|
||||
*/
|
||||
public class ReportWF_6_Fragment extends BaseReportWFFragment {
|
||||
|
||||
private final static int WOMEN = 1;
|
||||
private final static int CHILDREN = 2;
|
||||
private final static int MEN = 3;
|
||||
private final static int ANIMALS = 4;
|
||||
private final static int INFRASTRUCTURE = 5;
|
||||
|
||||
private final static String TAG = ReportWF_6_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner victimType;
|
||||
|
||||
private IncidentReport incident;
|
||||
|
||||
private OnInputFinishedListener mCallback;
|
||||
|
||||
public interface OnInputFinishedListener {
|
||||
@@ -63,7 +64,7 @@ public class ReportWF_6_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initInputElements() {
|
||||
victimType = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_6_victim);
|
||||
victimType = viewFragment.findViewById(R.id.dd_reportwf_6_victim);
|
||||
|
||||
victimType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
@@ -93,11 +94,15 @@ public class ReportWF_6_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimType.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimType.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkIfFinished(){
|
||||
boolean isMainCategoryFilled = false;
|
||||
|
||||
@@ -112,7 +117,12 @@ public class ReportWF_6_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidVictimCategory() != 0) victimType.setSelection(incident.getFidVictimCategory());
|
||||
@@ -131,7 +141,12 @@ public class ReportWF_6_Fragment extends BaseReportWFFragment {
|
||||
private void saveInput(){
|
||||
incident.setFidVictimCategory(victimType.getSelectedItemPosition());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
@@ -23,21 +26,18 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*
|
||||
*/
|
||||
public class ReportWF_7_Fragment extends BaseReportWFFragment {
|
||||
|
||||
|
||||
private final static int LOCAL = 1;
|
||||
private final static int TOURIST = 2;
|
||||
private final static int FOREIGNER = 3;
|
||||
private final static int ETC = 5;
|
||||
private final static int DONTKNOW = 4;
|
||||
|
||||
private View viewFragment;
|
||||
private final static String TAG = ReportWF_7_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
private Spinner victimOrigin;
|
||||
private EditText victimOriginEtcInput;
|
||||
|
||||
private IncidentReport incident;
|
||||
|
||||
private OnInputFinishedListener mCallback;
|
||||
|
||||
public interface OnInputFinishedListener {
|
||||
@@ -66,8 +66,8 @@ public class ReportWF_7_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initInputElements() {
|
||||
victimOrigin = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_7_victimorigin);
|
||||
victimOriginEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_7_victimorigin_etc);
|
||||
victimOrigin = viewFragment.findViewById(R.id.dd_reportwf_7_victimorigin);
|
||||
victimOriginEtcInput = viewFragment.findViewById(R.id.txt_reportwf_7_victimorigin_etc);
|
||||
|
||||
victimOriginEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -105,8 +105,13 @@ public class ReportWF_7_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimOrigin.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimOrigin.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +129,12 @@ public class ReportWF_7_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidVictimOriginCategory() != 0) victimOrigin.setSelection(incident.getFidVictimOriginCategory());
|
||||
@@ -145,7 +155,12 @@ public class ReportWF_7_Fragment extends BaseReportWFFragment {
|
||||
incident.setFidVictimOriginCategory(victimOrigin.getSelectedItemPosition());
|
||||
incident.setEtcVictimOriginCategory(victimOriginEtcInput.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
@@ -23,8 +26,6 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*
|
||||
*/
|
||||
public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
|
||||
|
||||
private final static int FEET = 1;
|
||||
private final static int MOTORBIKE = 2;
|
||||
private final static int CAR = 3;
|
||||
@@ -47,6 +48,8 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
private final static int ANIMALS = 4;
|
||||
private final static int ETC_3 = 5;
|
||||
|
||||
private final static String TAG = ReportWF_8_Fragment.class.getSimpleName();
|
||||
|
||||
private View viewFragment;
|
||||
|
||||
private Spinner suspectVehicle;
|
||||
@@ -86,7 +89,7 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
initSuspectRecognitionInputElements();
|
||||
setSuspectRecognitionMainSpinnerValues(R.array.cat_details_suspect_recon);
|
||||
|
||||
moreEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_8_etc);
|
||||
moreEtcInput = viewFragment.findViewById(R.id.txt_reportwf_8_etc);
|
||||
|
||||
return viewFragment;
|
||||
}
|
||||
@@ -98,8 +101,8 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void initSuspectVehicleInputElements() {
|
||||
suspectVehicle = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_8_suspectvehicle);
|
||||
suspectVehicleEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_8_suspectvehicle);
|
||||
suspectVehicle = viewFragment.findViewById(R.id.dd_reportwf_8_suspectvehicle);
|
||||
suspectVehicleEtcInput = viewFragment.findViewById(R.id.txt_reportwf_8_suspectvehicle);
|
||||
|
||||
suspectVehicleEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -143,13 +146,18 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setSuspectVehicleMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectVehicle.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectVehicle.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
private void initVictimAffiliationInputElements() {
|
||||
victimAffiliation = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_8_victimaff);
|
||||
victimAffiliationEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_8_victimaff);
|
||||
victimAffiliation = viewFragment.findViewById(R.id.dd_reportwf_8_victimaff);
|
||||
victimAffiliationEtcInput = viewFragment.findViewById(R.id.txt_reportwf_8_victimaff);
|
||||
|
||||
victimAffiliationEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -193,13 +201,18 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setVictimAffiliationMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimAffiliation.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
victimAffiliation.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
private void initSuspectRecognitionInputElements() {
|
||||
suspectRecongnition = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_8_recon);
|
||||
suspectRecongnitionEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_8_recon);
|
||||
suspectRecongnition = viewFragment.findViewById(R.id.dd_reportwf_8_recon);
|
||||
suspectRecongnitionEtcInput = viewFragment.findViewById(R.id.txt_reportwf_8_recon);
|
||||
|
||||
suspectRecongnitionEtcInput.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -237,8 +250,13 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
}
|
||||
|
||||
private void setSuspectRecognitionMainSpinnerValues(int stringId){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(getActivity(), stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectRecongnition.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
ArrayAdapter<CharSequence> adapter_main_1 = ArrayAdapter.createFromResource(activity, stringId, android.R.layout.simple_spinner_dropdown_item);
|
||||
suspectRecongnition.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, activity));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkIfFinished(){
|
||||
@@ -259,7 +277,12 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
incident = ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
incident = activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
if(incident != null){
|
||||
if(incident.getFidSuspectTransportationCategory() != 0) suspectVehicle.setSelection(incident.getFidSuspectTransportationCategory());
|
||||
@@ -296,7 +319,12 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
|
||||
incident.setEtcOthersCategory(moreEtcInput.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.setIncident(incident);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,6 +344,5 @@ public class ReportWF_8_Fragment extends BaseReportWFFragment {
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@ package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
@@ -22,13 +24,15 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
*/
|
||||
public class ReportWF_Finish_Fragment extends BaseReportWFFragment {
|
||||
|
||||
private final static String TAG = ReportWF_Finish_Fragment.class.getSimpleName();
|
||||
|
||||
private SendReportListener mCallback;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||
View viewFragment = inflater.inflate(R.layout.fragment_reportwf_finish, container, false);
|
||||
|
||||
Button btnSendReport = (Button) viewFragment.findViewById(R.id.btn_reportwf_finish_send);
|
||||
Button btnSendReport = viewFragment.findViewById(R.id.btn_reportwf_finish_send);
|
||||
btnSendReport.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -41,7 +45,13 @@ public class ReportWF_Finish_Fragment extends BaseReportWFFragment {
|
||||
|
||||
@Override
|
||||
public IncidentReport getCurrentInput() {
|
||||
return ((ReportWFActivity)getActivity()).getIncident();
|
||||
ReportWFActivity activity = (ReportWFActivity) getActivity();
|
||||
if(activity != null){
|
||||
return activity.getIncident();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public interface SendReportListener {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.SettingsActivity;
|
||||
@@ -36,7 +37,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class SettingsFragment extends PreferenceFragment {
|
||||
|
||||
private final static String TAG = SettingsFragment.class.getSimpleName();
|
||||
|
||||
private ValidatedEditTextPreference prefUsername;
|
||||
@@ -171,33 +171,35 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
prefName.setOnPreferenceChangeListener(changeListener);
|
||||
prefEmail.setOnPreferenceChangeListener(changeListener);
|
||||
|
||||
btnRequestPW.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getResources().getString(R.string.txt_settings_resetpwtitle))
|
||||
.setMessage(getResources().getString(R.string.txt_settings_resetpwtext))
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
requestPasswordReset();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// do nothing
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
if(btnRequestPW != null){
|
||||
btnRequestPW.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getResources().getString(R.string.txt_settings_resetpwtitle))
|
||||
.setMessage(getResources().getString(R.string.txt_settings_resetpwtext))
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
requestPasswordReset();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// do nothing
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if(!user.get(SessionManager.PROVIDER_TYPE).equals("local")){
|
||||
btnRequestPW.setEnabled(false);
|
||||
}else{
|
||||
btnRequestPW.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
if(!user.get(SessionManager.PROVIDER_TYPE).equals("local")){
|
||||
btnRequestPW.setEnabled(false);
|
||||
}else{
|
||||
btnRequestPW.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,11 +258,12 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
((SettingsActivity) getActivity()).showMessage(getString(R.string.alert_passwordreset_confirmation));
|
||||
}else{
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error request email reset (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error request email reset (Server returned error): " + errorMsg);
|
||||
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_resetpw));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -268,7 +271,7 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error request email reset: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error request email reset: " + error.getMessage());
|
||||
((SettingsActivity) getActivity()).showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||
((SettingsActivity) getActivity()).hideDialog();
|
||||
}
|
||||
@@ -338,12 +341,13 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting user settings (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting user settings (Server returned error): " + errorMsg);
|
||||
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_changesettings));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
} finally {
|
||||
updatePrefs();
|
||||
}
|
||||
@@ -355,7 +359,7 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting user settings: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting user settings: " + error.getMessage());
|
||||
((SettingsActivity) getActivity()).showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||
((SettingsActivity) getActivity()).hideDialog();
|
||||
updatePrefs();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.deke.risk.riskahead.fragment;
|
||||
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
@@ -12,8 +11,8 @@ import android.widget.TextView;
|
||||
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.ProfileActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.deke.risk.riskahead.SubscriptionsActivity;
|
||||
import org.json.JSONException;
|
||||
@@ -27,7 +26,6 @@ import org.json.JSONObject;
|
||||
*
|
||||
*/
|
||||
public class SubscriptionItemFragment extends Fragment {
|
||||
|
||||
private final static String TAG = SubscriptionItemFragment.class.getSimpleName();
|
||||
|
||||
private SubscriptionsActivity parent;
|
||||
@@ -43,12 +41,12 @@ public class SubscriptionItemFragment extends Fragment {
|
||||
View view = inflater.inflate(R.layout.fragment_subscriptionitem, container, false);
|
||||
parent = (SubscriptionsActivity)getActivity();
|
||||
|
||||
txtTitle = (TextView) view.findViewById(R.id.txt_subs_title);
|
||||
txtDescription = (TextView) view.findViewById(R.id.txt_subs_desc);
|
||||
btnPurchase = (BootstrapButton) view.findViewById(R.id.btn_sub_purchase);
|
||||
txtTitle = view.findViewById(R.id.txt_subs_title);
|
||||
txtDescription = view.findViewById(R.id.txt_subs_desc);
|
||||
btnPurchase = view.findViewById(R.id.btn_sub_purchase);
|
||||
|
||||
imgSubs = (ImageView) view.findViewById(R.id.img_subs);
|
||||
btnBadge = (BootstrapButton) view.findViewById(R.id.btn_subs_membershiptype);
|
||||
imgSubs = view.findViewById(R.id.img_subs);
|
||||
btnBadge = view.findViewById(R.id.btn_subs_membershiptype);
|
||||
|
||||
txtTitle.setVisibility(View.GONE);
|
||||
txtDescription.setVisibility(View.GONE);
|
||||
@@ -79,7 +77,6 @@ public class SubscriptionItemFragment extends Fragment {
|
||||
btnBadge.setText(getResources().getString(R.string.lbl_membershiptype_premium));
|
||||
}
|
||||
|
||||
|
||||
txtTitle.setText(title);
|
||||
txtDescription.setText(description);
|
||||
btnPurchase.setText(price);
|
||||
@@ -98,9 +95,8 @@ public class SubscriptionItemFragment extends Fragment {
|
||||
imgSubs.setVisibility(View.VISIBLE);
|
||||
btnBadge.setVisibility(View.VISIBLE);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.ProfileActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -38,8 +39,8 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class Top10Fragment extends Fragment {
|
||||
|
||||
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
||||
|
||||
private ProfileActivity parent;
|
||||
|
||||
ListView myListView;
|
||||
@@ -51,7 +52,7 @@ public class Top10Fragment extends Fragment {
|
||||
View view = inflater.inflate(R.layout.fragment_top10list, container, false);
|
||||
parent = (ProfileActivity)getActivity();
|
||||
|
||||
myListView = (ListView) view.findViewById(R.id.lv_top10list);
|
||||
myListView = view.findViewById(R.id.lv_top10list);
|
||||
|
||||
myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
@@ -59,7 +60,8 @@ public class Top10Fragment extends Fragment {
|
||||
try {
|
||||
parent.gotoProfileActivity(resultList.get(position).getString("id"));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -70,14 +72,18 @@ public class Top10Fragment extends Fragment {
|
||||
}
|
||||
|
||||
private void getTop10ForList() {
|
||||
((ProfileActivity)getActivity()).showDialog();
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.showDialog();
|
||||
|
||||
StringRequest strReq2 = getStringRequestTop10();
|
||||
String tag_string_req2 = "req_top10";
|
||||
AppController.getInstance().addToRequestQueue(strReq2, tag_string_req2);
|
||||
StringRequest strReq2 = getStringRequestTop10();
|
||||
String tag_string_req2 = "req_top10";
|
||||
AppController.getInstance().addToRequestQueue(strReq2, tag_string_req2);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private StringRequest getStringRequestTop10() {
|
||||
return new StringRequest(Request.Method.POST, AppConfig.REST_GET_TOP10, new Response.Listener<String>() {
|
||||
|
||||
@@ -105,13 +111,20 @@ public class Top10Fragment extends Fragment {
|
||||
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting top 10 stats (Server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting top 10 stats (Server returned error): " + errorMsg);
|
||||
parent.showMessage(getResources().getString(R.string.txt_errormsg_gettop10));
|
||||
}
|
||||
|
||||
((ProfileActivity)getActivity()).hideDialog();
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.hideDialog();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,10 +132,15 @@ public class Top10Fragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting top 10 stats: " + error.getMessage());
|
||||
((ProfileActivity)getActivity()).hideDialog();
|
||||
((ProfileActivity)getActivity()).handleVolleyErrorResponse();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting top 10 stats: " + error.getMessage());
|
||||
|
||||
ProfileActivity activity = (ProfileActivity) getActivity();
|
||||
if(activity != null){
|
||||
activity.hideDialog();
|
||||
activity.handleVolleyErrorResponse();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get parent Activity");
|
||||
}
|
||||
}
|
||||
}) {
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.widget.Toast;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
@@ -35,6 +36,7 @@ import org.deke.risk.riskahead.R;
|
||||
*
|
||||
*/
|
||||
public class TwitterButtonFragment extends Fragment {
|
||||
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
||||
|
||||
private BootstrapButton btnLoginTW;
|
||||
private TwitterAuthClient client;
|
||||
@@ -68,7 +70,7 @@ public class TwitterButtonFragment extends Fragment {
|
||||
client = new TwitterAuthClient();
|
||||
|
||||
view = inflater.inflate(R.layout.fragment_twitter_button, container, false);
|
||||
btnLoginTW = (BootstrapButton) view.findViewById(R.id.btn_login_twitter);
|
||||
btnLoginTW = view.findViewById(R.id.btn_login_twitter);
|
||||
|
||||
btnLoginTW.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -87,7 +89,7 @@ public class TwitterButtonFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void failure(TwitterException exception) {
|
||||
Log.e("Twitter", "onFailure wird ausgeführt: "+exception);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "onFailure wird ausgeführt: "+exception);
|
||||
showMessage("Could not log in with Twitter. Please use E-Mail instead or try again later.");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AppRater {
|
||||
}
|
||||
}
|
||||
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class AppRater {
|
||||
|
||||
Long date_firstLaunch = System.currentTimeMillis();
|
||||
editor.putLong("date_firstlaunch", date_firstLaunch);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
alert.setNegativeButton(R.string.txt_rate_neverbtn,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.deke.risk.riskahead.helper;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.AlertDialog;
|
||||
@@ -19,7 +18,6 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@@ -45,6 +43,7 @@ import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.android.gms.ads.AdListener;
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.InterstitialAd;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
import com.mikepenz.materialdrawer.AccountHeader;
|
||||
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
|
||||
@@ -153,7 +152,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
Log.d(TAG, user.get(SessionManager.KEY_UID));
|
||||
|
||||
mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
mToolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
initNavigationDrawer(savedInstanceState);
|
||||
|
||||
@@ -169,9 +168,11 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
|
||||
am.setInexactRepeating(AlarmManager.RTC, firstStart, interval,
|
||||
wtdSServicePendingIntent);
|
||||
|
||||
if (am != null){
|
||||
am.setInexactRepeating(AlarmManager.RTC, firstStart, interval, wtdSServicePendingIntent);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "AlarmManager in BaseActivity is null. No AlarmManager found.");
|
||||
}
|
||||
|
||||
startService(new Intent(this, NotificationService.class));
|
||||
} else {
|
||||
@@ -213,14 +214,21 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
try {
|
||||
unregisterReceiver(myReceiver);
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initProgressDialog() {
|
||||
pDialog = new Dialog(this);
|
||||
pDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
pDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
|
||||
if(pDialog.getWindow() != null){
|
||||
pDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "ProgressDialog Window is null. Could not set BackgroundDrawable.");
|
||||
}
|
||||
|
||||
pDialog.setContentView(R.layout.dialog_progresscircle);
|
||||
}
|
||||
|
||||
@@ -373,9 +381,18 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void isNetworkAvailable() {
|
||||
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
|
||||
NetworkInfo activeNetworkInfo;
|
||||
|
||||
if(connectivityManager != null){
|
||||
activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve connectivityManager. Network Status can not be checked.");
|
||||
return;
|
||||
}
|
||||
|
||||
// In case no activeNetworkInfo is found actually no standard network is present. Output message bos in that case
|
||||
if (activeNetworkInfo == null) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(getString(R.string.alert_internetconnection_title))
|
||||
@@ -620,7 +637,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
try {
|
||||
((TextView) dialoglayout.findViewById(R.id.lbl_about_version)).setText(String.format("Version: %s", getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(BaseActivity.this)
|
||||
@@ -674,17 +692,18 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void sendFeedback(String feedback) {
|
||||
String sysprop = "";
|
||||
StringBuilder sysprop = new StringBuilder();
|
||||
|
||||
java.util.Properties props = System.getProperties();
|
||||
java.util.Enumeration e = props.propertyNames();
|
||||
while (e.hasMoreElements()) {
|
||||
String k = (String) e.nextElement();
|
||||
String v = props.getProperty(k);
|
||||
sysprop += k + ": " + v + "\n";
|
||||
sysprop.append(k).append(": ").append(v).append("\n");
|
||||
}
|
||||
|
||||
|
||||
StringRequest strReq = getStringRequestSendFeedback(feedback, sysprop);
|
||||
StringRequest strReq = getStringRequestSendFeedback(feedback, sysprop.toString());
|
||||
String tag_string_req = "reqsendfeedback";
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
@@ -704,10 +723,11 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
showMessage(getString(R.string.txt_feedback_response));
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error sending feedback (server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error sending feedback (server returned error): " + errorMsg);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -715,7 +735,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error sending feedback: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error sending feedback: " + error.getMessage());
|
||||
}
|
||||
}) {
|
||||
|
||||
@@ -751,11 +771,14 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
private boolean isMyNotificationServiceRunning() {
|
||||
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
|
||||
if (NotificationService.class.getName().equals(service.service.getClassName())) {
|
||||
return true;
|
||||
if(manager != null){
|
||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
|
||||
if (NotificationService.class.getName().equals(service.service.getClassName())) return true;
|
||||
}
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not retrieve Activity_Service Manager.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@ package org.deke.risk.riskahead.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.maps.model.BitmapDescriptor;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.google.maps.android.clustering.ClusterItem;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -15,6 +17,7 @@ import org.json.JSONObject;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,6 +27,7 @@ import java.util.Date;
|
||||
*
|
||||
*/
|
||||
public class IncidentReport implements ClusterItem {
|
||||
private final static String TAG = IncidentReport.class.getSimpleName();
|
||||
|
||||
private int id = 0;
|
||||
private LatLng incidentPosition;
|
||||
@@ -134,14 +138,13 @@ public class IncidentReport implements ClusterItem {
|
||||
if(mIncident.has("fid_others")) this.fidOthersCategory = mIncident.getInt("fid_others");
|
||||
if(mIncident.has("etc_others")) this.etcOthersCategory = mIncident.getString("etc_others");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
public BitmapDescriptor getIcon() {
|
||||
BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(getIconDrawable());
|
||||
|
||||
return icon;
|
||||
return BitmapDescriptorFactory.fromResource(getIconDrawable());
|
||||
}
|
||||
|
||||
public int getIconDrawable() {
|
||||
@@ -149,18 +152,19 @@ public class IncidentReport implements ClusterItem {
|
||||
|
||||
Date tmpFromDate = null;
|
||||
SimpleDateFormat simpleDateFormat;
|
||||
Date today = new Date(System.currentTimeMillis()-1*60*60*1000);
|
||||
Date today = new Date(System.currentTimeMillis()-60*60*1000);
|
||||
|
||||
try {
|
||||
if(this.fromDate != null && this.fromTime != null){
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.US);
|
||||
tmpFromDate = simpleDateFormat.parse(this.fromDate+" "+this.fromTime);
|
||||
}else if(this.fromDate != null){
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
tmpFromDate = simpleDateFormat.parse(this.fromDate);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
switch (this.fidIncidentCategory) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import org.deke.risk.riskahead.MapsActivity;
|
||||
import org.deke.risk.riskahead.R;
|
||||
@@ -32,6 +33,7 @@ import org.json.JSONObject;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,6 @@ import java.util.Map;
|
||||
*
|
||||
*/
|
||||
public class NotificationService extends Service {
|
||||
|
||||
private final static String TAG = NotificationService.class.getSimpleName();
|
||||
private final static String EXTRA_MESSAGE = "org.deke.risk.riskahead.MESSAGE";
|
||||
|
||||
@@ -223,10 +224,11 @@ public class NotificationService extends Service {
|
||||
sentNotification(notification);
|
||||
} else {
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Log.e(TAG, "Error getting incident notification (server returned error): " + errorMsg);
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting incident notification (server returned error): " + errorMsg);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -234,7 +236,7 @@ public class NotificationService extends Service {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Error getting incident notification: " + error.getMessage());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Error getting incident notification: " + error.getMessage());
|
||||
}
|
||||
}) {
|
||||
|
||||
@@ -264,7 +266,7 @@ public class NotificationService extends Service {
|
||||
context = notification.length() + " " + getString(R.string.txt_notification_context_multi);
|
||||
}
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(getApplicationContext())
|
||||
new NotificationCompat.Builder(getApplicationContext(), "MyChannelId_01")
|
||||
.setSmallIcon(R.drawable.logo_380)
|
||||
.setAutoCancel(true)
|
||||
.setContentTitle(title)
|
||||
@@ -276,7 +278,8 @@ public class NotificationService extends Service {
|
||||
try {
|
||||
resultIntent.putExtra(EXTRA_MESSAGE, notification.getJSONObject(notification.length()-1).getDouble("latitude")+":"+notification.getJSONObject(notification.length()-1).getDouble("longitude"));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
||||
@@ -291,7 +294,7 @@ public class NotificationService extends Service {
|
||||
mBuilder.setContentIntent(resultPendingIntent);
|
||||
|
||||
mNotificationManager.notify(1, mBuilder.build());
|
||||
session.setLastNotification(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()));
|
||||
session.setLastNotification(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Calendar.getInstance().getTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,12 +5,14 @@ import android.util.Log;
|
||||
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
import com.google.maps.android.clustering.ClusterManager;
|
||||
import com.google.maps.android.clustering.view.DefaultClusterRenderer;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -20,7 +22,7 @@ import java.util.Date;
|
||||
*
|
||||
*/
|
||||
public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
|
||||
|
||||
private final static String TAG = OwnIconRendered.class.getSimpleName();
|
||||
Context context;
|
||||
|
||||
public OwnIconRendered(Context context, GoogleMap map,ClusterManager<IncidentReport> clusterManager) {
|
||||
@@ -32,11 +34,9 @@ public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
|
||||
protected void onBeforeClusterItemRendered(IncidentReport item, MarkerOptions markerOptions) {
|
||||
markerOptions.icon(item.getIcon());
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
Date dateToCheck = null;
|
||||
|
||||
|
||||
|
||||
try {
|
||||
if(item.getToDate() != null && !item.getToDate().equals("0000-00-00")){
|
||||
dateToCheck = simpleDateFormat.parse(item.getToDate());
|
||||
@@ -44,7 +44,8 @@ public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
|
||||
dateToCheck = simpleDateFormat.parse(item.getFromDate());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "ParseException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
if(dateToCheck != null && !dateToCheck.after(new Date(System.currentTimeMillis()-14*24*60*60*1000))){
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.deke.risk.riskahead.helper;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -16,18 +20,20 @@ import org.json.JSONObject;
|
||||
*
|
||||
*/
|
||||
public class PlaceJSONParser {
|
||||
private final static String TAG = PlaceJSONParser.class.getSimpleName();
|
||||
|
||||
/** Receives a JSONObject and returns a list */
|
||||
public List<HashMap<String,String>> parse(JSONObject jObject){
|
||||
|
||||
JSONArray jPlaces = null;
|
||||
try {
|
||||
/** Retrieves all the elements in the 'places' array */
|
||||
/* Retrieves all the elements in the 'places' array */
|
||||
jPlaces = jObject.getJSONArray("predictions");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
/** Invoking getPlaces with the array of json object
|
||||
/* Invoking getPlaces with the array of json object
|
||||
* where each json object represent a place
|
||||
*/
|
||||
return getPlaces(jPlaces);
|
||||
@@ -38,15 +44,16 @@ public class PlaceJSONParser {
|
||||
List<HashMap<String, String>> placesList = new ArrayList<>();
|
||||
HashMap<String, String> place;
|
||||
|
||||
/** Taking each place, parses and adds to list object */
|
||||
/* Taking each place, parses and adds to list object */
|
||||
for(int i=0; i<placesCount;i++){
|
||||
try {
|
||||
/** Call getPlace with place JSON object to parse the place */
|
||||
/* Call getPlace with place JSON object to parse the place */
|
||||
place = getPlace((JSONObject)jPlaces.get(i));
|
||||
placesList.add(place);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +80,8 @@ public class PlaceJSONParser {
|
||||
place.put("reference",reference);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
return place;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.deke.risk.riskahead.helper;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -15,6 +19,7 @@ import org.json.JSONObject;
|
||||
*
|
||||
*/
|
||||
public class PlaceJSONParserDetail {
|
||||
private final static String TAG = PlaceJSONParserDetail.class.getSimpleName();
|
||||
|
||||
/** Receives a JSONObject and returns a list */
|
||||
public List<HashMap<String,String>> parse(JSONObject jObject){
|
||||
@@ -30,9 +35,9 @@ public class PlaceJSONParserDetail {
|
||||
lat = (Double)jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location").get("lat");
|
||||
lng = (Double)jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location").get("lng");
|
||||
formattedAddress = (String) jObject.getJSONObject("result").get("formatted_address");
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
hm.put("lat", Double.toString(lat));
|
||||
|
||||
@@ -23,6 +23,8 @@ import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
/**
|
||||
*
|
||||
* (C) Copyright 2016 RiskAhead (http://www.riskahead.net)
|
||||
@@ -31,7 +33,7 @@ import android.util.Log;
|
||||
*
|
||||
*/
|
||||
public class PlaceProvider extends ContentProvider {
|
||||
|
||||
private final static String TAG = PlaceProvider.class.getSimpleName();
|
||||
public static final String AUTHORITY = "org.deke.risk.riskahead.helper.PlaceProvider";
|
||||
|
||||
public static final Uri SEARCH_URI = Uri.parse("content://"+AUTHORITY+"/search");
|
||||
@@ -71,13 +73,13 @@ public class PlaceProvider extends ContentProvider {
|
||||
PlaceJSONParser parser = new PlaceJSONParser();
|
||||
PlaceJSONParserDetail detailsParser = new PlaceJSONParserDetail();
|
||||
|
||||
String jsonString = "";
|
||||
String jsonPlaceDetails = "";
|
||||
String jsonString;
|
||||
String jsonPlaceDetails;
|
||||
|
||||
List<HashMap<String, String>> list = null;
|
||||
List<HashMap<String, String>> list;
|
||||
List<HashMap<String, String>> detailsList = null;
|
||||
|
||||
MatrixCursor mCursor = null;
|
||||
MatrixCursor mCursor;
|
||||
|
||||
switch(mUriMatcher.match(uri)){
|
||||
case SEARCH:
|
||||
@@ -118,7 +120,8 @@ public class PlaceProvider extends ContentProvider {
|
||||
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
c = mCursor;
|
||||
break;
|
||||
@@ -146,7 +149,8 @@ public class PlaceProvider extends ContentProvider {
|
||||
mCursor.addRow(new String[] { Integer.toString(i), hMap.get("description"), hMap.get("reference") });
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
c = mCursor;
|
||||
break;
|
||||
@@ -160,13 +164,19 @@ public class PlaceProvider extends ContentProvider {
|
||||
try {
|
||||
detailsList = detailsParser.parse(new JSONObject(jsonPlaceDetails));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "JSONException caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
|
||||
for(int j=0;j<detailsList.size();j++){
|
||||
HashMap<String, String> hMapDetails = detailsList.get(j);
|
||||
mCursor.addRow(new String[]{ hMapDetails.get("formatted_address") , hMapDetails.get("lat") , hMapDetails.get("lng") });
|
||||
if(detailsList != null){
|
||||
for(int j = 0; j < detailsList.size(); j++){
|
||||
HashMap<String, String> hMapDetails = detailsList.get(j);
|
||||
mCursor.addRow(new String[]{ hMapDetails.get("formatted_address") , hMapDetails.get("lat") , hMapDetails.get("lng") });
|
||||
}
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "DetailsList is null");
|
||||
}
|
||||
|
||||
c = mCursor;
|
||||
break;
|
||||
}
|
||||
@@ -229,10 +239,11 @@ public class PlaceProvider extends ContentProvider {
|
||||
br.close();
|
||||
|
||||
}catch(Exception e){
|
||||
Log.d("Exception downloading", e.toString());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "downloadURL Exception");
|
||||
FirebaseCrash.report(e);
|
||||
}finally{
|
||||
iStream.close();
|
||||
urlConnection.disconnect();
|
||||
if(iStream != null) iStream.close();
|
||||
if(urlConnection != null) urlConnection.disconnect();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -291,7 +302,8 @@ public class PlaceProvider extends ContentProvider {
|
||||
// Fetching the data from web service in background
|
||||
data = downloadUrl(url);
|
||||
}catch(Exception e){
|
||||
Log.d("Background Task",e.toString());
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught in backgroundTask");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -302,7 +314,8 @@ public class PlaceProvider extends ContentProvider {
|
||||
try {
|
||||
data = downloadUrl(url);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Exception caught");
|
||||
FirebaseCrash.report(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.content.Intent;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.crash.FirebaseCrash;
|
||||
|
||||
/**
|
||||
*
|
||||
* (C) Copyright 2016 RiskAhead (http://www.riskahead.net)
|
||||
@@ -20,7 +22,7 @@ public class RABroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||
Log.d(TAG, "BroadcastReceiver received intent");
|
||||
|
||||
Intent wtdSServiceIntent = new Intent(context, NotificationService.class);
|
||||
@@ -30,10 +32,12 @@ public class RABroadcastReceiver extends BroadcastReceiver {
|
||||
long interval = DateUtils.MINUTE_IN_MILLIS * 2;
|
||||
long firstStart = System.currentTimeMillis() + interval;
|
||||
|
||||
AlarmManager am = (AlarmManager) context
|
||||
.getSystemService(Context.ALARM_SERVICE);
|
||||
am.setInexactRepeating(AlarmManager.RTC, firstStart,
|
||||
interval, wtdSServicePendingIntent);
|
||||
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
if(am != null){
|
||||
am.setInexactRepeating(AlarmManager.RTC, firstStart,interval, wtdSServicePendingIntent);
|
||||
}else{
|
||||
FirebaseCrash.logcat(Log.ERROR, TAG, "Could not get AlarmManager");
|
||||
}
|
||||
|
||||
Log.v(TAG, "AlarmManager gesetzt");
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ import java.util.HashMap;
|
||||
*
|
||||
*/
|
||||
public class SessionManager {
|
||||
|
||||
|
||||
private static String TAG = SessionManager.class.getSimpleName();
|
||||
|
||||
SharedPreferences status;
|
||||
|
||||
@@ -13,7 +13,6 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
|
||||
@@ -24,9 +23,7 @@ import org.deke.risk.riskahead.R;
|
||||
* Date of Release: 10.02.2016
|
||||
*
|
||||
*/
|
||||
public class ValidatedEditTextPreference extends EditTextPreference
|
||||
{
|
||||
|
||||
public class ValidatedEditTextPreference extends EditTextPreference {
|
||||
private final static int TYPE_VARIATION_EMAIL_ADDRESS = 33;
|
||||
|
||||
public ValidatedEditTextPreference(Context ctx, AttributeSet attrs, int defStyle)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:tint="@color/white"
|
||||
android:src="@android:drawable/ic_input_add"
|
||||
app:borderWidth="0dp"
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
android:layout_above="@+id/layoutFooter"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@android:drawable/ic_dialog_map" />
|
||||
|
||||
<com.beardedhen.androidbootstrap.AwesomeTextView
|
||||
|
||||
@@ -299,6 +299,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@android:drawable/ic_dialog_map" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
@@ -308,7 +309,8 @@
|
||||
android:layout_margin="16dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:clickable="true" />
|
||||
android:clickable="true"
|
||||
android:focusable="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -434,5 +434,6 @@
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
</string-array>
|
||||
<string name="asset_statements" translatable="false">[{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://www.riskahead.net\",\n }\n}]</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user