Merge pull request #4248 from osmandapp/fix_tts
Copy tts when change path during first launch
This commit is contained in:
commit
8e300271a2
2 changed files with 21 additions and 4 deletions
|
@ -17,6 +17,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -196,11 +198,22 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
return sz;
|
||||
}
|
||||
|
||||
private void checkAssets() {
|
||||
getMyApplication().getResourceManager().checkAssets(IProgress.EMPTY_PROGRESS, true);
|
||||
}
|
||||
|
||||
private void updateDownloadIndexes() {
|
||||
DownloadIndexesThread downloadIndexesThread = getMyApplication().getDownloadThread();
|
||||
downloadIndexesThread.runReloadIndexFilesSilent();
|
||||
}
|
||||
|
||||
private View.OnClickListener deviceMemoryOnClickListener =
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
saveFilesLocation(deviceStorageType, deviceStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
|
@ -211,6 +224,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
saveFilesLocation(sharedStorageType, sharedStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
|
@ -221,6 +236,8 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean res = saveFilesLocation(cardStorageType, cardStorage, getActivity());
|
||||
checkAssets();
|
||||
updateDownloadIndexes();
|
||||
isInterestedInFirstTime = false;
|
||||
if (res) {
|
||||
dismiss();
|
||||
|
|
|
@ -350,7 +350,7 @@ public class ResourceManager {
|
|||
public List<String> reloadIndexesOnStart(AppInitializer progress, List<String> warnings){
|
||||
close();
|
||||
// check we have some assets to copy to sdcard
|
||||
warnings.addAll(checkAssets(progress));
|
||||
warnings.addAll(checkAssets(progress, false));
|
||||
progress.notifyEvent(InitEvents.ASSETS_COPIED);
|
||||
reloadIndexes(progress, warnings);
|
||||
progress.notifyEvent(InitEvents.MAPS_INITIALIZED);
|
||||
|
@ -414,9 +414,9 @@ public class ResourceManager {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
private List<String> checkAssets(IProgress progress) {
|
||||
public List<String> checkAssets(IProgress progress, boolean forceUpdate) {
|
||||
String fv = Version.getFullVersion(context);
|
||||
if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())) {
|
||||
if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get()) || forceUpdate) {
|
||||
File applicationDataDir = context.getAppPath(null);
|
||||
applicationDataDir.mkdirs();
|
||||
if (applicationDataDir.canWrite()) {
|
||||
|
@ -424,7 +424,7 @@ public class ResourceManager {
|
|||
progress.startTask(context.getString(R.string.installing_new_resources), -1);
|
||||
AssetManager assetManager = context.getAssets();
|
||||
boolean isFirstInstall = context.getSettings().PREVIOUS_INSTALLED_VERSION.get().equals("");
|
||||
unpackBundledAssets(assetManager, applicationDataDir, progress, isFirstInstall);
|
||||
unpackBundledAssets(assetManager, applicationDataDir, progress, isFirstInstall || forceUpdate);
|
||||
context.getSettings().PREVIOUS_INSTALLED_VERSION.set(fv);
|
||||
copyRegionsBoundaries();
|
||||
// see Issue #3381
|
||||
|
|
Loading…
Reference in a new issue