fix VoiceRouter tabulation
This commit is contained in:
Nazar 2019-06-25 13:06:51 +03:00
parent 4e5b942096
commit 9807fe212d
15 changed files with 993 additions and 946 deletions

View file

@ -2,6 +2,7 @@ package net.osmand.plus.routing;
import java.io.IOException; import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -21,18 +22,14 @@ import net.osmand.plus.voice.CommandBuilder;
import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.voice.CommandPlayer;
import net.osmand.router.RouteSegmentResult; import net.osmand.router.RouteSegmentResult;
import net.osmand.router.TurnType; import net.osmand.router.TurnType;
import java.lang.ref.WeakReference;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import alice.tuprolog.Struct; import alice.tuprolog.Struct;
import alice.tuprolog.Term; import alice.tuprolog.Term;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.SoundPool; import android.media.SoundPool;
public class VoiceRouter { public class VoiceRouter {
private static final int STATUS_UTWP_TOLD = -1; private static final int STATUS_UTWP_TOLD = -1;
private static final int STATUS_UNKNOWN = 0; private static final int STATUS_UNKNOWN = 0;
@ -424,7 +421,6 @@ public class VoiceRouter {
/** /**
* Updates status of voice guidance * Updates status of voice guidance
*
* @param currentLocation * @param currentLocation
*/ */
protected void updateStatus(Location currentLocation, boolean repeat) { protected void updateStatus(Location currentLocation, boolean repeat) {

View file

@ -57,6 +57,9 @@ public class MainActivity extends AppCompatActivity {
private LinearLayout llPluginPreferencesLayout; private LinearLayout llPluginPreferencesLayout;
private RadioGroupWrapper osmandVersionRadioGroup; private RadioGroupWrapper osmandVersionRadioGroup;
private FrameLayout btnOpenOsmand; private FrameLayout btnOpenOsmand;
private ImageView ivTimeSetUpIcon;
private ImageView ivSensorIcon;
private View bottomSensorCardShadow;
private View osmandVersionsPanel; private View osmandVersionsPanel;
private Paint pGreyScale; private Paint pGreyScale;
@ -99,6 +102,8 @@ public class MainActivity extends AppCompatActivity {
tvTime = findViewById(R.id.tvTime); tvTime = findViewById(R.id.tvTime);
flPanelSensor = findViewById(R.id.flPanelSensor); flPanelSensor = findViewById(R.id.flPanelSensor);
swSensorEnableSwitcher = findViewById(R.id.swSensorEnableSwitcher); swSensorEnableSwitcher = findViewById(R.id.swSensorEnableSwitcher);
ivTimeSetUpIcon = findViewById(R.id.ivTimeSetUpIcon);
ivSensorIcon = findViewById(R.id.ivSensorIcon);
btnOpenOsmand.setOnClickListener(new View.OnClickListener() { btnOpenOsmand.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -271,6 +276,8 @@ public class MainActivity extends AppCompatActivity {
tvPluginStateDescription.setText(getString(R.string.enabled)); tvPluginStateDescription.setText(getString(R.string.enabled));
tvPluginStateDescription.setTextColor(getResources().getColor(R.color.black)); tvPluginStateDescription.setTextColor(getResources().getColor(R.color.black));
tbPluginToolbar.setBackgroundColor(getResources().getColor(R.color.orange)); tbPluginToolbar.setBackgroundColor(getResources().getColor(R.color.orange));
ivTimeSetUpIcon.setColorFilter(ContextCompat.getColor(this, R.color.blue),
android.graphics.PorterDuff.Mode.MULTIPLY);
llPluginPreferencesLayout.setLayerType(LAYER_TYPE_HARDWARE, null); llPluginPreferencesLayout.setLayerType(LAYER_TYPE_HARDWARE, null);
@ -289,6 +296,8 @@ public class MainActivity extends AppCompatActivity {
tvPluginStateDescription.setText(getString(R.string.disabled)); tvPluginStateDescription.setText(getString(R.string.disabled));
tvPluginStateDescription.setTextColor(getResources().getColor(R.color.darkGrey)); tvPluginStateDescription.setTextColor(getResources().getColor(R.color.darkGrey));
tbPluginToolbar.setBackgroundColor(getResources().getColor(R.color.darkGrey)); tbPluginToolbar.setBackgroundColor(getResources().getColor(R.color.darkGrey));
ivTimeSetUpIcon.setColorFilter(ContextCompat.getColor(this, R.color.darkGrey),
android.graphics.PorterDuff.Mode.MULTIPLY);
llPluginPreferencesLayout.setLayerType(LAYER_TYPE_HARDWARE, pGreyScale); llPluginPreferencesLayout.setLayerType(LAYER_TYPE_HARDWARE, pGreyScale);
@ -302,8 +311,12 @@ public class MainActivity extends AppCompatActivity {
if (isSensorEnabled) { if (isSensorEnabled) {
sensorHelper.switchOnSensor(); sensorHelper.switchOnSensor();
ivSensorIcon.setColorFilter(ContextCompat.getColor(this, R.color.blue),
android.graphics.PorterDuff.Mode.MULTIPLY);
} else { } else {
sensorHelper.switchOffSensor(); sensorHelper.switchOffSensor();
ivSensorIcon.setColorFilter(ContextCompat.getColor(this, R.color.darkGrey),
android.graphics.PorterDuff.Mode.MULTIPLY);
} }
PluginSettings.UnlockTime currentTime = settings.getTime(); PluginSettings.UnlockTime currentTime = settings.getTime();
@ -316,7 +329,14 @@ public class MainActivity extends AppCompatActivity {
availableOsmandVersions = PluginSettings.OsmandVersion.getOnlyInstalledVersions(); availableOsmandVersions = PluginSettings.OsmandVersion.getOnlyInstalledVersions();
llElementsScreen.removeView(osmandVersionsPanel); llElementsScreen.removeView(osmandVersionsPanel);
if (bottomSensorCardShadow==null) {
bottomSensorCardShadow = getLayoutInflater().inflate(R.layout.card_top_divider, null, false);
llElementsScreen.addView(bottomSensorCardShadow);
}
if (availableOsmandVersions.size() > 1) { if (availableOsmandVersions.size() > 1) {
llElementsScreen.removeView(bottomSensorCardShadow);
bottomSensorCardShadow = null;
osmandVersionsPanel = createOsmandVersionsPanel(); osmandVersionsPanel = createOsmandVersionsPanel();
llElementsScreen.addView(osmandVersionsPanel); llElementsScreen.addView(osmandVersionsPanel);
@ -335,9 +355,9 @@ public class MainActivity extends AppCompatActivity {
private View createOsmandVersionsPanel() { private View createOsmandVersionsPanel() {
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
LinearLayout llWraper = new LinearLayout(MainActivity.this); LinearLayout llWrapper = new LinearLayout(MainActivity.this);
llWraper.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); llWrapper.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
llWraper.setOrientation(LinearLayout.VERTICAL); llWrapper.setOrientation(LinearLayout.VERTICAL);
View panelOsmandVersions = inflater.inflate(R.layout.main_el_osmand_versions, null, false); View panelOsmandVersions = inflater.inflate(R.layout.main_el_osmand_versions, null, false);
LinearLayout llOsmandVersions = panelOsmandVersions.findViewById(R.id.llOsmandVersions); LinearLayout llOsmandVersions = panelOsmandVersions.findViewById(R.id.llOsmandVersions);
@ -379,11 +399,11 @@ public class MainActivity extends AppCompatActivity {
View cardDevider = inflater.inflate(R.layout.card_devider, null, false); View cardDevider = inflater.inflate(R.layout.card_devider, null, false);
View cardTop = inflater.inflate(R.layout.card_top_divider, null, false); View cardTop = inflater.inflate(R.layout.card_top_divider, null, false);
llWraper.addView(cardDevider); llWrapper.addView(cardDevider);
llWraper.addView(panelOsmandVersions); llWrapper.addView(panelOsmandVersions);
llWraper.addView(cardTop); llWrapper.addView(cardTop);
return llWraper; return llWrapper;
} }
private void setEnableForElements(boolean enable) { private void setEnableForElements(boolean enable) {

View file

@ -7,6 +7,8 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import net.osmand.turnScreenOn.app.TurnScreenApp; import net.osmand.turnScreenOn.app.TurnScreenApp;
@ -28,6 +30,8 @@ public class PluginDescriptionActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_plugin_description); setContentView(R.layout.activity_plugin_description);
setStatusBarColor(R.color.white);
currentMode = getIntent().getIntExtra(MODE_KEY, MODE_HELP); currentMode = getIntent().getIntExtra(MODE_KEY, MODE_HELP);
app = (TurnScreenApp) getApplicationContext(); app = (TurnScreenApp) getApplicationContext();
@ -72,4 +76,10 @@ public class PluginDescriptionActivity extends AppCompatActivity {
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState); super.onSaveInstanceState(outState, outPersistentState);
} }
private void setStatusBarColor(int colorResId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorResId));
}
}
} }

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape>
<solid
android:color="@color/white" />
</shape>
</item> <!-- pressed -->
<item android:state_pressed="true" >
<shape>
<solid
android:color="@color/lightGrey" />
</shape>
</item>
</selector>

View file

@ -23,7 +23,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="64dp" android:paddingLeft="72dp"
android:paddingRight="64dp" android:paddingRight="64dp"
android:text="@string/permissionDescription" android:text="@string/permissionDescription"
android:textColor="@color/black" android:textColor="@color/black"

View file

@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".PluginDescriptionActivity"> tools:context=".PluginDescriptionActivity"
android:background="@color/white">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -6,8 +6,7 @@
<include layout="@layout/card_bottom_divider"/> <include layout="@layout/card_bottom_divider"/>
<View <View android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="4dp"/> android:layout_height="4dp"/>
<include layout="@layout/card_top_divider"/> <include layout="@layout/card_top_divider"/>

View file

@ -10,7 +10,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/horizontal_padding"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -19,6 +18,7 @@
android:layout_height="@dimen/basic_element_height" android:layout_height="@dimen/basic_element_height"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="@color/black" android:textColor="@color/black"
android:layout_marginLeft="@dimen/horizontal_padding"
android:layout_marginRight="@dimen/horizontal_padding" android:layout_marginRight="@dimen/horizontal_padding"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -35,6 +35,7 @@
android:layout_gravity="end|bottom" android:layout_gravity="end|bottom"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/cancel" android:text="@string/cancel"
android:layout_marginLeft="@dimen/horizontal_padding"
android:layout_marginRight="@dimen/horizontal_padding" android:layout_marginRight="@dimen/horizontal_padding"
android:textColor="@color/blue" android:textColor="@color/blue"
android:textSize="16sp" /> android:textSize="16sp" />

View file

@ -5,8 +5,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/basic_element_height" android:background="@drawable/btn_preference"
android:layout_marginRight="@dimen/horizontal_padding"> android:layout_height="@dimen/basic_element_height">
<TextView <TextView
android:id="@+id/tvTime" android:id="@+id/tvTime"
android:layout_width="0dp" android:layout_width="0dp"
@ -15,6 +15,7 @@
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/black" android:textColor="@color/black"
android:gravity="start" android:gravity="start"
android:layout_marginLeft="@dimen/horizontal_padding"
android:layout_gravity="center_vertical"/> android:layout_gravity="center_vertical"/>
<RadioButton <RadioButton
@ -22,6 +23,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/horizontal_padding"
style="@style/RadioButtonStyle"/> style="@style/RadioButtonStyle"/>
</LinearLayout> </LinearLayout>

View file

@ -21,6 +21,7 @@
android:layout_height="@dimen/basic_element_height"> android:layout_height="@dimen/basic_element_height">
<ImageView <ImageView
android:id="@+id/ivSensorIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -27,6 +27,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/ivTimeSetUpIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -15,4 +15,5 @@
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="pluginDescHeader">#6617D3</color> <color name="pluginDescHeader">#6617D3</color>
<color name="pluginDescSubHeader">#A99CBA</color> <color name="pluginDescSubHeader">#A99CBA</color>
<color name="lightGrey">#eeeeee</color>
</resources> </resources>

View file

@ -9,7 +9,7 @@
<string name="OsmandVersion">OsmAnd Version</string> <string name="OsmandVersion">OsmAnd Version</string>
<string name="OsmandPlus">OsmAnd Plus</string> <string name="OsmandPlus">OsmAnd Plus</string>
<string name="Osmand">OsmAnd</string> <string name="Osmand">OsmAnd</string>
<string name="continueDesc">continue</string> <string name="continueDesc">Continue</string>
<string name="sensorHeader">Использовать датчик приближения</string> <string name="sensorHeader">Использовать датчик приближения</string>
<string name="help">Help</string> <string name="help">Help</string>
<string name="install_instruction">You need to install <b>OsmAnd</b> or <b>OsmAnd+</b>, to use this plugin.</string> <string name="install_instruction">You need to install <b>OsmAnd</b> or <b>OsmAnd+</b>, to use this plugin.</string>

View file

@ -22,7 +22,7 @@
<style name="RadioButtonStyle" parent="Theme.AppCompat.Light"> <style name="RadioButtonStyle" parent="Theme.AppCompat.Light">
<!--<item name="colorControlNormal">@color/darkGrey</item>--> <!--<item name="colorControlNormal">@color/darkGrey</item>-->
<item name="colorControlActivated">@color/blue</item> <item name="colorControlActivated">@color/blue</item>
<item name="android:background">@color/white</item> <item name="android:background">@android:color/transparent</item>
</style> </style>
<style name="turnScreenOnHeaderTextStyle"> <style name="turnScreenOnHeaderTextStyle">