unlocked orientation
This commit is contained in:
parent
141a99d64c
commit
d643895e06
|
@ -37,8 +37,7 @@
|
|||
<activity
|
||||
android:name=".ui.core.SplashScreenActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/SplashTheme"
|
||||
android:screenOrientation="portrait">
|
||||
android:theme="@style/SplashTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -52,16 +51,14 @@
|
|||
|
||||
<activity
|
||||
android:name=".ui.WelcomeActivity"
|
||||
android:theme="@style/DarkTheme"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:theme="@style/DarkTheme"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:configChanges="layoutDirection|locale"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/DarkTheme"
|
||||
android:screenOrientation="portrait">
|
||||
android:theme="@style/DarkTheme">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package com.vanced.manager.ui.dialogs
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
@ -112,39 +108,4 @@ object DialogContainer {
|
|||
}
|
||||
}
|
||||
|
||||
fun launchVanced(context: Context) {
|
||||
val intent = Intent()
|
||||
intent.component =
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getString("vanced_variant", "nonroot") == "root")
|
||||
ComponentName("com.google.android.youtube", "com.google.android.youtube.HomeActivity")
|
||||
else
|
||||
ComponentName("com.vanced.android.youtube", "com.google.android.youtube.HomeActivity")
|
||||
|
||||
MaterialAlertDialogBuilder(context).apply {
|
||||
setTitle(context.getString(R.string.success))
|
||||
setMessage(context.getString(R.string.vanced_installed))
|
||||
setPositiveButton(context.getString(R.string.launch)) { _, _ ->
|
||||
startActivity(context, intent, null)
|
||||
}
|
||||
setNegativeButton(context.getString(R.string.close)) { dialog, _ -> dialog.dismiss() }
|
||||
create()
|
||||
applyAccent()
|
||||
}
|
||||
}
|
||||
|
||||
fun launchMusic(activity: Activity) {
|
||||
val intent = Intent()
|
||||
intent.component = ComponentName("com.vanced.android.youtube.music", "com.vanced.android.youtube.music.MusicActivity")
|
||||
MaterialAlertDialogBuilder(activity).apply {
|
||||
setTitle(activity.getString(R.string.success))
|
||||
setMessage(activity.getString(R.string.music_installed))
|
||||
setPositiveButton(activity.getString(R.string.launch)) { _, _ ->
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
setNegativeButton(activity.getString(R.string.close)) { dialog, _ -> dialog.dismiss() }
|
||||
create()
|
||||
applyAccent()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import android.content.ContextWrapper
|
||||
import android.content.DialogInterface
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import android.widget.RadioGroup
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.fragment.app.DialogFragment
|
||||
|
@ -28,7 +29,12 @@ object Extensions {
|
|||
}
|
||||
|
||||
fun DialogFragment.show(activity: FragmentActivity) {
|
||||
show(activity.supportFragmentManager, "")
|
||||
try {
|
||||
show(activity.supportFragmentManager, "")
|
||||
} catch (e: Exception) {
|
||||
Log.d("VMUI", e.stackTraceToString())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun Context.getDefaultPrefs(): SharedPreferences = getDefaultSharedPreferences(this)
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.vanced.manager.core.ui.base
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
|
||||
abstract class BindingBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment() {
|
||||
|
@ -22,6 +26,20 @@ abstract class BindingBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetD
|
|||
return binding.root
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val dialog = super.onCreateDialog(savedInstanceState)
|
||||
dialog.setOnShowListener {
|
||||
val bottomSheetDialogFragment = (it as BottomSheetDialog).findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
|
||||
if (bottomSheetDialogFragment != null) {
|
||||
BottomSheetBehavior.from(bottomSheetDialogFragment).apply {
|
||||
state = BottomSheetBehavior.STATE_EXPANDED
|
||||
peekHeight = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return dialog
|
||||
}
|
||||
|
||||
protected abstract fun binding(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
Loading…
Reference in New Issue