This commit is contained in:
Alexey Pelykh 2015-02-05 14:56:46 +02:00
parent 2ba8c33986
commit f3979fef89
21 changed files with 123 additions and 62 deletions

3
.gitignore vendored
View file

@ -29,5 +29,8 @@ out/
# MacOSX # MacOSX
.DS_Store .DS_Store
# Windows
Thumbs.db
# Output files # Output files
/build /build

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:color="#ffffff" />
<item android:state_checked="true" android:state_pressed="false" android:color="#77848c" />
<item android:state_checked="false" android:state_pressed="true" android:color="#ffffff" />
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:color="#ffffff" />
<item android:state_checked="true" android:color="#727272" />
</selector>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="false"
android:state_pressed="false"
android:color="#ffffff"/>
<item
android:state_checked="false"
android:state_pressed="true"
android:color="#ffffff"/>
<item
android:state_checked="true"
android:state_pressed="false"
android:color="#ff8f00"/>
<item
android:state_checked="true"
android:state_pressed="true"
android:color="#ff8f00"/>
</selector>

Binary file not shown.

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#525e66" />
<corners
android:radius="3dp" />
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#cccccc" />
<corners
android:radius="3dp" />
</shape>

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 android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#4caf50" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#66bb6a" />
</shape>
</item>
</selector>

View file

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item>
android:top="6dp"
android:right="2dp">
<bitmap <bitmap
android:src="@drawable/ic_overflow_menu_dark" android:src="@drawable/ic_overflow_menu_dark"
android:gravity="top|end" /> android:gravity="center" />
</item> </item>
</layer-list> </layer-list>

View file

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item>
android:top="6dp"
android:right="2dp">
<bitmap <bitmap
android:src="@drawable/ic_overflow_menu_light" android:src="@drawable/ic_overflow_menu_light"
android:gravity="top|end" /> android:gravity="center" />
</item> </item>
</layer-list> </layer-list>

View file

@ -4,21 +4,19 @@
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="2dp" /> <corners android:radius="2dp" />
<solid android:color="#ff8f00" /> <solid android:color="#ff8f00" />
<stroke android:width="1.5dp" android:color="#ff8f00" />
</shape> </shape>
</item> </item>
<item android:state_checked="false" android:state_pressed="true"> <item android:state_checked="false" android:state_pressed="true">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="2dp" /> <corners android:radius="2dp" />
<solid android:color="#ffb24c" /> <solid android:color="#ffb24c" />
<stroke android:width="1.5dp" android:color="#ffb24c" />
</shape> </shape>
</item> </item>
<item android:state_checked="true" android:state_pressed="false"> <item android:state_checked="true" android:state_pressed="false">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="2dp" /> <corners android:radius="2dp" />
<solid android:color="@null" /> <solid android:color="@null" />
<stroke android:width="1.5dp" android:color="#ff8f00" /> <stroke android:width="1.5dp" android:color="#77848c" />
</shape> </shape>
</item> </item>
<item android:state_checked="true" android:state_pressed="true"> <item android:state_checked="true" android:state_pressed="true">

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ff8f00" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ffb24c" />
</shape>
</item>
<item android:state_checked="true" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@null" />
<stroke android:width="1.5dp" android:color="#727272" />
</shape>
</item>
<item android:state_checked="true" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#66ff8f00" />
<stroke android:width="1.5dp" android:color="#ff8f00" />
</shape>
</item>
</selector>

View file

@ -22,7 +22,7 @@
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_margin="11dp" android:layout_margin="11dp"
android:background="@drawable/bg_plugin_logo" android:background="@drawable/bg_plugin_logo_enabled"
android:scaleType="center" android:scaleType="center"
tools:src="@drawable/ic_extension_dark"/> tools:src="@drawable/ic_extension_dark"/>
@ -52,7 +52,7 @@
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/switch_ex_background" android:background="?attr/switch_ex_background"
android:minHeight="0dp" android:minHeight="0dp"
android:minWidth="0dp" android:minWidth="0dp"
android:paddingTop="8dp" android:paddingTop="8dp"
@ -60,7 +60,7 @@
android:paddingLeft="9.5dp" android:paddingLeft="9.5dp"
android:paddingRight="9.5dp" android:paddingRight="9.5dp"
osmand:textAllCapsCompat="true" osmand:textAllCapsCompat="true"
android:textColor="@color/switch_ex_text_color" android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/enable_plugin" android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin" android:textOn="@string/disable_plugin"
android:textSize="12sp" android:textSize="12sp"

View file

@ -4,8 +4,7 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
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">
android:layout_marginTop="?attr/actionBarSize">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,7 +15,9 @@
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="144dp" android:layout_height="144dp"
android:visibility="gone"/> android:background="@drawable/bg_plugin_logo_enabled"
android:scaleType="center"
android:src="@drawable/ic_extension_dark"/>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -45,20 +46,18 @@
<net.osmand.plus.widgets.SwitchEx <net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable" android:id="@+id/plugin_enable_disable"
android:layout_width="wrap_content" android:layout_width="139dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:background="@drawable/switch_ex_background" android:background="?attr/switch_ex_background"
android:minHeight="0dp"
android:minWidth="0dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:paddingLeft="9.5dp" android:paddingLeft="9.5dp"
android:paddingRight="9.5dp" android:paddingRight="9.5dp"
android:paddingTop="8dp" android:paddingTop="8dp"
osmand:textAllCapsCompat="true" osmand:textAllCapsCompat="true"
android:textColor="@color/switch_ex_text_color" android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/enable_plugin" android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin" android:textOn="@string/disable_plugin"
android:textSize="12sp" android:textSize="12sp"

View file

@ -14,12 +14,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageButton
android:id="@+id/plugin_logo" android:id="@+id/plugin_logo"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_margin="8dp" android:layout_margin="8dp"
android:background="@drawable/bg_plugin_logo" android:background="@drawable/bg_plugin_logo_enabled"
android:scaleType="center" android:scaleType="center"
tools:src="@drawable/ic_extension_dark"/> tools:src="@drawable/ic_extension_dark"/>
@ -29,8 +29,8 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginLeft="6dp" android:layout_marginLeft="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginRight="16dp" android:layout_marginRight="36dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="36dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
@ -40,8 +40,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="50dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
@ -68,12 +66,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top|end" android:layout_gravity="top|end"
android:orientation="horizontal"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/plugin_is_enabled" android:id="@+id/plugin_is_enabled"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:src="?attr/ic_action_check" android:src="?attr/ic_action_check"
android:visibility="invisible" android:visibility="invisible"
@ -83,6 +82,7 @@
android:id="@+id/plugin_options" android:id="@+id/plugin_options"
android:layout_width="36dp" android:layout_width="36dp"
android:layout_height="36dp" android:layout_height="36dp"
android:layout_marginTop="6dp"
android:background="?attr/ic_plugin_options"/> android:background="?attr/ic_plugin_options"/>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>

View file

@ -23,6 +23,9 @@
<attr name="ic_action_marker2" format="reference" /> <attr name="ic_action_marker2" format="reference" />
<attr name="search_background" format="reference" /> <attr name="search_background" format="reference" />
<attr name="ic_action_settings" format="reference" /> <attr name="ic_action_settings" format="reference" />
<attr name="switch_ex_background" format="reference" />
<attr name="switch_ex_text_color" format="color|reference" />
<attr name="bg_plugin_logo_disabled" format="reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="PagerSlidingTabStrip"> <declare-styleable name="PagerSlidingTabStrip">

View file

@ -101,4 +101,6 @@
<color name="card_bg_color_light">#ffffff</color> <color name="card_bg_color_light">#ffffff</color>
<color name="card_bg_color_dark">#333b40</color> <color name="card_bg_color_dark">#333b40</color>
<color name="get_button_text">#ffffff</color>
</resources> </resources>

View file

@ -158,6 +158,9 @@
<item name="actionModeStyle">@style/WhiteActionMode</item> <item name="actionModeStyle">@style/WhiteActionMode</item>
<item name="android:actionMenuTextColor">@color/color_white</item> <item name="android:actionMenuTextColor">@color/color_white</item>
<item name="actionMenuTextColor">@color/color_white</item> <item name="actionMenuTextColor">@color/color_white</item>
<item name="switch_ex_background">@drawable/switch_ex_background_light</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_light</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_light</item>
</style> </style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat"> <style name="OsmandDarkTheme" parent="Theme.AppCompat">
@ -188,6 +191,9 @@
<item name="ic_action_marker2">@drawable/ic_action_marker2_dark</item> <item name="ic_action_marker2">@drawable/ic_action_marker2_dark</item>
<item name="search_background">@color/color_white</item> <item name="search_background">@color/color_white</item>
<item name="ic_action_settings">@drawable/ic_action_settings_dark</item> <item name="ic_action_settings">@drawable/ic_action_settings_dark</item>
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_dark</item>
</style> </style>
<style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">

View file

@ -6,6 +6,7 @@ import net.osmand.plus.R;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.PopupMenu; import android.support.v7.widget.PopupMenu;
import android.view.MenuItem; import android.view.MenuItem;
@ -13,7 +14,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
public class PluginsActivity extends OsmandListActivity { public class PluginsActivity extends OsmandListActivity {
@ -80,8 +81,22 @@ public class PluginsActivity extends OsmandListActivity {
view.setTag(plugin); view.setTag(plugin);
ImageView pluginLogo = (ImageView)view.findViewById(R.id.plugin_logo); ImageButton pluginLogo = (ImageButton)view.findViewById(R.id.plugin_logo);
pluginLogo.setImageResource(plugin.getLogoResourceId()); pluginLogo.setImageResource(plugin.getLogoResourceId());
if (plugin.isActive()) {
pluginLogo.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
} else {
TypedArray attributes = getTheme().obtainStyledAttributes(
new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
enableDisablePlugin(plugin, !plugin.isActive());
}
});
TextView pluginName = (TextView)view.findViewById(R.id.plugin_name); TextView pluginName = (TextView)view.findViewById(R.id.plugin_name);
pluginName.setText(plugin.getName()); pluginName.setText(plugin.getName());

View file

@ -6,7 +6,6 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.development.OsmandDevelopmentPlugin;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -34,16 +33,6 @@ public class DashPluginsFragment extends DashBaseFragment {
} }
}; };
private final View.OnClickListener pluginSettingsListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
OsmandPlugin plugin = (OsmandPlugin)view.getTag();
Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
startActivity(new Intent(getActivity(), settingsActivity));
}
};
private final View.OnClickListener pluginDetailsListener = new View.OnClickListener() { private final View.OnClickListener pluginDetailsListener = new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -80,7 +69,7 @@ public class DashPluginsFragment extends DashBaseFragment {
if (pluginsContainer.getChildCount() > 2) { if (pluginsContainer.getChildCount() > 2) {
break; break;
} }
if (plugin instanceof OsmandDevelopmentPlugin) { if (plugin instanceof OsmandDevelopmentPlugin) {
continue; continue;
} }
if (enabledPlugins.contains(plugin)) { if (enabledPlugins.contains(plugin)) {