-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
710 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
namespace "dev.toolworks.trustynotes" | ||
compileSdkVersion rootProject.ext.compileSdkVersion | ||
defaultConfig { | ||
applicationId "dev.toolworks.trustynotes" | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_17 | ||
targetCompatibility JavaVersion.VERSION_17 | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" | ||
implementation 'androidx.core:core-splashscreen:1.0.1' | ||
implementation project(':capacitor-android') | ||
implementation project(':capacitor-cordova-android-plugins') | ||
} | ||
|
||
apply from: 'capacitor.build.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
android/app/src/main/java/dev/toolworks/trustynotes/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package dev.toolworks.trustynotes; | ||
|
||
import android.os.Bundle; | ||
import android.Manifest; | ||
import android.content.pm.PackageManager; | ||
import android.widget.Toast; | ||
import androidx.core.app.ActivityCompat; | ||
import androidx.core.content.ContextCompat; | ||
import com.getcapacitor.BridgeActivity; | ||
import java.util.ArrayList; | ||
import androidx.appcompat.app.AppCompatDelegate; | ||
import android.view.View; | ||
import android.graphics.Color; | ||
|
||
public class MainActivity extends BridgeActivity { | ||
private static final int PERMISSION_REQUEST_CODE = 123; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); | ||
|
||
super.onCreate(savedInstanceState); | ||
|
||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
View decorView = getWindow().getDecorView(); | ||
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); | ||
} | ||
|
||
checkPermissions(); | ||
} | ||
|
||
private void checkPermissions() { | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { | ||
// For Android 13+ | ||
String[] permissions = { | ||
Manifest.permission.READ_MEDIA_IMAGES, | ||
Manifest.permission.READ_MEDIA_VIDEO, | ||
Manifest.permission.READ_MEDIA_AUDIO | ||
}; | ||
requestPermissions(permissions); | ||
} else { | ||
// For Android 12 and below | ||
String[] permissions = { | ||
Manifest.permission.READ_EXTERNAL_STORAGE, | ||
Manifest.permission.WRITE_EXTERNAL_STORAGE | ||
}; | ||
requestPermissions(permissions); | ||
} | ||
} | ||
|
||
private void requestPermissions(String[] permissions) { | ||
ArrayList<String> permissionsToRequest = new ArrayList<>(); | ||
|
||
for (String permission : permissions) { | ||
if (ContextCompat.checkSelfPermission(this, permission) | ||
!= PackageManager.PERMISSION_GRANTED) { | ||
permissionsToRequest.add(permission); | ||
} | ||
} | ||
|
||
if (!permissionsToRequest.isEmpty()) { | ||
ActivityCompat.requestPermissions( | ||
this, | ||
permissionsToRequest.toArray(new String[0]), | ||
PERMISSION_REQUEST_CODE | ||
); | ||
} | ||
} | ||
|
||
@Override | ||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { | ||
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
if (requestCode == PERMISSION_REQUEST_CODE) { | ||
boolean allGranted = true; | ||
for (int result : grantResults) { | ||
if (result != PackageManager.PERMISSION_GRANTED) { | ||
allGranted = false; | ||
break; | ||
} | ||
} | ||
if (!allGranted) { | ||
// Handle the case where permissions are denied | ||
Toast.makeText(this, "Required permissions not granted", Toast.LENGTH_LONG).show(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@color/colorPrimary" /> | ||
<item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/ic_launcher" /> | ||
</item> | ||
</layer-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
<item name="android:navigationBarColor">@android:color/transparent</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:windowLightStatusBar">false</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
<item name="android:navigationBarColor">@android:color/transparent</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:windowLightStatusBar">false</item> | ||
<item name="android:windowLightNavigationBar">false</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<resources> | ||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> | ||
<item name="android:forceDarkAllowed">true</item> | ||
<item name="android:windowLightStatusBar">false</item> | ||
<item name="android:windowLightNavigationBar">false</item> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
<item name="android:navigationBarColor">@android:color/transparent</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:enforceStatusBarContrast">false</item> | ||
<item name="android:enforceNavigationBarContrast">false</item> | ||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#FFFFFF</color> | ||
<color name="colorPrimaryDark">#FFFFFF</color> | ||
<color name="colorAccent">#3880FF</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">Trusty Notes</string> | ||
<string name="title_activity_main">Trusty Notes</string> | ||
<string name="package_name">dev.toolworks.trustynotes</string> | ||
<string name="custom_url_scheme">dev.toolworks.trustynotes</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> | ||
<item name="colorPrimary">@color/colorPrimary</item> | ||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||
<item name="colorAccent">@color/colorAccent</item> | ||
<item name="android:windowLightStatusBar">false</item> | ||
<item name="android:statusBarColor">@color/colorPrimaryDark</item> | ||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:windowBackground">@color/background_material_dark</item> | ||
</style> | ||
|
||
<style name="AppTheme.NoActionBar" parent="AppTheme"> | ||
<item name="windowActionBar">false</item> | ||
<item name="windowNoTitle">true</item> | ||
</style> | ||
|
||
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen"> | ||
<item name="windowSplashScreenBackground">@color/background_material_dark</item> | ||
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item> | ||
<item name="postSplashScreenTheme">@style/AppTheme</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
buildscript { | ||
ext { | ||
compileSdkVersion = 34 | ||
targetSdkVersion = 34 | ||
minSdkVersion = 23 | ||
androidxAppCompatVersion = '1.6.1' | ||
} | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:8.7.2' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
android/capacitor-cordova-android-plugins/cordova.variables.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
android.useAndroidX=true | ||
android.enableJetifier=true | ||
org.gradle.jvmargs=-Xmx2048m | ||
android.defaults.buildfeatures.buildconfig=true | ||
android.nonTransitiveRClass=false | ||
android.nonFinalResIds=false |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.