Browse Source

added Timetable and Moodle shortcut, cleaned up activity init

tags/0.5.1
Jannik Seiler 1 month ago
parent
commit
bed3f5d978
Signed by: Seil0 <seil0@mosad.xyz> GPG Key ID: E8459F3723C52C24
18 changed files with 76 additions and 33 deletions
  1. +1
    -1
      README.md
  2. +13
    -16
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  3. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt
  4. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/NFCMensaCard.kt
  5. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/PreferencesController.kt
  6. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/TCoRAPIController.kt
  7. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  8. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  9. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt
  10. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt
  11. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt
  12. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/DataTypes.kt
  13. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/DayCardView.kt
  14. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/LessonLinearLayout.kt
  15. +1
    -1
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/MealLinearLayout.kt
  16. +28
    -0
      app/src/main/res/layouts/activities/xml/shortcuts.xml
  17. +12
    -2
      app/src/main/res/values-de-rDE/strings.xml
  18. +9
    -1
      app/src/main/res/values/strings.xml

+ 1
- 1
README.md View File

@@ -20,4 +20,4 @@ ProjectLaogai is a app to access the timetable and the mensa menu of Hochschule
[<img src="https://www.mosad.xyz/images/Project_Laogai/ProjectLaogai_Settings.png" width=180>](https://www.mosad.xyz/images/Project_Laogai/ProjectLaogai_Settings.png)
[<img src="https://www.mosad.xyz/images/Project_Laogai/ProjectLaogai_Mensa_dark.png" width=180>](https://www.mosad.xyz/images/Project_Laogai/ProjectLaogai_Mensa_dark.png)

ProjectLaogai © 2019 [@Seil0](https://git.mosad.xyz/Seil0), a [mosad](http://www.mosad.xyz) Project
ProjectLaogai © 2019-2020 [@Seil0](https://git.mosad.xyz/Seil0), a [mosad](http://www.mosad.xyz) Project

+ 13
- 16
app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,6 +62,8 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
private var useNFC = false

override fun onCreate(savedInstanceState: Bundle?) {
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()

Aesthetic.attach(this)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
@@ -72,11 +74,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
initAesthetic()
initForegroundDispatch()

//init home fragment
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.fragment_container, activeFragment)
fragmentTransaction.commit()

val toggle = ActionBarDrawerToggle(
this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
)
@@ -85,17 +82,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()
// based on the inent we get, call readBalance or open a Fragment
when (intent.action) {
NfcAdapter.ACTION_TECH_DISCOVERED -> NFCMensaCard.readBalance(intent, this)
"org.mosad.seil0.projectlaogai.fragments.MensaFragment" -> activeFragment = MensaFragment()
"org.mosad.seil0.projectlaogai.fragments.TimeTableFragment" -> activeFragment = TimeTableFragment()
"org.mosad.seil0.projectlaogai.fragments.MoodleFragment" -> activeFragment = MoodleFragment()
}

// open the activeFragment, default is the HomeFragment
fragmentTransaction.replace(R.id.fragment_container, activeFragment)
fragmentTransaction.commit()
}

override fun onNewIntent(intent: Intent) {


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/controller/NFCMensaCard.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/controller/PreferencesController.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/controller/TCoRAPIController.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/DataTypes.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/DayCardView.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/LessonLinearLayout.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 1
- 1
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/MealLinearLayout.kt View File

@@ -1,7 +1,7 @@
/**
* ProjectLaogai
*
* Copyright 2019 <seil0@mosad.xyz>
* Copyright 2019-2020 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by


+ 28
- 0
app/src/main/res/layouts/activities/xml/shortcuts.xml View File

@@ -12,4 +12,32 @@
android:targetClass="org.mosad.seil0.projectlaogai.MainActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>

<shortcut
android:shortcutId="timetable"
android:enabled="true"
android:icon="@drawable/ic_baseline_calendar_today_24dp"
android:shortcutShortLabel="@string/shortcut_timetable_short"
android:shortcutLongLabel="@string/shortcut_timetable_long"
android:shortcutDisabledMessage="@string/shortcut_timetable_disabled">
<intent
android:action="org.mosad.seil0.projectlaogai.fragments.TimeTableFragment"
android:targetPackage="org.mosad.seil0.projectlaogai"
android:targetClass="org.mosad.seil0.projectlaogai.MainActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>

<shortcut
android:shortcutId="moodle"
android:enabled="true"
android:icon="@drawable/ic_school_black_24dp"
android:shortcutShortLabel="@string/shortcut_moodle_short"
android:shortcutLongLabel="@string/shortcut_moodle_long"
android:shortcutDisabledMessage="@string/shortcut_moodle_disabled">
<intent
android:action="org.mosad.seil0.projectlaogai.fragments.MoodleFragment"
android:targetPackage="org.mosad.seil0.projectlaogai"
android:targetClass="org.mosad.seil0.projectlaogai.MainActivity" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>

+ 12
- 2
app/src/main/res/values-de-rDE/strings.xml View File

@@ -46,8 +46,18 @@
<!-- 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>
<!-- shortcuts -->
<string name="shortcut_mensa_short">Mensa</string>
<string name="shortcut_mensa_long">Mensa</string>
<string name="shortcut_mensa_disabled">Mensa deaktiviert</string>

<string name="shortcut_timetable_short">Stundenplan</string>
<string name="shortcut_timetable_long">Stundenplan</string>
<string name="shortcut_timetable_disabled">Stundenplan deaktiviert</string>

<string name="shortcut_moodle_short">Moodle</string>
<string name="shortcut_moodle_long">Moodle</string>
<string name="shortcut_moodle_disabled">Moodle deaktiviert</string>

</resources>

+ 9
- 1
app/src/main/res/values/strings.xml View File

@@ -25,7 +25,7 @@
<string name="user">User</string>
<string name="course_desc">Tap to change course</string>
<string name="about_dialog_heading">About</string>
<string name="about_dialog_text" translatable="false">"This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2019 seil0@mosad.xyz "</string>
<string name="about_dialog_text" translatable="false">"This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2020 seil0@mosad.xyz "</string>
<string name="about_txtView" translatable="false">hso App by @Seil0</string>
<string name="about_version" translatable="false">Version %1$s (%2$s)</string>
<string name="licenses">Licenses</string>
@@ -64,6 +64,14 @@
<string name="shortcut_mensa_long">Mensa</string>
<string name="shortcut_mensa_disabled">Mensa disabled</string>

<string name="shortcut_timetable_short">Timetable</string>
<string name="shortcut_timetable_long">Timetable</string>
<string name="shortcut_timetable_disabled">Timetable disabled</string>

<string name="shortcut_moodle_short">Moodle</string>
<string name="shortcut_moodle_long">Moodle</string>
<string name="shortcut_moodle_disabled">Moodle 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>


Loading…
Cancel
Save