mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-10 12:55:06 +00:00
some fixes
This commit is contained in:
parent
1ab4b843ef
commit
fddce8ed85
9 changed files with 47 additions and 41 deletions
|
@ -123,8 +123,10 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
R.id.root_switch ->
|
||||
if (Shell.rootAccess())
|
||||
writeToVariantPref("root", R.anim.slide_in_right, R.anim.slide_out_left)
|
||||
else
|
||||
else {
|
||||
writeToVariantPref("nonroot", R.anim.slide_in_left, R.anim.slide_out_right)
|
||||
Toast.makeText(activity, "Root access not granted", Toast.LENGTH_SHORT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ class StubInstaller: Service() {
|
|||
if (!apkFile.exists()) {
|
||||
copyStub()
|
||||
}
|
||||
Log.d("VMpath", apkFile.path)
|
||||
Log.d("VMpath", apkFile.canonicalPath)
|
||||
Log.d("AppLog", "Installing stub...")
|
||||
val installResult = Shell.su("pm install ${apkFile.path}").exec()
|
||||
val installResult = Shell.su("pm install ${apkFile.canonicalPath}").exec()
|
||||
Log.d("AppLog", "succeeded installing?${installResult.isSuccess}")
|
||||
if (installResult.isSuccess) {
|
||||
val mIntent = Intent(HomeFragment.SIGNATURE_DISABLED)
|
||||
|
@ -30,7 +30,7 @@ class StubInstaller: Service() {
|
|||
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
|
||||
}
|
||||
|
||||
return START_NOT_STICKY
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
|
|
|
@ -70,7 +70,7 @@ class HomeFragment : Home() {
|
|||
}
|
||||
}
|
||||
|
||||
view.findViewById<ViewGroup>(R.id.changelog_card).layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
|
||||
view.findViewById<ViewGroup>(R.id.home_container).layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
|
||||
view.findViewById<ImageButton>(R.id.changelog_button).setOnClickListener {
|
||||
cardExpandCollapse()
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
|
||||
private val pm = application.packageManager
|
||||
|
||||
val vancedInstallButtonTxt: MutableLiveData<String> = MutableLiveData()
|
||||
val vancedInstallButtonIcon: MutableLiveData<Drawable> = MutableLiveData()
|
||||
|
||||
val microgInstalled: Boolean = isPackageInstalled("com.mgoogle.android.gms", application.packageManager)
|
||||
val vancedInstalled: Boolean = isPackageInstalled(vancedPkgName, application.packageManager)
|
||||
|
||||
|
@ -133,38 +136,35 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
|
|||
microgVersion.value = displayJsonString("microg.json","version", application)
|
||||
vancedInstalledVersion.value = getPkgInfo(vancedInstalled, vancedPkgName, application)
|
||||
microgInstalledVersion.value = getPkgInfo(microgInstalled, "com.mgoogle.android.gms", application)
|
||||
vancedInstallButtonIcon.value =
|
||||
if (variant == "nonroot") {
|
||||
if (microgInstalled)
|
||||
compareIntDrawable(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else
|
||||
null
|
||||
} else {
|
||||
if (signatureStatusTxt.value == application.getString(R.string.signature_disabled))
|
||||
compareIntDrawable(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else
|
||||
null
|
||||
}
|
||||
vancedInstallButtonTxt.value =
|
||||
if (variant == "nonroot") {
|
||||
if (microgInstalled) {
|
||||
compareInt(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
} else {
|
||||
application.getString(R.string.no_microg)
|
||||
}
|
||||
} else {
|
||||
when (signatureStatusTxt.value) {
|
||||
application.getString(R.string.unavailable) -> application.getString(R.string.signature_not_checked)
|
||||
application.getString(R.string.signature_enabled) -> application.getString(R.string.signature_disable)
|
||||
application.getString(R.string.signature_disabled) -> compareInt(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else -> throw NotImplementedError("Error handling status")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val vancedInstallButtonTxt =
|
||||
if (variant == "nonroot") {
|
||||
if (microgInstalled) {
|
||||
compareInt(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
} else {
|
||||
application.getString(R.string.no_microg)
|
||||
}
|
||||
} else {
|
||||
when (signatureStatusTxt.value) {
|
||||
application.getString(R.string.unavailable) -> application.getString(R.string.signature_not_checked)
|
||||
application.getString(R.string.signature_enabled) -> application.getString(R.string.signature_disable)
|
||||
application.getString(R.string.signature_disabled) -> compareInt(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else -> throw NotImplementedError("Error handling status")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val vancedInstallButtonIcon =
|
||||
if (variant == "nonroot") {
|
||||
if (microgInstalled)
|
||||
compareIntDrawable(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else
|
||||
null
|
||||
} else {
|
||||
if (signatureStatusTxt.value == application.getString(R.string.signature_disabled))
|
||||
compareIntDrawable(vancedInstalledVersionCode, vancedVersionCode, application)
|
||||
else
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:fromXDelta="100%"
|
||||
android:fromXDelta="-100%"
|
||||
android:toXDelta="0%"
|
||||
android:duration="500"/>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:fromXDelta="-100%"
|
||||
android:fromXDelta="100%"
|
||||
android:toXDelta="0%"
|
||||
android:duration="500"/>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<translate
|
||||
android:fromXDelta="0%"
|
||||
android:toXDelta="100%"
|
||||
android:toXDelta="-100%"
|
||||
android:duration="500"/>
|
||||
|
||||
</set>
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<translate
|
||||
android:fromXDelta="0%"
|
||||
android:toXDelta="-100%"
|
||||
android:toXDelta="100%"
|
||||
android:duration="500"/>
|
||||
|
||||
</set>
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
@ -15,6 +14,7 @@
|
|||
</data>
|
||||
|
||||
<com.vanced.manager.ui.core.SlidingNestedScrollView
|
||||
android:id="@+id/home_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
|
@ -30,6 +30,8 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/stdp"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
|
@ -41,6 +43,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:textAllCaps="false"
|
||||
android:text="@string/nonroot"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
@ -62,6 +65,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:textAllCaps="false"
|
||||
android:text="@string/root"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
|
Loading…
Reference in a new issue