Browse Source

added a Mensa shortcut

* added a Mensa shortcut, to directly display the Mensa-Screen
* kotlin 1.3.60 -> 1.3.61
pull/38/head
Jannik 3 years ago
parent
commit
9907d083e9
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 3
      app/src/main/AndroidManifest.xml
  2. 8
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  3. 15
      app/src/main/res/layouts/activities/xml/shortcuts.xml
  4. 3
      app/src/main/res/values-de-rDE/strings.xml
  5. 5
      app/src/main/res/values/strings.xml
  6. 2
      build.gradle

3
app/src/main/AndroidManifest.xml

@ -23,6 +23,9 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity

8
app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt

@ -85,9 +85,17 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
nav_view.setNavigationItemSelectedListener(this)
// TODO use a switch expression
// if we get an NFC read intent while the app is closed call readBalance
if (NfcAdapter.ACTION_TECH_DISCOVERED == intent.action)
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) {

15
app/src/main/res/layouts/activities/xml/shortcuts.xml

@ -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>

3
app/src/main/res/values-de-rDE/strings.xml

@ -46,5 +46,8 @@
<!-- errors -->
<string name="error">Fehler</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>

5
app/src/main/res/values/strings.xml

@ -59,6 +59,11 @@
<string name="error">Error</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 -->
<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>

2
build.gradle

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close