Removed shortcuts.xml, Changed shortcut icon, to lower case "Start stopwatch".

This commit is contained in:
MohitMaliDeveloper 2022-11-21 12:57:55 +05:30
parent 260fb70612
commit ea217b9988
47 changed files with 99 additions and 72 deletions

View File

@ -51,23 +51,6 @@ class App : Application(), LifecycleObserver {
}
checkUseEnglish()
if (isNougatMR1Plus()) {
val shortcutManager = getSystemService(ShortcutManager::class.java)
val intent = Intent(this, SplashActivity::class.java).apply {
putExtra(OPEN_TAB, TAB_STOPWATCH)
putExtra(TOGGLE_STOPWATCH, true)
action = STOPWATCH_TOGGLE_ACTION
}
val shortcut = ShortcutInfo.Builder(this, STOPWATCH_SHORTCUT_ID)
.setShortLabel(getString(R.string.stopwatch))
.setLongLabel(getString(R.string.start_stopwatch))
.setIcon(Icon.createWithResource(this, R.drawable.ic_stopwatch_vector))
.setIntent(
intent
)
.build()
shortcutManager.dynamicShortcuts = listOf(shortcut)
}
}
override fun onTerminate() {

View File

@ -1,7 +1,11 @@
package com.simplemobiletools.clock.activities
import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.ShortcutInfo
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Icon
import android.graphics.drawable.LayerDrawable
import android.os.Bundle
import android.view.WindowManager
import android.widget.ImageView
@ -69,8 +73,44 @@ class MainActivity : SimpleActivity() {
}
setupTabColors()
checkShortcuts()
}
@SuppressLint("NewApi")
private fun checkShortcuts() {
val appIconColor = config.appIconColor
if (isNougatMR1Plus() && config.lastHandledShortcutColor != appIconColor) {
val launchDialpad = getLaunchStopwatchShortcut(appIconColor)
try {
shortcutManager.dynamicShortcuts = listOf(launchDialpad)
config.lastHandledShortcutColor = appIconColor
} catch (ignored: Exception) {
}
}
}
@SuppressLint("NewApi")
private fun getLaunchStopwatchShortcut(appIconColor: Int): ShortcutInfo {
val newEvent = getString(R.string.start_stopwatch)
val drawable = resources.getDrawable(R.drawable.shortcut_stopwatch)
(drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_stopwatch_background).applyColorFilter(appIconColor)
val bmp = drawable.convertToBitmap()
val intent = Intent(this, SplashActivity::class.java).apply {
putExtra(OPEN_TAB, TAB_STOPWATCH)
putExtra(TOGGLE_STOPWATCH, true)
action = STOPWATCH_TOGGLE_ACTION
}
return ShortcutInfo.Builder(this, STOPWATCH_SHORTCUT_ID)
.setShortLabel(newEvent)
.setLongLabel(newEvent)
.setIcon(Icon.createWithBitmap(bmp))
.setIntent(intent)
.build()
}
override fun onPause() {
super.onPause()
storeStateVariables()

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shortcut_stopwatch_background">
<shape android:shape="oval">
<solid android:color="@color/color_primary" />
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_stopwatch_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin" />
</layer-list>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">ساعة التوقيف</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">اللفه</string>
<string name="stopwatch_stopped">تم إيقاف ساعة التوقيف</string>
<string name="timer_stopped">تم إيقاف الموقت</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Sayğac</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Dövrə</string>
<string name="stopwatch_stopped">Saniyəölçən dayandı</string>
<string name="timer_stopped">Sayğaç dayandı</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Гадзіннік</string>
<string name="timer">Таймер</string>
<string name="stopwatch">Секундамер</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Круг</string>
<string name="stopwatch_stopped">Секундамер спынены</string>
<string name="timer_stopped">Таймер спынены</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Часовник</string>
<string name="timer">Таймер</string>
<string name="stopwatch">Секундомер</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Обиколка</string>
<string name="stopwatch_stopped">Секундомерът е спрян</string>
<string name="timer_stopped">Таймерът е спрян</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Temporitzador</string>
<string name="stopwatch">Cronòmetre</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Volta</string>
<string name="stopwatch_stopped">S\'ha aturat el cronòmetre</string>
<string name="timer_stopped">S\'ha aturat el temporitzador</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Hodiny</string>
<string name="timer">Časovač</string>
<string name="stopwatch">Stopky</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Mezičas</string>
<string name="stopwatch_stopped">Stopky byly zastaveny</string>
<string name="timer_stopped">Časovač byl zastaven</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Amserydd</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Lap</string>
<string name="stopwatch_stopped">Cafodd y stopwats ei stopio</string>
<string name="timer_stopped">Cafodd yr amserydd ei stopio</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Æggeur</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Mellemtid</string>
<string name="stopwatch_stopped">Stopuret er standset</string>
<string name="timer_stopped">Æggeuret er standset</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stoppuhr</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Runde</string>
<string name="stopwatch_stopped">Die Stoppuhr wurde angehalten</string>
<string name="timer_stopped">Der Timer wurde angehalten</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Ρολόι</string>
<string name="timer">Χρονόμετρο</string>
<string name="stopwatch">Χρονομετρητής</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Γύρος</string>
<string name="stopwatch_stopped">Ο χρονοδιακόπτης σταμάτησε</string>
<string name="timer_stopped">Το χρονόμετρο σταμάτησε</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Lap</string>
<string name="stopwatch_stopped">Stopwatch has been stopped</string>
<string name="timer_stopped">Timer has been stopped</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Reloj</string>
<string name="timer">Temporizador</string>
<string name="stopwatch">Cronómetro</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Vuelta</string>
<string name="stopwatch_stopped">El cronómetro se ha detenido</string>
<string name="timer_stopped">El temporizador se ha detenido</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Taimer</string>
<string name="stopwatch">Stopper</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Ringi aeg</string>
<string name="stopwatch_stopped">Stopper on kinni</string>
<string name="timer_stopped">Taimer on peatunud</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Tenporizagailua</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Bira</string>
<string name="stopwatch_stopped">Kronometroa gelditu da</string>
<string name="timer_stopped">Tenporizagailua gelditu da</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Ajastin</string>
<string name="stopwatch">Ajanotto</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Kierrosaika</string>
<string name="stopwatch_stopped">Sekuntikello pysäytetty</string>
<string name="timer_stopped">Ajastin on pysäytetty</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Minuterie</string>
<string name="stopwatch">Chronomètre</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Tour</string>
<string name="stopwatch_stopped">Chronomètre arrêté</string>
<string name="timer_stopped">La minuterie a été arrêtée</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Reloxo</string>
<string name="timer">Temporizador</string>
<string name="stopwatch">Cronómetro</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Volta</string>
<string name="stopwatch_stopped">O cronómetro detívose</string>
<string name="timer_stopped">O temporizador detívose</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Sat</string>
<string name="timer">Brojač</string>
<string name="stopwatch">Štoperica</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Runda</string>
<string name="stopwatch_stopped">Štoperica je zaustavljena</string>
<string name="timer_stopped">Brojač je zaustavljen</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Időzítő</string>
<string name="stopwatch">stopperóra</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Kör</string>
<string name="stopwatch_stopped">A stopper leállt</string>
<string name="timer_stopped">Az időzítő leállt</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Putaran</string>
<string name="stopwatch_stopped">Stopwatch telah berhenti</string>
<string name="timer_stopped">Timer telah berhenti</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Contaminuti</string>
<string name="stopwatch">Cronometro</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Parziale</string>
<string name="stopwatch_stopped">Il cronometro è stato fermato</string>
<string name="timer_stopped">Il contaminuti è stato fermato</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">טיימר</string>
<string name="stopwatch">סטופר</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">הקפה</string>
<string name="stopwatch_stopped">שעון העצר הופסק</string>
<string name="timer_stopped">הטיימר הופסק</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">タイマー</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">ラップ</string>
<string name="stopwatch_stopped">ストップウォッチが停止しました</string>
<string name="timer_stopped">タイマーが停止しました</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Laikmatis</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Etapas</string>
<string name="stopwatch_stopped">Chronometras buvo sustabdytas</string>
<string name="timer_stopped">Laikmatis buvo sustabdytas</string>

View File

@ -8,7 +8,7 @@
<string name="clock">ക്ലോക്ക്</string>
<string name="timer">ടൈമർ</string>
<string name="stopwatch">സ്റ്റോപ്പ് വാച്ച്</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">ലാപ്‌</string>
<string name="stopwatch_stopped">സ്റ്റോപ്പ് വാച്ച് നിർത്തിയിരിക്കുന്നു</string>
<string name="timer_stopped">ടൈമർ നിർത്തിയിരിക്കുന്നു</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Runde</string>
<string name="stopwatch_stopped">Stoppeklokke er stoppet</string>
<string name="timer_stopped">Timer er stoppet</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Klok</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Ronde</string>
<string name="stopwatch_stopped">Stopwatch is gestopt</string>
<string name="timer_stopped">Timer is gestopt</string>

View File

@ -9,7 +9,7 @@
<string name="no_days_selected">کوئی دن نہیں چݨے اے</string>
<string name="timer">سماں والا</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">لیپ</string>
<string name="stopwatch_stopped">Stopwatch has been stopped</string>
<string name="timer_stopped">Timer has been stopped</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Zegar</string>
<string name="timer">Minutnik</string>
<string name="stopwatch">Stoper</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Okrążenie</string>
<string name="stopwatch_stopped">Stoper został zatrzymany</string>
<string name="timer_stopped">Minutnik został zatrzymany</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Temporizador</string>
<string name="stopwatch">Cronômetro</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Volta</string>
<string name="stopwatch_stopped">O cronômetro foi parado</string>
<string name="timer_stopped">O temporizador foi parado</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">Temporizador</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Volta</string>
<string name="stopwatch_stopped">Cronómetro parado</string>
<string name="timer_stopped">Temporizador parado</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Ceas</string>
<string name="timer">Temporizator</string>
<string name="stopwatch">Cronometru</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Tură</string>
<string name="stopwatch_stopped">Cronometrul a fost oprit</string>
<string name="timer_stopped">Temporizatorul a fost oprit</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Часы</string>
<string name="timer">Таймер</string>
<string name="stopwatch">Секундомер</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Круг</string>
<string name="stopwatch_stopped">Секундомер остановлен</string>
<string name="timer_stopped">Таймер остановлен</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Hodinky</string>
<string name="timer">Časovač</string>
<string name="stopwatch">Stopky</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Okruh</string>
<string name="stopwatch_stopped">Stopky boli zastavené</string>
<string name="timer_stopped">Časovač bol zastavený</string>

View File

@ -9,7 +9,7 @@
<string name="clock">Ura</string>
<string name="timer">Časovnik</string>
<string name="stopwatch">Štoparica</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="stopwatch_stopped">Štoparica se je ustavila</string>
<string name="timer_stopped">Časovnik je bil ustavljen</string>
<string name="max_reminder_duration">Najdaljše trajanje opomnika</string>

View File

@ -4,7 +4,7 @@
<string name="clock">Сат</string>
<string name="timer">Сат</string>
<string name="stopwatch">Штоперица</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Круг</string>
<string name="app_name">Једноставан сат</string>
<string name="app_launcher_name">Сат</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Klocka</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stoppur</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Varv</string>
<string name="stopwatch_stopped">Stoppuret har stoppats</string>
<string name="timer_stopped">Timern har stoppats</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Lap</string>
<string name="stopwatch_stopped">Stopwatch has been stopped</string>
<string name="timer_stopped">Timer has been stopped</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Saat</string>
<string name="timer">Zamanlayıcı</string>
<string name="stopwatch">Kronometre</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Tur</string>
<string name="stopwatch_stopped">Kronometre durduruldu</string>
<string name="timer_stopped">Zamanlayıcı durduruldu</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Таймер</string>
<string name="stopwatch">Секундомір</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Інтервал</string>
<string name="stopwatch_stopped">Секундомір зупинено</string>
<string name="timer_stopped">Таймер зупинено</string>

View File

@ -8,7 +8,7 @@
<string name="clock">时钟</string>
<string name="timer">定时器</string>
<string name="stopwatch">秒表</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">分段</string>
<string name="stopwatch_stopped">秒表已停止</string>
<string name="timer_stopped">定时器已停止</string>

View File

@ -7,7 +7,7 @@
<string name="clock">Clock</string>
<string name="timer">計時器</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">分段</string>
<string name="stopwatch_stopped">碼錶已停止</string>
<string name="timer_stopped">計時器已停止</string>

View File

@ -8,7 +8,7 @@
<string name="clock">Clock</string>
<string name="timer">Timer</string>
<string name="stopwatch">Stopwatch</string>
<string name="start_stopwatch">Start Stopwatch</string>
<string name="start_stopwatch">Start stopwatch</string>
<string name="lap">Lap</string>
<string name="stopwatch_stopped">Stopwatch has been stopped</string>
<string name="timer_stopped">Timer has been stopped</string>

View File

@ -1,12 +0,0 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_stopwatch_vector"
android:shortcutId="compose"
android:shortcutShortLabel="@string/startup">
<intent
android:action="FLAG_ACTIVITY_NEW_TASK"
android:targetClass="com.simplemobiletools.clock.App"
android:targetPackage="com.simplemobiletools.clock" />
</shortcut>
</shortcuts>