forked from organicmaps/organicmaps
Changed facebook share dialog display rules.
This commit is contained in:
parent
55c36e7e04
commit
5f09ba278b
2 changed files with 30 additions and 17 deletions
|
@ -91,6 +91,7 @@ import com.nineoldandroids.view.ViewHelper;
|
|||
import com.nvidia.devtech.NvEventQueueActivity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Stack;
|
||||
|
@ -532,6 +533,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
|
||||
private void showDialogImpl(final int dlgID, int resMsg, DialogInterface.OnClickListener okListener)
|
||||
{
|
||||
final MWMApplication application = MWMApplication.get();
|
||||
new AlertDialog.Builder(this)
|
||||
.setCancelable(false)
|
||||
.setMessage(getString(resMsg))
|
||||
|
@ -542,7 +544,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
MWMApplication.get().submitDialogResult(dlgID, MWMApplication.NEVER);
|
||||
application.submitDialogResult(dlgID, MWMApplication.NEVER);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.later), new DialogInterface.OnClickListener()
|
||||
|
@ -551,7 +553,9 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
dlg.dismiss();
|
||||
MWMApplication.get().submitDialogResult(dlgID, MWMApplication.LATER);
|
||||
application.submitDialogResult(dlgID, MWMApplication.LATER);
|
||||
// FIXME hack to deal with native & java FACEBOOK dialog views conflict
|
||||
application.nativeSetInt(MWMApplication.LAUNCH_NUMBER_SETTING, application.nativeGetInt(MWMApplication.LAUNCH_NUMBER_SETTING, 0) + 1);
|
||||
}
|
||||
})
|
||||
.create()
|
||||
|
@ -597,8 +601,18 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private void checkFacebookDialog()
|
||||
{
|
||||
if (ConnectionState.isConnected() &&
|
||||
MWMApplication.get().shouldShowDialog(MWMApplication.FACEBOOK) &&
|
||||
// TODO If new dialog display logic will be fine - move it to core and uncomment the following line
|
||||
// MWMApplication.get().shouldShowDialog(MWMApplication.FACEBOOK) &&
|
||||
Arrays.asList(MWMApplication.FACEBOOK_RATE_LAUNCHES).contains(MWMApplication.get().getLaunchesNumber()) &&
|
||||
MWMApplication.get().nativeGetBoolean("ShouldShowFacebookDialog", true) &&
|
||||
!isChinaRegion())
|
||||
mInfoView.postDelayed(mShareFacebookRunnable, 30 * 1000);
|
||||
}
|
||||
|
||||
private Runnable mShareFacebookRunnable = new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
showDialogImpl(MWMApplication.FACEBOOK, R.string.share_on_facebook_text,
|
||||
new DialogInterface.OnClickListener()
|
||||
|
@ -614,7 +628,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void checkBuyProDialog()
|
||||
{
|
||||
|
@ -1281,13 +1295,11 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
protected void onPause()
|
||||
{
|
||||
pauseLocation();
|
||||
|
||||
stopWatchingExternalStorage();
|
||||
|
||||
stopWatchingCompassStatusUpdate();
|
||||
|
||||
super.onPause();
|
||||
mLocationPredictor.pause();
|
||||
mInfoView.removeCallbacks(mShareFacebookRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class MWMApplication extends android.app.Application implements ActiveCou
|
|||
{
|
||||
private final static String TAG = "MWMApplication";
|
||||
private static final String FOREGROUND_TIME_SETTING = "AllForegroundTime";
|
||||
private static final String LAUNCH_NUMBER_SETTING = "LaunchNumber";
|
||||
public static final String LAUNCH_NUMBER_SETTING = "LaunchNumber";
|
||||
public static final String IS_PREINSTALLED = "IsPreinstalled";
|
||||
|
||||
private static MWMApplication mSelf;
|
||||
|
@ -107,8 +107,8 @@ public class MWMApplication extends android.app.Application implements ActiveCou
|
|||
|
||||
// init native framework
|
||||
nativeInit(getApkPath(), extStoragePath, extTmpPath, getOBBGooglePath(),
|
||||
BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE, BuildConfig.IS_PRO,
|
||||
mIsYota, getResources().getBoolean(R.bool.isTablet));
|
||||
BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE, BuildConfig.IS_PRO,
|
||||
mIsYota, getResources().getBoolean(R.bool.isTablet));
|
||||
|
||||
ActiveCountryTree.addListener(this);
|
||||
|
||||
|
@ -226,12 +226,13 @@ public class MWMApplication extends android.app.Application implements ActiveCou
|
|||
|
||||
public native boolean nativeIsBenchmarking();
|
||||
|
||||
/// @name Dealing with dialogs.
|
||||
/// @note Constants should be equal with map/dialog_settings.hpp
|
||||
/// @{
|
||||
static public final int FACEBOOK = 0;
|
||||
static public final int BUYPRO = 1;
|
||||
static public final int ROUTING = 3;
|
||||
// Dealing with dialogs.
|
||||
// Constants should be equal with map/dialog_settings.hpp
|
||||
public static final int FACEBOOK = 0;
|
||||
public static final int BUYPRO = 1;
|
||||
public static final int ROUTING = 3;
|
||||
|
||||
public static final Integer[] FACEBOOK_RATE_LAUNCHES = new Integer[]{3, 7, 10, 15, 21};
|
||||
|
||||
public native boolean shouldShowDialog(int dlg);
|
||||
|
||||
|
@ -240,7 +241,7 @@ public class MWMApplication extends android.app.Application implements ActiveCou
|
|||
static public final int NEVER = 2;
|
||||
|
||||
public native void submitDialogResult(int dlg, int res);
|
||||
/// @}
|
||||
//
|
||||
|
||||
private native void nativeAddLocalization(String name, String value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue