mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-22 19:25:11 +00:00
disabled button test
This commit is contained in:
parent
a89a850bae
commit
b0e5e1325b
4 changed files with 17 additions and 23 deletions
|
@ -71,6 +71,7 @@ dependencies {
|
|||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.airbnb.android:paris:1.5.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'com.github.ssseasonnn.RxDownload:rxdownload4:1.0.9'
|
||||
implementation 'com.github.100rabhkr:GetJSON:1.0'
|
||||
|
|
|
@ -4,6 +4,8 @@ import android.content.ActivityNotFoundException
|
|||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
|
@ -125,10 +127,12 @@ open class Home : BaseFragment() {
|
|||
microgsettingsbtn.visibility = View.INVISIBLE
|
||||
microguninstallbtn.visibility = View.INVISIBLE
|
||||
microgVerText.text = getString(R.string.unavailable)
|
||||
if (PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") == "Nonroot")
|
||||
vancedinstallbtn.visibility = View.GONE
|
||||
else
|
||||
vancedinstallbtn.visibility = View.VISIBLE
|
||||
vancedinstallbtn.isEnabled = PreferenceManager.getDefaultSharedPreferences(activity).getString("vanced_variant", "Nonroot") != "Nonroot"
|
||||
if (!vancedinstallbtn.isEnabled) {
|
||||
vancedinstallbtn.backgroundTintList = ColorStateList.valueOf(Color.DKGRAY)
|
||||
vancedinstallbtn.setTextColor(ColorStateList.valueOf(Color.GRAY))
|
||||
vancedinstallbtn.text = activity?.getString(R.string.no_microg)
|
||||
}
|
||||
}
|
||||
|
||||
val vancedVerText = view.findViewById<TextView>(R.id.vanced_installed_version)
|
||||
|
|
|
@ -31,32 +31,20 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/vanced_title_buttons_barrier" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vanced_buttons_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/DisabledButtonStyle"
|
||||
android:text="No Microg!"
|
||||
android:clickable="false" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/vanced_installbtn"
|
||||
style="@style/ButtonStyle"
|
||||
android:text="@string/install"
|
||||
app:icon="@drawable/outline_cloud_download_24"/>
|
||||
|
||||
</FrameLayout>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:icon="@drawable/outline_cloud_download_24" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/vanced_title_buttons_barrier"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="home_vanced_logo, vanced_buttons_frame"/>
|
||||
app:constraint_referenced_ids="home_vanced_logo, vanced_installbtn"/>
|
||||
|
||||
<ImageView
|
||||
style="@style/ClickableImageWidget.Red"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<string name="latest">Latest:</string>
|
||||
<string name="loading">Loading…</string>
|
||||
<string name="network_error">Network connection unavailable</string>
|
||||
<string name="no_microg">No Microg!</string>
|
||||
<string name="unavailable">Unavailable</string>
|
||||
<string name="update">Update</string>
|
||||
<string name="useful_links">Useful Links</string>
|
||||
|
|
Loading…
Reference in a new issue