Update activity
This commit is contained in:
parent
dd506bbfa4
commit
1ae0258121
4 changed files with 41 additions and 37 deletions
|
@ -172,7 +172,7 @@ public class OsmandApplication extends Application {
|
|||
if (routingHelper != null) {
|
||||
routingHelper.getVoiceRouter().onApplicationTerminate();
|
||||
}
|
||||
if(RateUsBottomSheetDialog.shouldShow(osmandSettings)) {
|
||||
if(RateUsBottomSheetDialog.shouldShow(this)) {
|
||||
osmandSettings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.IGNORED);
|
||||
}
|
||||
getNotificationHelper().removeServiceNotification();
|
||||
|
|
|
@ -399,7 +399,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents {
|
|||
} else {
|
||||
if (ErrorBottomSheetDialog.shouldShow(settings, this)) {
|
||||
new ErrorBottomSheetDialog().show(getFragmentManager(), "dialog");
|
||||
} else if (RateUsBottomSheetDialog.shouldShow(settings)) {
|
||||
} else if (RateUsBottomSheetDialog.shouldShow(app)) {
|
||||
new RateUsBottomSheetDialog().show(getFragmentManager(), "dialog");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
|
||||
|
@ -24,7 +24,7 @@ public class DashRateUsFragment extends DashBaseFragment {
|
|||
new DashboardOnMap.DefaultShouldShow() {
|
||||
@Override
|
||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||
return RateUsBottomSheetDialog.shouldShow(settings)
|
||||
return RateUsBottomSheetDialog.shouldShow(activity.getMyApplication())
|
||||
&& super.shouldShow(settings, activity, tag);
|
||||
}
|
||||
};
|
||||
|
@ -86,15 +86,14 @@ public class DashRateUsFragment extends DashBaseFragment {
|
|||
return;
|
||||
case USER_LIKES_APP:
|
||||
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
||||
// Assuming GooglePlay
|
||||
Uri uri = Uri.parse("market://details?id=" + getActivity().getPackageName());
|
||||
Uri uri = Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName());
|
||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||
try {
|
||||
startActivity(goToMarket);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse("http://play.google.com/store/apps/details?id="
|
||||
+ getActivity().getPackageName())));
|
||||
|
||||
Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName())));
|
||||
}
|
||||
break;
|
||||
case USER_DISLIKES_APP:
|
||||
|
|
|
@ -10,9 +10,10 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
@ -34,7 +35,11 @@ public class RateUsBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
public static boolean shouldShow(OsmandSettings settings) {
|
||||
public static boolean shouldShow(OsmandApplication app) {
|
||||
if(!Version.isMarketEnabled(app)) {
|
||||
return false;
|
||||
}
|
||||
OsmandSettings settings = app.getSettings();
|
||||
if(!settings.LAST_DISPLAY_TIME.isSet()) {
|
||||
settings.LAST_DISPLAY_TIME.set(System.currentTimeMillis());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue