DT @14.02.2016: 2.0.3 release

This commit is contained in:
Dennis Thießen
2016-02-14 14:34:00 +01:00
parent edb15e2b65
commit 6cd2f6b6e7
6 changed files with 78 additions and 41 deletions

View File

@@ -1,10 +1,13 @@
package org.deke.risk.riskahead;
import android.Manifest;
import android.app.AlertDialog;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentTransaction;
import android.content.DialogInterface;
import android.content.Intent;
@@ -26,6 +29,8 @@ import com.android.volley.toolbox.StringRequest;
import com.beardedhen.androidbootstrap.BootstrapButton;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
import com.google.gson.Gson;
import org.deke.risk.riskahead.fragment.BaseReportWFFragment;
@@ -65,6 +70,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
,ReportWF_7_Fragment.OnInputFinishedListener, ReportWF_8_Fragment.OnInputFinishedListener, ReportWF_Finish_Fragment.SendReportListener {
private final static String TAG = ReportWFActivity.class.getSimpleName();
private static final int MY_PERMISSIONS_REQUEST_STORAGE = 42;
private List<BaseReportWFFragment> fragList = new ArrayList<>();
@@ -384,7 +390,36 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
}
private void showDialogWhenReportAdded(final IncidentReport incident) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_STORAGE);
return;
}else{
showShareDialog(incident);
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_STORAGE: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
showShareDialog(incident);
} else {
finishReportAndGotoMap(incident);
}
return;
}
// other 'case' lines to check for other
// permissions this app might request
}
}
private void showShareDialog(final IncidentReport incident) {
new AlertDialog.Builder(ReportWFActivity.this)
.setTitle(R.string.txt_share_title)
.setMessage(R.string.txt_share_message)
@@ -392,7 +427,11 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
public void onClick(DialogInterface dialog, int which) {
resetStateAndIncident();
gotoMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude);
startShareIncidentIntent(incident);
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@@ -402,7 +441,6 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
private void startShareIncidentIntent(IncidentReport incident) {

View File

@@ -79,39 +79,42 @@ public class SubscriptionsActivity extends BaseActivity{
tblBillings = (TableLayout) findViewById(R.id.tbl_billing);
handler = new Handler();
Thread thread = new Thread() {
@Override
public void run() {
ServiceConnection mServiceConn = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
Log.d(TAG, "Disconnected from InApp Billing Service");
}
@Override
public void onServiceConnected(ComponentName name,
IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
Log.d(TAG,"Connected to InApp Billing Service");
Thread thread = new Thread() {
@Override
public void run() {
initBillingOptions();
getAlreadyPurchasedItems();
}
};
ServiceConnection mServiceConn = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
Log.d(TAG, "Disconnected from InApp Billing Service");
}
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
@Override
public void onServiceConnected(ComponentName name,
IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
Log.d(TAG, "Connected to InApp Billing Service");
querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
initBillingOptions();
getAlreadyPurchasedItems();
}
};
}
};
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
}
};
thread.start();
thread.start();
}
private void getAlreadyPurchasedItems() {

View File

@@ -15,7 +15,6 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
@@ -46,8 +45,6 @@ import com.android.volley.toolbox.StringRequest;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
@@ -140,16 +137,13 @@ public abstract class BaseActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//overridePendingTransition(R.anim.fade_in_anim, R.anim.fade_out_anim);
//overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
onStartCount = 1;
if (savedInstanceState == null) // 1st time
if (savedInstanceState == null)
{
this.overridePendingTransition(R.anim.slide_in_left,
R.anim.slide_out_left);
} else // already created so reverse animation
} else
{
onStartCount = 2;
}