mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-10 12:55:06 +00:00
UX fixes
This commit is contained in:
parent
7ab604bee8
commit
90d8164f64
7 changed files with 17 additions and 21 deletions
|
@ -6,8 +6,6 @@ import android.content.pm.PackageInstaller
|
|||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.vanced.manager.ui.MainActivity
|
||||
import com.vanced.manager.utils.AppUtils.sendRefreshHome
|
||||
|
||||
class AppUninstallerService: Service() {
|
||||
|
|
|
@ -93,7 +93,7 @@ class HomeFragment : Home() {
|
|||
|
||||
private fun cardExpandCollapse() {
|
||||
with(binding.includeChangelogsLayout) {
|
||||
viewModel?.expanded?.set(!isExpanded)
|
||||
activity?.runOnUiThread { viewModel?.expanded?.set(!isExpanded) }
|
||||
changelogButton.animate().apply {
|
||||
rotation(if (isExpanded) 0F else 180F)
|
||||
interpolator = AccelerateDecelerateInterpolator()
|
||||
|
@ -112,7 +112,7 @@ class HomeFragment : Home() {
|
|||
when (intent.action) {
|
||||
MICROG_DOWNLOADED -> binding.includeMicrogLayout.microgInstalling.visibility = View.VISIBLE
|
||||
VANCED_DOWNLOADED -> binding.includeVancedLayout.vancedInstalling.visibility = View.VISIBLE
|
||||
REFRESH_HOME -> viewModel.fetchData()
|
||||
REFRESH_HOME -> activity?.runOnUiThread { viewModel.fetchData() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
private val variant = getDefaultSharedPreferences(application).getString("vanced_variant", "nonroot")
|
||||
|
||||
private val vancedPkgName: String =
|
||||
if (variant== "root") {
|
||||
if (variant == "root") {
|
||||
"com.google.android.youtube"
|
||||
} else {
|
||||
"com.vanced.android.youtube"
|
||||
|
@ -35,6 +35,12 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
|
||||
private val pm = application.packageManager
|
||||
|
||||
private val vancedInstalledVersionCode = ObservableField<Int>()
|
||||
private val microgInstalledVersionCode = ObservableField<Int>()
|
||||
|
||||
private val vancedVersionCode = ObservableField<Int>()
|
||||
private val microgVersionCode = ObservableField<Int>()
|
||||
|
||||
//this is fucking retarded
|
||||
val vancedInstallButtonTxt = ObservableField<String>()
|
||||
val vancedInstallButtonIcon = ObservableField<Drawable>()
|
||||
|
@ -47,12 +53,6 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
val microgInstallButtonTxt = ObservableField<String>()
|
||||
val microgInstallButtonIcon = ObservableField<Drawable>()
|
||||
|
||||
private val vancedInstalledVersionCode = ObservableField<Int>()
|
||||
private val microgInstalledVersionCode = ObservableField<Int>()
|
||||
|
||||
private val vancedVersionCode = ObservableField<Int>()
|
||||
private val microgVersionCode = ObservableField<Int>()
|
||||
|
||||
val nonrootModeSelected: Boolean = variant == "nonroot"
|
||||
|
||||
val expanded = ObservableField<Boolean>()
|
||||
|
@ -77,8 +77,8 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
microgVersionCode.set(getJsonInt("microg.json", "versionCode", getApplication()))
|
||||
vancedInstalledVersionCode.set(getPkgVerCode(vancedInstalled.get()!!, vancedPkgName))
|
||||
microgInstalledVersionCode.set(getPkgVerCode(microgInstalled.get()!!, "com.mgoogle.android.gms"))
|
||||
microgInstallButtonTxt.set(compareInt(microgInstalledVersionCode.get()!!, microgVersionCode.get()!!, getApplication()))
|
||||
microgInstallButtonIcon.set(compareIntDrawable(microgInstalledVersionCode.get()!!, microgVersionCode.get()!!, getApplication()))
|
||||
microgInstallButtonTxt.set(compareInt(microgVersionCode.get()!!, microgInstalledVersionCode.get()!!, getApplication()))
|
||||
microgInstallButtonIcon.set(compareIntDrawable(microgVersionCode.get()!!, microgInstalledVersionCode.get()!!, getApplication()))
|
||||
shouldBeDisabled.set(nonrootModeSelected && !microgInstalled.get()!!)
|
||||
vancedInstallButtonIcon.set(
|
||||
if (shouldBeDisabled.get()!!) {
|
||||
|
|
|
@ -10,10 +10,9 @@ import com.vanced.manager.ui.fragments.HomeFragment
|
|||
object AppUtils {
|
||||
|
||||
fun sendRefreshHome(context: Context) {
|
||||
val mIntent = Intent()
|
||||
mIntent.action = HomeFragment.REFRESH_HOME
|
||||
mIntent.putExtra("package", "normal")
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(mIntent)
|
||||
val intent = Intent()
|
||||
intent.action = HomeFragment.REFRESH_HOME
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
||||
}
|
||||
|
||||
fun getErrorMessage(status: Int, context: Context): String {
|
||||
|
|
|
@ -12,7 +12,7 @@ object DownloadHelper {
|
|||
setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
|
||||
setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
|
||||
setTitle(context.getString(R.string.downloading_file, child))
|
||||
setDestinationInExternalPublicDir(context.getExternalFilesDir(dir)?.path, child)
|
||||
setDestinationInExternalFilesDir(context, dir, child)
|
||||
}
|
||||
|
||||
val downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
<import type="com.vanced.manager.R" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
|
@ -51,7 +50,7 @@
|
|||
style="@style/ButtonStyle"
|
||||
android:text="@{viewModel.vancedInstallButtonTxt}"
|
||||
android:textColor="@{viewModel.shouldBeDisabled ? @color/LightGray : @color/White}"
|
||||
android:backgroundTint="@{viewModel.shouldBeDisabled ? R.attr.colorDisabled : R.attr.colorPrimary}"
|
||||
android:backgroundTint="@{viewModel.shouldBeDisabled ? @color/Gray : @color/Accent}"
|
||||
app:icon="@{viewModel.vancedInstallButtonIcon}"
|
||||
android:clickable="@{!viewModel.shouldBeDisabled}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
<color name="LightGray">#908E8E</color>
|
||||
<color name="Gray">#5F5E5E</color>
|
||||
|
||||
<color name="Accent">?colorPrimary</color>
|
||||
<color name="Accent">?attr/colorPrimary</color>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue