DT @06.01.2016: SettingsActivity mit ValidatedEditTextPreference ausgestattet. SSL Requests für Login/Registration hinzugefügt und LoginActivity refactored
This commit is contained in:
Binary file not shown.
@@ -120,6 +120,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ReportWFActivity"
|
android:name=".ReportWFActivity"
|
||||||
android:label="@string/title_activity_report_wf" />
|
android:label="@string/title_activity_report_wf" />
|
||||||
|
|
||||||
|
<service android:name=".helper.NotificationService"
|
||||||
|
android:exported="false" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
private TextView input_email;
|
private TextView input_email;
|
||||||
private TextView input_username;
|
private TextView input_username;
|
||||||
private TextView input_password;
|
private TextView input_password;
|
||||||
|
private TextView btn_requestPW;
|
||||||
|
|
||||||
private ProgressDialog pDialog;
|
private ProgressDialog pDialog;
|
||||||
private SessionManager session;
|
private SessionManager session;
|
||||||
@@ -56,51 +57,94 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
session = new SessionManager(getApplicationContext());
|
||||||
|
|
||||||
|
pDialog = new ProgressDialog(this);
|
||||||
|
pDialog.setMessage("Sending data...");
|
||||||
|
pDialog.setCancelable(false);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
msg_intent = intent.getStringExtra(LoginActivity.EXTRA_MESSAGE);
|
msg_intent = intent.getStringExtra(LoginActivity.EXTRA_MESSAGE);
|
||||||
|
|
||||||
pDialog = new ProgressDialog(this);
|
|
||||||
pDialog.setCancelable(false);
|
|
||||||
|
|
||||||
session = new SessionManager(getApplicationContext());
|
|
||||||
|
|
||||||
if(msg_intent.equals("login")){
|
if(msg_intent.equals("login")){
|
||||||
setContentView(R.layout.activity_login);
|
initLoginView();
|
||||||
}else if(msg_intent.equals("register")){
|
}else if(msg_intent.equals("register")){
|
||||||
setContentView(R.layout.activity_register);
|
initRegisterView();
|
||||||
input_username = (TextView) findViewById(R.id.input_register_name);
|
|
||||||
|
|
||||||
input_username.addTextChangedListener(new TextValidator(input_username,getApplicationContext()) {
|
|
||||||
@Override
|
|
||||||
public void validate(TextView textView, String text) {
|
|
||||||
if (text.length() < 5) {
|
|
||||||
textView.setError(getString(R.string.error_anytext));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initSocialLoginButtons();
|
||||||
|
initMyLoginButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initLoginView() {
|
||||||
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
input_email = (TextView) findViewById(R.id.input_register_email);
|
input_email = (TextView) findViewById(R.id.input_register_email);
|
||||||
input_password = (TextView) findViewById(R.id.input_register_password);
|
input_password = (TextView) findViewById(R.id.input_register_password);
|
||||||
|
btn_requestPW = (TextView) findViewById(R.id.lbl_login_resendPW);
|
||||||
|
|
||||||
input_email.addTextChangedListener(new TextValidator(input_email,getApplicationContext()) {
|
input_email.addTextChangedListener(new TextValidator(input_email, getApplicationContext()) {
|
||||||
@Override
|
@Override
|
||||||
public void validate(TextView textView, String text) {
|
public void validate(TextView textView, String text) {
|
||||||
if(!Patterns.EMAIL_ADDRESS.matcher(text).matches()){
|
if (!Patterns.EMAIL_ADDRESS.matcher(text).matches()) {
|
||||||
textView.setError(getString(R.string.error_email));
|
textView.setError(getString(R.string.error_email));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
input_password.addTextChangedListener(new TextValidator(input_password,getApplicationContext()) {
|
input_password.addTextChangedListener(new TextValidator(input_password, getApplicationContext()) {
|
||||||
@Override
|
@Override
|
||||||
public void validate(TextView textView, String text) {
|
public void validate(TextView textView, String text) {
|
||||||
if(text.length() < 5) {
|
if (text.length() < 5) {
|
||||||
textView.setError(getString(R.string.error_password));
|
textView.setError(getString(R.string.error_password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
btn_requestPW.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
onRequestNewPasswordClick(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRegisterView() {
|
||||||
|
setContentView(R.layout.activity_register);
|
||||||
|
|
||||||
|
input_username = (TextView) findViewById(R.id.input_register_name);
|
||||||
|
input_email = (TextView) findViewById(R.id.input_register_email);
|
||||||
|
input_password = (TextView) findViewById(R.id.input_register_password);
|
||||||
|
|
||||||
|
input_username.addTextChangedListener(new TextValidator(input_username,getApplicationContext()) {
|
||||||
|
@Override
|
||||||
|
public void validate(TextView textView, String text) {
|
||||||
|
if (text.length() < 5) {
|
||||||
|
textView.setError(getString(R.string.error_anytext));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
input_email.addTextChangedListener(new TextValidator(input_email, getApplicationContext()) {
|
||||||
|
@Override
|
||||||
|
public void validate(TextView textView, String text) {
|
||||||
|
if (!Patterns.EMAIL_ADDRESS.matcher(text).matches()) {
|
||||||
|
textView.setError(getString(R.string.error_email));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
input_password.addTextChangedListener(new TextValidator(input_password, getApplicationContext()) {
|
||||||
|
@Override
|
||||||
|
public void validate(TextView textView, String text) {
|
||||||
|
if (text.length() < 5) {
|
||||||
|
textView.setError(getString(R.string.error_password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSocialLoginButtons() {
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
FacebookButtonFragment fragmentFB = new FacebookButtonFragment();
|
FacebookButtonFragment fragmentFB = new FacebookButtonFragment();
|
||||||
GooglePlusButtonFragment fragmentGP = new GooglePlusButtonFragment();
|
GooglePlusButtonFragment fragmentGP = new GooglePlusButtonFragment();
|
||||||
@@ -108,11 +152,9 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||||
transaction.add(R.id.frag_login_btnGP, fragmentGP);
|
transaction.add(R.id.frag_login_btnGP, fragmentGP);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
|
||||||
initMySigninButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMySigninButton() {
|
private void initMyLoginButton() {
|
||||||
btn_login = (Button) findViewById(R.id.btn_register);
|
btn_login = (Button) findViewById(R.id.btn_register);
|
||||||
btn_login.setOnClickListener(new View.OnClickListener() {
|
btn_login.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -126,7 +168,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
showMessage(getString(R.string.error_validation));
|
showMessage(getString(R.string.error_validation));
|
||||||
} else {
|
} else {
|
||||||
showDialog();
|
showDialog();
|
||||||
checkLogin(email, password);
|
performLogin(email, password);
|
||||||
}
|
}
|
||||||
} else if (msg_intent.equals("register")) {
|
} else if (msg_intent.equals("register")) {
|
||||||
String name = input_username.getText().toString();
|
String name = input_username.getText().toString();
|
||||||
@@ -134,7 +176,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
showMessage(getString(R.string.error_validation));
|
showMessage(getString(R.string.error_validation));
|
||||||
} else {
|
} else {
|
||||||
showDialog();
|
showDialog();
|
||||||
registerUser(name, email, password);
|
performRegistration(name, email, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,52 +184,16 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void performLogin(final String email, final String password) {
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
String tag_string_req = "req_login";
|
||||||
getMenuInflater().inflate(R.menu.menu_common, menu);
|
StringRequest strReq = getStringRequestLogin(email, password);
|
||||||
return true;
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void performRegistration(final String username, final String email, final String password) {
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
String tag_string_req = "req_register";
|
||||||
int id = item.getItemId();
|
StringRequest strReq = getStringRequestRegisterUser(username, email, password);
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
if((id == R.id.menu_action_exit)){
|
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
|
||||||
intent.addCategory(Intent.CATEGORY_HOME);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}else if((id == R.id.menu_action_about)){
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/about/"));
|
|
||||||
startActivity(browserIntent);
|
|
||||||
}else if((id == R.id.menu_action_help)){
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/contact/"));
|
|
||||||
startActivity(browserIntent);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
|
|
||||||
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
|
||||||
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnGP);
|
|
||||||
fragment.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
TwitterButtonFragment twitter_fragment = (TwitterButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnTW);
|
|
||||||
if (twitter_fragment != null) {
|
|
||||||
twitter_fragment.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
FacebookButtonFragment facebook_fragment = (FacebookButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnFB);
|
|
||||||
if (facebook_fragment != null) {
|
|
||||||
facebook_fragment.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("Test","GOT ACTIVITY RESULT!!!:"+requestCode+" : "+resultCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSocialMediaLogin(final String key, final String providerType, final String username, final String email){
|
public void handleSocialMediaLogin(final String key, final String providerType, final String username, final String email){
|
||||||
@@ -207,19 +213,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkLogin(final String email, final String password) {
|
public void onRequestNewPasswordClick(View view){
|
||||||
String tag_string_req = "req_login";
|
|
||||||
StringRequest strReq = getStringRequestLogin(email, password);
|
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerUser(final String username, final String email,final String password) {
|
|
||||||
String tag_string_req = "req_register";
|
|
||||||
StringRequest strReq = getStringRequestRegisterUser(username, email, password);
|
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(View view){
|
|
||||||
if(input_email.getText() != null && input_email.getText().toString().isEmpty()){
|
if(input_email.getText() != null && input_email.getText().toString().isEmpty()){
|
||||||
showMessage(getString(R.string.message_enteremail));
|
showMessage(getString(R.string.message_enteremail));
|
||||||
return;
|
return;
|
||||||
@@ -230,11 +224,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
.setMessage(getString(R.string.alert_passwordreset_text))
|
.setMessage(getString(R.string.alert_passwordreset_text))
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
String tag_string_req = "requestpwreset";
|
performRequestNewPassword();
|
||||||
StringRequest strReq = getStringRequestResetPW(input_email.getText().toString());
|
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
|
||||||
|
|
||||||
showMessage(getString(R.string.alert_passwordreset_confirmation));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||||
@@ -246,8 +236,14 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void performRequestNewPassword() {
|
||||||
|
String tag_string_req = "requestpwreset";
|
||||||
|
StringRequest strReq = getStringRequestResetPW(input_email.getText().toString());
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestSocialMediaLogin(final String key, final String providerType, final String username, final String email) {
|
private StringRequest getStringRequestSocialMediaLogin(final String key, final String providerType, final String username, final String email) {
|
||||||
return new StringRequest(Method.POST,AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Method.POST,AppConfig.URL_ENCRYPTED, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -319,7 +315,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestLogin(final String email, final String password) {
|
private StringRequest getStringRequestLogin(final String email, final String password) {
|
||||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Method.POST, AppConfig.URL_ENCRYPTED, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -407,7 +403,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestRegisterUser(final String username, final String email, final String password) {
|
private StringRequest getStringRequestRegisterUser(final String username, final String email, final String password) {
|
||||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Method.POST, AppConfig.URL_ENCRYPTED, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -468,7 +464,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestResetPW(final String email) {
|
private StringRequest getStringRequestResetPW(final String email) {
|
||||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Method.POST, AppConfig.URL_ENCRYPTED, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -479,6 +475,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
JSONObject jObj = new JSONObject(response);
|
JSONObject jObj = new JSONObject(response);
|
||||||
boolean error = jObj.getBoolean("error");
|
boolean error = jObj.getBoolean("error");
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
showMessage(getString(R.string.alert_passwordreset_confirmation));
|
||||||
} else {
|
} else {
|
||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Toast.makeText(getApplicationContext(),
|
Toast.makeText(getApplicationContext(),
|
||||||
@@ -513,7 +510,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestActivationLinkUser(final String email) {
|
private StringRequest getStringRequestActivationLinkUser(final String email) {
|
||||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Method.POST, AppConfig.URL_ENCRYPTED, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -560,7 +557,6 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onFragmentInteraction(Uri uri){
|
public void onFragmentInteraction(Uri uri){
|
||||||
//you can leave it empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDialog() {
|
private void showDialog() {
|
||||||
@@ -568,18 +564,56 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
pDialog.show();
|
pDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
Intent intent = new Intent(
|
|
||||||
LoginActivity.this,
|
|
||||||
StartActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideDialog() {
|
private void hideDialog() {
|
||||||
if (pDialog.isShowing())
|
if (pDialog.isShowing())
|
||||||
pDialog.dismiss();
|
pDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_common, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
if((id == R.id.menu_action_exit)){
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}else if((id == R.id.menu_action_about)){
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/about/"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
}else if((id == R.id.menu_action_help)){
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/contact/"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
||||||
|
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnGP);
|
||||||
|
fragment.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
TwitterButtonFragment twitter_fragment = (TwitterButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnTW);
|
||||||
|
if (twitter_fragment != null) {
|
||||||
|
twitter_fragment.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
FacebookButtonFragment facebook_fragment = (FacebookButtonFragment) getSupportFragmentManager().findFragmentById(R.id.frag_login_btnFB);
|
||||||
|
if (facebook_fragment != null) {
|
||||||
|
facebook_fragment.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("Test", "GOT ACTIVITY RESULT!!!:" + requestCode + " : " + resultCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
package org.deke.risk.riskahead;
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.app.TaskStackBuilder;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -26,13 +21,10 @@ import org.deke.risk.riskahead.helper.AppConfig;
|
|||||||
import org.deke.risk.riskahead.helper.AppController;
|
import org.deke.risk.riskahead.helper.AppController;
|
||||||
import org.deke.risk.riskahead.helper.BaseActivity;
|
import org.deke.risk.riskahead.helper.BaseActivity;
|
||||||
import org.deke.risk.riskahead.helper.SessionManager;
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -93,7 +85,7 @@ public class MainActivity extends BaseActivity{
|
|||||||
.color(getResources().getColor(R.color.white))
|
.color(getResources().getColor(R.color.white))
|
||||||
.sizeDp(24);
|
.sizeDp(24);
|
||||||
|
|
||||||
map.setCompoundDrawables(null,null, mapIcon, null);
|
map.setCompoundDrawables(null, null, mapIcon, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +142,7 @@ public class MainActivity extends BaseActivity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestIncidentCount() {
|
private StringRequest getStringRequestIncidentCount() {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -127,11 +127,14 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
||||||
findViewById(R.id.fab_reportwf_map).setVisibility(View.VISIBLE);
|
findViewById(R.id.fab_reportwf_map).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if(getIntent().getStringExtra(EXTRA_MESSAGE).equals("NoIncident")){
|
String intentMessage = getIntent().getStringExtra(EXTRA_MESSAGE);
|
||||||
|
if(session.getNotificationPositionRequest()){
|
||||||
findViewById(R.id.fab_reportwf_map).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.fab_reportwf_map).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
session.setLocation((long)markedLocation.latitude,(long)markedLocation.longitude);
|
session.setLocation(Double.doubleToRawLongBits(markedLocation.latitude), Double.doubleToRawLongBits(markedLocation.longitude));
|
||||||
|
Log.d(TAG, "MARKED LOCATION: " + markedLocation.latitude + " " + markedLocation.longitude);
|
||||||
|
session.setNotificationPositionRequest(false);
|
||||||
gotoSettingsActivity();
|
gotoSettingsActivity();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -293,7 +296,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestGetAllIncidentsForHeatMapFromBound(final LatLng northeast, final LatLng southwest) {
|
private StringRequest getStringRequestGetAllIncidentsForHeatMapFromBound(final LatLng northeast, final LatLng southwest) {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -340,7 +343,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestGetAllIncidentsFromBound(final LatLng northeast, final LatLng southwest) {
|
private StringRequest getStringRequestGetAllIncidentsFromBound(final LatLng northeast, final LatLng southwest) {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -419,7 +422,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestGetIncidentScoreForInfoWindow(final View infoView, final String incidentID) {
|
private StringRequest getStringRequestGetIncidentScoreForInfoWindow(final View infoView, final String incidentID) {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -522,10 +525,10 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
} else if(Intent.ACTION_VIEW.equals(intent.getAction())) {
|
} else if(Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||||
getPlace(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
|
getPlace(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
|
||||||
} else {
|
} else {
|
||||||
String pos = intent.getStringExtra(EXTRA_MESSAGE);
|
String intentMessage = intent.getStringExtra(EXTRA_MESSAGE);
|
||||||
|
|
||||||
if(pos != null) {
|
if(intentMessage != null && intentMessage.contains(":")) {
|
||||||
String[] position = pos.split(":");
|
String[] position = intentMessage.split(":");
|
||||||
|
|
||||||
String latitude = position[0];
|
String latitude = position[0];
|
||||||
String longitude = position[1];
|
String longitude = position[1];
|
||||||
@@ -534,6 +537,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
||||||
} else {
|
} else {
|
||||||
myPosition = session.getLocation();
|
myPosition = session.getLocation();
|
||||||
|
|
||||||
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0))
|
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0))
|
||||||
{
|
{
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
@@ -543,13 +547,13 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
|
|
||||||
if(sDefSystemLanguage.equals("en")){
|
if(sDefSystemLanguage.equals("en")){
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
new LatLng(52.603048, -2.298889), DEFAULT_ZOOM_LEVEL));
|
new LatLng(51.507351, -0.127758), DEFAULT_ZOOM_LEVEL));
|
||||||
} else if (sDefSystemLanguage.equals("de")){
|
} else if (sDefSystemLanguage.equals("de")){
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
new LatLng(53.090725, 14.268494), DEFAULT_ZOOM_LEVEL));
|
new LatLng(52.518594, 13.376188), DEFAULT_ZOOM_LEVEL));
|
||||||
} else {
|
} else {
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
||||||
new LatLng(19.432608, -99.133209), DEFAULT_ZOOM_LEVEL));
|
new LatLng(19.410704, -99.132385), DEFAULT_ZOOM_LEVEL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -660,6 +664,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
getSupportFragmentManager().beginTransaction().remove(getSupportFragmentManager().findFragmentById(R.id.frag_maps_map)).commitAllowingStateLoss();
|
getSupportFragmentManager().beginTransaction().remove(getSupportFragmentManager().findFragmentById(R.id.frag_maps_map)).commitAllowingStateLoss();
|
||||||
mMap = null;
|
mMap = null;
|
||||||
}
|
}
|
||||||
|
session.setNotificationPositionRequest(false);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,4 +677,10 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
protected String getActivityName() {
|
protected String getActivityName() {
|
||||||
return mActivityTitle;
|
return mActivityTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onBackPressed(){
|
||||||
|
session.setNotificationPositionRequest(false);
|
||||||
|
super.onBackPressed();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
|
|
||||||
private StringRequest getStringRequestAddIncidentWithPosition(final IncidentReport incident) {
|
private StringRequest getStringRequestAddIncidentWithPosition(final IncidentReport incident) {
|
||||||
showDialog();
|
showDialog();
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
private EditText txtSuspectTransport;
|
private EditText txtSuspectTransport;
|
||||||
private EditText txtVictimAffiliation;
|
private EditText txtVictimAffiliation;
|
||||||
private EditText txtSuspectRecognition;
|
private EditText txtSuspectRecognition;
|
||||||
|
private EditText txtEtcEtc;
|
||||||
|
|
||||||
|
|
||||||
private BootstrapLabel scorelabel;
|
private BootstrapLabel scorelabel;
|
||||||
@@ -71,6 +72,7 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
txtSuspectTransport = (EditText) findViewById(R.id.txt_viewreport_suspecttransport);
|
txtSuspectTransport = (EditText) findViewById(R.id.txt_viewreport_suspecttransport);
|
||||||
txtVictimAffiliation = (EditText) findViewById(R.id.txt_viewreport_victimaff);
|
txtVictimAffiliation = (EditText) findViewById(R.id.txt_viewreport_victimaff);
|
||||||
txtSuspectRecognition = (EditText) findViewById(R.id.txt_viewreport_suspectrecon);
|
txtSuspectRecognition = (EditText) findViewById(R.id.txt_viewreport_suspectrecon);
|
||||||
|
txtEtcEtc = (EditText) findViewById(R.id.txt_viewreport_etcetc);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
final Integer id = intent.getIntExtra(BaseActivity.EXTRA_MESSAGE, 0);
|
final Integer id = intent.getIntExtra(BaseActivity.EXTRA_MESSAGE, 0);
|
||||||
@@ -141,7 +143,7 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
|
|
||||||
private StringRequest getStringRequestDeleteIncident(final Integer incidentid) {
|
private StringRequest getStringRequestDeleteIncident(final Integer incidentid) {
|
||||||
showDialog();
|
showDialog();
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -191,7 +193,7 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
|
|
||||||
private StringRequest getStringRequestGetIncidentWithPositionFromID(final Integer incidentid) {
|
private StringRequest getStringRequestGetIncidentWithPositionFromID(final Integer incidentid) {
|
||||||
showDialog();
|
showDialog();
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -241,21 +243,32 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String checkIfTextEmptyAndReturnString(String input){
|
||||||
|
String formattedString = "Keine Angaben";
|
||||||
|
|
||||||
|
if(input.trim().length() > 0){
|
||||||
|
formattedString = input;
|
||||||
|
}
|
||||||
|
|
||||||
|
return formattedString;
|
||||||
|
}
|
||||||
|
|
||||||
private void initReport(IncidentReport incident) {
|
private void initReport(IncidentReport incident) {
|
||||||
Context tmpContext = getApplicationContext();
|
Context tmpContext = getApplicationContext();
|
||||||
|
|
||||||
scorelabel.setText(Integer.toString(incident.getVotedScore()));
|
scorelabel.setText(Integer.toString(incident.getVotedScore()));
|
||||||
txtIncidentCategory.setText(incident.getIncidentCategoryName(tmpContext));
|
txtIncidentCategory.setText(incident.getIncidentCategoryName(tmpContext));
|
||||||
txtIncidentSubCategory.setText(incident.getIncidentSubCategoryName(tmpContext));
|
txtIncidentSubCategory.setText(checkIfTextEmptyAndReturnString(incident.getIncidentSubCategoryName(tmpContext)));
|
||||||
txtTime.setText(incident.getTimeString(tmpContext));
|
txtTime.setText(checkIfTextEmptyAndReturnString(incident.getTimeString(tmpContext)));
|
||||||
txtSuspect.setText(incident.getSuspectString(tmpContext));
|
txtSuspect.setText(checkIfTextEmptyAndReturnString(incident.getSuspectString(tmpContext)));
|
||||||
txtWeapons.setText(incident.getSuspectWeaponsString(tmpContext));
|
txtWeapons.setText(checkIfTextEmptyAndReturnString(incident.getSuspectWeaponsString(tmpContext)));
|
||||||
txtNumOfSuspects.setText(incident.getSuspectNoOfString(tmpContext));
|
txtNumOfSuspects.setText(checkIfTextEmptyAndReturnString(incident.getSuspectNoOfString(tmpContext)));
|
||||||
txtVictim.setText(incident.getVictimString(tmpContext));
|
txtVictim.setText(checkIfTextEmptyAndReturnString(incident.getVictimString(tmpContext)));
|
||||||
txtVictimOrigin.setText(incident.getVictimOriginString(tmpContext));
|
txtVictimOrigin.setText(checkIfTextEmptyAndReturnString(incident.getVictimOriginString(tmpContext)));
|
||||||
txtSuspectTransport.setText(incident.getSuspectTransportString(tmpContext));
|
txtSuspectTransport.setText(checkIfTextEmptyAndReturnString(incident.getSuspectTransportString(tmpContext)));
|
||||||
txtVictimAffiliation.setText(incident.getVictimAffiliationString(tmpContext));
|
txtVictimAffiliation.setText(checkIfTextEmptyAndReturnString(incident.getVictimAffiliationString(tmpContext)));
|
||||||
txtSuspectRecognition.setText(incident.getSuspectRecognitionString(tmpContext));
|
txtSuspectRecognition.setText(checkIfTextEmptyAndReturnString(incident.getSuspectRecognitionString(tmpContext)));
|
||||||
|
txtEtcEtc.setText(checkIfTextEmptyAndReturnString(incident.getEtcOthersCategory()));
|
||||||
|
|
||||||
this.incident = incident;
|
this.incident = incident;
|
||||||
|
|
||||||
@@ -316,7 +329,7 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestAddVote(final Integer incidentid, final String votetype) {
|
private StringRequest getStringRequestAddVote(final Integer incidentid, final String votetype) {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class ProfileStatisticsFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestProfileStats() {
|
private StringRequest getStringRequestProfileStats() {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class ReportListFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestGetIncidentsWithPositionFromUserID() {
|
private StringRequest getStringRequestGetIncidentsWithPositionFromUserID() {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
package org.deke.risk.riskahead.fragment;
|
package org.deke.risk.riskahead.fragment;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.method.PasswordTransformationMethod;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.volley.Request;
|
import com.android.volley.Request;
|
||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
@@ -30,12 +20,11 @@ import org.deke.risk.riskahead.SettingsActivity;
|
|||||||
import org.deke.risk.riskahead.helper.AppConfig;
|
import org.deke.risk.riskahead.helper.AppConfig;
|
||||||
import org.deke.risk.riskahead.helper.AppController;
|
import org.deke.risk.riskahead.helper.AppController;
|
||||||
import org.deke.risk.riskahead.helper.SessionManager;
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
import org.deke.risk.riskahead.helper.TextValidator;
|
import org.deke.risk.riskahead.helper.ValidatedEditTextPreference;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,10 +34,10 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
private final static String TAG = SettingsFragment.class.getSimpleName();
|
private final static String TAG = SettingsFragment.class.getSimpleName();
|
||||||
|
|
||||||
private EditTextPreference prefUsername;
|
private ValidatedEditTextPreference prefUsername;
|
||||||
private EditTextPreference prefSurname;
|
private EditTextPreference prefSurname;
|
||||||
private EditTextPreference prefName;
|
private EditTextPreference prefName;
|
||||||
private EditTextPreference prefEmail;
|
private ValidatedEditTextPreference prefEmail;
|
||||||
private Preference btnRequestPW;
|
private Preference btnRequestPW;
|
||||||
|
|
||||||
private SwitchPreference prefNotifications;
|
private SwitchPreference prefNotifications;
|
||||||
@@ -57,8 +46,6 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
private SwitchPreference prefGPSENabled;
|
private SwitchPreference prefGPSENabled;
|
||||||
private Preference prefLocation;
|
private Preference prefLocation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SessionManager session;
|
public SessionManager session;
|
||||||
public HashMap<String, String> user;
|
public HashMap<String, String> user;
|
||||||
|
|
||||||
@@ -73,11 +60,18 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
initAccountPrefs();
|
initAccountPrefs();
|
||||||
|
|
||||||
|
initNotificationPrefs();
|
||||||
|
|
||||||
|
|
||||||
|
updatePrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initNotificationPrefs() {
|
||||||
prefNotifications = (SwitchPreference) getPreferenceManager().findPreference("notifyEnable");
|
prefNotifications = (SwitchPreference) getPreferenceManager().findPreference("notifyEnable");
|
||||||
prefRadius = (ListPreference) getPreferenceManager().findPreference("notifyRadius");
|
prefRadius = (ListPreference) getPreferenceManager().findPreference("notifyRadius");
|
||||||
prefFrequency = (ListPreference) getPreferenceManager().findPreference("notifyFrequency");
|
prefFrequency = (ListPreference) getPreferenceManager().findPreference("notifyFrequency");
|
||||||
prefGPSENabled = (SwitchPreference) getPreferenceManager().findPreference("notifyEnableGPS");
|
prefGPSENabled = (SwitchPreference) getPreferenceManager().findPreference("notifyEnableGPS");
|
||||||
prefLocation = (Preference) getPreferenceManager().findPreference("notifyChooseLocation");
|
prefLocation = getPreferenceManager().findPreference("notifyChooseLocation");
|
||||||
|
|
||||||
prefNotifications.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
prefNotifications.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -94,7 +88,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
session.setNotificationRadius(Integer.valueOf(newStringValue));
|
session.setNotificationRadius(Integer.valueOf(newStringValue));
|
||||||
((ListPreference)preference).setValue(newValue.toString());
|
((ListPreference)preference).setValue(newValue.toString());
|
||||||
((ListPreference)preference).setSummary(prefRadius.getEntry());
|
preference.setSummary(prefRadius.getEntry());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -105,7 +99,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
session.setNotificationPollFreq(Integer.valueOf(newStringValue));
|
session.setNotificationPollFreq(Integer.valueOf(newStringValue));
|
||||||
((ListPreference)preference).setValue(newValue.toString());
|
((ListPreference)preference).setValue(newValue.toString());
|
||||||
((ListPreference)preference).setSummary(prefFrequency.getEntry());
|
preference.setSummary(prefFrequency.getEntry());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -115,6 +109,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
session.setGPSForNotificationsEnabled(Boolean.valueOf(newStringValue));
|
session.setGPSForNotificationsEnabled(Boolean.valueOf(newStringValue));
|
||||||
|
updatePrefs();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -122,23 +117,21 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
prefLocation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
prefLocation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
((SettingsActivity)getActivity()).gotoMapActivity("NoIncident");
|
session.setNotificationPositionRequest(true);
|
||||||
|
((SettingsActivity)getActivity()).gotoMapActivity();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
updatePrefs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAccountPrefs() {
|
private void initAccountPrefs() {
|
||||||
prefUsername = (EditTextPreference) getPreferenceManager().findPreference("usernamePref");
|
prefUsername = (ValidatedEditTextPreference) getPreferenceManager().findPreference("usernamePref");
|
||||||
prefSurname = (EditTextPreference) getPreferenceManager().findPreference("surnamePref");
|
prefSurname = (EditTextPreference) getPreferenceManager().findPreference("surnamePref");
|
||||||
prefName = (EditTextPreference) getPreferenceManager().findPreference("namePref");
|
prefName = (EditTextPreference) getPreferenceManager().findPreference("namePref");
|
||||||
prefEmail = (EditTextPreference) getPreferenceManager().findPreference("emailPref");
|
prefEmail = (ValidatedEditTextPreference) getPreferenceManager().findPreference("emailPref");
|
||||||
btnRequestPW = (Preference) getPreferenceManager().findPreference("resetPassword");
|
btnRequestPW = getPreferenceManager().findPreference("resetPassword");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
prefUsername.getEditText().addTextChangedListener(new TextValidator(prefUsername.getEditText(), getActivity().getApplicationContext()) {
|
prefUsername.getEditText().addTextChangedListener(new TextValidator(prefUsername.getEditText(), getActivity().getApplicationContext()) {
|
||||||
@Override
|
@Override
|
||||||
public void validate(TextView textView, String text) {
|
public void validate(TextView textView, String text) {
|
||||||
@@ -157,6 +150,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
Preference.OnPreferenceChangeListener changeListener = new Preference.OnPreferenceChangeListener() {
|
Preference.OnPreferenceChangeListener changeListener = new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -220,12 +214,12 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
prefRadius.setValue(Integer.toString(session.getNotificationRadius()));
|
prefRadius.setValue(Integer.toString(session.getNotificationRadius()));
|
||||||
prefRadius.setSummary(prefRadius.getEntry());
|
prefRadius.setSummary(prefRadius.getEntry());
|
||||||
prefGPSENabled.setChecked(session.isGPSForNotificationsEnabled());
|
prefGPSENabled.setChecked(session.isGPSForNotificationsEnabled());
|
||||||
|
prefLocation.setSummary("Your Location (Latitude/Longitude):\n"+Double.toString(session.getLocation().latitude)+" : "+Double.toString(session.getLocation().longitude));
|
||||||
|
|
||||||
if(session.isGPSForNotificationsEnabled()){
|
if(session.isGPSForNotificationsEnabled()){
|
||||||
btnRequestPW.setEnabled(false);
|
prefLocation.setEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
btnRequestPW.setEnabled(true);
|
prefLocation.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +233,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
private StringRequest getStringRequestResetPW(final String email) {
|
private StringRequest getStringRequestResetPW(final String email) {
|
||||||
((SettingsActivity) getActivity()).showDialog();
|
((SettingsActivity) getActivity()).showDialog();
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
@@ -303,7 +297,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
private StringRequest getStringChangeUserSettings(final String username, final String name, final String surname, final String email) {
|
private StringRequest getStringChangeUserSettings(final String username, final String name, final String surname, final String email) {
|
||||||
((SettingsActivity) getActivity()).showDialog();
|
((SettingsActivity) getActivity()).showDialog();
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class Top10Fragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
private StringRequest getStringRequestTop10() {
|
private StringRequest getStringRequestTop10() {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ package org.deke.risk.riskahead.helper;
|
|||||||
* Created by Dennis on 09.08.2015.
|
* Created by Dennis on 09.08.2015.
|
||||||
*/
|
*/
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
// Server user login url
|
public static String URL_ENCRYPTED = "https://www.riskahead.de/helper/rest/";
|
||||||
public static String URL_LOGIN = "http://www.riskahead.de/helper/rest/";
|
|
||||||
|
|
||||||
// Server user register url
|
public static String URL_DEFAULT = "http://www.riskahead.de/helper/rest/";
|
||||||
public static String URL_REGISTER = "http://www.riskahead.de/helper/rest/";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
Log.d("Unknown switch page: ", Integer.toString(position));
|
Log.d("Unknown switch page: ", Integer.toString(position));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
session.setNotificationPositionRequest(false);
|
||||||
if(intent != null) BaseActivity.this.startActivity(intent);
|
if(intent != null) BaseActivity.this.startActivity(intent);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class NotificationService extends Service {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private StringRequest getStringRequestIncidentsFromAreaAndTime(final Double latitude, final Double longitude, final int radius, final String time) {
|
private StringRequest getStringRequestIncidentsFromAreaAndTime(final Double latitude, final Double longitude, final int radius, final String time) {
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class SessionManager {
|
|||||||
public static final String KEY_NOTIFY_RADIUS = "notifyRadius";
|
public static final String KEY_NOTIFY_RADIUS = "notifyRadius";
|
||||||
public static final String KEY_NOTIFY_POLLINGFREQ = "notifyPollingfreq";
|
public static final String KEY_NOTIFY_POLLINGFREQ = "notifyPollingfreq";
|
||||||
public static final String KEY_NOTIFY_GPS = "notifyGPSEnabled";
|
public static final String KEY_NOTIFY_GPS = "notifyGPSEnabled";
|
||||||
|
public static final String KEY_NOTIFY_REQUEST_POS = "notifyGPSPositionRequest";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -95,10 +96,7 @@ public class SessionManager {
|
|||||||
return status.getString(KEY_LAST_NOTIFICATION, "");
|
return status.getString(KEY_LAST_NOTIFICATION, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationEnabled(boolean isEnabled){
|
|
||||||
statusEditor.putBoolean(KEY_NOTIFY_ENABLED, isEnabled);
|
|
||||||
statusEditor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotificationRadius(int radius){
|
public void setNotificationRadius(int radius){
|
||||||
statusEditor.putInt(KEY_NOTIFY_RADIUS, radius);
|
statusEditor.putInt(KEY_NOTIFY_RADIUS, radius);
|
||||||
@@ -110,10 +108,24 @@ public class SessionManager {
|
|||||||
statusEditor.apply();
|
statusEditor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNotificationEnabled(boolean isEnabled){
|
||||||
|
statusEditor.putBoolean(KEY_NOTIFY_ENABLED, isEnabled);
|
||||||
|
statusEditor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getNotificationEnabled(){
|
public Boolean getNotificationEnabled(){
|
||||||
return status.getBoolean(KEY_NOTIFY_ENABLED, true);
|
return status.getBoolean(KEY_NOTIFY_ENABLED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNotificationPositionRequest(boolean isEnabled){
|
||||||
|
statusEditor.putBoolean(KEY_NOTIFY_REQUEST_POS, isEnabled);
|
||||||
|
statusEditor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getNotificationPositionRequest(){
|
||||||
|
return status.getBoolean(KEY_NOTIFY_REQUEST_POS, false);
|
||||||
|
}
|
||||||
|
|
||||||
public int getNotificationRadius(){
|
public int getNotificationRadius(){
|
||||||
return status.getInt(KEY_NOTIFY_RADIUS, 5);
|
return status.getInt(KEY_NOTIFY_RADIUS, 5);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.EditTextPreference;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.InputType;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.Patterns;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright 2015 RiskAhead Dennis Thiessen
|
||||||
|
* <p/>
|
||||||
|
* Created by Dennis Thiessen on 06.01.2016.
|
||||||
|
*/
|
||||||
|
public class ValidatedEditTextPreference extends EditTextPreference
|
||||||
|
{
|
||||||
|
|
||||||
|
private final static int TYPE_VARIATION_EMAIL_ADDRESS = 33;
|
||||||
|
|
||||||
|
public ValidatedEditTextPreference(Context ctx, AttributeSet attrs, int defStyle)
|
||||||
|
{
|
||||||
|
super(ctx, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidatedEditTextPreference(Context ctx, AttributeSet attrs)
|
||||||
|
{
|
||||||
|
super(ctx, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditTextWatcher implements TextWatcher
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int before, int count){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s)
|
||||||
|
{
|
||||||
|
onEditTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditTextWatcher m_watcher = new EditTextWatcher();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true in order to enable positive button or false to disable it.
|
||||||
|
*/
|
||||||
|
protected boolean onCheckValue(String value)
|
||||||
|
{
|
||||||
|
boolean enable = true;
|
||||||
|
|
||||||
|
if((getEditText().getInputType() & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) != 0){
|
||||||
|
if (!Patterns.EMAIL_ADDRESS.matcher(value).matches()) {
|
||||||
|
getEditText().setError("Please enter a valid email address\n" +
|
||||||
|
"e.g.: text@abc.de");
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (value.length() < 5) {
|
||||||
|
getEditText().setError("Your username must be at least\n" +
|
||||||
|
"5 characters in length.");
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d("SettingValidator", "inputtype: "+getEditText().getInputType());
|
||||||
|
return enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onEditTextChanged()
|
||||||
|
{
|
||||||
|
boolean enable = onCheckValue(getEditText().getText().toString());
|
||||||
|
|
||||||
|
Dialog dlg = getDialog();
|
||||||
|
|
||||||
|
|
||||||
|
if(dlg instanceof AlertDialog){
|
||||||
|
AlertDialog alertDlg = (AlertDialog)dlg;
|
||||||
|
Button btn = alertDlg.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
|
btn.setEnabled(enable);
|
||||||
|
Log.d("SettingValidator", "btnSetEnable durchgeführt: "+btn.isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void showDialog(Bundle state)
|
||||||
|
{
|
||||||
|
super.showDialog(state);
|
||||||
|
|
||||||
|
getEditText().removeTextChangedListener(m_watcher);
|
||||||
|
getEditText().addTextChangedListener(m_watcher);
|
||||||
|
onEditTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,8 +124,6 @@
|
|||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@+id/btn_register"
|
android:layout_below="@+id/btn_register"
|
||||||
android:clickable="true"
|
|
||||||
android:onClick="onClick"
|
|
||||||
android:text="@string/lbl_login_resendPW"
|
android:text="@string/lbl_login_resendPW"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,21 @@
|
|||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/til_viewreport_etcetc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/til_viewreport_suspectrecon">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txt_viewreport_etcetc"
|
||||||
|
android:hint="@string/lbl_viewreport_etcetc"
|
||||||
|
android:enabled="false"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">RiskAhead</string>
|
<string name="app_name">RiskAhead</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="btn_start_login">Login</string>
|
<string name="btn_start_login">Login</string>
|
||||||
<string name="btn_start_register">Register</string>
|
<string name="btn_start_register">Register</string>
|
||||||
|
|
||||||
@@ -17,6 +18,9 @@
|
|||||||
<string name="status_signing_in">Signing in...</string>
|
<string name="status_signing_in">Signing in...</string>
|
||||||
<string name="status_signing_out">Signing out...</string>
|
<string name="status_signing_out">Signing out...</string>
|
||||||
|
|
||||||
|
<string name="title_activity_start">RiskAhead</string>
|
||||||
|
<string name="title_activity_entrance">RiskAhead</string>
|
||||||
|
|
||||||
<string name="drawer_open">Open navigation drawer</string>
|
<string name="drawer_open">Open navigation drawer</string>
|
||||||
<string name="drawer_close">Close navigation drawer</string>
|
<string name="drawer_close">Close navigation drawer</string>
|
||||||
|
|
||||||
@@ -25,8 +29,6 @@
|
|||||||
<string name="search_hint">Location</string>
|
<string name="search_hint">Location</string>
|
||||||
<string name="search_settings">Search Settings</string>
|
<string name="search_settings">Search Settings</string>
|
||||||
|
|
||||||
<string name="title_activity_start">RiskAhead</string>
|
|
||||||
<string name="title_activity_entrance">RiskAhead</string>
|
|
||||||
<string name="title_activity_base">Base</string>
|
<string name="title_activity_base">Base</string>
|
||||||
<string name="title_activity_user_config">User Profile</string>
|
<string name="title_activity_user_config">User Profile</string>
|
||||||
<string name="title_activity_maps">Risk Map</string>
|
<string name="title_activity_maps">Risk Map</string>
|
||||||
@@ -35,7 +37,6 @@
|
|||||||
<string name="title_activity_subscriptions">Subscriptions</string>
|
<string name="title_activity_subscriptions">Subscriptions</string>
|
||||||
<string name="title_activity_view_report">View Report</string>
|
<string name="title_activity_view_report">View Report</string>
|
||||||
<string name="title_activity_reportlist">Report List</string>
|
<string name="title_activity_reportlist">Report List</string>
|
||||||
<string name="title_activity_report_wf">Report Incident</string>
|
|
||||||
|
|
||||||
<string name="menu_action_about">About</string>
|
<string name="menu_action_about">About</string>
|
||||||
<string name="menu_action_language">Language</string>
|
<string name="menu_action_language">Language</string>
|
||||||
@@ -77,7 +78,6 @@
|
|||||||
<string name="btn_profile_viewposts">{fa_search} View Posts</string>
|
<string name="btn_profile_viewposts">{fa_search} View Posts</string>
|
||||||
<string name="lbl_profile_top10">Top 10</string>
|
<string name="lbl_profile_top10">Top 10</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="btn_maps_confirm_position">{fa_paint_brush} Report this position!</string>
|
<string name="btn_maps_confirm_position">{fa_paint_brush} Report this position!</string>
|
||||||
|
|
||||||
<string name="navigation_start">Home</string>
|
<string name="navigation_start">Home</string>
|
||||||
@@ -112,6 +112,7 @@
|
|||||||
<string name="errormsg_couldnotretrieve">Could not retrieve data from server. Please check internet connection.</string>
|
<string name="errormsg_couldnotretrieve">Could not retrieve data from server. Please check internet connection.</string>
|
||||||
<string name="progress_getdata_text">Please wait...</string>
|
<string name="progress_getdata_text">Please wait...</string>
|
||||||
<string name="progress_getdata_title">Retrieve data from server</string>
|
<string name="progress_getdata_title">Retrieve data from server</string>
|
||||||
|
<string name="title_activity_report_wf">Report Incident</string>
|
||||||
|
|
||||||
<string name="lbl_mapsinfowindow_author">Author:</string>
|
<string name="lbl_mapsinfowindow_author">Author:</string>
|
||||||
<string name="lbl_mapsinfowindow_score">Rating:</string>
|
<string name="lbl_mapsinfowindow_score">Rating:</string>
|
||||||
@@ -119,13 +120,13 @@
|
|||||||
<string name="lbl_mapsinfowindow_victim">Victim:</string>
|
<string name="lbl_mapsinfowindow_victim">Victim:</string>
|
||||||
<string name="lbl_mapsinfowindow_time">Time:</string>
|
<string name="lbl_mapsinfowindow_time">Time:</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="lbl_spinner_choose">Please choose...</string>
|
<string name="lbl_spinner_choose">Please choose...</string>
|
||||||
<string name="lbl_report_from_date">From date (yyyy-MM-dd)</string>
|
<string name="lbl_report_from_date">From date (yyyy-MM-dd)</string>
|
||||||
<string name="lbl_report_from_time">From time</string>
|
<string name="lbl_report_from_time">From time</string>
|
||||||
<string name="lbl_report_to_date">To date (yyyy-MM-dd)</string>
|
<string name="lbl_report_to_date">To date (yyyy-MM-dd)</string>
|
||||||
<string name="lbl_report_to_time">To time</string>
|
<string name="lbl_report_to_time">To time</string>
|
||||||
|
<string name="lbl_viewreport_incidentcategory">Incident Category</string>
|
||||||
|
<string name="lbl_viewreport_incidentsubcategory">Incident Subcategory</string>
|
||||||
|
|
||||||
<string name="lbl_question_situation">Was ist passiert?</string>
|
<string name="lbl_question_situation">Was ist passiert?</string>
|
||||||
<string name="lbl_question_place">Wo passiert es?</string>
|
<string name="lbl_question_place">Wo passiert es?</string>
|
||||||
@@ -141,9 +142,17 @@
|
|||||||
<string name="lbl_question_etc_recon">Wie erkennt man die Täter?</string>
|
<string name="lbl_question_etc_recon">Wie erkennt man die Täter?</string>
|
||||||
<string name="lbl_question_etc_etc">Weiteres?</string>
|
<string name="lbl_question_etc_etc">Weiteres?</string>
|
||||||
<string name="cat_hint">Weitere Details...</string>
|
<string name="cat_hint">Weitere Details...</string>
|
||||||
|
|
||||||
<string name="hint_place">Bitte wähle zunächst einen Ort auf der Karte aus</string>
|
<string name="hint_place">Bitte wähle zunächst einen Ort auf der Karte aus</string>
|
||||||
|
<string name="lbl_viewreport_time">Time</string>
|
||||||
<string name="lbl_viewreport_suspect">Suspect</string>
|
<string name="lbl_viewreport_suspect">Suspect</string>
|
||||||
<string name="lbl_viewreport_victim">Victim</string>
|
<string name="lbl_viewreport_victim">Victim</string>
|
||||||
|
<string name="lbl_viewreport_suspectweapon">Weapons</string>
|
||||||
|
<string name="lbl_viewreport_suspectcount">Quantity</string>
|
||||||
|
<string name="lbl_viewreport_victimorigin">Origin of victim</string>
|
||||||
|
<string name="lbl_viewreport_suspecttransport">Vehicle</string>
|
||||||
|
<string name="lbl_viewreport_victimaff">Victim affiliation</string>
|
||||||
|
<string name="lbl_viewreport_suspectrecon">Suspect attributes</string>
|
||||||
|
|
||||||
<string-array name="cat_situation_main">
|
<string-array name="cat_situation_main">
|
||||||
<item>Allgemeiner Vorfall/Situation</item>
|
<item>Allgemeiner Vorfall/Situation</item>
|
||||||
@@ -167,7 +176,7 @@
|
|||||||
<string-array name="cat_situation_sub_verbal">
|
<string-array name="cat_situation_sub_verbal">
|
||||||
<item>Sexuelle Belästigung</item>
|
<item>Sexuelle Belästigung</item>
|
||||||
<item>Beleidigung, Drohung</item>
|
<item>Beleidigung, Drohung</item>
|
||||||
<item>Vernehmung/Befragung öffentlich</item>
|
<item>Nötigung/Vernehmung</item>
|
||||||
<item>Aufhetzung</item>
|
<item>Aufhetzung</item>
|
||||||
<item>Sonstiges...</item>
|
<item>Sonstiges...</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -194,7 +203,7 @@
|
|||||||
<string-array name="cat_situation_sub_nature">
|
<string-array name="cat_situation_sub_nature">
|
||||||
<item>Temperaturextrem</item>
|
<item>Temperaturextrem</item>
|
||||||
<item>Wind, Sturm, Orkan, Tornado</item>
|
<item>Wind, Sturm, Orkan, Tornado</item>
|
||||||
<item>Überschwemmung/-flutung</item>
|
<item>Überschwemmung/-flutung, Tsunami</item>
|
||||||
<item>Erdbeben, Berghang Einsturz</item>
|
<item>Erdbeben, Berghang Einsturz</item>
|
||||||
<item>Feuer, Rauch, Vulkanausbruch</item>
|
<item>Feuer, Rauch, Vulkanausbruch</item>
|
||||||
<item>Hungersnot, Tierplage</item>
|
<item>Hungersnot, Tierplage</item>
|
||||||
@@ -208,7 +217,7 @@
|
|||||||
<item>Brandkatastrophe</item>
|
<item>Brandkatastrophe</item>
|
||||||
<item>Chemiekatastrophe, Ölpest</item>
|
<item>Chemiekatastrophe, Ölpest</item>
|
||||||
<item>Seuche, Krankheit</item>
|
<item>Seuche, Krankheit</item>
|
||||||
<item>Chaos Bevölkerung</item>
|
<item>Chaos Bevölkerung, Anarchie</item>
|
||||||
<item>Sonstiges...</item>
|
<item>Sonstiges...</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
@@ -221,8 +230,8 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="cat_time_sub_periodical">
|
<string-array name="cat_time_sub_periodical">
|
||||||
<item>Vormittags</item>
|
<item>Morgens</item>
|
||||||
<item>Tagsüber</item>
|
<item>Mittags</item>
|
||||||
<item>Abends</item>
|
<item>Abends</item>
|
||||||
<item>Nachts</item>
|
<item>Nachts</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -247,7 +256,7 @@
|
|||||||
<item>Alltagsgegenstände</item>
|
<item>Alltagsgegenstände</item>
|
||||||
<item>Schusswaffe</item>
|
<item>Schusswaffe</item>
|
||||||
<item>Explosionswaffen oder Sprengkörper</item>
|
<item>Explosionswaffen oder Sprengkörper</item>
|
||||||
<item>Großkaliber z.B. Panzer, Flugbombe</item>
|
<item>Großwaffen z.B. Panzer, Flugbombe</item>
|
||||||
<item>Sonstiges…</item>
|
<item>Sonstiges…</item>
|
||||||
<item>Weiß ich nicht</item>
|
<item>Weiß ich nicht</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -264,7 +273,8 @@
|
|||||||
<item>Frauen</item>
|
<item>Frauen</item>
|
||||||
<item>Kinder</item>
|
<item>Kinder</item>
|
||||||
<item>Männer</item>
|
<item>Männer</item>
|
||||||
<item>Tieren</item>
|
<item>Jede Person</item>
|
||||||
|
<item>Tiere</item>
|
||||||
<item>Gebäude/Infrastruktur</item>
|
<item>Gebäude/Infrastruktur</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
@@ -303,6 +313,98 @@
|
|||||||
<item>Tiere</item>
|
<item>Tiere</item>
|
||||||
<item>Sonstiges…</item>
|
<item>Sonstiges…</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="title_activity_settings_activityv2">Settings</string>
|
||||||
|
|
||||||
|
<!-- Strings related to Settings -->
|
||||||
|
|
||||||
|
<!-- Example General settings -->
|
||||||
|
<string name="pref_header_general">General</string>
|
||||||
|
|
||||||
|
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||||
|
<string name="pref_description_social_recommendations">Recommendations for people to contact
|
||||||
|
based on your message history
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<string name="pref_title_display_name">Display name</string>
|
||||||
|
<string name="pref_default_display_name">John Smith</string>
|
||||||
|
|
||||||
|
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||||
|
<string-array name="pref_example_list_titles">
|
||||||
|
<item>Always</item>
|
||||||
|
<item>When possible</item>
|
||||||
|
<item>Never</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_example_list_values">
|
||||||
|
<item>1</item>
|
||||||
|
<item>0</item>
|
||||||
|
<item>-1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Example settings for Data & Sync -->
|
||||||
|
<string name="pref_header_data_sync">Data & sync</string>
|
||||||
|
|
||||||
|
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||||
|
<string-array name="pref_sync_frequency_titles">
|
||||||
|
<item>15 minutes</item>
|
||||||
|
<item>30 minutes</item>
|
||||||
|
<item>1 hour</item>
|
||||||
|
<item>3 hours</item>
|
||||||
|
<item>6 hours</item>
|
||||||
|
<item>Never</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_sync_frequency_values">
|
||||||
|
<item>15</item>
|
||||||
|
<item>30</item>
|
||||||
|
<item>60</item>
|
||||||
|
<item>180</item>
|
||||||
|
<item>360</item>
|
||||||
|
<item>-1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||||
|
|
||||||
|
<!-- Example settings for Notifications -->
|
||||||
|
<string name="pref_header_notifications">Notifications</string>
|
||||||
|
|
||||||
|
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||||
|
|
||||||
|
<string name="pref_title_ringtone">Ringtone</string>
|
||||||
|
<string name="pref_ringtone_silent">Silent</string>
|
||||||
|
|
||||||
|
<string name="pref_title_vibrate">Vibrate</string>
|
||||||
|
<string name="title_activity_settings_activity_v2">Settings</string>
|
||||||
|
<string name="lbl_viewreport_etcetc">More Details</string>
|
||||||
|
|
||||||
|
<string-array name="notification_radius">
|
||||||
|
<item>1 KM</item>
|
||||||
|
<item>5 KM</item>
|
||||||
|
<item>10 KM</item>
|
||||||
|
<item>15 KM</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="notification_radius_entry">
|
||||||
|
<item>1</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>15</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="notification_freq">
|
||||||
|
<item>Every 5 Minutes</item>
|
||||||
|
<item>Every 10 Minutes</item>
|
||||||
|
<item>Every 15 Minutes</item>
|
||||||
|
<item>Every 30 Minutes</item>
|
||||||
|
<item>Every hour</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="notification_freq_entry">
|
||||||
|
<item>5</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>30</item>
|
||||||
|
<item>60</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
<string-array name="cat_situation_sub_verbal">
|
<string-array name="cat_situation_sub_verbal">
|
||||||
<item>Sexuelle Belästigung</item>
|
<item>Sexuelle Belästigung</item>
|
||||||
<item>Beleidigung, Drohung</item>
|
<item>Beleidigung, Drohung</item>
|
||||||
<item>Vernehmung/Befragung öffentlich</item>
|
<item>Nötigung/Vernehmung</item>
|
||||||
<item>Aufhetzung</item>
|
<item>Aufhetzung</item>
|
||||||
<item>Sonstiges...</item>
|
<item>Sonstiges...</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
<string-array name="cat_situation_sub_nature">
|
<string-array name="cat_situation_sub_nature">
|
||||||
<item>Temperaturextrem</item>
|
<item>Temperaturextrem</item>
|
||||||
<item>Wind, Sturm, Orkan, Tornado</item>
|
<item>Wind, Sturm, Orkan, Tornado</item>
|
||||||
<item>Überschwemmung/-flutung</item>
|
<item>Überschwemmung/-flutung, Tsunami</item>
|
||||||
<item>Erdbeben, Berghang Einsturz</item>
|
<item>Erdbeben, Berghang Einsturz</item>
|
||||||
<item>Feuer, Rauch, Vulkanausbruch</item>
|
<item>Feuer, Rauch, Vulkanausbruch</item>
|
||||||
<item>Hungersnot, Tierplage</item>
|
<item>Hungersnot, Tierplage</item>
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
<item>Brandkatastrophe</item>
|
<item>Brandkatastrophe</item>
|
||||||
<item>Chemiekatastrophe, Ölpest</item>
|
<item>Chemiekatastrophe, Ölpest</item>
|
||||||
<item>Seuche, Krankheit</item>
|
<item>Seuche, Krankheit</item>
|
||||||
<item>Chaos Bevölkerung</item>
|
<item>Chaos Bevölkerung, Anarchie</item>
|
||||||
<item>Sonstiges...</item>
|
<item>Sonstiges...</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
@@ -231,8 +231,8 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="cat_time_sub_periodical">
|
<string-array name="cat_time_sub_periodical">
|
||||||
<item>Vormittags</item>
|
<item>Morgens</item>
|
||||||
<item>Tagsüber</item>
|
<item>Mittags</item>
|
||||||
<item>Abends</item>
|
<item>Abends</item>
|
||||||
<item>Nachts</item>
|
<item>Nachts</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -257,7 +257,7 @@
|
|||||||
<item>Alltagsgegenstände</item>
|
<item>Alltagsgegenstände</item>
|
||||||
<item>Schusswaffe</item>
|
<item>Schusswaffe</item>
|
||||||
<item>Explosionswaffen oder Sprengkörper</item>
|
<item>Explosionswaffen oder Sprengkörper</item>
|
||||||
<item>Großkaliber z.B. Panzer, Flugbombe</item>
|
<item>Großwaffen z.B. Panzer, Flugbombe</item>
|
||||||
<item>Sonstiges…</item>
|
<item>Sonstiges…</item>
|
||||||
<item>Weiß ich nicht</item>
|
<item>Weiß ich nicht</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -274,7 +274,8 @@
|
|||||||
<item>Frauen</item>
|
<item>Frauen</item>
|
||||||
<item>Kinder</item>
|
<item>Kinder</item>
|
||||||
<item>Männer</item>
|
<item>Männer</item>
|
||||||
<item>Tieren</item>
|
<item>Jede Person</item>
|
||||||
|
<item>Tiere</item>
|
||||||
<item>Gebäude/Infrastruktur</item>
|
<item>Gebäude/Infrastruktur</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
@@ -373,6 +374,7 @@
|
|||||||
|
|
||||||
<string name="pref_title_vibrate">Vibrate</string>
|
<string name="pref_title_vibrate">Vibrate</string>
|
||||||
<string name="title_activity_settings_activity_v2">Settings</string>
|
<string name="title_activity_settings_activity_v2">Settings</string>
|
||||||
|
<string name="lbl_viewreport_etcetc">More Details</string>
|
||||||
|
|
||||||
<string-array name="notification_radius">
|
<string-array name="notification_radius">
|
||||||
<item>1 KM</item>
|
<item>1 KM</item>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="Account Settings">
|
android:title="Account Settings">
|
||||||
|
|
||||||
<EditTextPreference
|
<org.deke.risk.riskahead.helper.ValidatedEditTextPreference
|
||||||
android:key="usernamePref"
|
android:key="usernamePref"
|
||||||
android:title="Username"
|
android:title="Username"
|
||||||
android:summary="Please enter your username"
|
android:summary="Please enter your username"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
android:summary="Please enter your surname"
|
android:summary="Please enter your surname"
|
||||||
android:dialogTitle="Enter your surname" />
|
android:dialogTitle="Enter your surname" />
|
||||||
|
|
||||||
<EditTextPreference
|
<org.deke.risk.riskahead.helper.ValidatedEditTextPreference
|
||||||
android:key="emailPref"
|
android:key="emailPref"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:title="E-Mail"
|
android:title="E-Mail"
|
||||||
|
|||||||
Reference in New Issue
Block a user