forked from organicmaps/organicmaps
[android] fix: Code review fixes №3.
This commit is contained in:
parent
aadf4d1d78
commit
ffc3fa1033
5 changed files with 24 additions and 31 deletions
4
android/res/values-sw600dp/attrs.xml
Normal file
4
android/res/values-sw600dp/attrs.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<bool name="isTablet">true</bool>
|
||||
</resources>
|
|
@ -26,5 +26,6 @@
|
|||
<attr name="progress" format="integer"/>
|
||||
</declare-styleable>
|
||||
|
||||
<bool name="isTablet">false</bool>
|
||||
<bool name="tabletLayout">false</bool>
|
||||
</resources>
|
|
@ -122,7 +122,7 @@ public class MapPrefsFragment extends BaseXmlSettingsFragment
|
|||
String themeName = (String.valueOf(Framework.MAP_STYLE_DARK).equals(newValue) ? ThemeUtils.THEME_NIGHT : ThemeUtils.THEME_DEFAULT);
|
||||
Config.setUiTheme(themeName);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.Settings.MAP_STYLE,
|
||||
new Statistics.ParameterBuilder().add(Statistics.EventParam.NAME, themeName));
|
||||
Statistics.params().add(Statistics.EventParam.NAME, themeName));
|
||||
getActivity().recreate();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,28 +37,28 @@ public class MyPositionButton
|
|||
Drawable image;
|
||||
switch (state)
|
||||
{
|
||||
case LocationState.UNKNOWN_POSITION:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow, R.attr.iconTintLight);
|
||||
break;
|
||||
case LocationState.UNKNOWN_POSITION:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow, R.attr.iconTintLight);
|
||||
break;
|
||||
|
||||
case LocationState.NOT_FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_not_follow);
|
||||
break;
|
||||
case LocationState.NOT_FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_not_follow);
|
||||
break;
|
||||
|
||||
case LocationState.FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow, R.attr.colorAccent);
|
||||
break;
|
||||
case LocationState.FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow, R.attr.colorAccent);
|
||||
break;
|
||||
|
||||
case LocationState.ROTATE_AND_FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow_and_rotate, R.attr.colorAccent);
|
||||
break;
|
||||
case LocationState.ROTATE_AND_FOLLOW:
|
||||
image = Graphics.tint(mButton.getContext(), R.drawable.ic_follow_and_rotate, R.attr.colorAccent);
|
||||
break;
|
||||
|
||||
case LocationState.PENDING_POSITION:
|
||||
image = mButton.getResources().getDrawable(ThemeUtils.getResource(mButton.getContext(), R.attr.myPositionButtonAnimation));
|
||||
break;
|
||||
case LocationState.PENDING_POSITION:
|
||||
image = mButton.getResources().getDrawable(ThemeUtils.getResource(mButton.getContext(), R.attr.myPositionButtonAnimation));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid button state: " + state);
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid button state: " + state);
|
||||
}
|
||||
|
||||
mButton.setImageDrawable(image);
|
||||
|
|
|
@ -2,11 +2,9 @@ package com.mapswithme.util;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.DimenRes;
|
||||
|
@ -18,7 +16,6 @@ import android.text.TextUtils;
|
|||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.widget.TextView;
|
||||
|
@ -29,7 +26,6 @@ import com.mapswithme.maps.R;
|
|||
public final class UiUtils
|
||||
{
|
||||
private static float sScreenDensity;
|
||||
private static Boolean sIsTablet;
|
||||
|
||||
public static class SimpleAnimationListener implements AnimationListener
|
||||
{
|
||||
|
@ -306,15 +302,7 @@ public final class UiUtils
|
|||
|
||||
public static boolean isTablet()
|
||||
{
|
||||
if (sIsTablet == null)
|
||||
{
|
||||
WindowManager wm = (WindowManager)MwmApplication.get().getSystemService(Context.WINDOW_SERVICE);
|
||||
Point sz = new Point();
|
||||
wm.getDefaultDisplay().getSize(sz);
|
||||
sIsTablet = (Math.min(sz.x, sz.y) >= toPx(600));
|
||||
}
|
||||
|
||||
return sIsTablet;
|
||||
return MwmApplication.get().getResources().getBoolean(R.bool.tabletLayout);
|
||||
}
|
||||
|
||||
public static int dimen(@DimenRes int id)
|
||||
|
|
Loading…
Add table
Reference in a new issue