加上點選呼叫鬧鐘畫面
This commit is contained in:
parent
6aaea610b8
commit
27995305a4
@ -13,10 +13,14 @@ class MainActivity : AppCompatActivity() {
|
||||
private val callback = object : PermissionUtil.PermissionResultCallback {
|
||||
override fun onGrant() {
|
||||
PreferenceUtil.isGranted = true
|
||||
if (ClockUpdateService.isServiceRunning) return
|
||||
startForegroundService(
|
||||
Intent(this@MainActivity, ClockUpdateService::class.java)
|
||||
)
|
||||
if (!ClockUpdateService.isServiceRunning) {
|
||||
startForegroundService(
|
||||
Intent(this@MainActivity, ClockUpdateService::class.java)
|
||||
)
|
||||
}
|
||||
/*val intent = Intent("android.intent.action.SHOW_ALARMS")
|
||||
startActivity(intent)
|
||||
finish()*/
|
||||
}
|
||||
|
||||
override fun onDeny(denies: ArrayList<String>?) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.ray650128.iosclockwidget.receiver
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetProvider
|
||||
import android.content.ComponentName
|
||||
@ -12,6 +13,7 @@ import android.widget.RemoteViews
|
||||
import com.ray650128.iosclockwidget.ClockUpdateService
|
||||
import com.ray650128.iosclockwidget.R
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of App Widget functionality.
|
||||
*/
|
||||
@ -69,6 +71,11 @@ internal fun updateAppWidget(
|
||||
tempCanvas.drawBitmap(bmpOriginal, 0f, 0f, null)
|
||||
views.setImageViewBitmap(R.id.imageView, bmpResult)
|
||||
|
||||
// Click to call Alarm
|
||||
val alarmClockIntent = Intent("android.intent.action.SHOW_ALARMS")
|
||||
val pendingIntent = PendingIntent.getActivity(context, 0, alarmClockIntent, PendingIntent.FLAG_IMMUTABLE)
|
||||
views.setOnClickPendingIntent(R.id.imageView, pendingIntent)
|
||||
|
||||
// Instruct the widget manager to update the widget
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user