Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorАлександр Зацепин <az@mapswithme.com>2017-07-19 17:09:09 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2017-07-19 19:26:19 +0300
commit0730b7b8cd52201f42138ab1ab1550cab7944b30 (patch)
tree3b70c002b61a7c90d60532f97b1f89a96aebe020
parent79af2184ee39cc684894c6764e90a50efdee5b21 (diff)
[android] Added handling of updating the maps after recovery of appbeta-916
-rw-r--r--android/src/com/mapswithme/maps/SplashActivity.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/android/src/com/mapswithme/maps/SplashActivity.java b/android/src/com/mapswithme/maps/SplashActivity.java
index d114a9f25d..2f847c4462 100644
--- a/android/src/com/mapswithme/maps/SplashActivity.java
+++ b/android/src/com/mapswithme/maps/SplashActivity.java
@@ -8,9 +8,11 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
+import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
+import com.mapswithme.maps.downloader.UpdaterDialogFragment;
import com.mapswithme.maps.editor.ViralFragment;
import com.mapswithme.maps.news.BaseNewsFragment;
import com.mapswithme.maps.news.NewsFragment;
@@ -95,6 +97,7 @@ public class SplashActivity extends AppCompatActivity
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ handleUpdateMapsFragmentCorrectly(savedInstanceState);
UiThread.cancelDelayedTasks(mPermissionsDelayedTask);
UiThread.cancelDelayedTasks(mInitCoreDelayedTask);
UiThread.cancelDelayedTasks(mFinalDelayedTask);
@@ -102,6 +105,39 @@ public class SplashActivity extends AppCompatActivity
initView();
}
+ private void handleUpdateMapsFragmentCorrectly(@Nullable Bundle savedInstanceState)
+ {
+ if (savedInstanceState == null)
+ return;
+
+ FragmentManager fm = getSupportFragmentManager();
+ DialogFragment updaterFragment = (DialogFragment) fm
+ .findFragmentByTag(UpdaterDialogFragment.class.getName());
+
+ if (updaterFragment == null)
+ return;
+
+ // If the user revoked the external storage permission while the app was killed
+ // we can't update maps automatically during recovering process, so just dismiss updater fragment
+ // and ask the user to grant the permission.
+ if (!PermissionsUtils.isExternalStorageGranted())
+ {
+ fm.beginTransaction().remove(updaterFragment).commitAllowingStateLoss();
+ fm.executePendingTransactions();
+ StoragePermissionsDialogFragment.show(this);
+ }
+ else
+ {
+ // If external permissions are still granted we just need to check platform
+ // and core initialization, because we may be in the recovering process,
+ // i.e. method onResume() may not be invoked in that case.
+ if (!MwmApplication.get().arePlatformAndCoreInitialized())
+ {
+ init();
+ }
+ }
+ }
+
@Override
protected void onResume()
{