format code
This commit is contained in:
7 files changed
+67
-36
No files matched your search
@@ -34,42 +34,50 @@
|
||||
android:name=".CreateProfileActivity"
|
||||
android:label="@string/clash_new_profile"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ImportFileActivity"
|
||||
android:label="@string/clash_import_from_file"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".ImportUrlActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ImportUrlActivity"
|
||||
android:label="@string/clash_import_from_url"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ClashStatusActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".ProxyActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ProxyActivity"
|
||||
android:label="@string/clash_proxy_manage"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".SettingMainActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SettingMainActivity"
|
||||
android:label="@string/application_setting_title"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".SettingProxyActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SettingProxyActivity"
|
||||
android:label="@string/application_setting_proxy"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".SettingAccessActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SettingAccessActivity"
|
||||
android:label="@string/proxy_setting_vpn_setting_access_control"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".SettingApplicationActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SettingApplicationActivity"
|
||||
android:label="@string/application_setting_application"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<service android:name=".ClashStartService"
|
||||
android:exported="false"/>
|
||||
|
||||
<service
|
||||
android:name=".ClashStartService"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name=".BootCompleteReceiver"
|
||||
android:exported="true"
|
||||
|
||||
@@ -24,9 +24,13 @@ class ClashStartService : Service() {
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
NotificationManagerCompat.from(this).apply {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
createNotificationChannel(NotificationChannel(NOTIFICATION_CHANNEL_ID,
|
||||
getString(R.string.clash_start_service_notification_channel),
|
||||
NotificationManager.IMPORTANCE_DEFAULT))
|
||||
createNotificationChannel(
|
||||
NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID,
|
||||
getString(R.string.clash_start_service_notification_channel),
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,16 @@ import kotlin.concurrent.thread
|
||||
|
||||
class ImportFileActivity : BaseActivity() {
|
||||
private val elements: List<FormAdapter.Type> = listOf(
|
||||
FormAdapter.TextType(R.drawable.ic_about,
|
||||
FormAdapter.TextType(
|
||||
R.drawable.ic_about,
|
||||
R.string.clash_profile_name,
|
||||
R.string.clash_profile_name_hint),
|
||||
FormAdapter.FilePickerType(R.drawable.ic_new_profile_file,
|
||||
R.string.clash_profile_name_hint
|
||||
),
|
||||
FormAdapter.FilePickerType(
|
||||
R.drawable.ic_new_profile_file,
|
||||
R.string.clash_profile_file,
|
||||
R.string.clash_profile_file_hint)
|
||||
R.string.clash_profile_file_hint
|
||||
)
|
||||
)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -48,7 +52,12 @@ class ImportFileActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (data != null && (activity_import_file_form.adapter as FormAdapter).onActivityResult(requestCode, resultCode, data) )
|
||||
if (data != null && (activity_import_file_form.adapter as FormAdapter).onActivityResult(
|
||||
requestCode,
|
||||
resultCode,
|
||||
data
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
@@ -59,20 +68,28 @@ class ImportFileActivity : BaseActivity() {
|
||||
val name = elements[0] as FormAdapter.TextType
|
||||
val file = elements[1] as FormAdapter.FilePickerType
|
||||
|
||||
if ( name.content.isEmpty() ) {
|
||||
if (name.content.isEmpty()) {
|
||||
runOnUiThread {
|
||||
activity_import_file_save.visibility = View.VISIBLE
|
||||
activity_import_file_saving.visibility = View.GONE
|
||||
Snackbar.make(activity_import_file_root, R.string.clash_import_file_empty_name, Snackbar.LENGTH_LONG).show()
|
||||
Snackbar.make(
|
||||
activity_import_file_root,
|
||||
R.string.clash_import_file_empty_name,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if ( file.content == null || file.content == Uri.EMPTY ) {
|
||||
if (file.content == null || file.content == Uri.EMPTY) {
|
||||
runOnUiThread {
|
||||
activity_import_file_save.visibility = View.VISIBLE
|
||||
activity_import_file_saving.visibility = View.GONE
|
||||
Snackbar.make(activity_import_file_root, R.string.clash_import_file_empty_path, Snackbar.LENGTH_LONG).show()
|
||||
Snackbar.make(
|
||||
activity_import_file_root,
|
||||
R.string.clash_import_file_empty_path,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ class ImportUrlActivity : BaseActivity() {
|
||||
FormAdapter.TextType(
|
||||
R.drawable.ic_about,
|
||||
R.string.clash_profile_name,
|
||||
R.string.clash_profile_name_hint),
|
||||
R.string.clash_profile_name_hint
|
||||
),
|
||||
FormAdapter.TextType(
|
||||
R.drawable.ic_link,
|
||||
R.string.clash_profile_url,
|
||||
@@ -33,7 +34,8 @@ class ImportUrlActivity : BaseActivity() {
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (data != null && (activity_import_url_form.adapter as FormAdapter)
|
||||
.onActivityResult(requestCode, resultCode, data))
|
||||
.onActivityResult(requestCode, resultCode, data)
|
||||
)
|
||||
return
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.net.Uri
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.github.kr328.clash.utils
|
||||
|
||||
import java.io.File
|
||||
import java.security.SecureRandom
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
object FileUtils {
|
||||
private val random = SecureRandom()
|
||||
@@ -12,7 +13,7 @@ object FileUtils {
|
||||
var file: File
|
||||
|
||||
do {
|
||||
file = dir.resolve(random.nextLong().toString() + suffix)
|
||||
file = dir.resolve(random.nextLong().absoluteValue.toString() + suffix)
|
||||
} while (file.exists())
|
||||
|
||||
return file
|
||||
|
||||
@@ -1,9 +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">
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
|
||||
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z" />
|
||||
</vector>
|
||||
Reference in new issue
Block a user