Skip to content

Commit

Permalink
Merge pull request #128 from Mahmud0808/master
Browse files Browse the repository at this point in the history
Merge master into fdroid
  • Loading branch information
Mahmud0808 authored Sep 20, 2024
2 parents 26993d5 + 440e4e9 commit 6112931
Show file tree
Hide file tree
Showing 69 changed files with 1,768 additions and 557 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ local.properties
/app/debug/
/app/release/
/*.hprof
/.idea/deploymentTargetDropDown.xml
/.idea/*
/.kotlin/sessions/*.salive
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ android {

defaultConfig {
minSdk = 31
targetSdk = 34
versionCode = 15
versionName = "v1.7"
targetSdk = 35
versionCode = 16
versionName = "v1.8"
}

buildTypes {
Expand Down Expand Up @@ -98,5 +98,6 @@ dependencies {
implementation(libs.recyclerview)
implementation(libs.recyclerview.selection)
implementation(libs.blurView)
implementation(libs.lifecycle.common.jvm)
annotationProcessor(libs.glide.compiler)
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

<queries>
<intent>
Expand Down Expand Up @@ -57,6 +58,7 @@
</activity>
<activity
android:name=".ui.activities.MainActivity"
android:configChanges="orientation|uiMode"
android:exported="true" />

<receiver
Expand Down
29 changes: 25 additions & 4 deletions app/src/main/java/com/drdisagree/colorblendr/common/Const.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.drdisagree.colorblendr.common

import com.drdisagree.colorblendr.BuildConfig
import com.drdisagree.colorblendr.config.RPrefs
import com.drdisagree.colorblendr.utils.SystemUtil
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.util.concurrent.atomic.AtomicInteger
Expand All @@ -19,13 +20,33 @@ object Const {
const val FIRST_RUN: String = "firstRun"
const val THEMING_ENABLED: String = "themingEnabled"
const val MONET_STYLE: String = "customMonetStyle"
const val MONET_ACCENT_SATURATION: String = "monetAccentSaturationValue"
const val MONET_BACKGROUND_SATURATION: String = "monetBackgroundSaturationValue"
const val MONET_BACKGROUND_LIGHTNESS: String = "monetBackgroundLightnessValue"
const val MODE_SPECIFIC_THEMES: String = "modeSpecificThemes"
private val modeSpecificThemes: Boolean
get() = RPrefs.getBoolean(MODE_SPECIFIC_THEMES, false)
val MONET_ACCENT_SATURATION: String
get() = if (!modeSpecificThemes) {
"monetAccentSaturationValue"
} else {
if (SystemUtil.isDarkMode) "monetAccentSaturationValue" else "monetAccentSaturationValueLight"
}
val MONET_BACKGROUND_SATURATION: String
get() = if (!modeSpecificThemes) {
"monetBackgroundSaturationValue"
} else {
if (SystemUtil.isDarkMode) "monetBackgroundSaturationValue" else "monetBackgroundSaturationValueLight"
}
val MONET_BACKGROUND_LIGHTNESS: String
get() = if (!modeSpecificThemes) {
"monetBackgroundLightnessValue"
} else {
if (SystemUtil.isDarkMode) "monetBackgroundLightnessValue" else "monetBackgroundLightnessValueLight"
}
const val MONET_ACCURATE_SHADES: String = "monetAccurateShades"
const val MONET_PITCH_BLACK_THEME: String = "monetPitchBlackTheme"
const val MONET_SEED_COLOR: String = "monetSeedColor"
const val MONET_SEED_COLOR_ENABLED: String = "monetSeedColorEnabled"
const val MONET_SEED_COLOR: String = "monetSeedColor"
const val MONET_SECONDARY_COLOR: String = "monetSecondaryColor"
const val MONET_TERTIARY_COLOR: String = "monetTertiaryColor"
const val MANUAL_OVERRIDE_COLORS: String = "manualOverrideColors"
const val MONET_LAST_UPDATED: String = "monetLastUpdated"
const val MONET_STYLE_ORIGINAL_NAME: String = "monetStyleOriginalName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ class MainActivity : AppCompatActivity() {

if (savedInstanceState == null) {
if (getBoolean(FIRST_RUN, true) || workingMethod == Const.WorkMethod.NULL ||
!intent.getBooleanExtra("success", false)
intent?.getBooleanExtra("success", false) == false
) {
replaceFragment(OnboardingFragment(), false)
} else {
replaceFragment(HomeFragment(), false)
replaceFragment(
HomeFragment().apply {
arguments = Bundle().apply {
putBoolean("success", true)
}
},
false
)
}
}
}
Expand Down Expand Up @@ -89,9 +96,23 @@ class MainActivity : AppCompatActivity() {

override fun onResume() {
super.onResume()
scheduleJob(applicationContext)

if (intent?.getBooleanExtra("success", false) == true) {
scheduleJob(applicationContext)
}
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)

if (newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES ||
newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_NO
) {
recreate()
}
}


companion object {
private lateinit var myFragmentManager: FragmentManager

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class SplashActivity : AppCompatActivity() {
countDownLatch.countDown()
}
} else {
success.set(false)
keepShowing = false
countDownLatch.countDown()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,68 @@ class AboutFragment : Fragment() {
)

binding.btnNews.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://t.me/IconifyOfficial")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://t.me/IconifyOfficial")
)
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

binding.btnSupport.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://t.me/IconifyDiscussion")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://t.me/IconifyDiscussion")
)
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

binding.btnGithub.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https:/Mahmud0808/ColorBlendr")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https:/Mahmud0808/ColorBlendr")
)
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

binding.developer.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https:/Mahmud0808")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https:/Mahmud0808")
)
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

binding.buymeacoffee.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://buymeacoffee.com/drdisagree")
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://buymeacoffee.com/drdisagree")
)
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

return binding.root
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.drdisagree.colorblendr.ui.fragments

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand All @@ -17,8 +16,8 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.drdisagree.colorblendr.R
import com.drdisagree.colorblendr.databinding.FragmentHomeBinding
import com.drdisagree.colorblendr.service.AutoStartService
import com.drdisagree.colorblendr.service.AutoStartService.Companion.isServiceNotRunning
import com.drdisagree.colorblendr.service.RestartBroadcastReceiver.Companion.scheduleJob
import com.drdisagree.colorblendr.utils.AppUtil
import com.drdisagree.colorblendr.utils.AppUtil.hasStoragePermission
import com.drdisagree.colorblendr.utils.AppUtil.openAppSettings
Expand Down Expand Up @@ -56,13 +55,10 @@ class HomeFragment : Fragment() {
Handler(Looper.getMainLooper()).postDelayed({
try {
if (permissionsGranted(requireContext())) {
if (isServiceNotRunning) {
requireContext().startForegroundService(
Intent(
requireContext(),
AutoStartService::class.java
)
)
if (isServiceNotRunning &&
arguments?.getBoolean("success", false) == true
) {
scheduleJob(requireContext())
}
} else {
requestPermissionsLauncher.launch(AppUtil.REQUIRED_PERMISSIONS)
Expand Down Expand Up @@ -170,13 +166,10 @@ class HomeFragment : Fragment() {
return
}

if (isServiceNotRunning) {
requireContext().startForegroundService(
Intent(
requireContext(),
AutoStartService::class.java
)
)
if (isServiceNotRunning &&
arguments?.getBoolean("success", false) == true
) {
scheduleJob(requireContext())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class OnboardingFragment : Fragment() {
adapter.addFragment(OnboardingItem1Fragment())
adapter.addFragment(OnboardingItem2Fragment())
adapter.addFragment(OnboardingItem3Fragment())
adapter.addFragment(OnboardingItem4Fragment())

binding.viewPager.adapter = adapter
binding.viewPager.offscreenPageLimit = adapter.itemCount
Expand Down Expand Up @@ -153,7 +154,14 @@ class OnboardingFragment : Fragment() {
updateFabricatedAppList(requireContext())
putBoolean(FIRST_RUN, false)
saveWorkingMethod(Const.WORKING_METHOD)
MainActivity.replaceFragment(HomeFragment(), true)
MainActivity.replaceFragment(
HomeFragment().apply {
arguments = Bundle().apply {
putBoolean("success", true)
}
},
true
)
} catch (_: Exception) {
}
}
Expand Down
Loading

0 comments on commit 6112931

Please sign in to comment.