add zh-cn

This commit is contained in:
Kr328 committed 2020-02-19 02:56:33 +08:00
1 parent e63f210cc8
commit 54c67f83ab
14 files changed
+43 -15

No files matched your search

@@ -1,7 +1,6 @@
package com.github.kr328.clash
class ApkBrokenActivity : BaseActivity() {
override fun onBackPressed() {
super.onBackPressed()
@@ -12,4 +11,7 @@ class ApkBrokenActivity : BaseActivity() {
override fun shouldDisplayHomeAsUpEnabled(): Boolean {
return false
}
override val activityLabel: CharSequence
get() = getText(R.string.application_broken)
}
@@ -161,13 +161,21 @@ abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope()
override fun setSupportActionBar(toolbar: Toolbar?) {
super.setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(shouldDisplayHomeAsUpEnabled())
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(shouldDisplayHomeAsUpEnabled())
activityLabel?.let {
title = it
}
}
}
open fun shouldDisplayHomeAsUpEnabled(): Boolean {
return true
}
abstract val activityLabel: CharSequence?
override fun onSupportNavigateUp(): Boolean {
this.onBackPressed()
@@ -66,6 +66,9 @@ class CreateProfileActivity : BaseActivity() {
}
}
override val activityLabel: CharSequence
get() = getText(R.string.create_profile)
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)
return finish()
@@ -63,6 +63,9 @@ class LogViewerActivity : BaseActivity() {
}
}
override val activityLabel: CharSequence
get() = getText(R.string.log_viewer)
override fun onStart() {
super.onStart()
@@ -88,6 +88,9 @@ class LogsActivity : BaseActivity() {
refreshList()
}
override val activityLabel: CharSequence
get() = getText(R.string.logs)
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if ( requestCode == REQUEST_CODE ) {
if ( resultCode == Activity.RESULT_OK ) {
@@ -72,6 +72,8 @@ class MainActivity : BaseActivity() {
stopBandwidthPolling()
}
override val activityLabel: CharSequence? = null
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK)
@@ -169,6 +169,8 @@ class ProfileEditActivity : BaseActivity() {
}
}
override val activityLabel: CharSequence? = null
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_CODE) {
if (resultCode != Activity.RESULT_OK || data == null)
@@ -62,6 +62,9 @@ class ProfilesActivity : BaseActivity(), ProfileAdapter.Callback, ProfilesMenu.C
backgroundJob = null
}
override val activityLabel: CharSequence?
get() = getText(R.string.profiles)
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == EDITOR_REQUEST_CODE) {
launch {
@@ -185,6 +185,9 @@ class ProxiesActivity : BaseActivity(), ScrollBinding.Callback {
return true
}
override val activityLabel: CharSequence?
get() = getText(R.string.proxy)
override suspend fun onClashStarted() {
finish()
}
@@ -1,6 +1,5 @@
package com.github.kr328.clash
import android.location.SettingInjectorService
import android.os.Bundle
import com.github.kr328.clash.service.util.intent
import kotlinx.android.synthetic.main.activity_settings.*
@@ -41,4 +40,7 @@ class SettingsActivity: BaseActivity() {
}
}
}
override val activityLabel: CharSequence?
get() = getText(R.string.settings)
}
@@ -1,11 +1,7 @@
package com.github.kr328.clash
import android.os.Bundle
import com.github.kr328.clash.service.settings.ServiceSettings
import com.github.kr328.clash.settings.BehaviorFragment
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class SettingsBehaviorActivity: BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -18,4 +14,7 @@ class SettingsBehaviorActivity: BaseActivity() {
.replace(R.id.fragment, BehaviorFragment())
.commit()
}
override val activityLabel: CharSequence?
get() = getText(R.string.behavior)
}
@@ -14,4 +14,7 @@ class SettingsInterfaceActivity: BaseActivity() {
.replace(R.id.fragment, InterfaceFragment())
.commit()
}
override val activityLabel: CharSequence?
get() = getText(R.string.interface_)
}
@@ -1,13 +1,7 @@
package com.github.kr328.clash
import android.os.Bundle
import com.github.kr328.clash.preference.UiSettings
import com.github.kr328.clash.service.settings.ServiceSettings
import com.github.kr328.clash.settings.NetworkFragment
import kotlinx.android.synthetic.main.activity_settings.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class SettingsNetworkActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -20,4 +14,7 @@ class SettingsNetworkActivity : BaseActivity() {
.replace(R.id.fragment, NetworkFragment())
.commit()
}
override val activityLabel: CharSequence?
get() = getText(R.string.network)
}
@@ -1,7 +1,5 @@
package com.github.kr328.clash.settings
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import com.github.kr328.clash.R
import com.github.kr328.clash.preference.UiSettings