DT @06.09.2015: Reset Password, Activation Link and Main Page included
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
|
||||
<uses-permission android:name="org.deke.risk.riskahead.permission.MAPS_RECEIVE" />
|
||||
<!-- Allows the Google Maps Android API V2 to cache map tile data in the device's external storage area -->
|
||||
<!-- Allows the Google Maps Android API V2 to cache map tile data in the device's external storage area -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- Google Maps Android API V2 requires OpenGL ES version 2 -->
|
||||
<uses-feature
|
||||
@@ -50,7 +50,8 @@
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName="org.deke.risk.riskahead.StartActivity" >>
|
||||
android:parentActivityName=".StartActivity" >
|
||||
>
|
||||
</activity>
|
||||
<activity android:name="com.twitter.sdk.android.core.identity.OAuthActivity" />
|
||||
<activity
|
||||
@@ -62,31 +63,39 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_entrance"
|
||||
android:parentActivityName="org.deke.risk.riskahead.LoginActivity">
|
||||
android:parentActivityName=".LoginActivity" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MapsActivity"
|
||||
android:label="@string/title_activity_maps"
|
||||
android:parentActivityName="org.deke.risk.riskahead.MainActivity">
|
||||
android:parentActivityName=".MainActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
<!-- Points to searchable activity -->
|
||||
<meta-data android:name="android.app.default_searchable"
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".MapsActivity" />
|
||||
|
||||
<!-- Points to searchable meta data -->
|
||||
<meta-data android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable"/>
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name=".helper.PlaceProvider"
|
||||
android:authorities="org.deke.risk.riskahead.helper.PlaceProvider"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".UserConfigActivity"
|
||||
android:label="@string/title_activity_user_config"
|
||||
android:parentActivityName="org.deke.risk.riskahead.MainActivity">
|
||||
android:parentActivityName=".MainActivity" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ReportActivity"
|
||||
android:label="@string/title_activity_report" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.deke.risk.riskahead;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
@@ -15,6 +19,7 @@ import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.facebook.CallbackManager;
|
||||
|
||||
import org.deke.risk.riskahead.fragments.FacebookButtonFragment;
|
||||
@@ -43,20 +48,20 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
private TextView input_email;
|
||||
private TextView input_full_name;
|
||||
private TextView input_password;
|
||||
private Context thiscontext;
|
||||
|
||||
private ProgressDialog pDialog;
|
||||
private SessionManager session;
|
||||
public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";
|
||||
private SQLiteHandler db;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Intent intent = getIntent();
|
||||
inputMsg = intent.getStringExtra(StartActivity.EXTRA_MESSAGE);
|
||||
callbackManager = CallbackManager.Factory.create();
|
||||
|
||||
thiscontext = this;
|
||||
// Session manager
|
||||
session = new SessionManager(getApplicationContext());
|
||||
|
||||
@@ -124,20 +129,6 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isEmpty(TextView etText) {
|
||||
return etText.getText().toString().trim().length() == 0;
|
||||
}
|
||||
|
||||
public void showMessage(String statusText){
|
||||
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
||||
public void onFragmentInteraction(Uri uri){
|
||||
//you can leave it empty
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_login, menu);
|
||||
@@ -155,6 +146,21 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
||||
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_gp);
|
||||
fragment.onActivityResult(requestCode, resultCode, data);
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
TwitterButtonFragment twitter_fragment = (TwitterButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_tw);
|
||||
if (twitter_fragment != null) {
|
||||
twitter_fragment.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSocialMediaLogin(final String key, final String providerType, final String username, final String email){
|
||||
if(session.isLoggedIn()){
|
||||
Intent intent = new Intent(
|
||||
@@ -171,7 +177,69 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
pDialog.setMessage("Social Media Login ...");
|
||||
showDialog();
|
||||
|
||||
StringRequest strReq = new StringRequest(Method.POST,
|
||||
StringRequest strReq = getStringRequestSocialMediaLogin(key, providerType, username, email);
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
|
||||
private void checkLogin(final String email, final String password) {
|
||||
// Tag used to cancel the request
|
||||
String tag_string_req = "req_login";
|
||||
db.deleteUsers();
|
||||
pDialog.setMessage("Logging in ...");
|
||||
showDialog();
|
||||
|
||||
StringRequest strReq = getStringRequestLogin(email, password);
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
|
||||
private void registerUser(final String username, final String email,final String password) {
|
||||
// Tag used to cancel the request
|
||||
String tag_string_req = "req_register";
|
||||
db.deleteUsers();
|
||||
pDialog.setMessage("Registering ...");
|
||||
showDialog();
|
||||
|
||||
StringRequest strReq = getStringRequestRegisterUser(username, email, password);
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
|
||||
public void onClick(View view){
|
||||
if(input_email.getText().toString().isEmpty()){
|
||||
showMessage("Enter your E-Mail to reset your password");
|
||||
return;
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("Send password reset E-Mail")
|
||||
.setMessage("Do you really want to reset your password? An E-Mail will be send to your address. Please follow the instructions to reset your password.")
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String tag_string_req = "requestpwreset";
|
||||
|
||||
StringRequest strReq = getStringRequestResetPW(input_email.getText().toString());
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
showMessage("E-Mail was sent to your address");
|
||||
}
|
||||
})
|
||||
.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();
|
||||
}
|
||||
|
||||
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>() {
|
||||
|
||||
@Override
|
||||
@@ -248,37 +316,10 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
||||
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_gp);
|
||||
fragment.onActivityResult(requestCode, resultCode, data);
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
TwitterButtonFragment twitter_fragment = (TwitterButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_tw);
|
||||
if (twitter_fragment != null) {
|
||||
twitter_fragment.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to verify login details in mysql db
|
||||
* */
|
||||
private void checkLogin(final String email, final String password) {
|
||||
// Tag used to cancel the request
|
||||
String tag_string_req = "req_login";
|
||||
db.deleteUsers();
|
||||
pDialog.setMessage("Logging in ...");
|
||||
showDialog();
|
||||
|
||||
StringRequest strReq = new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
private StringRequest getStringRequestLogin(final String email, final String password) {
|
||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
@@ -291,10 +332,6 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
// Check for error node in json
|
||||
if (!error) {
|
||||
// user successfully logged in
|
||||
// Create login session
|
||||
session.setLogin(true);
|
||||
|
||||
// Now store the user in sqlite
|
||||
String uid = jObj.getString("uid");
|
||||
|
||||
@@ -308,17 +345,45 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
String updated_at = user.getString("updated_at");
|
||||
String providerType = "local";
|
||||
|
||||
// Inserting row in users table
|
||||
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||
if(status.equals("0")){
|
||||
new AlertDialog.Builder(thiscontext)
|
||||
.setTitle("Activate your account")
|
||||
.setMessage("Your account is not activated yet. Please follow the instructions in your E-Mail. Do you want to resent the E-Mail?")
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String tag_string_req = "resendactivationusermail";
|
||||
|
||||
// Launch main activity
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
StringRequest strReq = getStringRequestActivationLinkUser(input_email.getText().toString());
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
showMessage("E-Mail was sent to your address");
|
||||
}
|
||||
})
|
||||
.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();
|
||||
}else {
|
||||
// Inserting row in users table
|
||||
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||
|
||||
// user successfully logged in
|
||||
// Create login session
|
||||
session.setLogin(true);
|
||||
|
||||
// Launch main activity
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
// Error in login. Get the error message
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Toast.makeText(getApplicationContext(),errorMsg, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getApplicationContext(), errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
// JSON error
|
||||
@@ -349,56 +414,89 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to store user in MySQL database will post params(tag, name,* email, password) to register url
|
||||
* */
|
||||
private void registerUser(final String username, final String email,final String password) {
|
||||
// Tag used to cancel the request
|
||||
String tag_string_req = "req_register";
|
||||
db.deleteUsers();
|
||||
pDialog.setMessage("Registering ...");
|
||||
showDialog();
|
||||
private StringRequest getStringRequestRegisterUser(final String username, final String email, final String password) {
|
||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
|
||||
StringRequest strReq = new StringRequest(Method.POST,
|
||||
AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
Log.d(TAG, "Register Response: " + response.toString());
|
||||
hideDialog();
|
||||
|
||||
try {
|
||||
JSONObject jObj = new JSONObject(response);
|
||||
boolean error = jObj.getBoolean("error");
|
||||
if (!error) {
|
||||
new AlertDialog.Builder(getApplicationContext())
|
||||
.setTitle("Activation Link")
|
||||
.setMessage("An activation link was send to your e-mail address. Please follow the instructions to activate your account. Thank you!")
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//do nothing
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
|
||||
// Launch login activity
|
||||
Intent intent = new Intent(
|
||||
LoginActivity.this,
|
||||
LoginActivity.class);
|
||||
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
|
||||
// Error occurred in registration. Get the error
|
||||
// message
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Toast.makeText(getApplicationContext(),
|
||||
errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
}
|
||||
}) {
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getParams() {
|
||||
// Posting params to register url
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("tag", "register");
|
||||
params.put("username", username);
|
||||
params.put("email", email);
|
||||
params.put("password", password);
|
||||
|
||||
return params;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private StringRequest getStringRequestResetPW(final String email) {
|
||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
Log.d(TAG, "Register Response: " + response.toString());
|
||||
Log.d(TAG, "Resend E-Mail Response: " + response.toString());
|
||||
hideDialog();
|
||||
|
||||
try {
|
||||
JSONObject jObj = new JSONObject(response);
|
||||
boolean error = jObj.getBoolean("error");
|
||||
if (!error) {
|
||||
// User successfully stored in MySQL
|
||||
// Now store the user in sqlite
|
||||
String uid = jObj.getString("uid");
|
||||
|
||||
JSONObject user = jObj.getJSONObject("user");
|
||||
String username = user.getString("username");
|
||||
String name = user.getString("name");
|
||||
String surname = user.getString("surname");
|
||||
String email = user.getString("email");
|
||||
String status = user.getString("status");
|
||||
String created_at = user.getString("created_at");
|
||||
String updated_at = user.getString("updated_at");
|
||||
String providerType = "local";
|
||||
|
||||
// Inserting row in users table
|
||||
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||
// Launch login activity
|
||||
Intent intent = new Intent(
|
||||
LoginActivity.this,
|
||||
LoginActivity.class);
|
||||
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||
startActivity(intent);
|
||||
finish();
|
||||
// do nothing actually
|
||||
} else {
|
||||
|
||||
// Error occurred in registration. Get the error
|
||||
@@ -416,7 +514,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||
Log.e(TAG, "E-Mail pw resend Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
@@ -427,18 +525,73 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
protected Map<String, String> getParams() {
|
||||
// Posting params to register url
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("tag", "register");
|
||||
params.put("username", username);
|
||||
params.put("tag", "requestpwreset");
|
||||
params.put("email", email);
|
||||
params.put("password", password);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// Adding request to request queue
|
||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||
private StringRequest getStringRequestActivationLinkUser(final String email) {
|
||||
return new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
Log.d(TAG, "Resend E-Mail Response: " + response.toString());
|
||||
hideDialog();
|
||||
|
||||
try {
|
||||
JSONObject jObj = new JSONObject(response);
|
||||
boolean error = jObj.getBoolean("error");
|
||||
if (!error) {
|
||||
// do nothing actually
|
||||
} else {
|
||||
|
||||
// Error occurred in registration. Get the error
|
||||
// message
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Toast.makeText(getApplicationContext(),
|
||||
errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "E-Mail pw resend Error: " + error.getMessage());
|
||||
Toast.makeText(getApplicationContext(),
|
||||
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||
hideDialog();
|
||||
}
|
||||
}) {
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getParams() {
|
||||
// Posting params to register url
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("tag", "resendactivationusermail");
|
||||
params.put("email", email);
|
||||
|
||||
return params;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private boolean isEmpty(TextView etText) {
|
||||
return etText.getText().toString().trim().length() == 0;
|
||||
}
|
||||
|
||||
public void showMessage(String statusText){
|
||||
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
public void onFragmentInteraction(Uri uri){
|
||||
//you can leave it empty
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
@@ -450,5 +603,4 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
if (pDialog.isShowing())
|
||||
pDialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.deke.risk.riskahead;
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.deke.risk.riskahead.helper.BaseActivity;
|
||||
|
||||
|
||||
public class ReportActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_report);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_report, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResourceId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getActivityName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void addDrawerItems() {
|
||||
String[] osArray = { "Start", "Maps", "Profile", "Settings", "Subscription", "Logout" };
|
||||
String[] osArray = { "Start", "Report", "Incident Map", "Profile", "Settings", "Subscription", "Logout" };
|
||||
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
|
||||
mDrawerList.setAdapter(mAdapter);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 49 KiB |
@@ -13,6 +13,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="20sp"
|
||||
android:typeface="sans"
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/hello" />
|
||||
|
||||
|
||||
@@ -117,6 +120,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClick"
|
||||
android:clickable="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/txt_resend_password"
|
||||
android:id="@+id/txt_resend_password"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:background="@drawable/vAGZp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
@@ -12,14 +14,81 @@
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Welcome!"
|
||||
android:id="@+id/textView2"
|
||||
android:text="We have currently ..."
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="52dp" />
|
||||
android:layout_marginTop="52dp"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_incidents"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="0"
|
||||
android:layout_marginTop="38dp"
|
||||
android:layout_below="@+id/textView1"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="... reported incidents"
|
||||
android:layout_marginTop="34dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_below="@+id/txt_incidents"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Contribute and share your information"
|
||||
android:layout_above="@+id/LinearLayout02"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="26dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginBottom="43dp">
|
||||
|
||||
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||
android:id="@+id/btn_report"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Report" android:layout_weight="1"
|
||||
bootstrap:bb_icon_left="fa-map-marker"
|
||||
bootstrap:bb_type="danger"
|
||||
bootstrap:bb_roundedCorners="true" />
|
||||
|
||||
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||
android:id="@+id/btn_view_map"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_weight="1"
|
||||
android:text="View Map"
|
||||
bootstrap:bb_icon_left="fa-map"
|
||||
bootstrap:bb_type="primary"
|
||||
bootstrap:bb_roundedCorners="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textSize="20sp"
|
||||
android:typeface="sans"
|
||||
android:textStyle="bold"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<EditText
|
||||
@@ -93,8 +96,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView"
|
||||
android:layout_above="@+id/fragment_btn_gp"
|
||||
android:layout_alignRight="@+id/hello"
|
||||
android:layout_alignEnd="@+id/hello" />
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<fragment
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
12
app/src/main/res/layout/activity_report.xml
Normal file
12
app/src/main/res/layout/activity_report.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="org.deke.risk.riskahead.ReportActivity">
|
||||
|
||||
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -4,15 +4,7 @@
|
||||
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.deke.risk.riskahead.fragments.FacebookButtonFragment">
|
||||
<!--
|
||||
<com.facebook.login.widget.LoginButton
|
||||
android:id="@+id/btn_login_fb"
|
||||
android:layout_width="225dp"
|
||||
android:layout_height="50dp"
|
||||
fb:com_facebook_login_text="Facebook"
|
||||
fb:com_facebook_logout_text="Facebook"
|
||||
/>
|
||||
-->
|
||||
|
||||
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||
android:id="@+id/btn_login_fb"
|
||||
android:layout_width="225dp"
|
||||
|
||||
7
app/src/main/res/menu/menu_report.xml
Normal file
7
app/src/main/res/menu/menu_report.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="org.deke.risk.riskahead.ReportActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
||||
@@ -1,9 +1,9 @@
|
||||
<resources>
|
||||
<string name="app_name">RiskAhead</string>
|
||||
<string name="facebook_app_id">658657714234846</string>
|
||||
<string name="txt_welcome_register">New here? Please register to use our service!</string>
|
||||
<string name="txt_welcome_login">Already registrated? Please log in to use our service!</string>
|
||||
<string name="txt_resend_password"><a href="test.com">Resend Password</a> </string>
|
||||
<string name="txt_welcome_register">Register to RiskAhead</string>
|
||||
<string name="txt_welcome_login">Log-in to RiskAhead</string>
|
||||
<string name="txt_resend_password">Forgot your password?\nClick here</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="txt_policy"><a href="test.com">Terms of Service</a> and\n<a href="test.com">Privacy Policy</a></string>
|
||||
<string name="hint_full_name">Full Name</string>
|
||||
@@ -43,4 +43,7 @@
|
||||
<string name="app_label">Label</string>
|
||||
<string name="search_hint">Location</string>
|
||||
<string name="search_settings">search settings</string>
|
||||
<string name="title_activity_report">ReportActivity</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user