Show first time
This commit is contained in:
parent
dfb6accba2
commit
5ffec46f39
5 changed files with 21 additions and 21 deletions
|
@ -46,8 +46,6 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import btools.routingapp.BRouterServiceConnection;
|
||||
|
||||
/**
|
||||
|
@ -70,6 +68,7 @@ public class AppInitializer implements IProgress {
|
|||
|
||||
private boolean initSettings = false;
|
||||
private boolean firstTime;
|
||||
private boolean activityChangesShowed = false;
|
||||
private boolean appVersionChanged;
|
||||
private long startTime;
|
||||
private long startBgTime;
|
||||
|
@ -124,17 +123,24 @@ public class AppInitializer implements IProgress {
|
|||
}
|
||||
|
||||
public boolean isFirstTime(Activity activity) {
|
||||
SharedPreferences pref = activity.getPreferences(Context.MODE_WORLD_WRITEABLE);
|
||||
return !pref.contains(FIRST_TIME_APP_RUN);
|
||||
initUiVars(activity);
|
||||
return firstTime;
|
||||
}
|
||||
|
||||
public void setFirstTime(boolean firstTime) {
|
||||
this.firstTime = firstTime;
|
||||
}
|
||||
|
||||
public boolean checkAppVersionChanged(Activity activity) {
|
||||
initUiVars(activity);
|
||||
if (!firstTime && appVersionChanged) {
|
||||
boolean showRecentChangesDialog = !firstTime && appVersionChanged;
|
||||
// showRecentChangesDialog = true;
|
||||
if (showRecentChangesDialog && !activityChangesShowed) {
|
||||
final Intent helpIntent = new Intent(activity, HelpActivity.class);
|
||||
helpIntent.putExtra(HelpActivity.TITLE, Version.getAppVersion(app));
|
||||
helpIntent.putExtra(HelpActivity.URL, LATEST_CHANGES_URL);
|
||||
activity.startActivity(helpIntent);
|
||||
activityChangesShowed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1152,7 +1152,9 @@ public class OsmandSettings {
|
|||
public static final String EXTERNAL_STORAGE_DIR = "external_storage_dir"; //$NON-NLS-1$
|
||||
|
||||
public File getExternalStorageDirectory() {
|
||||
String defaultLocation = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
String defaultLocation =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
// ctx.getExternalFilesDirs(type)
|
||||
return new File(settingsAPI.getString(globalPreferences, EXTERNAL_STORAGE_DIR,
|
||||
defaultLocation));
|
||||
}
|
||||
|
|
|
@ -127,16 +127,6 @@ public class MapActivity extends AccessibleActivity {
|
|||
return notification;
|
||||
}
|
||||
|
||||
public boolean isFirstTime(){
|
||||
return firstTime;
|
||||
}
|
||||
|
||||
public void userClosedWelcomeCard(){
|
||||
firstTime = false;
|
||||
dashboardOnMap.refreshDashboardFragments();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
long tm = System.currentTimeMillis();
|
||||
|
@ -151,12 +141,12 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(),
|
||||
getWindow().getDecorView().getHeight());
|
||||
app.getAppInitializer().checkAppVersionChanged(this);
|
||||
mapActions = new MapActivityActions(this);
|
||||
mapLayers = new MapActivityLayers(this);
|
||||
if (mapViewTrackingUtilities == null) {
|
||||
mapViewTrackingUtilities = new MapViewTrackingUtilities(app);
|
||||
}
|
||||
firstTime = app.getAppInitializer().isFirstTime(this);
|
||||
dashboardOnMap.createDashboardView();
|
||||
checkAppInitialization();
|
||||
parseLaunchIntentLocation();
|
||||
|
|
|
@ -67,7 +67,8 @@ public class DashFirstTimeFragment extends DashBaseFragment {
|
|||
view.findViewById(R.id.hide).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((MapActivity)getActivity()).userClosedWelcomeCard();
|
||||
getMyApplication().getAppInitializer().setFirstTime(false);
|
||||
dashboard.refreshDashboardFragments();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
}
|
||||
|
||||
public void refreshDashboardFragments(){
|
||||
addOrUpdateDashboardFragments(mapActivity.isFirstTime());
|
||||
addOrUpdateDashboardFragments();
|
||||
}
|
||||
|
||||
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
|
||||
|
@ -415,7 +415,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
|
||||
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
|
||||
if(visibleType == DashboardType.DASHBOARD) {
|
||||
addOrUpdateDashboardFragments(mapActivity.isFirstTime());
|
||||
addOrUpdateDashboardFragments();
|
||||
scrollView.setVisibility(View.VISIBLE);
|
||||
listViewLayout.setVisibility(View.GONE);
|
||||
onScrollChanged(scrollView.getScrollY(), false, false);
|
||||
|
@ -636,7 +636,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
}
|
||||
|
||||
|
||||
private void addOrUpdateDashboardFragments(boolean firstTime) {
|
||||
private void addOrUpdateDashboardFragments() {
|
||||
boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(mapActivity);
|
||||
// boolean showCards = mapActivity.getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.get();
|
||||
boolean showCards = !firstTime;
|
||||
|
||||
|
|
Loading…
Reference in a new issue