@@ -81,8 +81,7 @@
|
||||
android:launchMode="singleTask"/>
|
||||
|
||||
<activity android:name=".TaskerActivity"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:launchMode="singleTask">
|
||||
android:icon="@drawable/ic_launcher">
|
||||
<intent-filter>
|
||||
<action android:name="com.twofortyfouram.locale.intent.action.EDIT_SETTING" />
|
||||
</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="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||
</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,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 181 B |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 137 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 199 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 347 B |
|
After Width: | Height: | Size: 308 B |
|
After Width: | Height: | Size: 436 B |
@@ -9,48 +9,34 @@
|
||||
<include layout="@layout/toolbar_light_dark"/>
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="48dp"
|
||||
android:paddingStart="48dp"
|
||||
android:elevation="1dp"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="RtlSymmetry">
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
<Switch android:checked="true"
|
||||
android:id="@+id/onSwitch"
|
||||
android:text="@string/on"
|
||||
android:textSize="18sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingLeft="60dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/on"/>
|
||||
<Switch android:checked="true"
|
||||
android:id="@+id/onSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
<Switch android:checked="true"
|
||||
android:id="@+id/bypassSwitch"
|
||||
android:text="@string/bypass_apps"
|
||||
android:textSize="18sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingLeft="60dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp">
|
||||
<TextView
|
||||
android:id="@+id/bypassLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/bypass_apps"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/bypassSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
</LinearLayout>
|
||||
<FrameLayout android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
|
||||
@@ -1,30 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/toolbar_light_dark" />
|
||||
<RelativeLayout
|
||||
android:padding="16dp"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<Switch
|
||||
android:layout_width="wrap_content"
|
||||
<include layout="@layout/toolbar_light_dark" />
|
||||
<Switch android:checked="true"
|
||||
android:id="@+id/service_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toggle_service_state"
|
||||
android:id="@+id/service_switch"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save"
|
||||
android:textColor="@android:color/white"
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
android:textSize="18sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:padding="16dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:title="@string/save"
|
||||
android:id="@+id/save"
|
||||
android:icon="@drawable/ic_check"
|
||||
android:alphabeticShortcut="s"
|
||||
android:numericShortcut="0"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
||||
@@ -106,6 +106,6 @@
|
||||
<string name="toggle_service_state">Toggle service state</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="turn_service_state">Turn service %s</string>
|
||||
<string name="state_on">On</string>
|
||||
<string name="state_off">Off</string>
|
||||
<string name="state_on">on</string>
|
||||
<string name="state_off">off</string>
|
||||
</resources>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<resources>
|
||||
|
||||
<style name="Toolbar.Logo" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
|
||||
<item name="android:textSize">24sp</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
<style name="Theme.Material" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:alertDialogTheme">@style/Theme.Material.Dialog.Alert</item>
|
||||
|
||||
@@ -148,7 +148,7 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
|
||||
val intent = getParentActivityIntent
|
||||
if (intent == null) finish else navigateUpTo(intent)
|
||||
})
|
||||
toolbar.inflateMenu(R.menu.add_profile_methods)
|
||||
toolbar.inflateMenu(R.menu.profile_manager_menu)
|
||||
toolbar.setOnMenuItemClickListener(this)
|
||||
|
||||
ShadowsocksApplication.profileManager.setProfileAddedListener(profilesAdapter.add)
|
||||
|
||||
@@ -44,8 +44,7 @@ import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.{Button, Switch}
|
||||
import android.widget.Switch
|
||||
import com.github.shadowsocks.helper.TaskerSettings
|
||||
import com.twofortyfouram.locale.api.{Intent => ApiIntent}
|
||||
|
||||
@@ -56,27 +55,29 @@ class TaskerActivity extends AppCompatActivity {
|
||||
var taskerOption: TaskerSettings = _
|
||||
|
||||
var switch: Switch = _
|
||||
var btnSave: Button = _
|
||||
|
||||
override def onCreate(savedInstanceState: Bundle) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.layout_tasker)
|
||||
|
||||
switch = findViewById(R.id.service_switch).asInstanceOf[Switch]
|
||||
btnSave = findViewById(R.id.btn_save).asInstanceOf[Button]
|
||||
|
||||
val toolbar = findViewById(R.id.toolbar).asInstanceOf[Toolbar]
|
||||
toolbar.setTitle(R.string.screen_name)
|
||||
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha)
|
||||
toolbar.setTitle(R.string.app_name)
|
||||
toolbar.setNavigationIcon(R.drawable.ic_close)
|
||||
toolbar.setNavigationOnClickListener(_ => finish())
|
||||
|
||||
switch.setOnCheckedChangeListener((_, isChecked) => taskerOption.is_start = isChecked)
|
||||
btnSave.setOnClickListener(_ => saveResult())
|
||||
toolbar.inflateMenu(R.menu.tasker_menu)
|
||||
toolbar.setOnMenuItemClickListener(_.getItemId match {
|
||||
case R.id.save =>
|
||||
saveResult()
|
||||
true
|
||||
case _ => false
|
||||
})
|
||||
|
||||
loadSettings()
|
||||
}
|
||||
|
||||
private def loadSettings(): Unit = {
|
||||
private def loadSettings() {
|
||||
val intent: Intent = getIntent
|
||||
if (intent.getAction != ApiIntent.ACTION_EDIT_SETTING) {
|
||||
Log.w(Shadowsocks.TAG, "unknown tasker action")
|
||||
@@ -89,7 +90,8 @@ class TaskerActivity extends AppCompatActivity {
|
||||
switch.setChecked(taskerOption.is_start)
|
||||
}
|
||||
|
||||
private def saveResult(): Unit = {
|
||||
private def saveResult() {
|
||||
taskerOption.is_start = switch.isChecked
|
||||
setResult(Activity.RESULT_OK, taskerOption.toIntent(this))
|
||||
finish()
|
||||
}
|
||||
|
||||