Add more material design (1)
@@ -36,7 +36,7 @@ libraryDependencies ++= Seq(
|
||||
"com.google.android.gms" % "play-services-ads" % "8.1.0",
|
||||
"com.google.android.gms" % "play-services-analytics" % "8.1.0",
|
||||
"com.android.support" % "support-v4" % "23.1.0",
|
||||
"com.github.mrengineer13" % "snackbar" % "1.2.0",
|
||||
"com.android.support" % "design" % "23.1.0",
|
||||
"com.nostra13.universalimageloader" % "universal-image-loader" % "1.9.4",
|
||||
"com.j256.ormlite" % "ormlite-core" % "4.48",
|
||||
"com.j256.ormlite" % "ormlite-android" % "4.48"
|
||||
@@ -44,6 +44,7 @@ libraryDependencies ++= Seq(
|
||||
|
||||
proguardOptions in Android ++= Seq("-keep class android.support.v4.app.** { *; }",
|
||||
"-keep interface android.support.v4.app.** { *; }",
|
||||
"-keep class android.support.v7.widget.Toolbar { <init>(...); }",
|
||||
"-keep class com.actionbarsherlock.** { *; }",
|
||||
"-keep interface com.actionbarsherlock.** { *; }",
|
||||
"-keep class org.jraf.android.backport.** { *; }",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".AppManager"
|
||||
android:theme="@style/Theme.AppManager"
|
||||
android:theme="@style/Theme.Material"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName=".Shadowsocks">
|
||||
<intent-filter>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4c-1.48,0 -2.85,0.43 -4.01,1.17l1.46,1.46C10.21,6.23 11.08,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3 0,1.13 -0.64,2.11 -1.56,2.62l1.45,1.45C23.16,18.16 24,16.68 24,15c0,-2.64 -2.05,-4.78 -4.65,-4.96zM3,5.27l2.75,2.74C2.56,8.15 0,10.77 0,14c0,3.31 2.69,6 6,6h11.73l2,2L21,20.73 4.27,4 3,5.27zM7.73,10l8,8H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h1.73z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM19,18H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h0.71C7.37,7.69 9.48,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3s-1.34,3 -3,3z"/>
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 191 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 209 B |
|
After Width: | Height: | Size: 330 B |
|
After Width: | Height: | Size: 276 B |
|
Before Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 172 B |
|
After Width: | Height: | Size: 354 B |
|
After Width: | Height: | Size: 593 B |
|
After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 163 B |
|
Before Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 859 B |
|
After Width: | Height: | Size: 785 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<transition xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/md__list_pressed_holo_dark" />
|
||||
<item android:drawable="@drawable/md__list_longpressed_holo" />
|
||||
</transition>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false" android:drawable="@color/md__transparent" />
|
||||
|
||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
||||
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/md__list_selector_disabled_holo_dark" />
|
||||
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/md__list_selector_disabled_holo_dark" />
|
||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/md__list_selector_background_transition_holo_dark" />
|
||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/md__list_selector_background_transition_holo_dark" />
|
||||
<item android:state_focused="true" android:drawable="@drawable/md__list_focused_holo" />
|
||||
</selector>
|
||||
@@ -5,6 +5,7 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:duplicateParentState="false">
|
||||
<include layout="@layout/toolbar_light_dark" />
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<include layout="@layout/toolbar_light_dark" />
|
||||
<fragment android:name="com.github.shadowsocks.ShadowsocksSettings"
|
||||
android:id="@android:id/content" android:layout_below="@+id/toolbar"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent" />
|
||||
<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:backgroundTint="@color/material_blue_500"
|
||||
android:src="@drawable/ic_cloud_off"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_alignBottom="@+id/toolbar"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="-28dp" app:elevation="6dp"
|
||||
app:pressedTranslationZ="6dp" app:borderWidth="0dp" />
|
||||
</RelativeLayout>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="26sp"
|
||||
android:textColor="@color/title"
|
||||
android:text="@string/screen_name"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switchButton"
|
||||
android:switchTextAppearance="@android:style/TextAppearance.Small.Inverse"
|
||||
android:enabled="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight = "10dp"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_height="?attr/actionBarSize" android:layout_width="match_parent"
|
||||
android:background="?attr/colorPrimary" android:elevation="4dp"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" android:id="@+id/toolbar" />
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- File created by the Android Action Bar Style Generator
|
||||
|
||||
Copyright (C) 2011 The Android Open Source Project
|
||||
Copyright (C) 2012 readyState Software Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Shadow" parent="@android:style/Theme.Material.Light.DarkActionBar">
|
||||
<item name="android:actionBarItemBackground">@drawable/selectable_background_shadow</item>
|
||||
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
|
||||
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
|
||||
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item>
|
||||
<item name="android:actionDropDownStyle">@style/DropDownNav.Shadow</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBar.Solid.Shadow</item>
|
||||
<item name="android:actionModeBackground">@drawable/cab_background_top_shadow</item>
|
||||
<item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item>
|
||||
<!-- Light.DarkActionBar specific -->
|
||||
<item name="android:actionBarWidgetTheme">@style/Theme.Shadow.Widget</item>
|
||||
<item name="android:textAppearanceLargePopupMenu">@style/m_textAppearanceLargePopupMenu</item>
|
||||
<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBar.Solid.Shadow" parent="@android:style/Widget.Material.ActionBar">
|
||||
<item name="android:background">@drawable/ab_background_textured_shadow</item>
|
||||
<item name="android:backgroundStacked">@drawable/ab_stacked_solid_shadow</item>
|
||||
<item name="android:backgroundSplit">@drawable/ab_background_textured_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBar.Transparent.Shadow" parent="@android:style/Widget.Material.ActionBar">
|
||||
<item name="android:background">@drawable/ab_transparent_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="PopupMenu.Shadow" parent="@android:style/Widget.Material.ListPopupWindow">
|
||||
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="m_textAppearanceSmallPopupMenu" parent="@android:style/TextAppearance.Material.Widget.PopupMenu.Small">
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="m_textAppearanceLargePopupMenu" parent="@android:style/TextAppearance.Material.Widget.PopupMenu.Large">
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownListView.Shadow" parent="@android:style/Widget.Material.ListView.DropDown">
|
||||
<item name="android:listSelector">@drawable/selectable_background_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBarTabStyle.Shadow" parent="@android:style/Widget.Material.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/tab_indicator_ab_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownNav.Shadow" parent="@android:style/Widget.Material.Spinner">
|
||||
<item name="android:background">@drawable/spinner_background_ab_shadow</item>
|
||||
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
|
||||
<item name="android:dropDownSelector">@drawable/selectable_background_shadow</item>
|
||||
</style>
|
||||
|
||||
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
|
||||
<style name="Theme.Shadow.Widget" parent="@android:style/Theme.Material">
|
||||
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
|
||||
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textAppearanceLargePopupMenu">@style/m_textAppearanceLargePopupMenu</item>
|
||||
<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
|
||||
</style>
|
||||
|
||||
<style name="PopupTheme" parent="@android:style/Theme.Material.Light">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateAlwaysHidden</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowCloseOnTouchOutside">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -12,4 +12,12 @@
|
||||
<color name="md__transparent">#00000000</color>
|
||||
<color name="md__defaultBackground">#FF555555</color>
|
||||
|
||||
<color name="material_blue_500">#2196F3</color>
|
||||
<color name="material_blue_grey_300">#90A4AE</color>
|
||||
<color name="material_blue_grey_500">#607D8B</color>
|
||||
<color name="material_blue_grey_700">#455A64</color>
|
||||
<color name="material_accent_300">@color/material_blue_grey_300</color>
|
||||
<color name="material_accent_500">@color/material_blue_grey_500</color>
|
||||
<color name="material_accent_700">@color/material_blue_grey_700</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -16,11 +16,27 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.AppManager" parent="@style/Theme.Shadow">
|
||||
<style name="Theme.Material" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:alertDialogTheme">@style/Theme.Material.Dialog.Alert</item>
|
||||
<item name="android:dialogTheme">@style/Theme.Material.Dialog</item>
|
||||
<item name="android:navigationBarColor">@color/material_accent_700</item>
|
||||
<item name="colorAccent">@color/material_accent_500</item>
|
||||
<item name="colorButtonNormal">@color/material_accent_500</item>
|
||||
<item name="colorPrimary">@color/material_accent_500</item>
|
||||
<item name="colorPrimaryDark">@color/material_accent_700</item>
|
||||
</style>
|
||||
<style name="Theme.Material.Dialog" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">@color/material_accent_500</item>
|
||||
<item name="colorPrimary">@color/material_accent_500</item>
|
||||
<item name="colorPrimaryDark">@color/material_accent_700</item>
|
||||
</style>
|
||||
<style name="Theme.Material.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<item name="colorAccent">@color/material_accent_500</item>
|
||||
<item name="colorPrimary">@color/material_accent_500</item>
|
||||
<item name="colorPrimaryDark">@color/material_accent_700</item>
|
||||
</style>
|
||||
|
||||
<style name="PopupTheme" parent="@android:style/Theme.Holo.Light">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<style name="PopupTheme" parent="Theme.Material.Dialog">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
@@ -29,12 +45,11 @@
|
||||
<item name="android:windowSoftInputMode">stateAlwaysHidden</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowCloseOnTouchOutside">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation on the Light theme that turns off the title -->
|
||||
<style name="Theme.Shadowsocks" parent="@style/Theme.Shadow">
|
||||
<style name="Theme.Shadowsocks" parent="Theme.Material">
|
||||
<item name="menuDrawerStyle">@style/MenuDrawerStyle</item>
|
||||
</style>
|
||||
|
||||
@@ -57,7 +72,7 @@
|
||||
</style>
|
||||
|
||||
<style name="MenuDrawer.Widget.Title">
|
||||
<item name="android:background">@drawable/md__list_selector_holo_dark</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:textAppearance">?android:attr/textAppearance</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- File created by the Android Action Bar Style Generator
|
||||
|
||||
Copyright (C) 2011 The Android Open Source Project
|
||||
Copyright (C) 2012 readyState Software Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Shadow" parent="@android:style/Theme.Holo.Light.DarkActionBar">
|
||||
<item name="android:actionBarItemBackground">@drawable/selectable_background_shadow</item>
|
||||
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
|
||||
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
|
||||
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item>
|
||||
<item name="android:actionDropDownStyle">@style/DropDownNav.Shadow</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBar.Solid.Shadow</item>
|
||||
<item name="android:actionModeBackground">@drawable/cab_background_top_shadow</item>
|
||||
<item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item>
|
||||
<item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Shadow</item>
|
||||
<!-- Light.DarkActionBar specific -->
|
||||
<item name="android:actionBarWidgetTheme">@style/Theme.Shadow.Widget</item>
|
||||
<item name="android:textAppearanceLargePopupMenu">@style/m_textAppearanceLargePopupMenu</item>
|
||||
<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBar.Solid.Shadow" parent="@android:style/Widget.Holo.ActionBar">
|
||||
<item name="android:background">@drawable/ab_background_textured_shadow</item>
|
||||
<item name="android:backgroundStacked">@drawable/ab_stacked_solid_shadow</item>
|
||||
<item name="android:backgroundSplit">@drawable/ab_background_textured_shadow</item>
|
||||
<item name="android:progressBarStyle">@style/ProgressBar.Shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBar.Transparent.Shadow" parent="@android:style/Widget.Holo.ActionBar">
|
||||
<item name="android:background">@drawable/ab_transparent_shadow</item>
|
||||
<item name="android:progressBarStyle">@style/ProgressBar.Shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="PopupMenu.Shadow" parent="@android:style/Widget.Holo.ListPopupWindow">
|
||||
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="m_textAppearanceSmallPopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="m_textAppearanceLargePopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownListView.Shadow" parent="@android:style/Widget.Holo.ListView.DropDown">
|
||||
<item name="android:listSelector">@drawable/selectable_background_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBarTabStyle.Shadow" parent="@android:style/Widget.Holo.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/tab_indicator_ab_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownNav.Shadow" parent="@android:style/Widget.Holo.Spinner">
|
||||
<item name="android:background">@drawable/spinner_background_ab_shadow</item>
|
||||
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
|
||||
<item name="android:dropDownSelector">@drawable/selectable_background_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ProgressBar.Shadow" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
|
||||
<item name="android:progressDrawable">@drawable/progress_horizontal_shadow</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionButton.CloseMode.Shadow" parent="@android:style/Widget.Holo.ActionButton.CloseMode">
|
||||
<item name="android:background">@drawable/btn_cab_done_shadow</item>
|
||||
</style>
|
||||
|
||||
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
|
||||
<style name="Theme.Shadow.Widget" parent="@android:style/Theme.Holo">
|
||||
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
|
||||
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textAppearanceLargePopupMenu">@style/m_textAppearanceLargePopupMenu</item>
|
||||
<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -49,6 +49,7 @@ import android.graphics.{Bitmap, PixelFormat}
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.preference.PreferenceManager
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
@@ -260,9 +261,6 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
|
||||
}
|
||||
Toast.makeText(this, R.string.action_import_err, Toast.LENGTH_SHORT).show()
|
||||
return false
|
||||
case android.R.id.home =>
|
||||
navigateUpTo(getParentActivityIntent)
|
||||
return true
|
||||
}
|
||||
super.onOptionsItemSelected(item)
|
||||
}
|
||||
@@ -277,11 +275,14 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
|
||||
|
||||
handler = new Handler()
|
||||
|
||||
val actionBar = getActionBar
|
||||
actionBar.setTitle(R.string.proxied_help)
|
||||
actionBar.setDisplayHomeAsUpEnabled(true)
|
||||
actionBar.setDisplayShowHomeEnabled(false)
|
||||
this.setContentView(R.layout.layout_apps)
|
||||
val toolbar = findViewById(R.id.toolbar).asInstanceOf[Toolbar]
|
||||
toolbar.setTitle(R.string.proxied_help)
|
||||
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha)
|
||||
toolbar.setNavigationOnClickListener((v: View) => {
|
||||
val intent = getParentActivityIntent
|
||||
if (intent == null) finish else navigateUpTo(intent)
|
||||
})
|
||||
this.overlay = View.inflate(this, R.layout.overlay, null).asInstanceOf[TextView]
|
||||
getWindowManager.addView(overlay, new
|
||||
WindowManager.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
||||
|
||||
@@ -51,12 +51,13 @@ import android.graphics.{Bitmap, Color, Typeface}
|
||||
import android.net.{Uri, VpnService}
|
||||
import android.os._
|
||||
import android.preference._
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.design.widget.{FloatingActionButton, Snackbar}
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.util.{DisplayMetrics, Log}
|
||||
import android.view._
|
||||
import android.webkit.{WebView, WebViewClient}
|
||||
import android.widget._
|
||||
import com.github.mrengineer13.snackbar._
|
||||
import com.github.shadowsocks.aidl.{IShadowsocksService, IShadowsocksServiceCallback}
|
||||
import com.github.shadowsocks.database._
|
||||
import com.github.shadowsocks.preferences.{PasswordEditTextPreference, ProfileEditTextPreference, SummaryEditTextPreference}
|
||||
@@ -173,8 +174,7 @@ object Shadowsocks {
|
||||
}
|
||||
|
||||
class Shadowsocks
|
||||
extends PreferenceActivity
|
||||
with CompoundButton.OnCheckedChangeListener
|
||||
extends AppCompatActivity
|
||||
with MenuAdapter.MenuListener {
|
||||
|
||||
// Flags
|
||||
@@ -184,8 +184,9 @@ class Shadowsocks
|
||||
var singlePane: Int = -1
|
||||
|
||||
// Variables
|
||||
var switchButton: Switch = null
|
||||
var progressDialog: ProgressDialog = null
|
||||
private var serviceStarted = false
|
||||
var fab: FloatingActionButton = _
|
||||
var progressDialog: ProgressDialog = _
|
||||
var progressTag = -1
|
||||
var state = State.INIT
|
||||
var prepared = false
|
||||
@@ -210,7 +211,7 @@ class Shadowsocks
|
||||
case ignored: RemoteException => // Nothing
|
||||
}
|
||||
// Update the UI
|
||||
if (switchButton != null) switchButton.setEnabled(true)
|
||||
if (fab != null) fab.setEnabled(true)
|
||||
if (State.isAvailable(bgService.getState)) {
|
||||
setPreferenceEnabled(enabled = true)
|
||||
} else {
|
||||
@@ -218,8 +219,6 @@ class Shadowsocks
|
||||
setPreferenceEnabled(enabled = false)
|
||||
}
|
||||
state = bgService.getState
|
||||
// set the listener
|
||||
switchButton.setOnCheckedChangeListener(Shadowsocks.this)
|
||||
|
||||
if (!status.getBoolean(getVersionName, false)) {
|
||||
status.edit.putBoolean(getVersionName, true).commit()
|
||||
@@ -228,7 +227,7 @@ class Shadowsocks
|
||||
}
|
||||
|
||||
override def onServiceDisconnected(name: ComponentName) {
|
||||
if (switchButton != null) switchButton.setEnabled(false)
|
||||
if (fab != null) fab.setEnabled(false)
|
||||
try {
|
||||
if (bgService != null) bgService.unregisterCallback(callback)
|
||||
} catch {
|
||||
@@ -238,8 +237,10 @@ class Shadowsocks
|
||||
}
|
||||
}
|
||||
|
||||
private lazy val settings = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
private lazy val status = getSharedPreferences(Key.status, Context.MODE_PRIVATE)
|
||||
private lazy val preferences =
|
||||
getFragmentManager.findFragmentById(android.R.id.content).asInstanceOf[ShadowsocksSettings]
|
||||
lazy val settings = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
lazy val status = getSharedPreferences(Key.status, Context.MODE_PRIVATE)
|
||||
private lazy val preferenceReceiver = new PreferenceBroadcastReceiver
|
||||
private lazy val drawer = MenuDrawer.attach(this)
|
||||
private lazy val menuAdapter = new MenuAdapter(this, getMenuList)
|
||||
@@ -265,13 +266,12 @@ class Shadowsocks
|
||||
}
|
||||
|
||||
private def changeSwitch(checked: Boolean) {
|
||||
switchButton.setOnCheckedChangeListener(null)
|
||||
switchButton.setChecked(checked)
|
||||
if (switchButton.isEnabled) {
|
||||
switchButton.setEnabled(false)
|
||||
handler.postDelayed(() => switchButton.setEnabled(true), 1000)
|
||||
serviceStarted = checked
|
||||
fab.setImageResource(if (checked) R.drawable.ic_cloud else R.drawable.ic_cloud_off)
|
||||
if (fab.isEnabled) {
|
||||
fab.setEnabled(false)
|
||||
handler.postDelayed(() => fab.setEnabled(true), 1000)
|
||||
}
|
||||
switchButton.setOnCheckedChangeListener(this)
|
||||
}
|
||||
|
||||
private def showProgress(msg: Int): Handler = {
|
||||
@@ -374,16 +374,9 @@ class Shadowsocks
|
||||
}
|
||||
|
||||
def isTextEmpty(s: String, msg: String): Boolean = {
|
||||
if (s == null || s.length <= 0) {
|
||||
new SnackBar.Builder(this)
|
||||
.withMessage(msg)
|
||||
.withActionMessageId(R.string.error)
|
||||
.withStyle(SnackBar.Style.ALERT)
|
||||
.withDuration(SnackBar.LONG_SNACK)
|
||||
.show()
|
||||
return true
|
||||
}
|
||||
false
|
||||
if (s != null && s.length > 0) return false
|
||||
Snackbar.make(getWindow.getDecorView.findViewById(android.R.id.content), msg, Snackbar.LENGTH_LONG).show
|
||||
true
|
||||
}
|
||||
|
||||
def cancelStart() {
|
||||
@@ -416,24 +409,6 @@ class Shadowsocks
|
||||
}
|
||||
}
|
||||
|
||||
def onCheckedChanged(compoundButton: CompoundButton, checked: Boolean) {
|
||||
if (compoundButton eq switchButton) {
|
||||
checked match {
|
||||
case true =>
|
||||
if (isReady)
|
||||
prepareStartService()
|
||||
else
|
||||
changeSwitch(checked = false)
|
||||
case false =>
|
||||
serviceStop()
|
||||
}
|
||||
if (switchButton.isEnabled) {
|
||||
switchButton.setEnabled(false)
|
||||
handler.postDelayed(() => switchButton.setEnabled(true), 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getLayoutView(view: ViewParent): LinearLayout = {
|
||||
view match {
|
||||
case layout: LinearLayout => layout
|
||||
@@ -470,7 +445,7 @@ class Shadowsocks
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
addPreferencesFromResource(R.xml.pref_all)
|
||||
setContentView(R.layout.layout_main)
|
||||
|
||||
// Update the profile
|
||||
if (!status.getBoolean(getVersionName, false)) {
|
||||
@@ -502,24 +477,32 @@ class Shadowsocks
|
||||
}
|
||||
|
||||
// Initialize action bar
|
||||
val switchLayout = getLayoutInflater
|
||||
.inflate(R.layout.layout_switch, null)
|
||||
.asInstanceOf[RelativeLayout]
|
||||
val title: TextView = switchLayout.findViewById(R.id.title).asInstanceOf[TextView]
|
||||
val toolbar = findViewById(R.id.toolbar).asInstanceOf[Toolbar]
|
||||
toolbar.setTitle(getTitle)
|
||||
val field = classOf[Toolbar].getDeclaredField("mTitleTextView")
|
||||
field.setAccessible(true)
|
||||
val title: TextView = field.get(toolbar).asInstanceOf[TextView]
|
||||
val tf: Typeface = Typefaces.get(this, "fonts/Iceland.ttf")
|
||||
if (tf != null) title.setTypeface(tf)
|
||||
switchButton = switchLayout.findViewById(R.id.switchButton).asInstanceOf[Switch]
|
||||
getActionBar.setCustomView(switchLayout)
|
||||
getActionBar.setDisplayShowTitleEnabled(false)
|
||||
getActionBar.setDisplayShowCustomEnabled(true)
|
||||
if (Utils.isLollipopOrAbove) {
|
||||
getWindow.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
getWindow.setStatusBarColor(ContextCompat.getColor(this, R.color.grey3))
|
||||
getActionBar.setDisplayHomeAsUpEnabled(true)
|
||||
getActionBar.setHomeAsUpIndicator(R.drawable.ic_drawer)
|
||||
} else {
|
||||
getActionBar.setIcon(R.drawable.ic_stat_shadowsocks)
|
||||
}
|
||||
fab = findViewById(R.id.fab).asInstanceOf[FloatingActionButton]
|
||||
fab.setOnClickListener((v: View) => {
|
||||
serviceStarted = !serviceStarted
|
||||
serviceStarted match {
|
||||
case true =>
|
||||
if (isReady)
|
||||
prepareStartService()
|
||||
else
|
||||
changeSwitch(checked = false)
|
||||
case false =>
|
||||
serviceStop()
|
||||
}
|
||||
if (fab.isEnabled) {
|
||||
fab.setEnabled(false)
|
||||
handler.postDelayed(() => fab.setEnabled(true), 1000)
|
||||
}
|
||||
})
|
||||
toolbar.setNavigationIcon(R.drawable.ic_drawer)
|
||||
toolbar.setNavigationOnClickListener((v: View) => drawer.toggleMenu())
|
||||
title.setOnLongClickListener((v: View) => {
|
||||
if (Utils.isLollipopOrAbove && bgService != null
|
||||
&& (bgService.getState == State.INIT || bgService.getState == State.STOPPED)) {
|
||||
@@ -785,18 +768,8 @@ class Shadowsocks
|
||||
buf.toList
|
||||
}
|
||||
|
||||
override def onOptionsItemSelected(item: MenuItem): Boolean = {
|
||||
item.getItemId match {
|
||||
case android.R.id.home =>
|
||||
drawer.toggleMenu()
|
||||
return true
|
||||
}
|
||||
super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
protected override def onPause() {
|
||||
super.onPause()
|
||||
switchButton.setOnCheckedChangeListener(null)
|
||||
prepared = false
|
||||
}
|
||||
|
||||
@@ -812,8 +785,6 @@ class Shadowsocks
|
||||
changeSwitch(checked = false)
|
||||
}
|
||||
state = bgService.getState
|
||||
// set the listener
|
||||
switchButton.setOnCheckedChangeListener(Shadowsocks.this)
|
||||
}
|
||||
ConfigUtils.refresh(this)
|
||||
|
||||
@@ -825,13 +796,13 @@ class Shadowsocks
|
||||
|
||||
private def setPreferenceEnabled(enabled: Boolean) {
|
||||
for (name <- Shadowsocks.PROXY_PREFS) {
|
||||
val pref = findPreference(name)
|
||||
val pref = preferences.findPreference(name)
|
||||
if (pref != null) {
|
||||
pref.setEnabled(enabled)
|
||||
}
|
||||
}
|
||||
for (name <- Shadowsocks.FEATRUE_PREFS) {
|
||||
val pref = findPreference(name)
|
||||
val pref = preferences.findPreference(name)
|
||||
if (pref != null) {
|
||||
if (Seq(Key.isGlobalProxy, Key.proxyedApps)
|
||||
.contains(name)) {
|
||||
@@ -846,11 +817,11 @@ class Shadowsocks
|
||||
private def updatePreferenceScreen() {
|
||||
val profile = currentProfile
|
||||
for (name <- Shadowsocks.PROXY_PREFS) {
|
||||
val pref = findPreference(name)
|
||||
val pref = preferences.findPreference(name)
|
||||
Shadowsocks.updatePreference(pref, name, profile)
|
||||
}
|
||||
for (name <- Shadowsocks.FEATRUE_PREFS) {
|
||||
val pref = findPreference(name)
|
||||
val pref = preferences.findPreference(name)
|
||||
Shadowsocks.updatePreference(pref, name, profile)
|
||||
}
|
||||
}
|
||||
@@ -983,22 +954,14 @@ class Shadowsocks
|
||||
try {
|
||||
val port: Int = Integer.valueOf(text)
|
||||
if (!low && port <= 1024) {
|
||||
new SnackBar.Builder(this)
|
||||
.withMessageId(R.string.port_alert)
|
||||
.withActionMessageId(R.string.error)
|
||||
.withStyle(SnackBar.Style.ALERT)
|
||||
.withDuration(SnackBar.LONG_SNACK)
|
||||
.show()
|
||||
Snackbar.make(getWindow.getDecorView.findViewById(android.R.id.content), R.string.port_alert,
|
||||
Snackbar.LENGTH_LONG).show
|
||||
return false
|
||||
}
|
||||
} catch {
|
||||
case ex: Exception =>
|
||||
new SnackBar.Builder(this)
|
||||
.withMessageId(R.string.port_alert)
|
||||
.withActionMessageId(R.string.error)
|
||||
.withStyle(SnackBar.Style.ALERT)
|
||||
.withDuration(SnackBar.LONG_SNACK)
|
||||
.show()
|
||||
Snackbar.make(getWindow.getDecorView.findViewById(android.R.id.content), R.string.port_alert,
|
||||
Snackbar.LENGTH_LONG).show
|
||||
return false
|
||||
}
|
||||
true
|
||||
@@ -1072,14 +1035,8 @@ class Shadowsocks
|
||||
clearDialog()
|
||||
}
|
||||
changeSwitch(checked = false)
|
||||
if (m != null) {
|
||||
new SnackBar.Builder(Shadowsocks.this)
|
||||
.withMessage(getString(R.string.vpn_error).formatLocal(Locale.ENGLISH, m))
|
||||
.withActionMessageId(R.string.error)
|
||||
.withStyle(SnackBar.Style.ALERT)
|
||||
.withDuration(SnackBar.LONG_SNACK)
|
||||
.show()
|
||||
}
|
||||
if (m != null) Snackbar.make(getWindow.getDecorView.findViewById(android.R.id.content),
|
||||
getString(R.string.vpn_error).formatLocal(Locale.ENGLISH, m), Snackbar.LENGTH_LONG).show
|
||||
setPreferenceEnabled(enabled = true)
|
||||
case State.STOPPING =>
|
||||
if (progressDialog == null) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.github.shadowsocks
|
||||
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceFragment
|
||||
|
||||
// TODO: Move related logic here
|
||||
class ShadowsocksSettings extends PreferenceFragment {
|
||||
override def onCreate(savedInstanceState: Bundle) {
|
||||
super.onCreate(savedInstanceState)
|
||||
addPreferencesFromResource(R.xml.pref_all)
|
||||
}
|
||||
}
|
||||