Drop unused code since migration to navigation components
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Aurora Store is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
|
||||
fun AppCompatActivity.restart() {
|
||||
val intent = intent
|
||||
overridePendingTransition(0, 0)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
|
||||
finish()
|
||||
overridePendingTransition(0, 0)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivity(): Unit =
|
||||
this.startActivity(newIntent<T>())
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivity(flags: Int): Unit =
|
||||
this.startActivity(newIntent<T>(flags))
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivity(extras: Bundle): Unit =
|
||||
this.startActivity(newIntent<T>(extras))
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivity(flags: Int, extras: Bundle): Unit =
|
||||
this.startActivity(newIntent<T>(flags, extras))
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivityForResult(requestCode: Int): Unit =
|
||||
this.startActivityForResult(newIntent<T>(), requestCode)
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivityForResult(
|
||||
requestCode: Int,
|
||||
flags: Int
|
||||
): Unit =
|
||||
this.startActivityForResult(newIntent<T>(flags), requestCode)
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivityForResult(
|
||||
extras: Bundle, requestCode: Int
|
||||
): Unit =
|
||||
this.startActivityForResult(newIntent<T>(extras), requestCode)
|
||||
|
||||
inline fun <reified T : Activity> Activity.startActivityForResult(
|
||||
extras: Bundle, requestCode: Int, flags: Int
|
||||
): Unit =
|
||||
this.startActivityForResult(newIntent<T>(flags, extras), requestCode)
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package com.aurora.extensions
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
@@ -30,15 +29,9 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.aurora.Constants
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.util.CommonUtil
|
||||
|
||||
fun Fragment.applyTheme(
|
||||
themeId: Int,
|
||||
shouldApplyTransition: Boolean = true,
|
||||
position: Int = 2
|
||||
) {
|
||||
fun Fragment.applyTheme(themeId: Int) {
|
||||
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
||||
|
||||
if (themeId == 0) {
|
||||
@@ -50,26 +43,13 @@ fun Fragment.applyTheme(
|
||||
|
||||
/*Apply Theme*/
|
||||
requireContext().theme.applyStyle(themeStyle, true)
|
||||
|
||||
/*Apply transition only on AppCompatActivity*/
|
||||
if (shouldApplyTransition)
|
||||
(requireActivity() as AppCompatActivity).transitionRecreate(position)
|
||||
else
|
||||
(requireActivity() as AppCompatActivity).recreate()
|
||||
(requireActivity() as AppCompatActivity).recreate()
|
||||
|
||||
if (themeId == 1) {
|
||||
(requireActivity() as AppCompatActivity).setLightConfiguration()
|
||||
}
|
||||
}
|
||||
|
||||
fun AppCompatActivity.transitionRecreate(position: Int = 2) {
|
||||
val intent = Intent(this, javaClass)
|
||||
intent.putExtra(Constants.INT_EXTRA, position)
|
||||
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
overridePendingTransition(R.anim.fade_in, R.anim.fade_out)
|
||||
}
|
||||
|
||||
fun AppCompatActivity.applyTheme(themeId: Int, accentId: Int = 1) {
|
||||
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
||||
val accentStyle = CommonUtil.getAccentStyleById(accentId)
|
||||
|
||||
Reference in New Issue
Block a user