Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ android {

buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -44,6 +45,11 @@ android {
compose = true
buildConfig = true
}
packaging {
jniLibs {
useLegacyPackaging = true
}
}
}

dependencies {
Expand Down
19 changes: 18 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,21 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# Gson rules
-keep class com.google.gson.** { *; }
-keepattributes Signature
-keepattributes *Annotation*

# Shizuku rules
-keep class rikka.shizuku.** { *; }
-keep class dev.rikka.shizuku.** { *; }

# Kotlin Reflect
-keep class kotlin.reflect.** { *; }
-keep class com.sameerasw.essentials.domain.model.** { *; }

# Prevent over-minification of settings and registry classes
-keep class com.sameerasw.essentials.data.repository.** { *; }
-keep class com.sameerasw.essentials.domain.registry.** { *; }
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@
android:label="@string/tab_app_updates_title"
android:theme="@style/Theme.Essentials">
</activity>
<activity
android:name=".ui.activities.ColorPickerActivity"
android:exported="false"
android:excludeFromRecents="true"
android:noHistory="true"
android:launchMode="singleInstance"
android:taskAffinity=""
android:theme="@style/Theme.Essentials.Translucent">
</activity>

<activity
android:name=".ui.activities.LocationAlarmActivity"
Expand Down
177 changes: 133 additions & 44 deletions app/src/main/java/com/sameerasw/essentials/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ import com.sameerasw.essentials.ui.components.sheets.AddRepoBottomSheet
import com.sameerasw.essentials.ui.components.sheets.GitHubAuthSheet
import com.sameerasw.essentials.ui.components.sheets.InstructionsBottomSheet
import com.sameerasw.essentials.ui.components.sheets.UpdateBottomSheet
import com.sameerasw.essentials.ui.components.menus.SegmentedDropdownMenu
import com.sameerasw.essentials.ui.components.menus.SegmentedDropdownMenuItem
import com.sameerasw.essentials.ui.composables.DIYScreen
import com.sameerasw.essentials.ui.composables.FreezeGridUI
import com.sameerasw.essentials.ui.composables.SetupFeatures
Expand Down Expand Up @@ -233,6 +235,7 @@ class MainActivity : FragmentActivity() {
val updateInfo by viewModel.updateInfo

var showGitHubAuthSheet by remember { mutableStateOf(false) }
var showNewAutomationSheet by remember { mutableStateOf(false) }
val gitHubToken by viewModel.gitHubToken
val gitHubUser by gitHubAuthViewModel.currentUser

Expand Down Expand Up @@ -426,8 +429,8 @@ class MainActivity : FragmentActivity() {
subtitle = currentTab.subtitle,
hasBack = false,
hasSearch = true,
hasSettings = true,
hasHelp = currentTab != DIYTabs.APPS,
hasSettings = currentTab == DIYTabs.ESSENTIALS || currentTab == DIYTabs.FREEZE,
hasHelp = currentTab == DIYTabs.ESSENTIALS,
helpIconRes = R.drawable.rounded_help_24,
helpContentDescription = R.string.action_help_guide,
onSearchClick = { searchRequested = true },
Expand All @@ -453,32 +456,136 @@ class MainActivity : FragmentActivity() {
showInstructionsSheet = true
},
actions = {
if (currentTab == DIYTabs.APPS) {
IconButton(
onClick = {
HapticUtil.performVirtualKeyHaptic(view)
updatesViewModel.checkForUpdates(context)
},
enabled = refreshingRepoIds.isEmpty(),
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceBright
),
modifier = Modifier.size(40.dp)
) {
if (refreshingRepoIds.isNotEmpty()) {
CircularWavyProgressIndicator(
progress = { animatedProgress },
modifier = Modifier.size(24.dp)
when (currentTab) {
DIYTabs.FREEZE -> {
var showFreezeMenu by remember { mutableStateOf(false) }
Box {
IconButton(
onClick = {
HapticUtil.performVirtualKeyHaptic(view)
showFreezeMenu = true
},
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceBright
)
) {
Icon(
painter = painterResource(id = R.drawable.rounded_mode_cool_24),
contentDescription = stringResource(R.string.tab_freeze)
)
}

SegmentedDropdownMenu(
expanded = showFreezeMenu,
onDismissRequest = { showFreezeMenu = false }
) {
SegmentedDropdownMenuItem(
text = { Text(stringResource(R.string.action_freeze_all)) },
onClick = {
showFreezeMenu = false
viewModel.freezeAllApps(context)
},
leadingIcon = {
Icon(
painter = painterResource(id = R.drawable.rounded_mode_cool_24),
contentDescription = null
)
}
)
SegmentedDropdownMenuItem(
text = { Text(stringResource(R.string.action_unfreeze_all)) },
onClick = {
showFreezeMenu = false
viewModel.unfreezeAllApps(context)
},
leadingIcon = {
Icon(
painter = painterResource(id = R.drawable.rounded_mode_cool_off_24),
contentDescription = null
)
}
)
SegmentedDropdownMenuItem(
text = { Text("Freeze Automatic") },
onClick = {
showFreezeMenu = false
viewModel.freezeAutomaticApps(context)
},
leadingIcon = {
Icon(
painter = painterResource(id = R.drawable.rounded_nest_farsight_cool_24),
contentDescription = null
)
}
)
}
}
Spacer(modifier = Modifier.width(8.dp))
}

DIYTabs.DIY -> {
IconButton(
onClick = {
HapticUtil.performVirtualKeyHaptic(view)
showNewAutomationSheet = true
},
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceBright
)
} else {
) {
Icon(
painter = painterResource(id = R.drawable.rounded_add_24),
contentDescription = stringResource(R.string.diy_editor_new_title)
)
}
Spacer(modifier = Modifier.width(8.dp))
}

DIYTabs.APPS -> {
IconButton(
onClick = {
HapticUtil.performVirtualKeyHaptic(view)
showAddRepoSheet = true
},
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceBright
)
) {
Icon(
painter = painterResource(id = R.drawable.rounded_refresh_24),
contentDescription = stringResource(R.string.action_refresh),
modifier = Modifier.size(24.dp)
painter = painterResource(id = R.drawable.rounded_add_24),
contentDescription = stringResource(R.string.action_add_repo)
)
}
Spacer(modifier = Modifier.width(8.dp))

IconButton(
onClick = {
HapticUtil.performVirtualKeyHaptic(view)
updatesViewModel.checkForUpdates(context)
},
enabled = refreshingRepoIds.isEmpty(),
colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceBright
),
modifier = Modifier.size(40.dp)
) {
if (refreshingRepoIds.isNotEmpty()) {
CircularWavyProgressIndicator(
progress = { animatedProgress },
modifier = Modifier.size(24.dp)
)
} else {
Icon(
painter = painterResource(id = R.drawable.rounded_refresh_24),
contentDescription = stringResource(R.string.action_refresh),
modifier = Modifier.size(24.dp)
)
}
}
Spacer(modifier = Modifier.width(8.dp))
}
Spacer(modifier = Modifier.width(8.dp))

else -> {}
}
},
hasUpdateAvailable = isUpdateAvailable,
Expand Down Expand Up @@ -545,7 +652,9 @@ class MainActivity : FragmentActivity() {

DIYTabs.DIY -> {
DIYScreen(
modifier = Modifier.padding(innerPadding)
modifier = Modifier.padding(innerPadding),
showNewAutomationSheet = showNewAutomationSheet,
onDismissNewAutomationSheet = { showNewAutomationSheet = false }
)
}

Expand Down Expand Up @@ -816,29 +925,9 @@ class MainActivity : FragmentActivity() {
}
}

// FAB
FloatingActionButton(
onClick = {
HapticUtil.performMediumHaptic(view)
showAddRepoSheet = true
},
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(
bottom = 150.dp,
end = 32.dp
),
containerColor = MaterialTheme.colorScheme.primaryContainer,
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
) {
Icon(
painter = painterResource(id = R.drawable.rounded_add_24),
contentDescription = stringResource(R.string.action_add_repo)
)
}
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ColorPickerTileService : BaseTileService() {
override fun getTileState(): Int = Tile.STATE_INACTIVE

override fun onTileClick() {
val intent = Intent(Intent.ACTION_MAIN).apply {
component = ComponentName("com.android.eyedropper", "com.android.eyedropper.MainActivity")
val intent = Intent(this, com.sameerasw.essentials.ui.activities.ColorPickerActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}

Expand Down
Loading