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
|
package com.aurora.extensions
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -30,15 +29,9 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.aurora.Constants
|
|
||||||
import com.aurora.store.R
|
|
||||||
import com.aurora.store.util.CommonUtil
|
import com.aurora.store.util.CommonUtil
|
||||||
|
|
||||||
fun Fragment.applyTheme(
|
fun Fragment.applyTheme(themeId: Int) {
|
||||||
themeId: Int,
|
|
||||||
shouldApplyTransition: Boolean = true,
|
|
||||||
position: Int = 2
|
|
||||||
) {
|
|
||||||
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
||||||
|
|
||||||
if (themeId == 0) {
|
if (themeId == 0) {
|
||||||
@@ -50,26 +43,13 @@ fun Fragment.applyTheme(
|
|||||||
|
|
||||||
/*Apply Theme*/
|
/*Apply Theme*/
|
||||||
requireContext().theme.applyStyle(themeStyle, true)
|
requireContext().theme.applyStyle(themeStyle, true)
|
||||||
|
(requireActivity() as AppCompatActivity).recreate()
|
||||||
/*Apply transition only on AppCompatActivity*/
|
|
||||||
if (shouldApplyTransition)
|
|
||||||
(requireActivity() as AppCompatActivity).transitionRecreate(position)
|
|
||||||
else
|
|
||||||
(requireActivity() as AppCompatActivity).recreate()
|
|
||||||
|
|
||||||
if (themeId == 1) {
|
if (themeId == 1) {
|
||||||
(requireActivity() as AppCompatActivity).setLightConfiguration()
|
(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) {
|
fun AppCompatActivity.applyTheme(themeId: Int, accentId: Int = 1) {
|
||||||
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
val themeStyle = CommonUtil.getThemeStyleById(themeId)
|
||||||
val accentStyle = CommonUtil.getAccentStyleById(accentId)
|
val accentStyle = CommonUtil.getAccentStyleById(accentId)
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ class NotificationService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status.PAUSED -> {
|
Status.PAUSED -> {
|
||||||
val pauseString = getString(R.string.download_paused)
|
|
||||||
progressBigText.bigText(
|
progressBigText.bigText(
|
||||||
getString(
|
getString(
|
||||||
R.string.download_paused,
|
R.string.download_paused,
|
||||||
|
|||||||
@@ -23,10 +23,8 @@ import android.content.Context
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import coil.load
|
import coil.load
|
||||||
import com.airbnb.epoxy.CallbackProp
|
|
||||||
import com.airbnb.epoxy.ModelProp
|
import com.airbnb.epoxy.ModelProp
|
||||||
import com.airbnb.epoxy.ModelView
|
import com.airbnb.epoxy.ModelView
|
||||||
import com.airbnb.epoxy.OnViewRecycled
|
|
||||||
import com.aurora.gplayapi.data.models.details.Badge
|
import com.aurora.gplayapi.data.models.details.Badge
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.databinding.ViewBadgeBinding
|
import com.aurora.store.databinding.ViewBadgeBinding
|
||||||
@@ -77,13 +75,4 @@ class BadgeView : RelativeLayout {
|
|||||||
B.img.load(it.url)
|
B.img.load(it.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallbackProp
|
|
||||||
fun click(onClickListener: OnClickListener?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnViewRecycled
|
|
||||||
fun clear() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ import android.util.AttributeSet
|
|||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
import coil.load
|
import coil.load
|
||||||
import com.airbnb.epoxy.CallbackProp
|
|
||||||
import com.airbnb.epoxy.ModelProp
|
import com.airbnb.epoxy.ModelProp
|
||||||
import com.airbnb.epoxy.ModelView
|
import com.airbnb.epoxy.ModelView
|
||||||
import com.airbnb.epoxy.OnViewRecycled
|
|
||||||
import com.aurora.gplayapi.data.models.details.Badge
|
import com.aurora.gplayapi.data.models.details.Badge
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.databinding.ViewMoreBadgeBinding
|
import com.aurora.store.databinding.ViewMoreBadgeBinding
|
||||||
@@ -86,13 +84,4 @@ class MoreBadgeView : RelativeLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallbackProp
|
|
||||||
fun click(onClickListener: OnClickListener?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnViewRecycled
|
|
||||||
fun clear() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class AccentFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateAccent(accentId: Int) {
|
private fun updateAccent(accentId: Int) {
|
||||||
applyTheme(themeId, false)
|
applyTheme(themeId)
|
||||||
save(PREFERENCE_THEME_ACCENT, accentId)
|
save(PREFERENCE_THEME_ACCENT, accentId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class ThemeFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun update(themeId: Int) {
|
private fun update(themeId: Int) {
|
||||||
applyTheme(themeId, false)
|
applyTheme(themeId)
|
||||||
save(PREFERENCE_THEME_TYPE, themeId)
|
save(PREFERENCE_THEME_TYPE, themeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class UIPreference : PreferenceFragmentCompat() {
|
|||||||
val themeId = Integer.parseInt(newValue.toString())
|
val themeId = Integer.parseInt(newValue.toString())
|
||||||
|
|
||||||
save(Preferences.PREFERENCE_THEME_TYPE, themeId)
|
save(Preferences.PREFERENCE_THEME_TYPE, themeId)
|
||||||
applyTheme(themeId, shouldApplyTransition = false)
|
applyTheme(themeId)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ class UIPreference : PreferenceFragmentCompat() {
|
|||||||
val accentId = Integer.parseInt(newValue.toString())
|
val accentId = Integer.parseInt(newValue.toString())
|
||||||
|
|
||||||
save(Preferences.PREFERENCE_THEME_ACCENT, accentId)
|
save(Preferences.PREFERENCE_THEME_ACCENT, accentId)
|
||||||
applyTheme(themeId, shouldApplyTransition = false)
|
applyTheme(themeId)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user