added a Mensa shortcut
* added a Mensa shortcut, to directly display the Mensa-Screen * kotlin 1.3.60 -> 1.3.61
This commit is contained in:
parent
d4860b2a32
commit
9907d083e9
|
@ -23,6 +23,9 @@
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/shortcuts" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -85,9 +85,17 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
|
|
||||||
nav_view.setNavigationItemSelectedListener(this)
|
nav_view.setNavigationItemSelectedListener(this)
|
||||||
|
|
||||||
|
// TODO use a switch expression
|
||||||
// if we get an NFC read intent while the app is closed call readBalance
|
// if we get an NFC read intent while the app is closed call readBalance
|
||||||
if (NfcAdapter.ACTION_TECH_DISCOVERED == intent.action)
|
if (NfcAdapter.ACTION_TECH_DISCOVERED == intent.action)
|
||||||
NFCMensaCard.readBalance(intent, this)
|
NFCMensaCard.readBalance(intent, this)
|
||||||
|
if ("org.mosad.seil0.projectlaogai.fragments.MensaFragment" == intent.action) {
|
||||||
|
println("starting mensa screen")
|
||||||
|
// TODO find a way to use only one FragmentTransaction
|
||||||
|
val fragmentTransaction2: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||||
|
fragmentTransaction2.replace(R.id.fragment_container, MensaFragment())
|
||||||
|
fragmentTransaction2.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="mensa"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_local_dining_black_24dp"
|
||||||
|
android:shortcutShortLabel="@string/shortcut_mensa_short"
|
||||||
|
android:shortcutLongLabel="@string/shortcut_mensa_long"
|
||||||
|
android:shortcutDisabledMessage="@string/shortcut_mensa_disabled">
|
||||||
|
<intent
|
||||||
|
android:action="org.mosad.seil0.projectlaogai.fragments.MensaFragment"
|
||||||
|
android:targetPackage="org.mosad.seil0.projectlaogai"
|
||||||
|
android:targetClass="org.mosad.seil0.projectlaogai.MainActivity" />
|
||||||
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
</shortcut>
|
||||||
|
</shortcuts>
|
|
@ -46,5 +46,8 @@
|
||||||
<!-- errors -->
|
<!-- errors -->
|
||||||
<string name="error">Fehler</string>
|
<string name="error">Fehler</string>
|
||||||
<string name="timetable_error">Stundenplan konnte nicht geladen werden!</string>
|
<string name="timetable_error">Stundenplan konnte nicht geladen werden!</string>
|
||||||
|
<string name="shortcut_mensa_disabled">Mensa deaktiviert</string>
|
||||||
|
<string name="shortcut_mensa_long">Mensa</string>
|
||||||
|
<string name="shortcut_mensa_short">Mensa</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -59,6 +59,11 @@
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
<string name="timetable_error">Could not load timetable!"</string>
|
<string name="timetable_error">Could not load timetable!"</string>
|
||||||
|
|
||||||
|
<!-- shortcuts -->
|
||||||
|
<string name="shortcut_mensa_short">Mensa</string>
|
||||||
|
<string name="shortcut_mensa_long">Mensa</string>
|
||||||
|
<string name="shortcut_mensa_disabled">Mensa disabled</string>
|
||||||
|
|
||||||
<!-- save keys -->
|
<!-- save keys -->
|
||||||
<string name="preference_file_key" translatable="false">org.mosad.seil0.projectlaogai_preferences</string>
|
<string name="preference_file_key" translatable="false">org.mosad.seil0.projectlaogai_preferences</string>
|
||||||
<string name="save_key_course" translatable="false">org.mosad.seil0.projectlaogai.course</string>
|
<string name="save_key_course" translatable="false">org.mosad.seil0.projectlaogai.course</string>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.60'
|
ext.kotlin_version = '1.3.61'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
Loading…
Reference in New Issue