Initial commit
15
.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
1
.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
My Application
|
||||
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
||||
19
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
39
app/build.gradle
Normal file
@@ -0,0 +1,39 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.aldo.apps.familyhelpers'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.aldo.apps.familyhelpers"
|
||||
minSdk 32
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.aldo.apps.familyhelpers;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.aldo.apps.familyhelpers", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
44
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyApplication"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".HelperGridActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name=".workers.SleepTimerHelper" android:foregroundServiceType="specialUse"/>
|
||||
|
||||
<receiver android:name="com.aldo.apps.familyhelpers.DoerflingerHelpersDeviceAdminReceiver"
|
||||
android:permission="android.permission.BIND_DEVICE_ADMIN"
|
||||
android:exported="true">
|
||||
<meta-data
|
||||
android:name="android.app.device_admin"
|
||||
android:resource="@xml/device_admin" />
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_DISABLED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.aldo.apps.familyhelpers;
|
||||
|
||||
import android.app.admin.DeviceAdminReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class DoerflingerHelpersDeviceAdminReceiver extends DeviceAdminReceiver {
|
||||
@Override
|
||||
public void onEnabled(final Context context,final Intent intent) {
|
||||
// Called when the app is enabled as a device administrator.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled(final Context context, final Intent intent) {
|
||||
// Called when the app is disabled as a device administrator.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.aldo.apps.familyhelpers;
|
||||
|
||||
import static android.Manifest.permission.POST_NOTIFICATIONS;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aldo.apps.familyhelpers.ui.HelperGroupTile;
|
||||
import com.aldo.apps.familyhelpers.ui.SleepTimerPopup;
|
||||
import com.aldo.apps.familyhelpers.utils.DevicePolicyManagerHelper;
|
||||
|
||||
/**
|
||||
* The Activity showing the Grid of helpers to select from.
|
||||
*/
|
||||
public class HelperGridActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* Tag for debugging purpose.
|
||||
*/
|
||||
private static final String TAG = "HelperGridActivity";
|
||||
|
||||
/**
|
||||
* {@link HelperGroupTile} holding the option for a sleep timer.
|
||||
*/
|
||||
private HelperGroupTile mSleepTimerTile;
|
||||
|
||||
/**
|
||||
* Instance of the {@link DevicePolicyManagerHelper} to roll out device specific actions.
|
||||
*/
|
||||
private DevicePolicyManagerHelper mDevicePolicyHelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
mDevicePolicyHelper = DevicePolicyManagerHelper.getInstance(this);
|
||||
initSleepTimer();
|
||||
} /**
|
||||
* The {@link ActivityResultLauncher} to ask for the NotificationPermission.
|
||||
*/
|
||||
private final ActivityResultLauncher<String> mRequestPermissionLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> {
|
||||
if (isGranted) {
|
||||
// Permission granted, you can post notifications
|
||||
mSleepTimerTile.launchHelper();
|
||||
} else {
|
||||
// Permission denied, handle accordingly
|
||||
Toast.makeText(HelperGridActivity.this, R.string.sleep_timer_show_notifications_rationale,
|
||||
Toast.LENGTH_LONG).show();
|
||||
requestNotificationPermission();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper method to initialize the sleepTimer tile.
|
||||
*/
|
||||
private void initSleepTimer() {
|
||||
mSleepTimerTile = new HelperGroupTile(findViewById(R.id.tile_sleep_timer)) {
|
||||
@Override
|
||||
public void launchHelper() {
|
||||
// First check if the notification permission is granted
|
||||
if (!requestNotificationPermission()) {
|
||||
Log.d(TAG, "launchHelper: Notifications not allowed, return...");
|
||||
return;
|
||||
}
|
||||
// Second check for the app to be registered as DeviceAdmin
|
||||
if (!mDevicePolicyHelper.isDeviceAdmin()) {
|
||||
Toast.makeText(HelperGridActivity.this, R.string.warning_no_device_admin,
|
||||
Toast.LENGTH_LONG).show();
|
||||
mDevicePolicyHelper.requestDeviceAdminPrivileges(HelperGridActivity.this,
|
||||
R.string.sleep_timer_rationale_device_admin);
|
||||
return;
|
||||
}
|
||||
// If both previous checks pass, launch the actual sleep timer dialog.
|
||||
final SleepTimerPopup sleepTimerPopup = new SleepTimerPopup(HelperGridActivity.this);
|
||||
sleepTimerPopup.showTimePicker();
|
||||
Log.d(TAG, "launchHelper: Clicked SleepTimer");
|
||||
}
|
||||
};
|
||||
mSleepTimerTile.setLogo(R.drawable.icn_sleep_timer);
|
||||
mSleepTimerTile.setTitle(R.string.title_sleep_timer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to request the NotificationPermission as it is required for the service to run.
|
||||
*
|
||||
* @return true if the permission is granted, false otherwise.
|
||||
*/
|
||||
private boolean requestNotificationPermission() {
|
||||
if (ContextCompat.checkSelfPermission(this, POST_NOTIFICATIONS) ==
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission already granted
|
||||
return true;
|
||||
} else {
|
||||
if (shouldShowRequestPermissionRationale(POST_NOTIFICATIONS)) {
|
||||
Toast.makeText(HelperGridActivity.this, R.string.sleep_timer_show_notifications_rationale,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
mRequestPermissionLauncher.launch(POST_NOTIFICATIONS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.aldo.apps.familyhelpers.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.aldo.apps.familyhelpers.R;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Helper class to avoid boiler plate code for inflating more and more helper tiles.
|
||||
* Abstracts the inflation of the logo and the title and offers a way to handle the click.
|
||||
*/
|
||||
public abstract class HelperGroupTile implements View.OnClickListener {
|
||||
|
||||
/**
|
||||
* Tag for debugging purpose.
|
||||
*/
|
||||
private static final String TAG = "HelperGroupTile";
|
||||
|
||||
/**
|
||||
* The Logo of the Helper group.
|
||||
*/
|
||||
private final ImageView mHelperLogo;
|
||||
|
||||
/**
|
||||
* The title of the Helper group.
|
||||
*/
|
||||
private final TextView mHelperTitle;
|
||||
|
||||
/**
|
||||
* The {@link WeakReference} of the {@link Context} from where this was instantiated.
|
||||
*/
|
||||
private WeakReference<Context> mContextRef;
|
||||
|
||||
/**
|
||||
* The name of the helper, mainly used for logging purpose.
|
||||
*/
|
||||
private String mHelperName;
|
||||
|
||||
/**
|
||||
* C'tor.
|
||||
*
|
||||
* @param rootLayout The previously inflated view of the root layout.
|
||||
*/
|
||||
public HelperGroupTile(final View rootLayout) {
|
||||
mContextRef = new WeakReference<>(rootLayout.getContext());
|
||||
mHelperLogo = rootLayout.findViewById(R.id.iv_helper_group_icon);
|
||||
mHelperTitle = rootLayout.findViewById(R.id.tv_helper_group_title);
|
||||
rootLayout.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be invoked when the tile is pressed.
|
||||
*/
|
||||
public abstract void launchHelper();
|
||||
|
||||
/**
|
||||
* Helper method to set the Name of the HelperGroup.
|
||||
*
|
||||
* @param titleId The {@link StringRes} id of the title to be shown.
|
||||
*/
|
||||
public void setTitle(@StringRes final int titleId) {
|
||||
final Context context = mContextRef.get();
|
||||
if (context == null) {
|
||||
Log.w(TAG, "setTitle: Null context provided, cannot continue");
|
||||
return;
|
||||
}
|
||||
mHelperName = context.getString(titleId);
|
||||
if (mHelperTitle != null) {
|
||||
mHelperTitle.setText(titleId);
|
||||
} else {
|
||||
Log.d(TAG, "setLogo: Cannot set Logo for [" + mHelperName + "]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the Name of the HelperGroup.
|
||||
*
|
||||
* @param groupTitle The String to be used as a title for the group.
|
||||
*/
|
||||
public void setTitleString(final String groupTitle) {
|
||||
mHelperName = groupTitle;
|
||||
if (mHelperTitle != null) {
|
||||
mHelperTitle.setText(groupTitle);
|
||||
} else {
|
||||
Log.d(TAG, "setLogo: Cannot set Logo for [" + mHelperName + "]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the Logo of the HelperGroup.
|
||||
*
|
||||
* @param logoId The {@link DrawableRes} id of the logo to be shown.
|
||||
*/
|
||||
public void setLogo(@DrawableRes final int logoId) {
|
||||
if (mHelperLogo != null) {
|
||||
mHelperLogo.setImageResource(logoId);
|
||||
} else {
|
||||
Log.d(TAG, "setLogo: Cannot set Logo for [" + mHelperName + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
Log.d(TAG, "onClick: Clicked on [" + mHelperName + "]");
|
||||
launchHelper();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.aldo.apps.familyhelpers.ui;
|
||||
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.SLEEP_TIMER_DURATION_MILLIS_EXTRA;
|
||||
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.aldo.apps.familyhelpers.workers.SleepTimerHelper;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Helper class for the Popup to select a time where you want to have the screen locked.
|
||||
*/
|
||||
public class SleepTimerPopup {
|
||||
|
||||
/**
|
||||
* Tag for debugging purpose.
|
||||
*/
|
||||
private static final String TAG = "SleepTimerPopup";
|
||||
|
||||
/**
|
||||
* {@link WeakReference} to the {@link Context} from where this was called.
|
||||
*/
|
||||
private final WeakReference<Context> mContextRef;
|
||||
|
||||
/**
|
||||
* C'tor.
|
||||
*
|
||||
* @param context The {@link Context} from where this was called.
|
||||
*/
|
||||
public SleepTimerPopup(final Context context) {
|
||||
mContextRef = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes and shows the time picker, pre-selected to the current time of the day.
|
||||
*/
|
||||
public void showTimePicker() {
|
||||
final Context context = mContextRef.get();
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
final int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
final int minute = calendar.get(Calendar.MINUTE);
|
||||
|
||||
final TimePickerDialog timePickerDialog
|
||||
= new TimePickerDialog(context, this::handleSelectedTime, hour, minute, true);
|
||||
timePickerDialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to handle the selected time from the widget. Will calculate the milliseconds until
|
||||
* the timer expires from now and start the actual {@link SleepTimerHelper}.
|
||||
*
|
||||
* @param view Added for convenience purpose, not really needed.
|
||||
* @param hour The selected hour.
|
||||
* @param minute The selected minute.
|
||||
*/
|
||||
private void handleSelectedTime(final TimePicker view, final int hour, final int minute) {
|
||||
Log.d(TAG, "handleSelectedTime() called with: hour = [" + hour + "], minute = [" + minute + "]");
|
||||
final Calendar selectedTimeCalendar = Calendar.getInstance();
|
||||
final Calendar nowCalendar = Calendar.getInstance();
|
||||
selectedTimeCalendar.set(Calendar.HOUR_OF_DAY, hour);
|
||||
selectedTimeCalendar.set(Calendar.MINUTE, minute);
|
||||
// If the time is before now, add a day to make it expire tomorrow.
|
||||
if (selectedTimeCalendar.before(nowCalendar)) {
|
||||
Log.d(TAG, "handleSelectedTime: Selected a time in the past, adding a day");
|
||||
selectedTimeCalendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
}
|
||||
final long differenceMillis = selectedTimeCalendar.getTimeInMillis() - nowCalendar.getTimeInMillis();
|
||||
Log.d(TAG, "handleSelectedTime: Selected [" + differenceMillis + "] Milliseconds ");
|
||||
final Context context = mContextRef.get();
|
||||
|
||||
final Intent sleepTimerServiceIntent = new Intent(context, SleepTimerHelper.class);
|
||||
sleepTimerServiceIntent.putExtra(SLEEP_TIMER_DURATION_MILLIS_EXTRA, differenceMillis);
|
||||
context.startForegroundService(sleepTimerServiceIntent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.aldo.apps.familyhelpers.utils;
|
||||
|
||||
import static android.content.Context.DEVICE_POLICY_SERVICE;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.aldo.apps.familyhelpers.DoerflingerHelpersDeviceAdminReceiver;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Helper class to wrap all the {@link DevicePolicyManager} related tasks into one singleton instead
|
||||
* of instantiating it scattered all over the code.
|
||||
*/
|
||||
public final class DevicePolicyManagerHelper {
|
||||
|
||||
/**
|
||||
* Tag for debugging purpose.
|
||||
*/
|
||||
private static final String TAG = "DevicePolicyManagerHelper";
|
||||
|
||||
/**
|
||||
* The singleton instance of this class.
|
||||
*/
|
||||
private static DevicePolicyManagerHelper sInstance;
|
||||
|
||||
/**
|
||||
* {@link WeakReference} to the {@link DevicePolicyManager} to apply actual system settings.
|
||||
*/
|
||||
private final WeakReference<DevicePolicyManager> mDevicePolicyManagerRef;
|
||||
|
||||
/**
|
||||
* The {@link ComponentName} of the {@link {@link DoerflingerHelpersDeviceAdminReceiver}}.
|
||||
*/
|
||||
private final ComponentName mDeviceAdminReceiver;
|
||||
|
||||
/**
|
||||
* Private C'Tor to prevent instantiation from outside.
|
||||
*
|
||||
* @param context The {@link Context} from where this was called.
|
||||
*/
|
||||
private DevicePolicyManagerHelper(final Context context) {
|
||||
mDevicePolicyManagerRef = new WeakReference<>((DevicePolicyManager) context.getSystemService(DEVICE_POLICY_SERVICE));
|
||||
mDeviceAdminReceiver = new ComponentName(context, DoerflingerHelpersDeviceAdminReceiver.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of the {@link DevicePolicyManagerHelper}.
|
||||
*
|
||||
* @param context The {@link Context} from where this was called.
|
||||
*
|
||||
* @return the singleton instance of the {@link DevicePolicyManagerHelper}.
|
||||
*/
|
||||
public static DevicePolicyManagerHelper getInstance(final Context context) {
|
||||
if (sInstance == null) {
|
||||
Log.d(TAG, "getInstance: Creating new helper instance");
|
||||
sInstance = new DevicePolicyManagerHelper(context);
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* If not yet granted before, opens the settings page to grant deviceAdmin rights to the package.
|
||||
*
|
||||
* @param context The {@link Context} from where this was called.
|
||||
* @param explanationId The stringId of the explanation on why this is needed.
|
||||
*/
|
||||
public void requestDeviceAdminPrivileges(final Context context, @StringRes final int explanationId) {
|
||||
final String explanation = context.getString(explanationId);
|
||||
final Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminReceiver);
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, explanation);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check whether the package was already registered as DeviceAdmin or not.
|
||||
*
|
||||
* @return true if package is approved deviceAdmin, false otherwise.
|
||||
*/
|
||||
public boolean isDeviceAdmin() {
|
||||
final DevicePolicyManager devicePolicyManager = mDevicePolicyManagerRef.get();
|
||||
return devicePolicyManager.isAdminActive(mDeviceAdminReceiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually locks the screen when the sleepTimer expired.
|
||||
*
|
||||
* @return true, if the screen lock was performed, false otherwise.
|
||||
*/
|
||||
public boolean lockScreen() {
|
||||
final DevicePolicyManager devicePolicyManager = mDevicePolicyManagerRef.get();
|
||||
if (isDeviceAdmin()) {
|
||||
devicePolicyManager.lockNow();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.aldo.apps.familyhelpers.utils;
|
||||
|
||||
/**
|
||||
* Utility class holding global constants to be used for the application.
|
||||
*/
|
||||
public final class GlobalConstants {
|
||||
|
||||
/**
|
||||
* Private C'tor to prevent instantiation.
|
||||
*/
|
||||
private GlobalConstants() {}
|
||||
|
||||
/**
|
||||
* ID of the NotificationChannel for the SleepTimer Notification.
|
||||
*/
|
||||
public static final String SLEEP_TIMER_CHANNEL_ID = "CountdownChannel";
|
||||
|
||||
/**
|
||||
* Factor to calculate seconds from milliseconds and vice versa.
|
||||
*/
|
||||
public static final int ONE_SECOND_IN_MILLIS = 1000;
|
||||
|
||||
/**
|
||||
* Factor to calculate hours from minutes and vice versa.
|
||||
*/
|
||||
public static final int ONE_HOUR_IN_MINUTES = 60;
|
||||
|
||||
/**
|
||||
* The NotificationID of the SleepTimer notification.
|
||||
*/
|
||||
public static final int SLEEP_TIMER_NOTIFICATION_ID = 1;
|
||||
|
||||
/**
|
||||
* The key of the extra to be applied to the starting intent of the sleepTimer service,
|
||||
* holding the initial duration in millis.
|
||||
*/
|
||||
public static final String SLEEP_TIMER_DURATION_MILLIS_EXTRA = "sleep_timer_duration";
|
||||
|
||||
/**
|
||||
* Action to cancel an ongoing sleep timer.
|
||||
*/
|
||||
public static final String SLEEP_TIMER_CANCEL_ACTION = "SLEEP_TIMER_CANCEL";
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.aldo.apps.familyhelpers.workers;
|
||||
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.ONE_HOUR_IN_MINUTES;
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.ONE_SECOND_IN_MILLIS;
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.SLEEP_TIMER_CANCEL_ACTION;
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.SLEEP_TIMER_CHANNEL_ID;
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.SLEEP_TIMER_DURATION_MILLIS_EXTRA;
|
||||
import static com.aldo.apps.familyhelpers.utils.GlobalConstants.SLEEP_TIMER_NOTIFICATION_ID;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.aldo.apps.familyhelpers.HelperGridActivity;
|
||||
import com.aldo.apps.familyhelpers.R;
|
||||
import com.aldo.apps.familyhelpers.utils.DevicePolicyManagerHelper;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Service implementation to post a notification and execute the locking of the screen after the
|
||||
* #timeout ended.
|
||||
*/
|
||||
public class SleepTimerHelper extends Service {
|
||||
|
||||
/**
|
||||
* Tag for debugging purpose.
|
||||
*/
|
||||
private static final String TAG = "SleepTimerHelper";
|
||||
/**
|
||||
* {@link Handler} on the MainThread in order to perform the actual locking.
|
||||
*/
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
/**
|
||||
* Member holding the remaining time of the countdown.
|
||||
*/
|
||||
private long mCountdownTimeMillis;
|
||||
/**
|
||||
* The {@link Runnable} to execute the task in.
|
||||
*/
|
||||
private Runnable mCountdownRunnable;
|
||||
|
||||
/**
|
||||
* The {@link DevicePolicyManagerHelper} to actually lock the screen.
|
||||
*/
|
||||
private DevicePolicyManagerHelper mDevicePolicyHelper;
|
||||
|
||||
/**
|
||||
* {@link NotificationManager} to show and update the foreground service notification.
|
||||
*/
|
||||
private NotificationManager mNotificationManager;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.d(TAG, "onCreate() called");
|
||||
mDevicePolicyHelper = DevicePolicyManagerHelper.getInstance(this);
|
||||
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
if (intent == null) {
|
||||
Log.e(TAG, "onStartCommand: Invalid intent intent received, do nothing");
|
||||
return START_REDELIVER_INTENT;
|
||||
}
|
||||
if (intent.getAction() != null && intent.getAction().equals(SLEEP_TIMER_CANCEL_ACTION)) {
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
mCountdownTimeMillis = intent.getLongExtra(SLEEP_TIMER_DURATION_MILLIS_EXTRA, 0);
|
||||
createNotificationChannel();
|
||||
startForeground(SLEEP_TIMER_NOTIFICATION_ID, buildNotification());
|
||||
mNotificationManager.notify(SLEEP_TIMER_NOTIFICATION_ID, buildNotification());
|
||||
startCountdown();
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to prepare the actual runner to countdown, will finally lock the screen if the
|
||||
* countdown expired.
|
||||
*/
|
||||
private void startCountdown() {
|
||||
mCountdownRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mCountdownTimeMillis > 0) {
|
||||
updateNotification();
|
||||
mCountdownTimeMillis -= ONE_SECOND_IN_MILLIS;
|
||||
mHandler.postDelayed(this, ONE_SECOND_IN_MILLIS);
|
||||
} else {
|
||||
mDevicePolicyHelper.lockScreen();
|
||||
Log.d(TAG, "run: Countdown expired, lock screen");
|
||||
stopSelf();
|
||||
}
|
||||
}
|
||||
};
|
||||
mHandler.post(mCountdownRunnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to update the notification with the new time.
|
||||
*/
|
||||
private void updateNotification() {
|
||||
final Notification notification = buildNotification();
|
||||
mNotificationManager.notify(SLEEP_TIMER_NOTIFICATION_ID, notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to build the Notification to be shown showing the current progress of the countdown.#
|
||||
*
|
||||
* @return The built notification.
|
||||
*/
|
||||
private Notification buildNotification() {
|
||||
final String countdownText = formatTime(mCountdownTimeMillis);
|
||||
final Intent notificationIntent = new Intent(this, HelperGridActivity.class);
|
||||
final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
|
||||
notificationIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
final Intent cancelIntent = new Intent(this, SleepTimerHelper.class);
|
||||
cancelIntent.setAction(SLEEP_TIMER_CANCEL_ACTION);
|
||||
final PendingIntent cancelPendingIntent = PendingIntent.getService(this, 0,
|
||||
cancelIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
return new NotificationCompat.Builder(this, SLEEP_TIMER_CHANNEL_ID)
|
||||
.setContentTitle(getString(R.string.title_sleep_timer))
|
||||
.setContentText(String.format(getString(R.string.sleep_timer_notification_content),
|
||||
countdownText))
|
||||
.setSmallIcon(android.R.drawable.ic_lock_idle_alarm)
|
||||
.setContentIntent(pendingIntent)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
||||
getString(R.string.sleep_timer_notification_cancel), cancelPendingIntent)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates ad registers a new {@link NotificationChannel}.
|
||||
*/
|
||||
private void createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
final NotificationChannel channel = new NotificationChannel(SLEEP_TIMER_CHANNEL_ID,
|
||||
getString(R.string.sleep_timer_notification_channel),
|
||||
NotificationManager.IMPORTANCE_DEFAULT);
|
||||
mNotificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the provided time in milliseconds in a human readable format.
|
||||
*
|
||||
* @param millis The remaining time in milliseconds.
|
||||
*
|
||||
* @return The String representation of the milliseconds.
|
||||
*/
|
||||
private String formatTime(long millis) {
|
||||
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
|
||||
long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(minutes);
|
||||
if (minutes > ONE_HOUR_IN_MINUTES) {
|
||||
final long hours = minutes / ONE_HOUR_IN_MINUTES;
|
||||
final long minutesCleaned = minutes % ONE_HOUR_IN_MINUTES;
|
||||
return String.format(getString(R.string.sleep_timer_remaining_time_with_hour),
|
||||
hours, minutesCleaned, seconds);
|
||||
}
|
||||
return String.format(getString(R.string.sleep_timer_remaining_time_without_hour), minutes, seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mHandler.removeCallbacks(mCountdownRunnable);
|
||||
}
|
||||
}
|
||||
45
app/src/main/res/drawable/helper_group_tile_background.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<solid android:color="@color/md_theme_inverseOnSurface_highContrast" />
|
||||
|
||||
<stroke
|
||||
android:width="3dp"
|
||||
android:color="@color/md_theme_outline_highContrast" />
|
||||
|
||||
<padding
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="7dp"
|
||||
android:bottomRightRadius="7dp"
|
||||
android:topLeftRadius="7dp"
|
||||
android:topRightRadius="7dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="false">
|
||||
<shape>
|
||||
<solid android:color="@color/md_theme_inverseOnSurface_mediumContrast" />
|
||||
|
||||
<stroke
|
||||
android:width="3dp"
|
||||
android:color="@color/md_theme_outline_mediumContrast" />
|
||||
|
||||
<padding
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="7dp"
|
||||
android:bottomRightRadius="7dp"
|
||||
android:topLeftRadius="7dp"
|
||||
android:topRightRadius="7dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/icn_sleep_timer.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector android:height="200dp" android:viewportHeight="1024"
|
||||
android:viewportWidth="1024" android:width="200dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#5FCEFF" android:pathData="M366.3,744.8h524.5l-21.2,-303.6c-0,0 -401.1,-0.1 -503.2,303.6z"/>
|
||||
<path android:fillColor="#8B87C1" android:pathData="M943.3,744.8v159.8h-863.2v-159.8h800.1z"/>
|
||||
<path android:fillColor="#FFB578" android:pathData="M240.8,499.8c57,0 103.2,46.2 103.2,103.1s-46.2,103.2 -103.2,103.2 -103.1,-46.2 -103.1,-103.2 46.2,-103.1 103.1,-103.1z"/>
|
||||
<path android:fillColor="#4F46A3" android:pathData="M80.1,986.7a22.4,22.4 0,0 1,-22.4 -22.4v-529.2a22.4,22.4 0,1 1,44.8 0v529.2a22.4,22.4 0,0 1,-22.4 22.4zM943.3,986.7a22.4,22.4 0,0 1,-22.4 -22.4v-305.4a22.4,22.4 0,1 1,44.8 0v305.4c0,12.4 -10,22.4 -22.4,22.4z"/>
|
||||
<path android:fillColor="#4F46A3" android:pathData="M943.3,767.1h-863.2a22.4,22.4 0,1 1,0 -44.8h863.2a22.4,22.4 0,1 1,0 44.8z"/>
|
||||
<path android:fillColor="#4F46A3" android:pathData="M240.8,728.5c-69.2,0 -125.5,-56.3 -125.5,-125.5 0,-69.2 56.3,-125.5 125.5,-125.5 69.2,0 125.5,56.3 125.5,125.5 0,69.2 -56.3,125.5 -125.5,125.5zM240.8,522.2c-44.5,0 -80.8,36.2 -80.8,80.8 0,44.5 36.2,80.8 80.8,80.8 44.5,0 80.8,-36.2 80.8,-80.8 0,-44.5 -36.2,-80.8 -80.8,-80.8zM371.9,766.8a22.4,22.4 0,0 1,-22.4 -22.4c0,-82.6 58.1,-166.2 159.4,-229.4 102.4,-63.8 234.2,-99 371.3,-99a22.4,22.4 0,1 1,0 44.8c-128.8,0 -252.2,32.7 -347.6,92.2 -87.9,54.8 -138.3,124.6 -138.3,191.4a22.4,22.4 0,0 1,-22.4 22.4z"/>
|
||||
<path android:fillColor="#4F46A3" android:pathData="M880.2,767.1a22.4,22.4 0,0 1,-22.4 -22.4v-306.4a22.4,22.4 0,1 1,44.8 0v306.4a22.4,22.4 0,0 1,-22.4 22.4zM477.7,429.5h-167.8a22.4,22.4 0,0 1,-12.3 -41.1l105.6,-69.6H309.8a22.4,22.4 0,1 1,0 -44.8h167.8a22.4,22.4 0,0 1,12.3 41.1l-105.6,69.6h93.2a22.4,22.4 0,1 1,0 44.8zM636.6,205.7h-103a22.4,22.4 0,0 1,-12.3 -41.1l40.7,-26.8h-28.4a22.4,22.4 0,1 1,0 -44.8h103a22.4,22.4 0,0 1,12.3 41.1l-40.7,26.8h28.4a22.4,22.4 0,1 1,0 44.8zM868.4,136.5h-87a22.4,22.4 0,0 1,-12.3 -41.1l24.7,-16.3h-12.4a22.4,22.4 0,1 1,0 -44.8h87a22.4,22.4 0,0 1,12.3 41.1l-24.7,16.3h12.4a22.4,22.4 0,1 1,0 44.8zM943.3,927h-863.2a22.4,22.4 0,1 1,0 -44.8h863.2a22.4,22.4 0,1 1,0 44.8z"/>
|
||||
</vector>
|
||||
21
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".HelperGridActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="2">
|
||||
|
||||
<include layout="@layout/helper_group_tile_item"
|
||||
android:id="@+id/tile_sleep_timer"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
37
app/src/main/res/layout/helper_group_tile_item.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/helper_group_tile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="150dp"
|
||||
android:maxWidth="250dp"
|
||||
android:padding="15dp"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/helper_group_tile_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_helper_group_icon"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:src="@drawable/icn_sleep_timer"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_helper_group_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_helper_group_icon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="Sleep Timer"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/md_theme_onBackground_highContrast"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
6
app/src/main/res/mipmap-anydpi/ic_launcher.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
144
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="md_theme_primary">#91D5AC</color>
|
||||
<color name="md_theme_onPrimary">#003921</color>
|
||||
<color name="md_theme_primaryContainer">#055232</color>
|
||||
<color name="md_theme_onPrimaryContainer">#ADF2C7</color>
|
||||
<color name="md_theme_secondary">#B5CCBB</color>
|
||||
<color name="md_theme_onSecondary">#213528</color>
|
||||
<color name="md_theme_secondaryContainer">#374B3E</color>
|
||||
<color name="md_theme_onSecondaryContainer">#D0E8D6</color>
|
||||
<color name="md_theme_tertiary">#A4CDDC</color>
|
||||
<color name="md_theme_onTertiary">#043541</color>
|
||||
<color name="md_theme_tertiaryContainer">#224C59</color>
|
||||
<color name="md_theme_onTertiaryContainer">#BFE9F9</color>
|
||||
<color name="md_theme_error">#FFB4AB</color>
|
||||
<color name="md_theme_onError">#690005</color>
|
||||
<color name="md_theme_errorContainer">#93000A</color>
|
||||
<color name="md_theme_onErrorContainer">#FFDAD6</color>
|
||||
<color name="md_theme_background">#0F1511</color>
|
||||
<color name="md_theme_onBackground">#DFE4DD</color>
|
||||
<color name="md_theme_surface">#0F1511</color>
|
||||
<color name="md_theme_onSurface">#DFE4DD</color>
|
||||
<color name="md_theme_surfaceVariant">#404942</color>
|
||||
<color name="md_theme_onSurfaceVariant">#C0C9C0</color>
|
||||
<color name="md_theme_outline">#8A938B</color>
|
||||
<color name="md_theme_outlineVariant">#404942</color>
|
||||
<color name="md_theme_scrim">#000000</color>
|
||||
<color name="md_theme_inverseSurface">#DFE4DD</color>
|
||||
<color name="md_theme_inverseOnSurface">#2C322D</color>
|
||||
<color name="md_theme_inversePrimary">#276A49</color>
|
||||
<color name="md_theme_primaryFixed">#ADF2C7</color>
|
||||
<color name="md_theme_onPrimaryFixed">#002111</color>
|
||||
<color name="md_theme_primaryFixedDim">#91D5AC</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant">#055232</color>
|
||||
<color name="md_theme_secondaryFixed">#D0E8D6</color>
|
||||
<color name="md_theme_onSecondaryFixed">#0B1F14</color>
|
||||
<color name="md_theme_secondaryFixedDim">#B5CCBB</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant">#374B3E</color>
|
||||
<color name="md_theme_tertiaryFixed">#BFE9F9</color>
|
||||
<color name="md_theme_onTertiaryFixed">#001F27</color>
|
||||
<color name="md_theme_tertiaryFixedDim">#A4CDDC</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant">#224C59</color>
|
||||
<color name="md_theme_surfaceDim">#0F1511</color>
|
||||
<color name="md_theme_surfaceBright">#353B36</color>
|
||||
<color name="md_theme_surfaceContainerLowest">#0A0F0C</color>
|
||||
<color name="md_theme_surfaceContainerLow">#171D19</color>
|
||||
<color name="md_theme_surfaceContainer">#1B211D</color>
|
||||
<color name="md_theme_surfaceContainerHigh">#262B27</color>
|
||||
<color name="md_theme_surfaceContainerHighest">#303632</color>
|
||||
<color name="md_theme_primary_mediumContrast">#96D9B0</color>
|
||||
<color name="md_theme_onPrimary_mediumContrast">#001B0D</color>
|
||||
<color name="md_theme_primaryContainer_mediumContrast">#5C9E79</color>
|
||||
<color name="md_theme_onPrimaryContainer_mediumContrast">#000000</color>
|
||||
<color name="md_theme_secondary_mediumContrast">#B9D1BF</color>
|
||||
<color name="md_theme_onSecondary_mediumContrast">#061A0F</color>
|
||||
<color name="md_theme_secondaryContainer_mediumContrast">#809686</color>
|
||||
<color name="md_theme_onSecondaryContainer_mediumContrast">#000000</color>
|
||||
<color name="md_theme_tertiary_mediumContrast">#A8D1E0</color>
|
||||
<color name="md_theme_onTertiary_mediumContrast">#001921</color>
|
||||
<color name="md_theme_tertiaryContainer_mediumContrast">#6E97A5</color>
|
||||
<color name="md_theme_onTertiaryContainer_mediumContrast">#000000</color>
|
||||
<color name="md_theme_error_mediumContrast">#FFBAB1</color>
|
||||
<color name="md_theme_onError_mediumContrast">#370001</color>
|
||||
<color name="md_theme_errorContainer_mediumContrast">#FF5449</color>
|
||||
<color name="md_theme_onErrorContainer_mediumContrast">#000000</color>
|
||||
<color name="md_theme_background_mediumContrast">#0F1511</color>
|
||||
<color name="md_theme_onBackground_mediumContrast">#DFE4DD</color>
|
||||
<color name="md_theme_surface_mediumContrast">#0F1511</color>
|
||||
<color name="md_theme_onSurface_mediumContrast">#F7FCF5</color>
|
||||
<color name="md_theme_surfaceVariant_mediumContrast">#404942</color>
|
||||
<color name="md_theme_onSurfaceVariant_mediumContrast">#C4CDC4</color>
|
||||
<color name="md_theme_outline_mediumContrast">#9CA59D</color>
|
||||
<color name="md_theme_outlineVariant_mediumContrast">#7D857E</color>
|
||||
<color name="md_theme_scrim_mediumContrast">#000000</color>
|
||||
<color name="md_theme_inverseSurface_mediumContrast">#DFE4DD</color>
|
||||
<color name="md_theme_inverseOnSurface_mediumContrast">#262B27</color>
|
||||
<color name="md_theme_inversePrimary_mediumContrast">#075333</color>
|
||||
<color name="md_theme_primaryFixed_mediumContrast">#ADF2C7</color>
|
||||
<color name="md_theme_onPrimaryFixed_mediumContrast">#001509</color>
|
||||
<color name="md_theme_primaryFixedDim_mediumContrast">#91D5AC</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant_mediumContrast">#003F25</color>
|
||||
<color name="md_theme_secondaryFixed_mediumContrast">#D0E8D6</color>
|
||||
<color name="md_theme_onSecondaryFixed_mediumContrast">#02150A</color>
|
||||
<color name="md_theme_secondaryFixedDim_mediumContrast">#B5CCBB</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant_mediumContrast">#263B2E</color>
|
||||
<color name="md_theme_tertiaryFixed_mediumContrast">#BFE9F9</color>
|
||||
<color name="md_theme_onTertiaryFixed_mediumContrast">#00141A</color>
|
||||
<color name="md_theme_tertiaryFixedDim_mediumContrast">#A4CDDC</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant_mediumContrast">#0D3B47</color>
|
||||
<color name="md_theme_surfaceDim_mediumContrast">#0F1511</color>
|
||||
<color name="md_theme_surfaceBright_mediumContrast">#353B36</color>
|
||||
<color name="md_theme_surfaceContainerLowest_mediumContrast">#0A0F0C</color>
|
||||
<color name="md_theme_surfaceContainerLow_mediumContrast">#171D19</color>
|
||||
<color name="md_theme_surfaceContainer_mediumContrast">#1B211D</color>
|
||||
<color name="md_theme_surfaceContainerHigh_mediumContrast">#262B27</color>
|
||||
<color name="md_theme_surfaceContainerHighest_mediumContrast">#303632</color>
|
||||
<color name="md_theme_primary_highContrast">#EEFFF1</color>
|
||||
<color name="md_theme_onPrimary_highContrast">#000000</color>
|
||||
<color name="md_theme_primaryContainer_highContrast">#96D9B0</color>
|
||||
<color name="md_theme_onPrimaryContainer_highContrast">#000000</color>
|
||||
<color name="md_theme_secondary_highContrast">#EEFFF1</color>
|
||||
<color name="md_theme_onSecondary_highContrast">#000000</color>
|
||||
<color name="md_theme_secondaryContainer_highContrast">#B9D1BF</color>
|
||||
<color name="md_theme_onSecondaryContainer_highContrast">#000000</color>
|
||||
<color name="md_theme_tertiary_highContrast">#F5FCFF</color>
|
||||
<color name="md_theme_onTertiary_highContrast">#000000</color>
|
||||
<color name="md_theme_tertiaryContainer_highContrast">#A8D1E0</color>
|
||||
<color name="md_theme_onTertiaryContainer_highContrast">#000000</color>
|
||||
<color name="md_theme_error_highContrast">#FFF9F9</color>
|
||||
<color name="md_theme_onError_highContrast">#000000</color>
|
||||
<color name="md_theme_errorContainer_highContrast">#FFBAB1</color>
|
||||
<color name="md_theme_onErrorContainer_highContrast">#000000</color>
|
||||
<color name="md_theme_background_highContrast">#0F1511</color>
|
||||
<color name="md_theme_onBackground_highContrast">#DFE4DD</color>
|
||||
<color name="md_theme_surface_highContrast">#0F1511</color>
|
||||
<color name="md_theme_onSurface_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceVariant_highContrast">#404942</color>
|
||||
<color name="md_theme_onSurfaceVariant_highContrast">#F4FDF4</color>
|
||||
<color name="md_theme_outline_highContrast">#C4CDC4</color>
|
||||
<color name="md_theme_outlineVariant_highContrast">#C4CDC4</color>
|
||||
<color name="md_theme_scrim_highContrast">#000000</color>
|
||||
<color name="md_theme_inverseSurface_highContrast">#DFE4DD</color>
|
||||
<color name="md_theme_inverseOnSurface_highContrast">#000000</color>
|
||||
<color name="md_theme_inversePrimary_highContrast">#00311C</color>
|
||||
<color name="md_theme_primaryFixed_highContrast">#B1F6CB</color>
|
||||
<color name="md_theme_onPrimaryFixed_highContrast">#000000</color>
|
||||
<color name="md_theme_primaryFixedDim_highContrast">#96D9B0</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant_highContrast">#001B0D</color>
|
||||
<color name="md_theme_secondaryFixed_highContrast">#D5EDDB</color>
|
||||
<color name="md_theme_onSecondaryFixed_highContrast">#000000</color>
|
||||
<color name="md_theme_secondaryFixedDim_highContrast">#B9D1BF</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant_highContrast">#061A0F</color>
|
||||
<color name="md_theme_tertiaryFixed_highContrast">#C3EEFD</color>
|
||||
<color name="md_theme_onTertiaryFixed_highContrast">#000000</color>
|
||||
<color name="md_theme_tertiaryFixedDim_highContrast">#A8D1E0</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant_highContrast">#001921</color>
|
||||
<color name="md_theme_surfaceDim_highContrast">#0F1511</color>
|
||||
<color name="md_theme_surfaceBright_highContrast">#353B36</color>
|
||||
<color name="md_theme_surfaceContainerLowest_highContrast">#0A0F0C</color>
|
||||
<color name="md_theme_surfaceContainerLow_highContrast">#171D19</color>
|
||||
<color name="md_theme_surfaceContainer_highContrast">#1B211D</color>
|
||||
<color name="md_theme_surfaceContainerHigh_highContrast">#262B27</color>
|
||||
<color name="md_theme_surfaceContainerHighest_highContrast">#303632</color>
|
||||
</resources>
|
||||
6
app/src/main/res/values-night/styles.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<style name="Widget.Theme.MyApplication.MyView" parent="">
|
||||
<item name="android:background">@color/gray_600</item>
|
||||
<item name="exampleColor">@color/light_blue_600</item>
|
||||
</style>
|
||||
</resources>
|
||||
55
app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.MyApplication" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/md_theme_primary</item>
|
||||
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
|
||||
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>
|
||||
<item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item>
|
||||
<item name="colorSecondary">@color/md_theme_secondary</item>
|
||||
<item name="colorOnSecondary">@color/md_theme_onSecondary</item>
|
||||
<item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item>
|
||||
<item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item>
|
||||
<item name="colorTertiary">@color/md_theme_tertiary</item>
|
||||
<item name="colorOnTertiary">@color/md_theme_onTertiary</item>
|
||||
<item name="colorTertiaryContainer">@color/md_theme_tertiaryContainer</item>
|
||||
<item name="colorOnTertiaryContainer">@color/md_theme_onTertiaryContainer</item>
|
||||
<item name="colorError">@color/md_theme_error</item>
|
||||
<item name="colorOnError">@color/md_theme_onError</item>
|
||||
<item name="colorErrorContainer">@color/md_theme_errorContainer</item>
|
||||
<item name="colorOnErrorContainer">@color/md_theme_onErrorContainer</item>
|
||||
<item name="android:colorBackground">@color/md_theme_background</item>
|
||||
<item name="colorOnBackground">@color/md_theme_onBackground</item>
|
||||
<item name="colorSurface">@color/md_theme_surface</item>
|
||||
<item name="colorOnSurface">@color/md_theme_onSurface</item>
|
||||
<item name="colorSurfaceVariant">@color/md_theme_surfaceVariant</item>
|
||||
<item name="colorOnSurfaceVariant">@color/md_theme_onSurfaceVariant</item>
|
||||
<item name="colorOutline">@color/md_theme_outline</item>
|
||||
<item name="colorOutlineVariant">@color/md_theme_outlineVariant</item>
|
||||
<item name="colorSurfaceInverse">@color/md_theme_inverseSurface</item>
|
||||
<item name="colorOnSurfaceInverse">@color/md_theme_inverseOnSurface</item>
|
||||
<item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item>
|
||||
<item name="colorPrimaryFixed">@color/md_theme_primaryFixed</item>
|
||||
<item name="colorOnPrimaryFixed">@color/md_theme_onPrimaryFixed</item>
|
||||
<item name="colorPrimaryFixedDim">@color/md_theme_primaryFixedDim</item>
|
||||
<item name="colorOnPrimaryFixedVariant">@color/md_theme_onPrimaryFixedVariant</item>
|
||||
<item name="colorSecondaryFixed">@color/md_theme_secondaryFixed</item>
|
||||
<item name="colorOnSecondaryFixed">@color/md_theme_onSecondaryFixed</item>
|
||||
<item name="colorSecondaryFixedDim">@color/md_theme_secondaryFixedDim</item>
|
||||
<item name="colorOnSecondaryFixedVariant">@color/md_theme_onSecondaryFixedVariant</item>
|
||||
<item name="colorTertiaryFixed">@color/md_theme_tertiaryFixed</item>
|
||||
<item name="colorOnTertiaryFixed">@color/md_theme_onTertiaryFixed</item>
|
||||
<item name="colorTertiaryFixedDim">@color/md_theme_tertiaryFixedDim</item>
|
||||
<item name="colorOnTertiaryFixedVariant">@color/md_theme_onTertiaryFixedVariant</item>
|
||||
<item name="colorSurfaceDim">@color/md_theme_surfaceDim</item>
|
||||
<item name="colorSurfaceBright">@color/md_theme_surfaceBright</item>
|
||||
<item name="colorSurfaceContainerLowest">@color/md_theme_surfaceContainerLowest</item>
|
||||
<item name="colorSurfaceContainerLow">@color/md_theme_surfaceContainerLow</item>
|
||||
<item name="colorSurfaceContainer">@color/md_theme_surfaceContainer</item>
|
||||
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
|
||||
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>
|
||||
</style>
|
||||
|
||||
<style name="HelperGroupTileStyke" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/helperGroupTileBackground_NightMode</item>
|
||||
</style>
|
||||
</resources>
|
||||
8
app/src/main/res/values/attrs_helper_group_button.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
<declare-styleable name="HelperGroupButton">
|
||||
<attr name="exampleString" format="string" />
|
||||
<attr name="exampleDimension" format="dimension" />
|
||||
<attr name="exampleColor" format="color" />
|
||||
<attr name="exampleDrawable" format="color|reference" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
155
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="helperGroupTileBackground_LightMode">#DADADA</color>
|
||||
<color name="helperGroupTileBorder_LightMode">#00796B</color>
|
||||
<color name="helperGroupTileBackground_NightMode">#DADADA</color>
|
||||
<color name="helperGroupTileBorder_NightMode">#00796B</color>
|
||||
<color name="light_blue_400">#FF29B6F6</color>
|
||||
<color name="light_blue_600">#FF039BE5</color>
|
||||
<color name="gray_400">#FFBDBDBD</color>
|
||||
<color name="gray_600">#FF757575</color>
|
||||
|
||||
<!-- Auto-Generated Colors -->
|
||||
<color name="md_theme_primary">#276A49</color>
|
||||
<color name="md_theme_onPrimary">#FFFFFF</color>
|
||||
<color name="md_theme_primaryContainer">#ADF2C7</color>
|
||||
<color name="md_theme_onPrimaryContainer">#002111</color>
|
||||
<color name="md_theme_secondary">#4E6355</color>
|
||||
<color name="md_theme_onSecondary">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer">#D0E8D6</color>
|
||||
<color name="md_theme_onSecondaryContainer">#0B1F14</color>
|
||||
<color name="md_theme_tertiary">#3C6471</color>
|
||||
<color name="md_theme_onTertiary">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryContainer">#BFE9F9</color>
|
||||
<color name="md_theme_onTertiaryContainer">#001F27</color>
|
||||
<color name="md_theme_error">#BA1A1A</color>
|
||||
<color name="md_theme_onError">#FFFFFF</color>
|
||||
<color name="md_theme_errorContainer">#FFDAD6</color>
|
||||
<color name="md_theme_onErrorContainer">#410002</color>
|
||||
<color name="md_theme_background">#F6FBF4</color>
|
||||
<color name="md_theme_onBackground">#171D19</color>
|
||||
<color name="md_theme_surface">#F6FBF4</color>
|
||||
<color name="md_theme_onSurface">#171D19</color>
|
||||
<color name="md_theme_surfaceVariant">#DCE5DC</color>
|
||||
<color name="md_theme_onSurfaceVariant">#404942</color>
|
||||
<color name="md_theme_outline">#717972</color>
|
||||
<color name="md_theme_outlineVariant">#C0C9C0</color>
|
||||
<color name="md_theme_scrim">#000000</color>
|
||||
<color name="md_theme_inverseSurface">#2C322D</color>
|
||||
<color name="md_theme_inverseOnSurface">#EDF2EB</color>
|
||||
<color name="md_theme_inversePrimary">#91D5AC</color>
|
||||
<color name="md_theme_primaryFixed">#ADF2C7</color>
|
||||
<color name="md_theme_onPrimaryFixed">#002111</color>
|
||||
<color name="md_theme_primaryFixedDim">#91D5AC</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant">#055232</color>
|
||||
<color name="md_theme_secondaryFixed">#D0E8D6</color>
|
||||
<color name="md_theme_onSecondaryFixed">#0B1F14</color>
|
||||
<color name="md_theme_secondaryFixedDim">#B5CCBB</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant">#374B3E</color>
|
||||
<color name="md_theme_tertiaryFixed">#BFE9F9</color>
|
||||
<color name="md_theme_onTertiaryFixed">#001F27</color>
|
||||
<color name="md_theme_tertiaryFixedDim">#A4CDDC</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant">#224C59</color>
|
||||
<color name="md_theme_surfaceDim">#D6DBD5</color>
|
||||
<color name="md_theme_surfaceBright">#F6FBF4</color>
|
||||
<color name="md_theme_surfaceContainerLowest">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceContainerLow">#F0F5EE</color>
|
||||
<color name="md_theme_surfaceContainer">#EAEFE9</color>
|
||||
<color name="md_theme_surfaceContainerHigh">#E4EAE3</color>
|
||||
<color name="md_theme_surfaceContainerHighest">#DFE4DD</color>
|
||||
<color name="md_theme_primary_mediumContrast">#004D2F</color>
|
||||
<color name="md_theme_onPrimary_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_primaryContainer_mediumContrast">#40815E</color>
|
||||
<color name="md_theme_onPrimaryContainer_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondary_mediumContrast">#33473A</color>
|
||||
<color name="md_theme_onSecondary_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer_mediumContrast">#647A6B</color>
|
||||
<color name="md_theme_onSecondaryContainer_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiary_mediumContrast">#1E4855</color>
|
||||
<color name="md_theme_onTertiary_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryContainer_mediumContrast">#527A88</color>
|
||||
<color name="md_theme_onTertiaryContainer_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_error_mediumContrast">#8C0009</color>
|
||||
<color name="md_theme_onError_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_errorContainer_mediumContrast">#DA342E</color>
|
||||
<color name="md_theme_onErrorContainer_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_background_mediumContrast">#F6FBF4</color>
|
||||
<color name="md_theme_onBackground_mediumContrast">#171D19</color>
|
||||
<color name="md_theme_surface_mediumContrast">#F6FBF4</color>
|
||||
<color name="md_theme_onSurface_mediumContrast">#171D19</color>
|
||||
<color name="md_theme_surfaceVariant_mediumContrast">#DCE5DC</color>
|
||||
<color name="md_theme_onSurfaceVariant_mediumContrast">#3C453F</color>
|
||||
<color name="md_theme_outline_mediumContrast">#59615A</color>
|
||||
<color name="md_theme_outlineVariant_mediumContrast">#747D76</color>
|
||||
<color name="md_theme_scrim_mediumContrast">#000000</color>
|
||||
<color name="md_theme_inverseSurface_mediumContrast">#2C322D</color>
|
||||
<color name="md_theme_inverseOnSurface_mediumContrast">#EDF2EB</color>
|
||||
<color name="md_theme_inversePrimary_mediumContrast">#91D5AC</color>
|
||||
<color name="md_theme_primaryFixed_mediumContrast">#40815E</color>
|
||||
<color name="md_theme_onPrimaryFixed_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_primaryFixedDim_mediumContrast">#256846</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryFixed_mediumContrast">#647A6B</color>
|
||||
<color name="md_theme_onSecondaryFixed_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryFixedDim_mediumContrast">#4C6153</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryFixed_mediumContrast">#527A88</color>
|
||||
<color name="md_theme_onTertiaryFixed_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryFixedDim_mediumContrast">#39626F</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceDim_mediumContrast">#D6DBD5</color>
|
||||
<color name="md_theme_surfaceBright_mediumContrast">#F6FBF4</color>
|
||||
<color name="md_theme_surfaceContainerLowest_mediumContrast">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceContainerLow_mediumContrast">#F0F5EE</color>
|
||||
<color name="md_theme_surfaceContainer_mediumContrast">#EAEFE9</color>
|
||||
<color name="md_theme_surfaceContainerHigh_mediumContrast">#E4EAE3</color>
|
||||
<color name="md_theme_surfaceContainerHighest_mediumContrast">#DFE4DD</color>
|
||||
<color name="md_theme_primary_highContrast">#002816</color>
|
||||
<color name="md_theme_onPrimary_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_primaryContainer_highContrast">#004D2F</color>
|
||||
<color name="md_theme_onPrimaryContainer_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondary_highContrast">#12261B</color>
|
||||
<color name="md_theme_onSecondary_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer_highContrast">#33473A</color>
|
||||
<color name="md_theme_onSecondaryContainer_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiary_highContrast">#002630</color>
|
||||
<color name="md_theme_onTertiary_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryContainer_highContrast">#1E4855</color>
|
||||
<color name="md_theme_onTertiaryContainer_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_error_highContrast">#4E0002</color>
|
||||
<color name="md_theme_onError_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_errorContainer_highContrast">#8C0009</color>
|
||||
<color name="md_theme_onErrorContainer_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_background_highContrast">#F6FBF4</color>
|
||||
<color name="md_theme_onBackground_highContrast">#171D19</color>
|
||||
<color name="md_theme_surface_highContrast">#F6FBF4</color>
|
||||
<color name="md_theme_onSurface_highContrast">#000000</color>
|
||||
<color name="md_theme_surfaceVariant_highContrast">#DCE5DC</color>
|
||||
<color name="md_theme_onSurfaceVariant_highContrast">#1E2620</color>
|
||||
<color name="md_theme_outline_highContrast">#3C453F</color>
|
||||
<color name="md_theme_outlineVariant_highContrast">#3C453F</color>
|
||||
<color name="md_theme_scrim_highContrast">#000000</color>
|
||||
<color name="md_theme_inverseSurface_highContrast">#2C322D</color>
|
||||
<color name="md_theme_inverseOnSurface_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_inversePrimary_highContrast">#B6FBD0</color>
|
||||
<color name="md_theme_primaryFixed_highContrast">#004D2F</color>
|
||||
<color name="md_theme_onPrimaryFixed_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_primaryFixedDim_highContrast">#00341E</color>
|
||||
<color name="md_theme_onPrimaryFixedVariant_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryFixed_highContrast">#33473A</color>
|
||||
<color name="md_theme_onSecondaryFixed_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryFixedDim_highContrast">#1D3125</color>
|
||||
<color name="md_theme_onSecondaryFixedVariant_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryFixed_highContrast">#1E4855</color>
|
||||
<color name="md_theme_onTertiaryFixed_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryFixedDim_highContrast">#00323D</color>
|
||||
<color name="md_theme_onTertiaryFixedVariant_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceDim_highContrast">#D6DBD5</color>
|
||||
<color name="md_theme_surfaceBright_highContrast">#F6FBF4</color>
|
||||
<color name="md_theme_surfaceContainerLowest_highContrast">#FFFFFF</color>
|
||||
<color name="md_theme_surfaceContainerLow_highContrast">#F0F5EE</color>
|
||||
<color name="md_theme_surfaceContainer_highContrast">#EAEFE9</color>
|
||||
</resources>
|
||||
16
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources>
|
||||
<string name="app_name">Doerflinger-Helpers</string>
|
||||
|
||||
<string name="warning_no_device_admin">The action you would like to perform requires DeviceAdmin privileges, please grant them before continuing.</string>
|
||||
|
||||
<!-- Sleep Timer Functionality Strings -->
|
||||
<string name="title_sleep_timer">Sleep Timer</string>
|
||||
<string name="sleep_timer_notification_channel">SleepTimer</string>
|
||||
<string name="description_sleep_timer">Offers the possibility top set a sleep timer, after which the display will turn off</string>
|
||||
<string name="sleep_timer_rationale_device_admin">Device Admin privileges are needed for locking the screen after a specified timeout</string>
|
||||
<string name="sleep_timer_show_notifications_rationale">In order for this feature to work, the app must be allowed to show a Notification</string>
|
||||
<string name="sleep_timer_notification_content">Sleep timer is scheduled. Your device will lock itself in %s</string>
|
||||
<string name="sleep_timer_notification_cancel">Cancel</string>
|
||||
<string name="sleep_timer_remaining_time_with_hour">%02d:%02d:%02d"</string>
|
||||
<string name="sleep_timer_remaining_time_without_hour">%02d:%02d"</string>
|
||||
</resources>
|
||||
6
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<style name="Widget.Theme.MyApplication.MyView" parent="">
|
||||
<item name="android:background">@color/gray_400</item>
|
||||
<item name="exampleColor">@color/light_blue_400</item>
|
||||
</style>
|
||||
</resources>
|
||||
53
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.MyApplication" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/md_theme_primary</item>
|
||||
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
|
||||
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>
|
||||
<item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item>
|
||||
<item name="colorSecondary">@color/md_theme_secondary</item>
|
||||
<item name="colorOnSecondary">@color/md_theme_onSecondary</item>
|
||||
<item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item>
|
||||
<item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item>
|
||||
<item name="colorTertiary">@color/md_theme_tertiary</item>
|
||||
<item name="colorOnTertiary">@color/md_theme_onTertiary</item>
|
||||
<item name="colorTertiaryContainer">@color/md_theme_tertiaryContainer</item>
|
||||
<item name="colorOnTertiaryContainer">@color/md_theme_onTertiaryContainer</item>
|
||||
<item name="colorError">@color/md_theme_error</item>
|
||||
<item name="colorOnError">@color/md_theme_onError</item>
|
||||
<item name="colorErrorContainer">@color/md_theme_errorContainer</item>
|
||||
<item name="colorOnErrorContainer">@color/md_theme_onErrorContainer</item>
|
||||
<item name="android:colorBackground">@color/md_theme_background</item>
|
||||
<item name="colorOnBackground">@color/md_theme_onBackground</item>
|
||||
<item name="colorSurface">@color/md_theme_surface</item>
|
||||
<item name="colorOnSurface">@color/md_theme_onSurface</item>
|
||||
<item name="colorSurfaceVariant">@color/md_theme_surfaceVariant</item>
|
||||
<item name="colorOnSurfaceVariant">@color/md_theme_onSurfaceVariant</item>
|
||||
<item name="colorOutline">@color/md_theme_outline</item>
|
||||
<item name="colorOutlineVariant">@color/md_theme_outlineVariant</item>
|
||||
<item name="colorSurfaceInverse">@color/md_theme_inverseSurface</item>
|
||||
<item name="colorOnSurfaceInverse">@color/md_theme_inverseOnSurface</item>
|
||||
<item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item>
|
||||
<item name="colorPrimaryFixed">@color/md_theme_primaryFixed</item>
|
||||
<item name="colorOnPrimaryFixed">@color/md_theme_onPrimaryFixed</item>
|
||||
<item name="colorPrimaryFixedDim">@color/md_theme_primaryFixedDim</item>
|
||||
<item name="colorOnPrimaryFixedVariant">@color/md_theme_onPrimaryFixedVariant</item>
|
||||
<item name="colorSecondaryFixed">@color/md_theme_secondaryFixed</item>
|
||||
<item name="colorOnSecondaryFixed">@color/md_theme_onSecondaryFixed</item>
|
||||
<item name="colorSecondaryFixedDim">@color/md_theme_secondaryFixedDim</item>
|
||||
<item name="colorOnSecondaryFixedVariant">@color/md_theme_onSecondaryFixedVariant</item>
|
||||
<item name="colorTertiaryFixed">@color/md_theme_tertiaryFixed</item>
|
||||
<item name="colorOnTertiaryFixed">@color/md_theme_onTertiaryFixed</item>
|
||||
<item name="colorTertiaryFixedDim">@color/md_theme_tertiaryFixedDim</item>
|
||||
<item name="colorOnTertiaryFixedVariant">@color/md_theme_onTertiaryFixedVariant</item>
|
||||
<item name="colorSurfaceDim">@color/md_theme_surfaceDim</item>
|
||||
<item name="colorSurfaceBright">@color/md_theme_surfaceBright</item>
|
||||
<item name="colorSurfaceContainerLowest">@color/md_theme_surfaceContainerLowest</item>
|
||||
<item name="colorSurfaceContainerLow">@color/md_theme_surfaceContainerLow</item>
|
||||
<item name="colorSurfaceContainer">@color/md_theme_surfaceContainer</item>
|
||||
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
|
||||
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MyApplication" parent="Base.Theme.MyApplication" />
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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 that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
6
app/src/main/res/xml/device_admin.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-policies>
|
||||
<force-lock />
|
||||
</uses-policies>
|
||||
</device-admin>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.aldo.apps.familyhelpers;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
4
build.gradle
Normal file
@@ -0,0 +1,4 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.2.0-beta03' apply false
|
||||
}
|
||||
21
gradle.properties
Normal file
@@ -0,0 +1,21 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Thu Mar 06 15:05:01 CET 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
gradlew
vendored
Executable file
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
17
settings.gradle
Normal file
@@ -0,0 +1,17 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "My Application"
|
||||
include ':app'
|
||||