DT @8.11.2015: Delete report function implemented. Some design changes. Fadein and out animation added.

This commit is contained in:
Dennis Thießen
2015-11-08 19:16:25 +01:00
parent ea40208fdb
commit c8551bf081
16 changed files with 320 additions and 63 deletions

View File

@@ -54,6 +54,9 @@
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName=".StartActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".StartActivity" />
</activity>
<activity android:name="com.twitter.sdk.android.core.identity.OAuthActivity" />
@@ -122,7 +125,11 @@
<activity
android:name=".ReportlistActivity"
android:configChanges="orientation"
android:label="@string/title_activity_reportlist" >
android:label="@string/title_activity_reportlist"
android:parentActivityName=".ProfileActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ProfileActivity" />
</activity>
<activity

View File

@@ -562,6 +562,15 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
pDialog.show();
}
@Override
public void onBackPressed() {
Intent intent = new Intent(
LoginActivity.this,
StartActivity.class);
startActivity(intent);
finish();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();

View File

@@ -246,11 +246,13 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
JSONObject incident = incidents.getJSONObject(i);
LatLng pos = new LatLng(Double.parseDouble(incident.getString("latitude")),Double.parseDouble(incident.getString("longitude")));
Log.d(TAG, "Adding marker with position: " + pos.latitude +" : "+ pos.longitude);
mMarker = mMap.addMarker(new MarkerOptions()
.position(pos)
.title(incident.getString("text_short"))
.snippet("Crime Category:" + incident.getString("cat_name")));
switch (incident.getInt("fid_category")) {
case 1:
mMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
@@ -263,6 +265,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
break;
}
markerIDs.put(mMarker.getId(), incident.getString("uid"));
CircleOptions circleOptions = new CircleOptions()

View File

@@ -349,9 +349,11 @@ public class ReportActivity extends BaseActivity {
incidentCategoryList.add(category.getString("name"));
}
ArrayAdapter<String> adapter = new ArrayAdapter<>(getApplicationContext(),android.R.layout.simple_spinner_dropdown_item,incidentCategoryList);
Spinner spinner = (Spinner) findViewById(R.id.dd_report_category);
ArrayAdapter<String> adapter = new ArrayAdapter<>(ReportActivity.this, android.R.layout.simple_spinner_item,incidentCategoryList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
} else {
// Error in login. Get the error message
String errorMsg = jObj.getString("error_msg");

View File

@@ -1,5 +1,7 @@
package org.deke.risk.riskahead;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
@@ -80,7 +82,22 @@ public class ViewReportActivity extends BaseActivity {
findViewById(R.id.btn_viewreport_delete).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
deleteReport(uid);
new AlertDialog.Builder(ViewReportActivity.this)
.setTitle("Delete incident")
.setMessage("Do you really want to delete this incident?")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
deleteReport(uid);
}
})
.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();
}
});
}
@@ -99,14 +116,14 @@ public class ViewReportActivity extends BaseActivity {
return mActivityTitle;
}
public void deleteIncident(String uid) {
String tag_string_req = "deactivateIncident";
public void getIncident(String uid) {
String tag_string_req = "getincidentwithpositionfromid";
StringRequest strReq = getStringRequestGetIncidentWithPositionFromID(uid);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
}
public void getIncident(String uid) {
String tag_string_req = "getincidentwithpositionfromid";
public void deleteIncident(String uid) {
String tag_string_req = "deactivateIncident";
StringRequest strReq = getStringRequestDeleteIncident(uid);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
}
@@ -151,7 +168,7 @@ public class ViewReportActivity extends BaseActivity {
protected Map<String, String> getParams() {
// Posting parameters to login url
Map<String, String> params = new HashMap<>();
params.put("tag", "deactivateIncident");
params.put("tag", "deactivateincident");
params.put("uid", user.get("uid"));
params.put("token", user.get("token"));
params.put("incidentid", incidentid);

View File

@@ -73,6 +73,8 @@ public abstract class BaseActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(getLayoutResourceId());
overridePendingTransition(R.anim.fade_in_anim,R.anim.fade_out_anim);
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="300"
android:repeatCount="0" />
</set>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="300"
android:repeatCount="0" />
</set>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#dedede"/>
<stroke android:width="1dip" android:color="#66808080" />
<corners android:radius="3dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View File

@@ -5,8 +5,8 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#8ae6e6e6"
tools:context="org.deke.risk.riskahead.ProfileActivity">
android:background="#8a000000"
tools:context=".ProfileActivity">
<LinearLayout
android:id="@+id/linearLayout1"
@@ -17,17 +17,18 @@
<RelativeLayout
android:id="@+id/rl_main_content"
android:layout_width="match_parent"
android:background="@drawable/layout_bg"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:padding="4dp"
android:background="#11222222"
android:layout_marginBottom="10dp"
android:padding="8dp"
android:orientation="vertical" >
<TextView
android:id="@+id/lbl_profile_stats"
android:text="@string/lbl_profile_stats"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
@@ -124,12 +125,13 @@
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:padding="4dp"
android:background="#11222222"
android:padding="8dp"
android:background="@drawable/layout_bg"
android:orientation="vertical" >
<TextView
android:id="@+id/lbl_profile_top10"
android:textStyle="bold"
android:text="@string/lbl_profile_top10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -178,7 +180,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="#c55ed9ff"
android:background="#34bbff"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"

View File

@@ -8,6 +8,11 @@
android:layout_height="match_parent"
tools:context=".ReportActivity">
<!-- dummy item for disabling focus -->
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
@@ -30,7 +35,12 @@
android:layout_alignLeft="@+id/input_report_short"
android:layout_alignStart="@+id/input_report_short"/>
<EditText
<com.beardedhen.androidbootstrap.BootstrapEditText
bootstrap:bootstrapSize="lg"
bootstrap:bootstrapBrand="info"
bootstrap:roundedCorners="true"
android:id="@+id/input_report_short"
android:hint="@string/input_report_short_hint"
android:inputType="text"
@@ -50,7 +60,10 @@
android:layout_marginTop="10dp"
android:layout_below="@+id/input_report_short" />
<EditText
<com.beardedhen.androidbootstrap.BootstrapEditText
bootstrap:bootstrapSize="lg"
bootstrap:bootstrapBrand="info"
bootstrap:roundedCorners="true"
android:id="@+id/input_report_long"
android:hint="@string/input_report_long_hint"
android:inputType="textMultiLine"
@@ -63,7 +76,9 @@
android:textColorHint="@color/input_login_hint"
android:layout_below="@+id/lbl_report_long"
android:scrollbars="vertical"
android:minLines="3"/>
android:minLines="1"
android:lines="4"
android:maxLines="4"/>
<TextView
android:id="@+id/lbl_report_category"
@@ -97,18 +112,25 @@
android:layout_alignLeft="@+id/input_report_time"
android:layout_alignStart="@+id/input_report_time"/>
<EditText
<com.beardedhen.androidbootstrap.BootstrapEditText
bootstrap:bootstrapSize="lg"
bootstrap:bootstrapBrand="info"
bootstrap:roundedCorners="true"
android:id="@+id/input_report_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:layout_marginRight="5dp"
android:ems="10"
android:layout_below="@+id/lbl_report_date"
android:layout_alignLeft="@+id/lbl_report_date"
android:layout_alignStart="@+id/lbl_report_date"
android:focusable="false"/>
<EditText
<com.beardedhen.androidbootstrap.BootstrapEditText
bootstrap:bootstrapSize="lg"
bootstrap:bootstrapBrand="info"
bootstrap:roundedCorners="true"
android:id="@+id/input_report_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -133,6 +155,7 @@
android:id="@+id/input_report_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
android:ems="10"
android:layout_below="@+id/lbl_report_position"
android:layout_alignLeft="@+id/lbl_report_position"
@@ -164,7 +187,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="@color/white"
android:background="#34bbff"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_marginBottom="0dp">
@@ -182,6 +205,7 @@
</LinearLayout>
<ListView
android:id="@+id/navList"
android:layout_width="200dp"

View File

@@ -1,35 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#a6000000"
android:id="@+id/txt_reportlist_lvrow_title"
android:text="Header"
android:textSize="16dp"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Long Text"
android:id="@+id/txt_reportlist_lvrow_text"
android:typeface="serif" />
<LinearLayout
android:orientation="horizontal"
android:id="@+id/lay_reportlist_color"
android:background="#e45151"
android:layout_width="5dp"
android:layout_marginRight="5dp"
android:layout_height="match_parent">
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#a6000000"
android:id="@+id/txt_reportlist_lvrow_title"
android:text="Header"
android:textSize="16dp"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Long Text"
android:id="@+id/txt_reportlist_lvrow_text"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Category"
android:id="@+id/txt_reportlist_lvrow_category"
android:typeface="serif" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Category"
android:id="@+id/txt_reportlist_lvrow_category"
android:typeface="serif" />
</LinearLayout>

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:background="#8ae6e6e6"
android:background="#8a000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingsActivity">
@@ -22,8 +22,8 @@
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:padding="4dp"
android:background="#11222222"
android:padding="8dp"
android:background="@drawable/layout_bg"
android:orientation="vertical" >
<TextView
@@ -107,7 +107,7 @@
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:padding="4dp"
android:background="#11222222"
android:background="@drawable/layout_bg"
android:orientation="vertical" >
<TextView
@@ -138,7 +138,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="@color/white"
android:background="#34bbff"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_marginBottom="0dp">

View File

@@ -7,15 +7,104 @@
android:layout_height="match_parent"
tools:context=".SubscriptionsActivity">
<RelativeLayout
android:id="@+id/rl_main_content"
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView android:text="Subscriptions Activity!" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/rl_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:layout_marginBottom="20dp"
android:padding="8dp"
android:background="@drawable/layout_bg"
android:orientation="vertical" >
</RelativeLayout>
<TextView
android:id="@+id/lbl_subscription_title"
android:text="Subscriptions"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:gravity="center"
android:stretchColumns="1"
android:layout_below="@+id/lbl_subscription_title"
android:id="@+id/tableLayout2">
<TableRow android:padding="1dp">
<TextView
android:id="@+id/lbl_subscription_1_title"
android:text="No Ads"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"/>
</TableRow>
<TableRow>
<TextView
android:id="@+id/lbl_subscription_1_desription"
android:text="You can subscripe this option to have no more ads. This is a recuring subscriptions for $5 a month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</TableRow>
<TableRow>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Purchase"
android:id="@+id/btn_subscription_1" />
</TableRow>
<TableRow android:padding="1dp">
<TextView
android:id="@+id/lbl_subscription_2_title"
android:text="Unlimited Access"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"/>
</TableRow>
<TableRow>
<TextView
android:id="@+id/lbl_subscription_2_description"
android:text="You can get unlimimited access to the report map with this reccuring subscription for $10 a month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</TableRow>
<TableRow>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Purchase"
android:id="@+id/btn_subscription_2" />
</TableRow>
</TableLayout>
</RelativeLayout>
</LinearLayout>
<ListView
android:id="@+id/navList"

View File

@@ -23,7 +23,7 @@
<RelativeLayout
android:id="@+id/rl_main_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:layout_weight="1"
android:orientation="vertical">
@@ -38,7 +38,6 @@
<EditText
android:id="@+id/input_viewreport_short"
android:hint="@string/input_report_short_hint"
android:inputType="text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -47,6 +46,7 @@
android:textColor="@color/input_login"
android:textColorHint="@color/input_login_hint"
android:enabled="false"
android:editable="false"
android:layout_marginTop="20dp"/>
<TextView
@@ -59,7 +59,6 @@
<EditText
android:id="@+id/input_viewreport_long"
android:hint="@string/input_report_long_hint"
android:inputType="textMultiLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -71,7 +70,10 @@
android:layout_below="@+id/lbl_viewreport_long"
android:scrollbars="vertical"
android:enabled="false"
android:minLines="3"/>
android:editable="false"
android:minLines="1"
android:lines="4"
android:maxLines="4"/>
<TextView
android:id="@+id/lbl_viewreport_category"
@@ -179,7 +181,7 @@
android:padding="5dp"
android:orientation="vertical"
android:gravity="center"
android:background="#8a999999">
android:background="#8a98b5c6">
<com.beardedhen.androidbootstrap.AwesomeTextView
android:id="@+id/btn_viewreport_upvote"
@@ -219,7 +221,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="@color/white"
android:background="#34bbff"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="1">
<LinearLayout
android:orientation="horizontal"
android:id="@+id/lay_infowindow_color"
android:background="#e45151"
android:layout_width="5dp"
android:layout_marginRight="5dp"
android:layout_height="match_parent">
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#a6000000"
android:id="@+id/txt_infowindow_title"
android:text="Header"
android:textSize="16dp"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Long Text"
android:id="@+id/txt_infowindow_description"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Category"
android:id="@+id/txt_infowindow_category"
android:typeface="serif" />
</LinearLayout>
</LinearLayout>