Skip to content

Commit

Permalink
v1.3.1
Browse files Browse the repository at this point in the history
- hide on lockscreen
- delete on swipe option
- overall improvements

- reverted "fix" which was causing a crash on a12
- a122 close panel still not working
  • Loading branch information
Yanndroid committed Jun 9, 2022
1 parent 536a265 commit 208c226
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "de.dlyt.yanndroid.notinotes"
minSdk 26
targetSdk 31
versionCode 4
versionName "1.3.0"
versionCode 5
versionName "1.3.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
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": 4,
"versionName": "1.3.0",
"versionCode": 5,
"versionName": "1.3.1",
"outputFile": "app-release.apk"
}
],
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.dlyt.yanndroid.notinotes">

<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
Expand Down
41 changes: 28 additions & 13 deletions app/src/main/java/de/dlyt/yanndroid/notinotes/QSTile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import android.graphics.PixelFormat
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.os.IBinder
import android.provider.Settings
import android.service.quicksettings.IQSService
import android.service.quicksettings.TileService
import android.util.Log
import android.view.Gravity
Expand All @@ -40,15 +38,6 @@ import java.util.stream.Collectors

class QSTile : TileService() {

private var mTileToken: IBinder? = null
private var mService: IQSService? = null

override fun onBind(intent: Intent): IBinder {
mService = IQSService.Stub.asInterface(intent.getIBinderExtra(EXTRA_SERVICE))
mTileToken = intent.getIBinderExtra(EXTRA_TOKEN)
return super.onBind(intent)
}

private val NOTIFICATION_GROUP = "de.dlyt.yanndroid.notinotes.NOTES_GROUP"
private val NOTIFICATION_GROUP_HOLDER = -1
private val NOTIFICATION_CHANNEL = "1234"
Expand Down Expand Up @@ -319,7 +308,7 @@ class QSTile : TileService() {
val pIcon: ImageView

init {
mService?.onStartActivity(mTileToken)
closePanelAndUnlock()
windowManager = getSystemService(WINDOW_SERVICE) as WindowManager
val params = WindowManager.LayoutParams(
(resources.displayMetrics.widthPixels * 0.90).toInt(),
Expand Down Expand Up @@ -396,6 +385,31 @@ class QSTile : TileService() {
)
}

@SuppressLint("WrongConstant")
private fun closePanelAndUnlock() {
//unlock phone if locked
if (isLocked) unlockAndRun(null)

//close panel, won't work for A12+
try {
Class.forName("android.app.StatusBarManager").getMethod("collapsePanels")
.invoke(context.getSystemService("statusbar"))
} catch (e: Exception) {
Log.e("closePanel", e.message.toString())
try {
context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
} catch (e: Exception) {
Log.e("closePanel", e.message.toString())
}
}

//mService?.onStartActivity(mTileToken)
/*val intent = Intent(this, QSTile::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivityAndCollapse(intent)*/

}

/** #### App update #### **/

private fun checkForUpdate() {
Expand All @@ -406,7 +420,8 @@ class QSTile : TileService() {
val hashMap = HashMap<String?, String?>()
for (child in snapshot.children) hashMap[child.key] = child.value.toString()

if (hashMap[context.getString(R.string.firebase_versionCode)]?.toInt() ?: 0 > context.packageManager.getPackageInfo(
if ((hashMap[context.getString(R.string.firebase_versionCode)]?.toInt()
?: 0) > context.packageManager.getPackageInfo(
context.packageName,
0
).versionCode
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
<string name="download">Download</string>
<string name="update_available_desc">A new version is available: %s</string>
<string name="hide_on_lockscreen">Hide on Lockscreen</string>
<string name="locked">Locked</string>
<string name="locked">Lock in Notifications</string>
</resources>

0 comments on commit 208c226

Please sign in to comment.