Disabled "move to backscreen" button on Yotaphone2.

This commit is contained in:
Dmitry Yunitsky 2015-03-24 17:38:22 +03:00 committed by Alex Zolotarev
parent acf2072bed
commit c392d3b589
5 changed files with 26 additions and 41 deletions

View file

@ -26,6 +26,7 @@ import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.util.ConnectionState;
import com.mapswithme.util.Constants;
import com.mapswithme.util.Utils;
import com.mapswithme.util.Yota;
import com.mapswithme.util.statistics.Statistics;
import java.io.File;
@ -332,12 +333,11 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
private boolean checkLiteProPackages()
{
if (!MWMApplication.get().isYota() &&
if (!Yota.isFirstYota() &&
(getPackageIntent(Constants.Package.MWM_LITE_PACKAGE) != null ||
getPackageIntent(Constants.Package.MWM_SAMSUNG_PACKAGE) != null))
{
Toast.makeText(this, R.string.suggest_uninstall_lite, Toast.LENGTH_LONG).show();
}
return false;
}

View file

@ -712,29 +712,10 @@ public class MWMActivity extends BaseMwmFragmentActivity
private void setupYota()
{
final View yopmeButton = findViewById(R.id.yop_it);
if (!Yota.isYota())
yopmeButton.setVisibility(View.INVISIBLE);
if (Yota.isFirstYota())
yopmeButton.setOnClickListener(this);
else
{
yopmeButton.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
final double[] latLon = Framework.getScreenRectCenter();
final double zoom = Framework.getDrawScale();
final int locationStateMode = LocationState.INSTANCE.getLocationStateMode();
if (locationStateMode > LocationState.NOT_FOLLOW)
Yota.showLocation(getApplicationContext(), zoom);
else
Yota.showMap(getApplicationContext(), latLon[0], latLon[1], zoom, null, locationStateMode == LocationState.NOT_FOLLOW);
Statistics.INSTANCE.trackBackscreenCall("Map");
}
});
}
yopmeButton.setVisibility(View.INVISIBLE);
}
@Override
@ -766,8 +747,8 @@ public class MWMActivity extends BaseMwmFragmentActivity
{
if (savedInstanceState.getBoolean(STATE_PP_OPENED))
{
mPlacePage.setState(State.PREVIEW);
mPlacePage.setMapObject((MapObject) savedInstanceState.getParcelable(STATE_MAP_OBJECT));
mPlacePage.setState(State.PREVIEW);
}
else if (savedInstanceState.getBoolean(STATE_MENU_OPENED))
setVerticalToolbarVisible(true);
@ -1393,6 +1374,19 @@ public class MWMActivity extends BaseMwmFragmentActivity
case R.id.btn__myposition:
switchNextLocationState();
break;
case R.id.yop_it:
final double[] latLon = Framework.getScreenRectCenter();
final double zoom = Framework.getDrawScale();
final int locationStateMode = LocationState.INSTANCE.getLocationStateMode();
if (locationStateMode > LocationState.NOT_FOLLOW)
Yota.showLocation(getApplicationContext(), zoom);
else
Yota.showMap(getApplicationContext(), latLon[0], latLon[1], zoom, null, locationStateMode == LocationState.NOT_FOLLOW);
Statistics.INSTANCE.trackBackscreenCall("Map");
break;
default:
break;
}

View file

@ -2,7 +2,6 @@ package com.mapswithme.maps;
import android.app.Activity;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
@ -13,11 +12,11 @@ import android.util.Log;
import com.mapswithme.country.ActiveCountryTree;
import com.mapswithme.country.CountryItem;
import com.mapswithme.maps.background.Notifier;
import com.mapswithme.maps.background.WorkerService;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.Constants;
import com.mapswithme.util.FbUtil;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Yota;
import com.mapswithme.util.statistics.Statistics;
import java.io.File;
@ -42,7 +41,6 @@ public class MWMApplication extends android.app.Application implements ActiveCou
private static MWMApplication mSelf;
private boolean mAreStatsInitialised;
private boolean mIsYota;
public MWMApplication()
{
@ -96,8 +94,6 @@ public class MWMApplication extends android.app.Application implements ActiveCou
{
super.onCreate();
mIsYota = Build.DEVICE.equals(Constants.DEVICE_YOTAPHONE);
final String extStoragePath = getDataStoragePath();
final String extTmpPath = getTempPath();
@ -108,7 +104,7 @@ public class MWMApplication extends android.app.Application implements ActiveCou
// init native framework
nativeInit(getApkPath(), extStoragePath, extTmpPath, getOBBGooglePath(),
BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE,
mIsYota, UiUtils.isSmallTablet() || UiUtils.isBigTablet());
Yota.isFirstYota(), UiUtils.isSmallTablet() || UiUtils.isBigTablet());
ActiveCountryTree.addListener(this);
@ -199,11 +195,6 @@ public class MWMApplication extends android.app.Application implements ActiveCou
return nativeGetDouble(FOREGROUND_TIME_SETTING, 0);
}
public boolean isYota()
{
return mIsYota;
}
static
{
System.loadLibrary("mapswithme");

View file

@ -97,7 +97,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
private void storagePathSetup()
{
PreferenceScreen screen = (PreferenceScreen) findPreference(getString(R.string.pref_settings));
if (Yota.isYota())
if (Yota.isFirstYota())
screen.removePreference(mStoragePreference);
else if (mPathManager.hasMoreThanOneStorage())
screen.addPreference(mStoragePreference);
@ -110,7 +110,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
{
final PreferenceScreen screen = (PreferenceScreen) findPreference(getString(R.string.pref_settings));
final Preference yopPreference = findPreference(getString(R.string.pref_yota));
if (!Yota.isYota())
if (!Yota.isFirstYota())
screen.removePreference(yopPreference);
else
{

View file

@ -10,9 +10,9 @@ import com.mapswithme.maps.location.LocationHelper;
public class Yota
{
public static boolean isYota()
public static boolean isFirstYota()
{
return Build.DEVICE.contains(Constants.DEVICE_YOTAPHONE);
return Build.DEVICE.equals(Constants.DEVICE_YOTAPHONE);
}
private final static String YOPME_AUTHORITY = "com.mapswithme.yopme";