Implement immersive theme
This commit is contained in:
parent
54f958785c
commit
c5dda08c19
4 changed files with 23 additions and 2 deletions
|
@ -64,7 +64,7 @@ tasks.whenTaskAdded { task ->
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation "androidx.preference:preference:1.1.0-rc01"
|
implementation "androidx.preference:preference:1.1.0-rc01"
|
||||||
implementation 'com.github.shadowsocks:plugin:1.3.0'
|
implementation 'com.github.shadowsocks:plugin:1.3.1'
|
||||||
implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0'
|
implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
<meta-data android:name="com.github.shadowsocks.plugin.executable_path"
|
<meta-data android:name="com.github.shadowsocks.plugin.executable_path"
|
||||||
android:value="libv2ray.so"/>
|
android:value="libv2ray.so"/>
|
||||||
</provider>
|
</provider>
|
||||||
<activity android:name=".ConfigActivity">
|
<activity android:name=".ConfigActivity"
|
||||||
|
android:theme="@style/Theme.Shadowsocks.Immersive">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.github.shadowsocks.plugin.ACTION_CONFIGURE"/>
|
<action android:name="com.github.shadowsocks.plugin.ACTION_CONFIGURE"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
|
@ -22,8 +22,10 @@ package com.github.shadowsocks.plugin.v2ray
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
|
import android.view.View
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import com.github.shadowsocks.plugin.ConfigurationActivity
|
import com.github.shadowsocks.plugin.ConfigurationActivity
|
||||||
import com.github.shadowsocks.plugin.PluginOptions
|
import com.github.shadowsocks.plugin.PluginOptions
|
||||||
|
|
||||||
|
@ -34,6 +36,15 @@ class ConfigActivity : ConfigurationActivity(), Toolbar.OnMenuItemClickListener
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
findViewById<View>(android.R.id.content).apply {
|
||||||
|
setOnApplyWindowInsetsListener { view, insets ->
|
||||||
|
view.updatePadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
|
||||||
|
insets.systemWindowInsetRight)
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
insets.replaceSystemWindowInsets(0, 0, 0, insets.systemWindowInsetBottom)
|
||||||
|
}
|
||||||
|
systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
}
|
||||||
findViewById<Toolbar>(R.id.toolbar).apply {
|
findViewById<Toolbar>(R.id.toolbar).apply {
|
||||||
title = this@ConfigActivity.title
|
title = this@ConfigActivity.title
|
||||||
setNavigationIcon(R.drawable.ic_navigation_close)
|
setNavigationIcon(R.drawable.ic_navigation_close)
|
||||||
|
|
|
@ -25,6 +25,8 @@ import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputFilter
|
import android.text.InputFilter
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
|
@ -89,6 +91,13 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
listView.setOnApplyWindowInsetsListener { v, insets ->
|
||||||
|
insets.apply { v.updatePadding(bottom = systemWindowInsetBottom) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean {
|
override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean {
|
||||||
val (mode, tls) = readMode(newValue as String)
|
val (mode, tls) = readMode(newValue as String)
|
||||||
path.isEnabled = mode == null
|
path.isEnabled = mode == null
|
||||||
|
|
Loading…
Reference in a new issue