AppWidget加上透過Service實現秒針轉動
This commit is contained in:
parent
d684db72ed
commit
3b25ab2ab7
@ -2,6 +2,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
@ -11,6 +13,21 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.IOSClockWidget"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
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=".AlarmService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<receiver
|
||||
android:name=".IOSClockWidget"
|
||||
android:exported="false">
|
||||
@ -22,16 +39,6 @@
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/i_o_s_clock_widget_info" />
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
119
app/src/main/java/com/ray650128/iosclockwidget/AlarmService.kt
Normal file
119
app/src/main/java/com/ray650128/iosclockwidget/AlarmService.kt
Normal file
@ -0,0 +1,119 @@
|
||||
package com.ray650128.iosclockwidget
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.*
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.os.PowerManager.WakeLock
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import java.util.*
|
||||
|
||||
|
||||
class AlarmService : Service() {
|
||||
|
||||
private val timerThread = Thread {
|
||||
while (true) {
|
||||
if (!isServiceRunning) break
|
||||
val calendar = Calendar.getInstance()
|
||||
val second = calendar[Calendar.SECOND]
|
||||
// 計算時、分、秒的旋轉角度
|
||||
secondAngle = (second * 360f / 60f)
|
||||
sendWidgetIntent()
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent): IBinder {
|
||||
throw UnsupportedOperationException("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
isServiceRunning = true
|
||||
|
||||
//RetrofitClient.init("http://192.168.0.173:8080")
|
||||
|
||||
startForeground()
|
||||
}
|
||||
|
||||
@SuppressLint("WakelockTimeout")
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
timerThread.start()
|
||||
// return START_STICKY START_NOT_STICKY START_REDELIVER_INTENT
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
isServiceRunning = false
|
||||
}
|
||||
|
||||
//region Foreground Service 必要通知
|
||||
private fun startForeground() {
|
||||
//region Android 通知設定畫面 intent
|
||||
val intent = Intent().apply {
|
||||
action = "android.settings.APP_NOTIFICATION_SETTINGS"
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
putExtra("android.provider.extra.APP_PACKAGE", packageName)
|
||||
}
|
||||
val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
PendingIntent.getActivity(this.applicationContext, SERVICE_ID, intent, PendingIntent.FLAG_MUTABLE)
|
||||
} else {
|
||||
PendingIntent.getActivity(this.applicationContext, SERVICE_ID, intent, PendingIntent.FLAG_IMMUTABLE)
|
||||
}
|
||||
//endregion
|
||||
|
||||
val channelId = createNotificationChannel() // 建立通知頻道
|
||||
val notification = NotificationCompat.Builder(this, channelId)
|
||||
.setOngoing(true) // 持續顯示,不可被清除
|
||||
.setSmallIcon(R.drawable.ic_info) // 通知 icon
|
||||
.setPriority(NotificationManager.IMPORTANCE_NONE) // 重要性=無
|
||||
.setCategory(Notification.CATEGORY_SERVICE) // 類型=服務
|
||||
.setContentIntent(pendingIntent) // 點選後的跳轉 intent
|
||||
.setContentTitle("${getString(R.string.app_name)} 執行中") // 標題
|
||||
.setContentText("您可以在設定畫面中關閉\"背景服務\"通知") // 內容
|
||||
.build()
|
||||
startForeground(SERVICE_ID, notification)
|
||||
}
|
||||
|
||||
private fun createNotificationChannel(): String {
|
||||
val channel = NotificationChannel(NOTIFICATION_SERVICE_CH, "背景服務", NotificationManager.IMPORTANCE_NONE).apply {
|
||||
enableLights(false) // 不啟用指示燈
|
||||
enableVibration(false) // 不啟用震動
|
||||
setSound(null, null) // 不啟用鈴聲
|
||||
setShowBadge(false) // 不要顯示通知圓點
|
||||
description = "背景服務常駐通知,此為必須存在的通知類型,可以將顯示通知關閉來隱藏。"
|
||||
}
|
||||
|
||||
val notificationManager = NotificationManagerCompat.from(this)
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
return NOTIFICATION_SERVICE_CH
|
||||
}
|
||||
//endregion
|
||||
|
||||
private fun sendWidgetIntent() {
|
||||
val intent = Intent(this, IOSClockWidget::class.java).apply {
|
||||
action = SECOND_CHANGED
|
||||
putExtra(SECOND_ANGLE, secondAngle)
|
||||
}
|
||||
sendBroadcast(intent)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = AlarmService::class.java.simpleName
|
||||
|
||||
const val SERVICE_ID = 0x1
|
||||
|
||||
private const val NOTIFICATION_SERVICE_CH = "clock.service"
|
||||
|
||||
var isServiceRunning = false
|
||||
|
||||
var secondAngle = 0f
|
||||
|
||||
const val SECOND_CHANGED = "SECOND_CHANGED"
|
||||
const val SECOND_ANGLE = "SECOND_ANGLE"
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,33 @@ package com.ray650128.iosclockwidget
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetProvider
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.widget.RemoteViews
|
||||
|
||||
/**
|
||||
* Implementation of App Widget functionality.
|
||||
*/
|
||||
class IOSClockWidget : AppWidgetProvider() {
|
||||
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
super.onReceive(context, intent)
|
||||
val appWidgetManager = context?.getSystemService(Context.APPWIDGET_SERVICE) as AppWidgetManager
|
||||
val appWidgetIds = appWidgetManager.getAppWidgetIds(ComponentName(context, IOSClockWidget::class.java))
|
||||
|
||||
when (intent?.action) {
|
||||
AlarmService.SECOND_CHANGED -> {
|
||||
for (appWidgetId in appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUpdate(
|
||||
context: Context,
|
||||
appWidgetManager: AppWidgetManager,
|
||||
@ -38,7 +58,13 @@ internal fun updateAppWidget(
|
||||
// Construct the RemoteViews object
|
||||
val views = RemoteViews(context.packageName, R.layout.i_o_s_clock_widget)
|
||||
views.setTextViewText(R.id.appwidget_text, widgetText)
|
||||
val bmpOriginal = BitmapFactory.decodeResource(context.applicationContext.resources, R.drawable.img_second_hand)
|
||||
val bmpResult = Bitmap.createBitmap(285, 285, Bitmap.Config.ARGB_8888)
|
||||
val tempCanvas = Canvas(bmpResult)
|
||||
tempCanvas.rotate(AlarmService.secondAngle, 285 / 2.toFloat(), 285 / 2.toFloat())
|
||||
tempCanvas.drawBitmap(bmpOriginal, 0f, 0f, null)
|
||||
views.setImageViewBitmap(R.id.imageView, bmpResult)
|
||||
|
||||
// Instruct the widget manager to update the widget
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.ray650128.iosclockwidget
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
|
||||
@ -7,5 +8,11 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
if (!AlarmService.isServiceRunning) {
|
||||
startForegroundService(
|
||||
Intent(this@MainActivity, AlarmService::class.java)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-nodpi/img_second_hand.png
Normal file
BIN
app/src/main/res/drawable-nodpi/img_second_hand.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
6
app/src/main/res/drawable/ic_info.xml
Normal file
6
app/src/main/res/drawable/ic_info.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
|
||||
</vector>
|
||||
@ -1,68 +1,231 @@
|
||||
<vector android:height="250dp" android:viewportHeight="200"
|
||||
android:viewportWidth="200" android:width="250dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M98.16,3.57l2.91,0l0,7.93l-2.91,0z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M98.16,188.5l2.91,0l0,7.92l-2.91,0z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M3.08,98.8l7.93,0l0,2.91l-7.93,0z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M188.01,98.8l7.93,0l0,2.91l-7.93,0z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M50.69,17.15l2.52,-1.45l3.96,6.87l-2.52,1.45z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M143.15,177.29l2.52,-1.45l3.96,6.86l-2.52,1.45z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M15.96,147.16l6.87,-3.97l1.45,2.52l-6.87,3.97z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M176.11,54.7l6.87,-3.97l1.45,2.52l-6.87,3.97z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M175.5,145.38l1.45,-2.51l6.84,3.95l-1.45,2.51z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M15.37,52.92l1.45,-2.51l6.84,3.95l-1.45,2.51z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M175.5,145.38l1.45,-2.51l6.84,3.95l-1.45,2.51z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M50.26,182.88l3.95,-6.84l2.51,1.45l-3.95,6.84z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M142.72,22.75l3.95,-6.84l2.51,1.45l-3.95,6.84z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M88.09,4.27l2.88,-0.3l0.83,7.86l-2.88,0.3z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M107.39,188.17l2.88,-0.3l0.83,7.86l-2.88,0.3z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M3.47,108.92l7.86,-0.83l0.3,2.88l-7.86,0.83z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M187.36,89.53l7.86,-0.83l0.3,2.88l-7.86,0.83z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M42.25,22.72l2.35,-1.7l4.64,6.39l-2.35,1.7z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M150.95,172.32l2.35,-1.7l4.64,6.39l-2.35,1.7z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M21.29,155.63l6.39,-4.64l1.7,2.35l-6.39,4.64z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M170.88,46.93l6.39,-4.64l1.7,2.35l-6.39,4.64z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M179.75,137.23l1.18,-2.65l7.22,3.21l-1.18,2.65z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M10.85,62.01l1.18,-2.65l7.22,3.21l-1.18,2.65z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M179.75,137.23l1.18,-2.65l7.22,3.21l-1.18,2.65z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M59.17,187.53l3.21,-7.22l2.65,1.18l-3.21,7.22z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M134.39,18.64l3.21,-7.22l2.65,1.18l-3.21,7.22z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M78.11,5.98l2.84,-0.6l1.64,7.73l-2.84,0.6z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M116.51,186.89l2.84,-0.6l1.64,7.73l-2.84,0.6z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M4.87,118.85l7.73,-1.64l0.6,2.84l-7.73,1.64z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M185.77,80.45l7.73,-1.64l0.6,2.84l-7.73,1.64z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M34.49,29.07l2.15,-1.94l5.29,5.87l-2.15,1.94z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M158.23,166.58l2.15,-1.94l5.29,5.87l-2.15,1.94z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M27.54,163.52l5.87,-5.29l1.94,2.15l-5.87,5.29z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M164.97,39.83l5.87,-5.29l1.94,2.15l-5.87,5.29z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M183.23,128.57l0.9,-2.76l7.51,2.44l-0.9,2.76z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M7.4,71.5l0.9,-2.76l7.51,2.44l-0.9,2.76z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M183.23,128.57l0.9,-2.76l7.51,2.44l-0.9,2.76z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M68.56,191.3l2.44,-7.51l2.76,0.9l-2.44,7.51z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M125.63,15.47l2.44,-7.51l2.76,0.9l-2.44,7.51z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M68.35,8.66l2.76,-0.9l2.44,7.51l-2.76,0.9z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M125.55,184.55l2.76,-0.9l2.44,7.51l-2.76,0.9z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M7.44,128.59l7.51,-2.44l0.9,2.76l-7.51,2.44z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M183.26,71.51l7.51,-2.44l0.9,2.76l-7.51,2.44z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M27.41,36.21l1.94,-2.15l5.87,5.29l-1.94,2.15z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M164.85,160.02l1.94,-2.15l5.87,5.29l-1.94,2.15z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M34.62,170.59l5.29,-5.87l2.15,1.94l-5.29,5.87z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M158.36,33.23l5.29,-5.87l2.15,1.94l-5.29,5.87z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M185.8,119.61l0.6,-2.84l7.73,1.64l-0.6,2.84z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M4.88,81.19l0.6,-2.84l7.73,1.64l-0.6,2.84z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M185.8,119.61l0.6,-2.84l7.73,1.64l-0.6,2.84z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M78.26,194.04l1.64,-7.73l2.84,0.6l-1.64,7.73z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M116.69,13.12l1.64,-7.73l2.84,0.6l-1.64,7.73z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M59.02,12.45l2.65,-1.18l3.21,7.22l-2.65,1.18z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M134.19,181.35l2.65,-1.18l3.21,7.22l-2.65,1.18z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M10.96,138.11l7.22,-3.21l1.18,2.65l-7.22,3.21z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M179.82,62.85l7.22,-3.21l1.18,2.65l-7.22,3.21z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M21.18,44.12l1.7,-2.35l6.39,4.64l-1.7,2.35z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M170.78,152.83l1.7,-2.35l6.39,4.64l-1.7,2.35z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M42.33,177.02l4.64,-6.39l2.35,1.7l-4.64,6.39z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M151.04,27.41l4.64,-6.39l2.35,1.7l-4.64,6.39z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M187.33,110.51l0.3,-2.88l7.86,0.83l-0.3,2.88z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M3.47,91.19l0.3,-2.88l7.86,0.83l-0.3,2.88z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M187.33,110.51l0.3,-2.88l7.86,0.83l-0.3,2.88z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M88.22,195.74l0.83,-7.86l2.88,0.3l-0.83,7.86z"/>
|
||||
<path android:fillColor="#888888" android:pathData="M107.55,11.78l0.83,-7.86l2.88,0.3l-0.83,7.86z"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="200"
|
||||
android:viewportHeight="200">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M50.41,17.07l2.16,-1.25l5.07,8.79l-2.16,1.25z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M141.76,175.3l2.16,-1.25l5.07,8.78l-2.16,1.25z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M173.84,56.01l8.79,-5.07l1.25,2.16l-8.79,5.07z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15.6,147.36l8.79,-5.07l1.25,2.16l-8.79,5.07z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15.54,52.78l1.25,-2.16l8.79,5.07l-1.25,2.16z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M173.77,144.14l1.25,-2.16l8.78,5.07l-1.25,2.16z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M141.9,24.78l5.07,-8.79l2.16,1.25l-5.07,8.79z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M50.54,183.02l5.07,-8.79l2.16,1.25l-5.07,8.79z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M98.47,3.58l2.5,0l0,10.15l-2.5,0z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M98.47,186.29l2.5,0l0,10.14l-2.5,0z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M185.9,99.01l10.15,0l0,2.5l-10.15,0z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3.18,99.01l10.15,0l0,2.5l-10.15,0z"/>
|
||||
<path
|
||||
android:pathData="M42.37,22.67l2.02,-1.47l5.96,8.21l-2.02,1.47z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M149.77,170.48l2.02,-1.47l5.96,8.2l-2.02,1.47z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M169.2,48.48l8.21,-5.96l1.47,2.02l-8.21,5.96z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M21.38,155.89l8.21,-5.96l1.47,2.02l-8.21,5.96z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M11.42,61.86l1.02,-2.28l9.27,4.13l-1.02,2.28z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M178.34,136.17l1.02,-2.28l9.26,4.12l-1.02,2.28z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M134.17,20.81l4.13,-9.27l2.28,1.02l-4.13,9.27z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M59.85,187.72l4.13,-9.27l2.28,1.02l-4.13,9.27z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M88.79,4.26l2.48,-0.26l1.06,10.09l-2.48,0.26z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M107.88,185.97l2.48,-0.26l1.06,10.08l-2.48,0.26z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M185.71,90.03l10.09,-1.06l0.26,2.48l-10.09,1.06z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M4,109.13l10.09,-1.06l0.26,2.48l-10.09,1.06z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M34.68,29.17l1.86,-1.67l6.79,7.54l-1.86,1.67z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M156.91,164.95l1.86,-1.67l6.78,7.53l-1.86,1.67z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M163.5,41.6l7.54,-6.79l1.67,1.86l-7.54,6.79z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M27.71,163.85l7.54,-6.79l1.67,1.86l-7.54,6.79z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M7.85,71.28l0.77,-2.37l9.65,3.13l-0.77,2.37z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M181.62,127.73l0.77,-2.37l9.64,3.13l-0.77,2.37z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M125.63,17.61l3.13,-9.65l2.37,0.77l-3.13,9.65z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M69.18,191.4l3.13,-9.65l2.37,0.77l-3.13,9.65z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M78.83,6l2.44,-0.52l2.11,9.92l-2.44,0.52z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M116.81,184.71l2.44,-0.52l2.11,9.92l-2.44,0.52z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M184.18,81.17l9.92,-2.11l0.52,2.44l-9.92,2.11z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M5.47,119.15l9.92,-2.11l0.52,2.44l-9.92,2.11z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M27.63,36.38l1.67,-1.86l7.54,6.79l-1.67,1.86z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M163.4,158.64l1.67,-1.86l7.53,6.78l-1.67,1.86z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M157.06,35.27l6.79,-7.54l1.86,1.67l-6.79,7.54z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M34.79,171.04l6.79,-7.54l1.86,1.67l-6.79,7.54z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M5.51,81.08l0.52,-2.44l9.92,2.11l-0.52,2.44z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M184.22,119.08l0.52,-2.44l9.92,2.11l-0.52,2.44z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M117.05,15.41l2.11,-9.92l2.44,0.52l-2.11,9.92z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M79.04,194.13l2.11,-9.92l2.44,0.52l-2.11,9.92z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M69.11,8.56l2.37,-0.77l3.13,9.65l-2.37,0.77z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M125.57,182.34l2.37,-0.77l3.13,9.64l-2.37,0.77z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M181.77,72.31l9.65,-3.13l0.77,2.37l-9.65,3.13z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M7.96,128.78l9.65,-3.13l0.77,2.37l-9.65,3.13z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M21.32,44.22l1.47,-2.02l8.21,5.96l-1.47,2.02z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M169.14,151.62l1.47,-2.02l8.2,5.96l-1.47,2.02z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M149.93,29.58l5.96,-8.21l2.02,1.47l-5.96,8.21z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M42.52,177.41l5.96,-8.21l2.02,1.47l-5.96,8.21z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M4,91.07l0.26,-2.48l10.09,1.06l-0.26,2.48z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M185.71,110.18l0.26,-2.48l10.08,1.06l-0.26,2.48z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M108.06,14.1l1.06,-10.09l2.48,0.26l-1.06,10.09z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M88.95,195.82l1.06,-10.09l2.48,0.26l-1.06,10.09z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M59.77,12.46l2.28,-1.02l4.13,9.27l-2.28,1.02z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M134.07,179.36l2.28,-1.02l4.12,9.26l-2.28,1.02z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M178.45,64.08l9.27,-4.13l1.02,2.28l-9.27,4.13z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:pathData="M11.54,138.39l9.27,-4.13l1.02,2.28l-9.27,4.13z"
|
||||
android:fillColor="#868687"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M95.4,17.8v12.9h-2V20.1c-0.8,0.7 -1.8,1.3 -3,1.6v-1.9c0.6,-0.1 1.2,-0.4 1.8,-0.8c0.6,-0.4 1.2,-0.8 1.6,-1.3H95.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M108,18.6c0.8,0.7 1.2,1.6 1.2,2.8c0,1.1 -0.4,2.1 -1.3,3c-0.5,0.5 -1.4,1.2 -2.7,2.1c-1.4,0.9 -2.2,1.7 -2.5,2.4h6.4v1.7h-8.9c0,-1.3 0.4,-2.4 1.3,-3.4c0.4,-0.5 1.4,-1.3 2.9,-2.3c0.9,-0.6 1.5,-1.1 1.8,-1.5c0.6,-0.7 0.9,-1.4 0.9,-2.1c0,-0.7 -0.2,-1.3 -0.6,-1.6c-0.4,-0.4 -1,-0.5 -1.7,-0.5c-0.8,0 -1.4,0.3 -1.8,0.8c-0.4,0.5 -0.6,1.3 -0.7,2.4h-2c0,-1.4 0.4,-2.6 1.2,-3.5c0.8,-0.9 1.9,-1.4 3.3,-1.4C106.3,17.5 107.3,17.9 108,18.6z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M103.8,171h-1.9c-0.3,-1.2 -1,-1.9 -2.3,-1.9c-0.9,0 -1.6,0.4 -2.1,1.3c-0.5,0.8 -0.8,1.9 -0.8,3.1c0,0.1 0,0.2 0,0.2h0.1c0.4,-0.6 0.8,-1 1.4,-1.3c0.5,-0.3 1.1,-0.4 1.8,-0.4c1.3,0 2.3,0.4 3,1.2c0.7,0.8 1.1,1.9 1.1,3.1c0,1.3 -0.4,2.3 -1.3,3.2c-0.9,0.8 -1.9,1.3 -3.2,1.3c-1.6,0 -2.8,-0.6 -3.6,-1.7c-0.8,-1.1 -1.2,-2.6 -1.2,-4.6c0,-2.1 0.4,-3.8 1.3,-5.1c0.9,-1.3 2,-2 3.5,-2C102.1,167.5 103.5,168.7 103.8,171zM97.6,174.5c-0.5,0.5 -0.7,1.2 -0.7,2c0,0.8 0.2,1.5 0.7,2c0.5,0.5 1.1,0.8 1.9,0.8c0.8,0 1.4,-0.3 1.9,-0.8c0.5,-0.6 0.7,-1.2 0.7,-2c0,-0.8 -0.2,-1.5 -0.7,-2c-0.5,-0.5 -1.1,-0.8 -1.9,-0.8C98.7,173.7 98.1,174 97.6,174.5z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M26.8,95.3C27.6,96.5 28,98 28,100c0,2.1 -0.4,3.8 -1.3,5.1c-0.9,1.3 -2.1,2 -3.5,2c-2.5,0 -3.9,-1.2 -4.2,-3.5h1.9c0.3,1.2 1,1.9 2.3,1.9c0.9,0 1.6,-0.4 2.1,-1.3c0.5,-0.9 0.8,-1.9 0.8,-3.1l0,-0.2H26c-0.3,0.5 -0.8,1 -1.4,1.3c-0.6,0.3 -1.1,0.4 -1.8,0.4c-1.3,0 -2.3,-0.4 -3,-1.2c-0.7,-0.8 -1.1,-1.8 -1.1,-3.1c0,-1.3 0.4,-2.4 1.3,-3.2c0.9,-0.8 1.9,-1.3 3.2,-1.3C24.8,93.6 25.9,94.2 26.8,95.3zM21.3,96c-0.5,0.5 -0.7,1.2 -0.7,2c0,0.8 0.2,1.5 0.7,2c0.5,0.5 1.1,0.8 1.9,0.8c0.8,0 1.4,-0.3 1.9,-0.8c0.5,-0.5 0.7,-1.2 0.7,-2c0,-0.8 -0.2,-1.5 -0.7,-2c-0.5,-0.5 -1.1,-0.8 -1.9,-0.8C22.4,95.3 21.8,95.5 21.3,96z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M178,94.6c0.8,0.6 1.2,1.5 1.2,2.6c0,1.4 -0.7,2.4 -2.1,2.8c0.7,0.2 1.3,0.6 1.7,1.1c0.4,0.5 0.6,1.1 0.6,1.9c0,1.2 -0.4,2.2 -1.2,2.9c-0.9,0.8 -2,1.2 -3.4,1.2c-1.3,0 -2.4,-0.3 -3.2,-1c-0.9,-0.8 -1.4,-1.9 -1.5,-3.3h2c0,0.9 0.3,1.5 0.8,2c0.5,0.4 1.1,0.6 1.8,0.6c0.8,0 1.5,-0.2 2,-0.7c0.4,-0.4 0.7,-1 0.7,-1.6c0,-0.8 -0.2,-1.3 -0.7,-1.7c-0.4,-0.4 -1.1,-0.5 -1.9,-0.5h-0.9v-1.5h0.9c0.8,0 1.4,-0.2 1.8,-0.5c0.4,-0.3 0.6,-0.8 0.6,-1.5c0,-0.6 -0.2,-1.1 -0.6,-1.5c-0.4,-0.3 -1,-0.5 -1.7,-0.5c-0.8,0 -1.4,0.2 -1.8,0.6c-0.4,0.4 -0.7,1 -0.8,1.8h-1.9c0.1,-1.3 0.6,-2.3 1.4,-3c0.8,-0.7 1.8,-1.1 3.1,-1.1C176.1,93.6 177.2,93.9 178,94.6z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M32.9,55.9v12.9h-2V58.2c-0.8,0.7 -1.8,1.3 -3,1.6v-1.9c0.6,-0.1 1.2,-0.4 1.8,-0.8c0.6,-0.4 1.2,-0.8 1.6,-1.3H32.9z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M45.8,57.5c0.8,1.2 1.1,2.8 1.1,4.8c0,2 -0.4,3.6 -1.1,4.8c-0.8,1.3 -2,1.9 -3.5,1.9c-1.5,0 -2.7,-0.6 -3.5,-1.9c-0.8,-1.2 -1.1,-2.8 -1.1,-4.8c0,-2 0.4,-3.6 1.1,-4.8c0.8,-1.3 2,-1.9 3.5,-1.9C43.8,55.6 45,56.2 45.8,57.5zM40.1,59c-0.3,0.8 -0.5,1.9 -0.5,3.3c0,1.4 0.2,2.5 0.5,3.3c0.4,1.2 1.2,1.7 2.2,1.7c1.1,0 1.8,-0.6 2.2,-1.7c0.3,-0.8 0.5,-1.9 0.5,-3.3c0,-1.4 -0.2,-2.5 -0.5,-3.3c-0.4,-1.2 -1.2,-1.7 -2.2,-1.7C41.3,57.3 40.5,57.8 40.1,59z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M167.4,130.3h1.8v8.5h1.9v1.6h-1.9v2.8h-1.9v-2.8H161v-1.9L167.4,130.3zM167.3,132.8l-4.6,6h4.7L167.3,132.8L167.3,132.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M59.1,158.3h8.6v1.6l-4.6,11.3h-2.1l4.6,-11.1h-6.6V158.3z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M139.6,29.1v12.9h-2V31.4c-0.8,0.7 -1.8,1.3 -3,1.6v-1.9c0.6,-0.1 1.2,-0.4 1.8,-0.8c0.6,-0.4 1.2,-0.8 1.6,-1.3H139.6z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M59.4,29.1v12.9h-2V31.4c-0.8,0.7 -1.8,1.3 -3,1.6v-1.9c0.6,-0.1 1.2,-0.4 1.8,-0.8c0.6,-0.4 1.2,-0.8 1.6,-1.3H59.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M70.2,29.1v12.9h-2V31.4c-0.8,0.7 -1.8,1.3 -3,1.6v-1.9c0.6,-0.1 1.2,-0.4 1.8,-0.8c0.6,-0.4 1.2,-0.8 1.6,-1.3H70.2z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M134.6,158.3h7.7v1.7h-6.2l-0.4,3.7h0.1c0.4,-0.4 0.9,-0.7 1.4,-0.9c0.5,-0.2 1,-0.3 1.6,-0.3c1.2,0 2.2,0.4 3,1.2c0.8,0.8 1.2,1.9 1.2,3.3c0,1.3 -0.5,2.4 -1.5,3.3c-0.9,0.8 -2,1.1 -3.3,1.1c-1.1,0 -2.1,-0.3 -3,-1c-0.9,-0.7 -1.4,-1.6 -1.5,-2.8h1.9c0.1,0.7 0.4,1.3 0.8,1.6c0.4,0.3 1,0.5 1.7,0.5c0.8,0 1.4,-0.2 2,-0.7c0.5,-0.5 0.8,-1.2 0.8,-2c0,-0.9 -0.2,-1.6 -0.7,-2.1s-1.1,-0.8 -2,-0.8c-0.6,0 -1.1,0.1 -1.5,0.3c-0.5,0.2 -0.8,0.5 -1.1,1h-1.8L134.6,158.3z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M40.2,132.9c0.7,0.6 1.1,1.5 1.1,2.4c0,0.7 -0.1,1.2 -0.4,1.7c-0.3,0.5 -0.8,0.8 -1.5,1.1v0.1c0.6,0.1 1.2,0.5 1.6,1.1c0.5,0.6 0.8,1.3 0.8,2.1c0,1.1 -0.4,2.1 -1.2,2.8c-0.9,0.7 -2,1.1 -3.5,1.1c-1.5,0 -2.7,-0.4 -3.5,-1.1c-0.8,-0.7 -1.2,-1.6 -1.2,-2.8c0,-0.8 0.3,-1.5 0.8,-2.1c0.4,-0.6 1,-0.9 1.6,-1.1v-0.1c-0.6,-0.3 -1.1,-0.6 -1.5,-1.1c-0.3,-0.5 -0.4,-1 -0.4,-1.7c0,-1 0.4,-1.8 1.1,-2.4c0.8,-0.7 1.9,-1.1 3.3,-1.1C38.3,131.8 39.4,132.2 40.2,132.9zM34.8,139.6c-0.5,0.4 -0.7,1 -0.7,1.7c0,0.7 0.2,1.2 0.7,1.6c0.5,0.4 1.2,0.6 2.1,0.6c0.9,0 1.6,-0.2 2.1,-0.6c0.5,-0.4 0.7,-1 0.7,-1.6c0,-0.7 -0.2,-1.3 -0.7,-1.7c-0.5,-0.5 -1.2,-0.7 -2.1,-0.7C36,138.9 35.3,139.2 34.8,139.6zM35,134c-0.4,0.4 -0.6,0.8 -0.6,1.4c0,0.6 0.2,1.1 0.5,1.5c0.4,0.4 1.1,0.6 2,0.6c0.9,0 1.6,-0.2 2,-0.6c0.3,-0.4 0.5,-0.9 0.5,-1.5c0,-0.5 -0.2,-1 -0.6,-1.4c-0.5,-0.4 -1.1,-0.6 -1.9,-0.6C36.1,133.4 35.5,133.6 35,134z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M169.3,56.7c0.8,0.7 1.2,1.6 1.2,2.8c0,1.1 -0.4,2.1 -1.3,3c-0.5,0.5 -1.4,1.2 -2.7,2.1c-1.4,0.9 -2.2,1.7 -2.5,2.4h6.4v1.7h-8.9c0,-1.3 0.4,-2.4 1.3,-3.4c0.4,-0.5 1.4,-1.3 2.9,-2.3c0.9,-0.6 1.5,-1.1 1.8,-1.5c0.6,-0.7 0.9,-1.4 0.9,-2.1c0,-0.7 -0.2,-1.3 -0.6,-1.6c-0.4,-0.4 -1,-0.5 -1.7,-0.5c-0.8,0 -1.4,0.3 -1.8,0.8c-0.4,0.5 -0.6,1.3 -0.7,2.4h-2c0,-1.4 0.4,-2.6 1.2,-3.5c0.8,-0.9 1.9,-1.4 3.3,-1.4C167.5,55.6 168.5,56 169.3,56.7z"/>
|
||||
</vector>
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
android:height="20dp"
|
||||
android:top="132.5dp">
|
||||
<shape android:shape="oval">
|
||||
<stroke android:color="@color/black" android:width="2dp" />
|
||||
<solid android:color="@color/black" />
|
||||
<stroke android:color="@color/black" android:width="4dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/Widget.IOSClockWidget.AppWidget.Container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -16,6 +17,18 @@
|
||||
android:hand_hour="@drawable/img_hour_hand"
|
||||
android:hand_minute="@drawable/img_minute_hand" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/appwidget_text"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/img_second_hand" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user