@02.02.15 Dennis Thießen: Release 1.8.6

This commit is contained in:
Dennis Thießen
2016-02-02 22:35:16 +01:00
parent 1696718cbb
commit 6ee71e7e42
14 changed files with 96 additions and 81 deletions

Binary file not shown.

View File

@@ -19,8 +19,8 @@ android {
applicationId "org.deke.risk.riskahead"
minSdkVersion 15
targetSdkVersion 22
versionCode 20
versionName "1.8.5"
versionCode 21
versionName "1.8.6"
}
buildTypes {
release {

View File

@@ -122,6 +122,7 @@
<activity
android:name=".ReportWFActivity"
android:windowSoftInputMode="adjustPan"
android:noHistory="true"
android:label="@string/title_activity_report_wf"
android:screenOrientation="portrait" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@@ -1,12 +1,12 @@
package org.deke.risk.riskahead;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
@@ -35,6 +35,8 @@ public class MainActivity extends BaseActivity{
private Handler mHandler = new Handler();
private TextView notificationStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -193,4 +195,7 @@ public class MainActivity extends BaseActivity{
protected String getActivityName() {
return getResources().getString(R.string.title_activity_start);
}
}

View File

@@ -20,6 +20,7 @@ import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
@@ -94,6 +95,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
private boolean markersShown = false;
private boolean showAdd = true;
private int pbCounter = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -125,8 +128,6 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
initClustering();
}
@Override
public void onLowMemory() {
super.onLowMemory();
@@ -306,6 +307,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}
private void refreshIncidentMarkers(LatLng northeast, LatLng southwest){
showProgress();
String tag_string_req = "getincidentsfrombound";
StringRequest strReq = getStringRequestGetAllIncidentsFromBound(northeast,southwest);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
@@ -326,6 +329,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}
private void refreshIncidentHeatMap(LatLng northeast, LatLng southwest){
showProgress();
String tag_string_req = "getincidentsforheatmapfrombound";
StringRequest strReq = getStringRequestGetAllIncidentsForHeatMapFromBound(northeast, southwest);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
@@ -365,7 +370,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
@Override
public void onResponse(String response) {
Log.d(TAG, "Map HeatMap positions response: " + response);
hideProgress();
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
@@ -386,6 +391,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
hideProgress();
Log.e(TAG, "Error getting map positions: " + error.getMessage());
showMessage(getString(R.string.errormsg_couldnotretrieve));
}
@@ -412,7 +418,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
@Override
public void onResponse(String response) {
Log.d(TAG, "Map positions response: " + response);
hideProgress();
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
@@ -433,6 +439,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
hideProgress();
Log.e(TAG, "Error getting map positions: " + error.getMessage());
showMessage(getString(R.string.errormsg_couldnotretrieve));
}
@@ -480,6 +487,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}
private void loadInfoWindowInformation(View infoView, String incidentID){
showProgress();
String tag_string_req = "getincidentscoreforinfowindow";
StringRequest strReq = getStringRequestGetIncidentScoreForInfoWindow(infoView, incidentID);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
@@ -491,7 +500,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
@Override
public void onResponse(String response) {
Log.d(TAG, "Map positions response: " + response);
hideProgress();
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
@@ -503,7 +512,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
TextView tvUsername = ((TextView) infoView.findViewById(R.id.txt_infowindow_fromuser));
RatingBar rbScore = ((RatingBar) infoView.findViewById(R.id.rb_infowindow_rating));
tvUsername.setText(getString(R.string.lbl_mapsinfowindow_author) + " " + clickedClusterItem.getFromUsername());
tvUsername.setText(String.format("%s %s",getString(R.string.lbl_mapsinfowindow_author),clickedClusterItem.getFromUsername()));
rbScore.setRating(clickedClusterItem.getScoreStars());
if (markerShowingInfoWindow != null && markerShowingInfoWindow.isInfoWindowShown()) {
@@ -523,6 +532,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
hideProgress();
Log.e(TAG, "Error getting incident details: " + error.getMessage());
showMessage(getString(R.string.errormsg_couldnotretrieve));
}
@@ -577,7 +587,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
tvSuspect.setText(String.format("%s %s",getString(R.string.lbl_mapsinfowindow_suspect),clickedClusterItem.getSuspectString(getApplicationContext())));
tvVictim.setText(String.format("%s %s",getString(R.string.lbl_mapsinfowindow_victim),clickedClusterItem.getVictimString(getApplicationContext())));
tvTime.setText(String.format("%s %s",(R.string.lbl_mapsinfowindow_time),clickedClusterItem.getTimeString(getApplicationContext())));
tvTime.setText(String.format("%s %s", getString(R.string.lbl_mapsinfowindow_time), clickedClusterItem.getTimeString(getApplicationContext())));
}
return myContentsView;
}
@@ -738,8 +748,15 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
return getResources().getString(R.string.title_activity_maps);
}
public void onBackPressed(){
super.onBackPressed();
private void showProgress(){
((ProgressBar) findViewById(R.id.pb_map_progress)).setVisibility(View.VISIBLE);
pbCounter++;
}
private void hideProgress(){
pbCounter--;
if(pbCounter == 0){
((ProgressBar) findViewById(R.id.pb_map_progress)).setVisibility(View.GONE);
}
}
}

View File

@@ -149,7 +149,6 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
currentState = state;
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_reportwf, fragList.get(state));
transaction.commit();
@@ -168,6 +167,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
String currentSite = (currentState+1) + "/" + (fragList.size()-1);
siteIndicator.setText(currentSite);
}
private void resetStateAndIncident(){
@@ -378,34 +378,9 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
.setMessage(R.string.txt_share_message)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
gotoMapActivity(incident.getPosition().latitude+":"+incident.getPosition().longitude);
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
R.drawable.ra_qrcode);
String text = getString(R.string.txt_share_hint)
+getString(R.string.txt_share_hint2)+": "+ incident.getIncidentCategoryName(getApplicationContext())
+" - "+incident.getIncidentSubCategoryName(getApplicationContext())+"\n"
+getString(R.string.txt_share_hint3)+": "+ incident.getIncidentPositionDescription().split("\\n")[0] + " - " + incident.getIncidentPositionDescription().split("\\n")[1] + "\n"
+getString(R.string.txt_share_page);
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getApplicationContext().getContentResolver(), icon, "Share incident", null)));
sharingIntent.setType("image/*");
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.txt_share_acttitle)));
finish();
resetStateAndIncident();
gotoMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude);
startShareIncidentIntent(incident);
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@@ -416,15 +391,29 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
private void startShareIncidentIntent(IncidentReport incident) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
R.drawable.ra_qrcode);
String text = getString(R.string.txt_share_hint)
+getString(R.string.txt_share_hint2)+": "+ incident.getIncidentCategoryName(getApplicationContext())
+" - "+incident.getIncidentSubCategoryName(getApplicationContext())+"\n"
+getString(R.string.txt_share_hint3)+": "+ incident.getIncidentPositionDescription().split("\\n")[0] + " - " + incident.getIncidentPositionDescription().split("\\n")[1] + "\n"
+getString(R.string.txt_share_page);
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getApplicationContext().getContentResolver(), icon, "Share incident", null)));
sharingIntent.setType("image/*");
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.txt_share_acttitle)));
}
private void finishReportAndGotoMap(IncidentReport incident) {
resetStateAndIncident();
showAd();
gotoMapActivity(incident.getPosition().latitude+":"+incident.getPosition().longitude);
gotoMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude);
}
@Override

View File

@@ -4,7 +4,6 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
@@ -172,9 +171,7 @@ public class SubscriptionsActivity extends BaseActivity{
initPurchaseTable(responseList);
}
} catch (RemoteException e) {
e.printStackTrace();
} catch (JSONException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -235,11 +232,8 @@ public class SubscriptionsActivity extends BaseActivity{
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
startIntentSenderForResult(pendingIntent.getIntentSender(),
1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
Integer.valueOf(0));
} catch (RemoteException e) {
e.printStackTrace();
} catch (IntentSender.SendIntentException e) {
1001, new Intent(), 0, 0, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -256,7 +250,7 @@ public class SubscriptionsActivity extends BaseActivity{
JSONObject jo = new JSONObject(purchaseData);
String sku = jo.getString("productId");
showMessage(getResources().getString(R.string.txt_subs_youbought) + " " + purchaseMap.get(sku).getString("title") + ". " + getResources().getString(R.string.txt_subs_thankyou));
showMessage(String.format("%s %s. %s",getResources().getString(R.string.txt_subs_youbought),purchaseMap.get(sku).getString("title"),getResources().getString(R.string.txt_subs_thankyou)));
addSubscription(purchaseMap.get(sku).getString("productId"),purchaseMap.get(sku).getString("type"),purchaseMap.get(sku).getString("price_amount_micros"),purchaseMap.get(sku).getString("price_currency_code"));
}
catch (JSONException e) {
@@ -289,7 +283,7 @@ public class SubscriptionsActivity extends BaseActivity{
Log.e(TAG, "Error adding subscription (Server returned error): " + errorMsg);
showMessage(getResources().getString(R.string.txt_errormsg_subs));
} else {
getSubscriptionsAndSync(user.get(SessionManager.KEY_UID));
gotoSubscriptionsActivity();
}
} catch (JSONException e) {

View File

@@ -411,7 +411,6 @@ public abstract class BaseActivity extends AppCompatActivity {
Intent intent;
intent = new Intent(BaseActivity.this, MapsActivity.class);
BaseActivity.this.startActivity(intent);
finish();
}
public void gotoMapActivity(String position){
@@ -419,7 +418,6 @@ public abstract class BaseActivity extends AppCompatActivity {
intent = new Intent(getApplicationContext(), MapsActivity.class);
intent.putExtra(EXTRA_MESSAGE, position);
startActivity(intent);
finish();
}
public void getNotifyLocationFromMapActivity(){
@@ -427,7 +425,6 @@ public abstract class BaseActivity extends AppCompatActivity {
intent = new Intent(getApplicationContext(), MapsActivity.class);
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETNOTIFY);
startActivity(intent);
finish();
}
public void getIncidentLocationFromMapActivity(){
@@ -435,7 +432,6 @@ public abstract class BaseActivity extends AppCompatActivity {
intent = new Intent(getApplicationContext(), MapsActivity.class);
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETINCLOC);
startActivity(intent);
finish();
}
public void getNotifyLocationFromMapActivity(String position){
@@ -444,7 +440,6 @@ public abstract class BaseActivity extends AppCompatActivity {
intent.putExtra(EXTRA_MESSAGE, position);
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETNOTIFY);
startActivity(intent);
finish();
}
public void getIncidentLocationFromMapActivity(String position){
@@ -453,14 +448,12 @@ public abstract class BaseActivity extends AppCompatActivity {
intent.putExtra(EXTRA_MESSAGE, position);
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETINCLOC);
startActivity(intent);
finish();
}
public void gotoProfileActivity(){
Intent intent;
intent = new Intent(getApplicationContext(), ProfileActivity.class);
startActivity(intent);
finish();
}
public void gotoProfileActivity(String uid){
@@ -468,21 +461,18 @@ public abstract class BaseActivity extends AppCompatActivity {
intent = new Intent(getApplicationContext(), ProfileActivity.class);
intent.putExtra(EXTRA_MESSAGE, uid);
startActivity(intent);
finish();
}
public void gotoSettingsActivity(){
Intent intent;
intent = new Intent(getApplicationContext(), SettingsActivity.class);
startActivity(intent);
finish();
}
public void gotoSubscriptionsActivity(){
Intent intent;
intent = new Intent(getApplicationContext(), SubscriptionsActivity.class);
startActivity(intent);
finish();
}
public void gotoViewReportActivity(Integer uid){
@@ -490,7 +480,6 @@ public abstract class BaseActivity extends AppCompatActivity {
intent = new Intent(getApplicationContext(), ViewReportActivity.class);
intent.putExtra(EXTRA_MESSAGE, uid);
startActivity(intent);
finish();
}
@Override
@@ -577,7 +566,7 @@ public abstract class BaseActivity extends AppCompatActivity {
((TextView) dialoglayout.findViewById(R.id.txt_about_terms)).setMovementMethod(LinkMovementMethod.getInstance());
try {
((TextView) dialoglayout.findViewById(R.id.lbl_about_version)).setText("Version: "+ getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
((TextView) dialoglayout.findViewById(R.id.lbl_about_version)).setText(String.format("Version: %s",getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
@@ -719,19 +708,24 @@ public abstract class BaseActivity extends AppCompatActivity {
return false;
}
@Override
public void onBackPressed() {
if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis())
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
else {
Toast.makeText(getBaseContext(), R.string.txt_backpressed_msg, Toast.LENGTH_SHORT).show(); }
if (isTaskRoot()) {
if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis()) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} else {
showMessage(getString(R.string.txt_backpressed_msg));
}
mBackPressed = System.currentTimeMillis();
mBackPressed = System.currentTimeMillis();
} else {
super.onBackPressed();
}
}
}

View File

@@ -52,6 +52,8 @@ public class SessionManager {
public static final String KEY_SUBS_NOADS = "subs_noads";
public static final String KEY_SUBS_PREMIUM = "subs_premium";
public static final String KEY_ONBACKPRESSED= "onbackpressed";
public SessionManager(Context context) {
@@ -71,6 +73,15 @@ public class SessionManager {
return status.getBoolean(KEY_IS_LOGGEDIN, false);
}
public Long getOnBackPressed(){
return status.getLong(KEY_ONBACKPRESSED, 0);
}
public void setOnBackPressed(Long onbackpressed){
statusEditor.putLong(KEY_ONBACKPRESSED, onbackpressed);
statusEditor.apply();
}
public void setLocation(Long latitude, Long longitude){
statusEditor.putLong(KEY_LOCATION_LAT, latitude);
statusEditor.putLong(KEY_LOCATION_LNG, longitude);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -44,6 +44,13 @@
app:layout_anchorGravity="bottom|left|end"
android:layout_alignParentBottom="true"/>
<ProgressBar
style="?android:attr/progressBarStyle"
android:id="@+id/pb_map_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
</RelativeLayout>

View File

@@ -223,7 +223,7 @@
<string name="txt_share_page">Für mehr Details: www.riskahead.de</string>
<string name="txt_share_acttitle">Vorfall teilen…</string>
<string name="txt_viewreport_noinput">Keine Angaben</string>
<string name="txt_backpressed_msg">Drücke erneut Zurück um die RiskAhead zu schließen</string>
<string name="txt_backpressed_msg">Drücke erneut Zurück um RiskAhead zu schließen</string>
<string name="txt_notifystatus_txt">Benachrichtigungen: </string>
<string name="txt_notifystatus_activated">AN</string>
<string name="txt_notifystatus_activatedbutnotready">NICHT BEREIT (GPS FEHLT)</string>

View File

@@ -5,7 +5,6 @@
<color name="bg_common">#1175b7</color>
<color name="bg_common_trans">#9e1175b7</color>
<color name="main_button">#50626262</color>
<color name="main_button_pressed">#e4474747</color>
@@ -16,8 +15,6 @@
<color name="text_light_grey">#aa4b4b4b</color>
<color name="txt_main">#b3d1e6</color>
<color name="black">#000000</color>
<color name="white">#f5f5f5</color>