Skip to content

Commit

Permalink
Update dependencies. Cleanup code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jahirfiquitiva committed Dec 5, 2021
1 parent 092e6f2 commit 3708e8a
Show file tree
Hide file tree
Showing 23 changed files with 179 additions and 53 deletions.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

<activity
android:name=".MainActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="true">

<!-- TODO: Do NOT remove the intent-filter tags -->
<intent-filter>
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/kotlin/dev/jahir/blueprint/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ class MainActivity : BottomNavigationBlueprintActivity() {

override fun defaultTheme(): Int = R.style.MyApp_Default
override fun amoledTheme(): Int = R.style.MyApp_Default_Amoled
}

override fun defaultMaterialYouTheme(): Int = R.style.MyApp_Default_MaterialYou
override fun amoledMaterialYouTheme(): Int = R.style.MyApp_Default_Amoled_MaterialYou
}
50 changes: 50 additions & 0 deletions app/src/main/res/values-v31/m3_colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Light Theme Colors -->
<color name="m3_primary">@android:color/system_neutral1_10</color>
<color name="m3_primaryDark">@android:color/system_neutral1_10</color>
<color name="m3_onPrimary">@android:color/system_neutral1_900</color>

<color name="m3_accent">@android:color/system_accent1_500</color>
<color name="m3_onAccent">@android:color/system_accent1_0</color>

<color name="m3_surface">@android:color/system_neutral2_50</color>
<color name="m3_onSurface">@android:color/system_neutral2_900</color>
<color name="m3_onSurfaceVariant">@android:color/system_neutral2_700</color>

<color name="m3_background">@android:color/system_neutral1_10</color>
<color name="m3_onBackground">@android:color/system_neutral1_900</color>

<color name="m3_snackbarBackgroundColor">@android:color/system_neutral2_800</color>
<color name="m3_snackbarTextColor">@android:color/system_neutral2_50</color>
<color name="m3_snackbarButtonColor">@android:color/system_accent1_200</color>

<color name="m3_bottomNavActiveIndicator">@android:color/system_neutral2_100</color>

<!-- Dark Theme Colors -->
<color name="m3_darkThemePrimary">@android:color/system_neutral1_900</color>
<color name="m3_darkThemePrimaryDark">@android:color/system_neutral1_900</color>
<color name="m3_darkThemeOnPrimary">@android:color/system_neutral1_100</color>

<color name="m3_darkThemeAccent">@android:color/system_accent1_200</color>
<color name="m3_darkThemeOnAccent">@android:color/system_accent1_800</color>

<color name="m3_darkThemeSurface">@android:color/system_neutral2_800</color>
<color name="m3_darkThemeOnSurface">@android:color/system_neutral2_50</color>
<color name="m3_darkThemeOnSurfaceVariant">@android:color/system_neutral2_100</color>

<color name="m3_darkThemeBackground">@android:color/system_neutral1_900</color>
<color name="m3_darkThemeOnBackground">@android:color/system_neutral1_100</color>

<color name="m3_darkThemeSnackbarBackgroundColor">@android:color/system_neutral2_50</color>
<color name="m3_darkThemeSnackbarTextColor">@android:color/system_neutral2_900</color>
<color name="m3_darkThemeSnackbarButtonColor">@android:color/system_accent1_500</color>

<color name="m3_darkThemeBottomNavActiveIndicator">@android:color/system_neutral2_700</color>

<!-- Amoled Theme Colors -->
<color name="m3_amoledThemeAccent">@android:color/system_accent1_200</color>
<color name="m3_amoledThemeSnackbarButtonColor">@android:color/system_accent1_500</color>

<color name="m3_amoledThemeBottomNavActiveIndicator">@color/m3_darkThemeBottomNavActiveIndicator</color>
</resources>
29 changes: 29 additions & 0 deletions app/src/main/res/values/m3_shape_styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Learn more about Shape Theming and what you can do at:
https://material.io/develop/android/theming/shape/
Important: do NOT change the style names, just the attributes/properties
-->

<style name="ShapeAppearance.Frames.SmallComponent.MaterialYou" parent="ShapeAppearance.Material3.SmallComponent">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/small_components_corner_size</item>
</style>

<style name="ShapeAppearance.Frames.MediumComponent.MaterialYou" parent="ShapeAppearance.Material3.MediumComponent">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/medium_components_corner_size</item>
</style>

<style name="ShapeAppearance.Frames.LargeComponent.MaterialYou" parent="ShapeAppearance.Material3.LargeComponent">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/large_components_corner_size</item>
</style>

<style name="ShapeAppearance.Frames.CardView.MaterialYou" parent="ShapeAppearance.Frames.MediumComponent.MaterialYou">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/cards_corner_size</item>
</style>

</resources>
32 changes: 32 additions & 0 deletions app/src/main/res/values/m3_styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- Don't change the parent style -->
<style name="MyApp.Default.MaterialYou" parent="Frames.Default.MaterialYou">
<item name="bottomNavigationStyle">@style/MyApp.BottomNavigationView.MaterialYou</item>
<item name="customFontBold">@font/manrope_bold_fam</item>
<item name="customFontNormal">@font/manrope_normal_fam</item>
</style>

<!-- Don't change the parent style -->
<style name="MyApp.Default.Amoled.MaterialYou" parent="Frames.Default.Amoled.MaterialYou">
<item name="bottomNavigationStyle">@style/MyApp.BottomNavigationView.MaterialYou</item>
<item name="customFontBold">@font/manrope_bold_fam</item>
<item name="customFontNormal">@font/manrope_normal_fam</item>
</style>

<!-- Don't change the parent style -->
<style name="MyApp.BottomNavigationView.MaterialYou" parent="Widget.Frames.BottomNavigationView.MaterialYou">
<!--
Switch bottom navigation labels visibility style
You can use any of there:
- auto
- labeled
- unlabeled
- selected
Learn more: https://developer.android.com/reference/com/google/android/material/bottomnavigation/LabelVisibilityMode
-->
<item name="labelVisibilityMode">auto</item>
</style>

</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
You can change the parent to any of these:
- Frames.SplashScreen
- Frames.SplashScreen.Amoled
- Frames.SplashScreen.MaterialYou
- Frames.SplashScreen.Amoled.MaterialYou
-->
<style name="MyApp.SplashScreen" parent="Frames.SplashScreen">
<item name="customFontBold">@font/manrope_bold_fam</item>
Expand Down Expand Up @@ -45,4 +47,4 @@
<item name="labelVisibilityMode">labeled</item>
</style>

</resources>
</resources>
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Blueprint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

object Blueprint {
const val appId = "dev.jahir.blueprint.app"
const val version = 224
const val versionName = "2.2.4"
const val version = 225
const val versionName = "2.2.5"
}
12 changes: 6 additions & 6 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

object Versions {
// Plugins
const val gradle = "7.0.0"
const val kotlin = "1.5.21"
const val gradle = "7.0.3"
const val kotlin = "1.5.31"
const val sonatype = "1.1.0"

// OneSignal
const val oneSignalPlugin = "0.13.4"
const val oneSignal = "4.4.2"
const val oneSignalPlugin = "0.14.0"
const val oneSignal = "4.6.3"

// App
const val minSdk = 21
const val targetSdk = 30
const val targetSdk = 31
const val buildTools = "30.0.2"

// Kuper
const val kuper = "2.3.4"
const val kuper = "2.3.5"

// Adaptive Icons
const val adaptiveIcons = "1.0.0"
Expand Down
7 changes: 5 additions & 2 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

<activity
android:name="dev.jahir.kuper.ui.activities.KuperActivity"
android:exported="false" />
android:exported="false"
tools:replace="android:exported" />

<activity
android:name="dev.jahir.kuper.ui.activities.KuperSettingsActivity"
android:exported="false" />
android:exported="false"
tools:replace="android:exported" />

<activity
android:name=".ui.activities.BlueprintKuperActivity"
Expand All @@ -39,6 +41,7 @@

<activity
android:name=".ui.activities.BlueprintSettingsActivity"
android:exported="true"
android:label="@string/settings">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.jahir.blueprint.data.models

import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize

@Parcelize
data class ArcticResponse(val status: String? = null, val error: String? = null) : Parcelable
data class ArcticResponse(val status: String? = null, val error: String? = null) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Parcelable
import dev.jahir.blueprint.extensions.getAppIcon
import kotlinx.android.parcel.IgnoredOnParcel
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize

@Parcelize
data class RequestApp(val name: String, val packageName: String, val component: String) :
Expand All @@ -19,4 +19,4 @@ data class RequestApp(val name: String, val packageName: String, val component:
if (icon != null) return
icon = context.getAppIcon(packageName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ object SendIconRequest {
)

try {
val saved = iconFile?.saveIcon(app.icon?.toBitmap()) == true
if (saved) iconFile?.let { emailZipFiles.add(it) }
val saved = iconFile.saveIcon(app.icon?.toBitmap())
if (saved) iconFile.let { emailZipFiles.add(it) }

val count =
(iconsNames.find { it.first.equals(iconName, true) }?.second ?: 0) + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ internal fun Context.getThemeAttributeDimensionSize(@AttrRes attr: Int): Int {
var a: TypedArray? = null
try {
a = theme.obtainStyledAttributes(intArrayOf(attr))
return a?.getDimensionPixelSize(0, 0) ?: 0
return a.getDimensionPixelSize(0, 0)
} finally {
a?.recycle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ internal class EmailBuilder(
context.packageManager.getInstallerPackageName(context.packageName) ?: "None"

val deviceItems = mutableMapOf(
"OS Version" to "${System.getProperty(
"os.version"
)} (${Build.VERSION.INCREMENTAL})",
"OS Version" to "${
System.getProperty(
"os.version"
)
} (${Build.VERSION.INCREMENTAL})",
"OS API Level" to Build.VERSION.SDK_INT,
"Device (Manufacturer)" to "${Build.DEVICE} (${Build.MANUFACTURER})",
"Model (Product)" to "${Build.MODEL} (${Build.PRODUCT})",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment
import com.fondesa.kpermissions.PermissionStatus
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import com.google.android.material.snackbar.Snackbar
import dev.jahir.blueprint.BuildConfig
import dev.jahir.blueprint.R
import dev.jahir.blueprint.data.BlueprintPreferences
Expand Down Expand Up @@ -57,13 +56,11 @@ import dev.jahir.frames.extensions.utils.lazyViewModel
import dev.jahir.frames.extensions.utils.postDelayed
import dev.jahir.frames.extensions.views.isVisible
import dev.jahir.frames.extensions.views.setMarginBottom
import dev.jahir.frames.extensions.views.snackbar
import dev.jahir.frames.ui.activities.FramesActivity
import dev.jahir.frames.ui.fragments.CollectionsFragment
import dev.jahir.frames.ui.fragments.WallpapersFragment
import dev.jahir.kuper.data.models.Component
import dev.jahir.kuper.data.viewmodels.ComponentsViewModel
import dev.jahir.kuper.extensions.hasStoragePermission
import dev.jahir.kuper.ui.fragments.KuperWallpapersFragment
import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -177,11 +174,11 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback {
else super.onBackPressed()
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val created = super.onCreateOptionsMenu(menu)
menu?.findItem(R.id.templates)?.isVisible = templatesViewModel.components.isNotEmpty()
menu?.findItem(R.id.select_all)?.isVisible = currentItemId == R.id.request
menu?.findItem(R.id.icons_shape)?.isVisible =
menu.findItem(R.id.templates)?.isVisible = templatesViewModel.components.isNotEmpty()
menu.findItem(R.id.select_all)?.isVisible = currentItemId == R.id.request
menu.findItem(R.id.icons_shape)?.isVisible =
currentItemId == R.id.icons && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& boolean(R.bool.includes_adaptive_icons)
return created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class IconsCategoryActivity : BaseSearchableActivity<Preferences>() {
iconDialog?.show(this)
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val created = super.onCreateOptionsMenu(menu)
menu?.findItem(R.id.icons_shape)?.isVisible =
menu.findItem(R.id.icons_shape)?.isVisible =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && boolean(R.bool.includes_adaptive_icons)
return created
}
Expand Down Expand Up @@ -179,4 +179,4 @@ class IconsCategoryActivity : BaseSearchableActivity<Preferences>() {
internal const val CATEGORY_KEY = "category"
internal const val PICKER_KEY = "picker_key"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.jahir.blueprint.ui.adapters

import android.annotation.SuppressLint
import android.graphics.drawable.Drawable
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -14,9 +15,10 @@ class IconsCategoriesAdapter(
private val onIconClick: ((Icon, Drawable?) -> Unit)? = null
) : RecyclerView.Adapter<IconsCategoryPreviewViewHolder>() {

var categories: ArrayList<IconsCategory> = ArrayList()
var categories: List<IconsCategory> = listOf()
@SuppressLint("NotifyDataSetChanged")
set(value) {
field = ArrayList(value.filter { it.hasIcons() })
field = value.filter { it.hasIcons() }
notifyDataSetChanged()
}

Expand All @@ -30,4 +32,4 @@ class IconsCategoriesAdapter(
holder.bind(categories[position], position > 0, onOpenCategory, onIconClick)

override fun getItemCount(): Int = categories.size
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.jahir.blueprint.ui.adapters

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.ColorFilter
import android.view.ViewGroup
Expand All @@ -17,10 +18,10 @@ class LaunchersAdapter(

private val colorFilter: ColorFilter = bnwFilter

var launchers: ArrayList<Pair<Launcher, Boolean>> = Launcher.getSupportedLaunchers(context)
var launchers: List<Pair<Launcher, Boolean>> = Launcher.getSupportedLaunchers(context)
@SuppressLint("NotifyDataSetChanged")
set(value) {
field.clear()
field.addAll(value)
field = value
notifyDataSetChanged()
}

Expand All @@ -32,4 +33,4 @@ class LaunchersAdapter(
override fun onBindViewHolder(holder: LauncherViewHolder, position: Int) {
holder.bind(launchers[position], colorFilter, onClick)
}
}
}
Loading

0 comments on commit 3708e8a

Please sign in to comment.