Adjust UI

This commit is contained in:
2dust committed 2024-04-21 12:05:42 +08:00
1 parent a3b1feabff
commit 3bc2081540
24 files changed
+64 -133

No files matched your search

+1 -2
View File
@@ -96,7 +96,7 @@ dependencies {
implementation("androidx.viewpager2:viewpager2:1.1.0-beta02")
// Androidx ktx
implementation("androidx.activity:activity-ktx:1.8.2")
implementation("androidx.activity:activity-ktx:1.9.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
@@ -111,7 +111,6 @@ dependencies {
implementation("io.reactivex:rxjava:1.3.8")
implementation("io.reactivex:rxandroid:1.2.1")
implementation("com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar")
implementation("com.github.jorgecastilloprz:fabprogresscircle:1.01@aar")
implementation("me.drakeet.support:toastcompat:1.1.0")
implementation("com.blacksquircle.ui:editorkit:2.9.0")
implementation("com.blacksquircle.ui:language-base:2.9.0")
@@ -1,6 +1,9 @@
package com.v2ray.ang.service
import android.app.*
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@@ -290,7 +293,7 @@ object V2RayServiceManager {
.setShowWhen(false)
.setOnlyAlertOnce(true)
.setContentIntent(contentPendingIntent)
.addAction(R.drawable.ic_close_grey_800_24dp,
.addAction(R.drawable.ic_delete_24dp,
service.getString(R.string.notification_action_stop_v2ray),
stopV2RayPendingIntent)
//.build()
@@ -146,21 +146,16 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
mainViewModel.isRunning.observe(this) { isRunning ->
adapter.isRunning = isRunning
if (isRunning) {
if (!Utils.getDarkModeStatus(this)) {
binding.fab.setImageResource(R.drawable.ic_stat_name)
}
binding.fab.setImageResource(R.drawable.ic_stop_24dp)
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_orange))
setTestState(getString(R.string.connection_connected))
binding.layoutTest.isFocusable = true
} else {
if (!Utils.getDarkModeStatus(this)) {
binding.fab.setImageResource(R.drawable.ic_stat_name)
}
binding.fab.setImageResource(R.drawable.ic_play_24dp)
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_grey))
setTestState(getString(R.string.connection_not_connected))
binding.layoutTest.isFocusable = false
}
hideCircle()
}
mainViewModel.startListenBroadcast()
}
@@ -208,10 +203,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
if (mainStorage?.decodeString(MmkvManager.KEY_SELECTED_SERVER).isNullOrEmpty()) {
return
}
showCircle()
// toast(R.string.toast_services_start)
V2RayServiceManager.startV2Ray(this)
hideCircle()
}
fun restartV2Ray() {
@@ -657,29 +649,6 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
return super.onKeyDown(keyCode, event)
}
fun showCircle() {
binding.fabProgressCircle.show()
}
fun hideCircle() {
try {
Observable.timer(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
try {
if (binding.fabProgressCircle.isShown) {
binding.fabProgressCircle.hide()
}
} catch (e: Exception) {
Log.w(ANG_PACKAGE, e)
}
}
} catch (e: Exception) {
Log.d(ANG_PACKAGE, e.toString())
}
}
override fun onNavigationItemSelected(item: MenuItem): Boolean {
// Handle navigation view item clicks here.
when (item.itemId) {
@@ -3,12 +3,12 @@ package com.v2ray.ang.ui
import android.content.Intent
import android.graphics.Color
import android.text.TextUtils
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.gson.Gson
import com.tencent.mmkv.MMKV
import com.v2ray.ang.AngApplication.Companion.application
@@ -166,13 +166,11 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
}
notifyItemChanged(mActivity.mainViewModel.getPosition(guid))
if (isRunning) {
mActivity.showCircle()
Utils.stopVService(mActivity)
Observable.timer(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
V2RayServiceManager.startV2Ray(mActivity)
mActivity.hideCircle()
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 B

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M213.333333 789.461333V234.538667C213.333333 168.533333 285.013333 127.530667 341.930667 160.981333l471.68 277.461334c56.106667 32.981333 56.106667 114.133333 0 147.114666L341.930667 863.018667C285.056 896.469333 213.333333 855.466667 213.333333 789.461333z" />
</vector>
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_shortcut_background"
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<item
android:drawable="@drawable/ic_stat_name"
android:left="12dp"
android:top="12dp"
android:right="12dp"
android:bottom="12dp" />
</layer-list>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M256 192h512c35.392 0 64 28.608 64 64v512c0 35.392-28.608 64-64 64H256c-35.392 0-64-28.608-64-64V256c0-35.392 28.608-64 64-64z" />
</vector>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -1,9 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="135"
android:centerColor="#009688"
android:endColor="#00695C"
android:startColor="#4DB6AC"
android:type="linear" />
</shape>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp">
<path
android:fillColor="#424242"
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>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#424242"
android:pathData="M213.333333 789.461333V234.538667C213.333333 168.533333 285.013333 127.530667 341.930667 160.981333l471.68 277.461334c56.106667 32.981333 56.106667 114.133333 0 147.114666L341.930667 863.018667C285.056 896.469333 213.333333 855.466667 213.333333 789.461333z" />
</vector>
@@ -1,13 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="1024"
android:viewportWidth="1024">
<path
android:fillColor="@color/colorBg"
android:pathData="M0,512C0,229.23 229.81,0 512,0 794.77,0 1024,229.81 1024,512 1024,794.77 794.19,1024 512,1024 229.23,1024 0,794.19 0,512Z" />
<path
android:fillColor="@color/colorText"
android:pathData="M515.24,389.28c-67.56,0 -122.33,54.77 -122.33,122.33 0,67.58 54.77,122.35 122.33,122.35 67.58,0 122.34,-54.77 122.34,-122.35C637.57,444.04 582.81,389.28 515.24,389.28L515.24,389.28zM582.53,578.9c-17.98,17.98 -41.87,27.87 -67.29,27.87 -25.41,0 -49.31,-9.89 -67.28,-27.87s-27.87,-41.86 -27.87,-67.29c0,-25.42 9.91,-49.31 27.87,-67.28 17.97,-17.98 41.87,-27.87 67.28,-27.87 25.43,0 49.32,9.91 67.29,27.87 17.97,17.97 27.86,41.86 27.86,67.28C610.39,537.03 600.5,560.92 582.53,578.9L582.53,578.9zM816.2,588.62c0.18,-0.2 0.36,-0.43 0.52,-0.66 0.08,-0.12 0.15,-0.22 0.25,-0.35 0.15,-0.2 0.29,-0.43 0.43,-0.66 0.08,-0.14 0.16,-0.27 0.24,-0.41 0.12,-0.2 0.22,-0.42 0.34,-0.64 0.07,-0.17 0.15,-0.33 0.22,-0.48 0.09,-0.2 0.16,-0.4 0.24,-0.6 0.07,-0.19 0.15,-0.38 0.22,-0.57 0.06,-0.18 0.11,-0.39 0.17,-0.57 0.06,-0.21 0.12,-0.42 0.17,-0.64 0,-0.01 0,-0.02 0,-0.04 5.46,-23.29 8.23,-47.32 8.23,-71.43 0,-24.1 -2.77,-48.14 -8.23,-71.42 0,-0.02 0,-0.04 -0.01,-0.06 -0.09,-0.38 -0.2,-0.74 -0.32,-1.11 -0.02,-0.06 -0.04,-0.13 -0.07,-0.19 -0.14,-0.4 -0.3,-0.78 -0.46,-1.16 -0.02,-0.03 -0.02,-0.06 -0.04,-0.1 -0.18,-0.41 -0.4,-0.79 -0.62,-1.18l0,0c-1.99,-3.39 -5.4,-5.81 -9.39,-6.5 -0.01,0 -0.02,-0.01 -0.04,-0.01 -0.28,-0.04 -0.56,-0.07 -0.86,-0.1 -0.17,-0.01 -0.34,-0.05 -0.51,-0.06 -0.19,-0.01 -0.38,-0.01 -0.56,-0.01 -0.28,-0.01 -0.56,-0.02 -0.85,-0.01 -0.02,0 -0.04,0 -0.07,0 -1.29,0.06 -2.41,0.08 -3.48,0.08 -44.92,0 -81.45,-36.54 -81.45,-81.45 0,-15.84 4.55,-31.2 13.16,-44.4 0.02,-0.02 0.02,-0.04 0.04,-0.06 0.17,-0.28 0.34,-0.57 0.49,-0.85 0.07,-0.11 0.12,-0.22 0.17,-0.33 0.14,-0.28 0.26,-0.56 0.38,-0.84 0.06,-0.14 0.14,-0.27 0.19,-0.42 0.09,-0.22 0.15,-0.45 0.22,-0.67 0.07,-0.2 0.14,-0.41 0.2,-0.61 0.04,-0.15 0.07,-0.3 0.1,-0.45 0.07,-0.28 0.14,-0.56 0.19,-0.85 0.01,-0.07 0.02,-0.14 0.03,-0.2 0.07,-0.37 0.12,-0.74 0.14,-1.11 0,-0.03 0,-0.06 0,-0.09 0.03,-0.4 0.04,-0.8 0.04,-1.21 -0.01,-0.1 -0.02,-0.21 -0.04,-0.31 -0.01,-0.33 -0.03,-0.65 -0.07,-0.98 -0.02,-0.26 -0.09,-0.51 -0.12,-0.77 -0.02,-0.17 -0.04,-0.34 -0.09,-0.51 -0.08,-0.33 -0.17,-0.67 -0.25,-1 -0.04,-0.09 -0.05,-0.17 -0.07,-0.26 -0.12,-0.31 -0.22,-0.61 -0.35,-0.92 -0.04,-0.1 -0.07,-0.2 -0.12,-0.3 -0.11,-0.25 -0.22,-0.48 -0.35,-0.72 -0.08,-0.17 -0.14,-0.33 -0.22,-0.48 -0.09,-0.17 -0.2,-0.33 -0.3,-0.5 -0.13,-0.22 -0.27,-0.45 -0.4,-0.66 -0.09,-0.11 -0.16,-0.22 -0.24,-0.33 -0.2,-0.26 -0.38,-0.51 -0.6,-0.76 -0.06,-0.08 -0.15,-0.16 -0.22,-0.24 -0.22,-0.26 -0.46,-0.51 -0.72,-0.77 -0.02,-0.01 -0.03,-0.03 -0.04,-0.04 -35.58,-34.22 -79.25,-59.78 -126.27,-73.91 -0.1,-0.04 -0.21,-0.06 -0.32,-0.08 -0.25,-0.07 -0.51,-0.14 -0.77,-0.19 -0.18,-0.04 -0.38,-0.08 -0.56,-0.11 -0.25,-0.04 -0.51,-0.08 -0.75,-0.11 -0.2,-0.02 -0.4,-0.04 -0.61,-0.05 -0.22,-0.02 -0.46,-0.03 -0.7,-0.03 -0.22,-0.01 -0.44,0 -0.65,0 -0.22,0.01 -0.43,0.03 -0.64,0.04 -0.23,0.01 -0.46,0.04 -0.69,0.08 -0.2,0.02 -0.4,0.06 -0.6,0.09 -0.23,0.04 -0.46,0.09 -0.69,0.14 -0.2,0.05 -0.4,0.1 -0.6,0.16 -0.22,0.06 -0.43,0.13 -0.64,0.2 -0.21,0.07 -0.41,0.14 -0.61,0.22 -0.2,0.08 -0.4,0.16 -0.59,0.25 -0.2,0.1 -0.42,0.19 -0.62,0.3 -0.17,0.09 -0.35,0.18 -0.52,0.28 -0.21,0.12 -0.42,0.25 -0.63,0.38 -0.15,0.1 -0.32,0.21 -0.47,0.3 -0.2,0.15 -0.4,0.29 -0.6,0.45 -0.14,0.11 -0.3,0.23 -0.44,0.35 -0.17,0.16 -0.36,0.32 -0.53,0.48 -0.15,0.14 -0.3,0.28 -0.44,0.43 -0.15,0.17 -0.32,0.34 -0.46,0.51 -0.15,0.17 -0.3,0.35 -0.44,0.53 -0.14,0.16 -0.25,0.33 -0.38,0.5 -0.15,0.21 -0.29,0.42 -0.42,0.62 -0.1,0.16 -0.21,0.33 -0.31,0.5 -0.13,0.23 -0.25,0.46 -0.37,0.69 -0.05,0.1 -0.11,0.19 -0.15,0.3 -6.5,13.8 -16.71,25.48 -29.54,33.79 -13.16,8.52 -28.45,13.02 -44.21,13.02 -15.75,0 -31.04,-4.5 -44.2,-13.02 -12.83,-8.32 -23.05,-19.99 -29.55,-33.79 -0.04,-0.11 -0.1,-0.2 -0.15,-0.29 -0.12,-0.24 -0.25,-0.48 -0.37,-0.71 -0.1,-0.17 -0.2,-0.33 -0.3,-0.5 -0.14,-0.21 -0.28,-0.43 -0.43,-0.62 -0.12,-0.17 -0.25,-0.33 -0.37,-0.5 -0.14,-0.18 -0.29,-0.35 -0.44,-0.53 -0.14,-0.17 -0.3,-0.34 -0.46,-0.5 -0.15,-0.15 -0.3,-0.3 -0.45,-0.44 -0.17,-0.17 -0.35,-0.33 -0.53,-0.48 -0.15,-0.12 -0.3,-0.25 -0.46,-0.37 -0.2,-0.15 -0.39,-0.29 -0.59,-0.43 -0.16,-0.11 -0.33,-0.22 -0.48,-0.33 -0.2,-0.12 -0.4,-0.25 -0.61,-0.37 -0.17,-0.1 -0.35,-0.19 -0.53,-0.29 -0.2,-0.1 -0.4,-0.19 -0.61,-0.29 -0.2,-0.09 -0.4,-0.17 -0.6,-0.25 -0.2,-0.08 -0.4,-0.15 -0.59,-0.22 -0.22,-0.07 -0.44,-0.14 -0.66,-0.2 -0.2,-0.06 -0.39,-0.11 -0.59,-0.16 -0.23,-0.05 -0.46,-0.1 -0.69,-0.14 -0.2,-0.03 -0.4,-0.07 -0.6,-0.09 -0.23,-0.03 -0.46,-0.06 -0.69,-0.08 -0.22,-0.01 -0.43,-0.03 -0.64,-0.03 -0.22,-0.01 -0.44,-0.01 -0.66,-0.01 -0.23,0 -0.46,0.01 -0.71,0.03 -0.2,0.01 -0.4,0.03 -0.6,0.05 -0.25,0.03 -0.51,0.07 -0.76,0.11 -0.19,0.03 -0.38,0.07 -0.57,0.11 -0.25,0.05 -0.51,0.12 -0.77,0.19 -0.11,0.03 -0.21,0.04 -0.31,0.08 -46.64,14.02 -90.02,39.3 -125.43,73.1 -0.04,0.04 -0.07,0.08 -0.11,0.12 -0.2,0.2 -0.4,0.4 -0.59,0.61 -0.12,0.13 -0.23,0.26 -0.35,0.39 -0.17,0.21 -0.33,0.42 -0.48,0.64 -0.12,0.15 -0.23,0.3 -0.34,0.46 -0.13,0.19 -0.25,0.39 -0.37,0.59 -0.12,0.19 -0.23,0.38 -0.34,0.56 -0.09,0.18 -0.17,0.36 -0.26,0.54 -0.11,0.Line truncated
</vector>
@@ -1,18 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="1024"
android:viewportWidth="1024">
<path
android:fillColor="@color/colorBg"
android:pathData="M0,512C0,229.23 229.81,0 512,0 794.77,0 1024,229.81 1024,512 1024,794.77 794.19,1024 512,1024 229.23,1024 0,794.19 0,512Z" />
<item
android:drawable="@drawable/ic_shortcut_background"
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<item
android:drawable="@drawable/ic_stat_name_black"
android:left="12dp"
android:top="12dp"
android:right="12dp"
android:bottom="12dp" />
</layer-list>
<path
android:fillColor="@color/colorText"
android:pathData="M742.4 691.2c-12.8-12.8-25.6-12.8-38.4 0-51.2 51.2-115.2 83.2-185.6 83.2-128 0-230.4-89.6-256-204.8l44.8 0C320 569.6 332.8 550.4 320 537.6L243.2 428.8c-6.4-12.8-25.6-12.8-32 0L134.4 537.6c-12.8 12.8 0 32 19.2 32l51.2 0C224 716.8 358.4 832 512 832c89.6 0 166.4-32 230.4-96C748.8 723.2 748.8 704 742.4 691.2L742.4 691.2zM281.6 332.8c12.8 12.8 25.6 12.8 38.4 0C371.2 275.2 441.6 249.6 512 249.6c128 0 230.4 89.6 256 204.8l-44.8 0c-19.2 0-25.6 19.2-19.2 32l76.8 108.8c6.4 12.8 25.6 12.8 32 0l76.8-108.8c12.8-12.8 0-32-19.2-32l-51.2 0C800 307.2 665.6 192 512 192 422.4 192 345.6 230.4 281.6 288 275.2 300.8 275.2 320 281.6 332.8L281.6 332.8zM627.2 556.8c0 25.6-25.6 51.2-51.2 51.2l-128 0c-25.6 0-51.2-25.6-51.2-51.2L396.8 473.6c0-25.6 25.6-51.2 51.2-51.2l128 0c25.6 0 51.2 25.6 51.2 51.2L627.2 556.8 627.2 556.8zM627.2 556.8" />
</vector>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/colorBg" />
<size android:width="44dp" android:height="44dp" />
</shape>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#424242"
android:pathData="M256 192h512c35.392 0 64 28.608 64 64v512c0 35.392-28.608 64-64 64H256c-35.392 0-64-28.608-64-64V256c0-35.392 28.608-64 64-64z" />
</vector>
@@ -70,7 +70,7 @@
</LinearLayout>
<com.github.jorgecastilloprz.FABProgressCircle
<FrameLayout
android:id="@+id/fabProgressCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -94,7 +94,7 @@
android:src="@drawable/ic_stat_name"
app:layout_anchorGravity="bottom|right|end" />
</com.github.jorgecastilloprz.FABProgressCircle>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</RelativeLayout>
</LinearLayout>
@@ -184,7 +184,7 @@
android:layout_height="wrap_content"
android:lines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/color_fab_orange"
android:textColor="@color/colorConfigType"
android:textSize="10sp" />
</LinearLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="color_fab_orange">#f97910</color>
<color name="color_switch_fab_grey">#424242</color>
<color name="color_fab_grey">#646464</color>
<color name="color_secondary">#BDBDBD</color>
+2 -1
View File
@@ -2,8 +2,9 @@
<resources>
<color name="colorPing">#009966</color>
<color name="colorPingRed">#FF0099</color>
<color name="color_fab_orange">#f97910</color>
<color name="colorConfigType">#f97910</color>
<color name="color_fab_orange">#f97910</color>
<color name="color_switch_fab_grey">#CDCDCD</color>
<color name="color_fab_grey">#9C9C9C</color>
<color name="color_secondary">#727272</color>
@@ -28,18 +28,4 @@
android:targetPackage="com.v2ray.ang" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_qu_settings_24dp"
android:shortcutDisabledMessage="@string/title_settings"
android:shortcutId="shortcuts_settings"
android:shortcutLongLabel="@string/title_settings"
android:shortcutShortLabel="@string/title_settings">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.v2ray.ang.ui.SettingsActivity"
android:targetPackage="com.v2ray.ang" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>