Skip to content

Commit

Permalink
v1.7.1
Browse files Browse the repository at this point in the history
- update targetSdk to 34
- fix Android 14
  • Loading branch information
Yanndroid committed Dec 22, 2023
1 parent 56ff407 commit 4e3c505
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 31 deletions.
31 changes: 20 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@ plugins {
id 'kotlin-android'
}

def locales = file('src/main/res').listFiles(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
return name.matches('values-.*') && new File(dir, name).list().contains('strings.xml')
}
}).collect { it.name.substring(7) }

print("Locales: " + locales.join(', '))

android {
compileSdk 30
compileSdk 34

defaultConfig {
applicationId "de.dlyt.yanndroid.notinotes"
minSdk 26
targetSdk 30
versionCode 11
versionName "1.7.0"
targetSdk 34
versionCode 12
versionName "1.7.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resConfigs locales
}

buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -29,16 +38,16 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'de.dlyt.yanndroid.notinotes'
}

configurations.all {
exclude group: 'androidx.core', module: 'core'
}

dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'io.github.oneuiproject.sesl:appcompat:1.3.0'
implementation 'io.github.oneuiproject.sesl:picker-color:1.0.1'
implementation 'com.google.code.gson:gson:2.9.0'
implementation("androidx.annotation:annotation-experimental") { version { strictly("1.1.0") } }
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'io.github.oneuiproject.sesl:appcompat:1.4.0'
implementation 'io.github.oneuiproject.sesl:picker-color:1.1.0'
implementation 'com.google.code.gson:gson:2.10.1'
}
Binary file modified app/release/app-release.aab
Binary file not shown.
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 11,
"versionName": "1.7.0",
"versionCode": 12,
"versionName": "1.7.1",
"outputFile": "app-release.apk"
}
],
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.dlyt.yanndroid.notinotes">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission
android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand All @@ -13,6 +18,7 @@
android:name=".DialogActivity"
android:excludeFromRecents="true"
android:exported="false"
android:noHistory="true"
android:theme="@style/Transparent"
android:windowSoftInputMode="adjustResize" />

Expand All @@ -34,6 +40,7 @@
<intent-filter>
<action android:name="de.dlyt.yanndroid.notinotes.EDIT" />
<action android:name="de.dlyt.yanndroid.notinotes.DELETE" />
<action android:name="de.dlyt.yanndroid.notinotes.DISMISS" />
<action android:name="de.dlyt.yanndroid.notinotes.SHOW" />
</intent-filter>
<intent-filter>
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/de/dlyt/yanndroid/notinotes/ActionReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ActionReceiver : BroadcastReceiver() {
companion object {
val ACTION_EDIT = "de.dlyt.yanndroid.notinotes.EDIT"
val ACTION_DELETE = "de.dlyt.yanndroid.notinotes.DELETE"
val ACTION_DISMISS = "de.dlyt.yanndroid.notinotes.DISMISS"
val ACTION_SHOW = "de.dlyt.yanndroid.notinotes.SHOW"
val EXTRA_NOTE = "intent_note"

Expand All @@ -32,11 +33,22 @@ class ActionReceiver : BroadcastReceiver() {
Notification.createNotificationChannel(context)
Notification.showAll(context)
}

ACTION_DISMISS -> {
val note = (intent.getSerializableExtra(EXTRA_NOTE) ?: return) as Notes.Note
if (note.locked) { //A14 don't delete locked notes when dismissed
Notification.show(context, note)
} else {
Notes.deleteNote(context, note)
}
}

ACTION_DELETE -> {
val note = (intent.getSerializableExtra(EXTRA_NOTE) ?: return) as Notes.Note
Notes.deleteNote(context, note)
//todo notify TileService Detail View
}

ACTION_EDIT, ACTION_SHOW -> {
val note = (intent.getSerializableExtra(EXTRA_NOTE) ?: return) as Notes.Note
val dialogIntent = Intent(context, DialogActivity::class.java)
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/java/de/dlyt/yanndroid/notinotes/DialogActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package de.dlyt.yanndroid.notinotes
import android.app.KeyguardManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.util.TypedValue
import android.view.Gravity
Expand Down Expand Up @@ -47,7 +49,15 @@ class DialogActivity : AppCompatActivity() {
setContentView(R.layout.activity_dialog)
window.setGravity(Gravity.BOTTOM)

sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (checkSelfPermission(android.Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_DENIED) {
requestPermissions(arrayOf(android.Manifest.permission.POST_NOTIFICATIONS), 0)
}
}

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
}
mKeyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
mKeyguardManager.requestDismissKeyguard(this, null)

Expand Down
12 changes: 2 additions & 10 deletions app/src/main/java/de/dlyt/yanndroid/notinotes/Notification.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,10 @@ class Notification {
ActionReceiver.getPendingIntent(context, note, ActionReceiver.ACTION_DELETE)
)
.setContentIntent(
ActionReceiver.getPendingIntent(
context,
note,
ActionReceiver.ACTION_SHOW
)
ActionReceiver.getPendingIntent(context, note, ActionReceiver.ACTION_SHOW)
)
.setDeleteIntent(
ActionReceiver.getPendingIntent(
context,
note,
ActionReceiver.ACTION_DELETE
)
ActionReceiver.getPendingIntent(context, note, ActionReceiver.ACTION_DISMISS)
)
.setColor(note.color)

Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/de/dlyt/yanndroid/notinotes/QSTile.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.dlyt.yanndroid.notinotes

import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.net.Uri
Expand Down Expand Up @@ -31,7 +32,18 @@ class QSTile : TileService() {
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
dialogIntent.action = ActionReceiver.ACTION_EDIT
dialogIntent.putExtra(ActionReceiver.EXTRA_NOTE, Notes.defaultSettingNote(context))
startActivityAndCollapse(dialogIntent)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
val pendingDialogIntent = PendingIntent.getActivity(
context,
0,
dialogIntent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
startActivityAndCollapse(pendingDialogIntent)
} else {
startActivityAndCollapse(dialogIntent)
}
}

/** #### Detail view (samsung only) #### **/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Jan 19 12:18:26 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-rc-2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 4e3c505

Please sign in to comment.