ready check
This commit is contained in:
15 files changed
+137
-145
No files matched your search
@@ -1,24 +0,0 @@
|
||||
package net.rodakot.remaining
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("net.rodakot.remaining", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,6 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Remaining.Starting"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
|
||||
@@ -14,7 +14,6 @@ import kotlin.math.absoluteValue
|
||||
|
||||
class NotificationHelper(private val context: Context) {
|
||||
fun ensureChannel() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
val channel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"Account alerts",
|
||||
@@ -37,8 +36,12 @@ class NotificationHelper(private val context: Context) {
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.build()
|
||||
|
||||
NotificationManagerCompat.from(context)
|
||||
.notify(accountId.hashCode().absoluteValue, notification)
|
||||
try {
|
||||
NotificationManagerCompat.from(context)
|
||||
.notify(accountId.hashCode().absoluteValue, notification)
|
||||
} catch (exception: SecurityException) {
|
||||
// Notification permission may be revoked between the check and notify().
|
||||
}
|
||||
}
|
||||
|
||||
private fun canPostNotifications(): Boolean {
|
||||
|
||||
@@ -259,7 +259,7 @@ fun QuotaRing(
|
||||
progress: Float?,
|
||||
label: String,
|
||||
value: String,
|
||||
modifier: Modifier = Modifier.size(156.dp),
|
||||
modifier: Modifier = Modifier,
|
||||
accent: Color = MaterialTheme.colorScheme.primary
|
||||
) {
|
||||
val trackColor = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||
|
||||
@@ -180,7 +180,12 @@ private fun EmptyDashboard(modifier: Modifier = Modifier, onAddAccount: () -> Un
|
||||
verticalArrangement = Arrangement.spacedBy(18.dp),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
QuotaRing(progress = null, label = "dashboard", value = "Ready")
|
||||
QuotaRing(
|
||||
progress = null,
|
||||
label = "dashboard",
|
||||
value = "Ready",
|
||||
modifier = Modifier.size(156.dp)
|
||||
)
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(
|
||||
"Your usage command center",
|
||||
|
||||
@@ -60,8 +60,7 @@ fun WidgetGalleryScreen(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val canPin = remember {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
AppWidgetManager.getInstance(context).isRequestPinAppWidgetSupported
|
||||
AppWidgetManager.getInstance(context).isRequestPinAppWidgetSupported
|
||||
}
|
||||
|
||||
RemainingBackground {
|
||||
@@ -118,17 +117,15 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountChartTileWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountChartTileWidgetProvider::class.java.name,
|
||||
ACCOUNT_CHART_TILE_CONFIGURE_REQUEST
|
||||
)
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountChartTileWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountChartTileWidgetProvider::class.java.name,
|
||||
ACCOUNT_CHART_TILE_CONFIGURE_REQUEST
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -137,17 +134,15 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountSpotlightWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountSpotlightWidgetProvider::class.java.name,
|
||||
ACCOUNT_SPOTLIGHT_CONFIGURE_REQUEST
|
||||
)
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountSpotlightWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountSpotlightWidgetProvider::class.java.name,
|
||||
ACCOUNT_SPOTLIGHT_CONFIGURE_REQUEST
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -157,13 +152,11 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
type.componentName(context),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
type.componentName(context),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,4 @@
|
||||
<resources>
|
||||
<color name="remaining_splash_background">#0D1117</color>
|
||||
<color name="remaining_splash_icon_background">#151B23</color>
|
||||
<color name="remaining_primary">#8FD8FF</color>
|
||||
<color name="remaining_success">#3DDC84</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -1,13 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
<exclude domain="root" path="." />
|
||||
</full-backup-content>
|
||||
@@ -1,19 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
<exclude domain="root" path="." />
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
<exclude domain="root" path="." />
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
</data-extraction-rules>
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.rodakot.remaining
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user