Browse Source

added Timetable and Moodle shortcut, cleaned up activity init

pull/38/head
Jannik 2 years ago
parent
commit
bed3f5d978
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 2
      README.md
  2. 29
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  3. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt
  4. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/NFCMensaCard.kt
  5. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/PreferencesController.kt
  6. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/controller/TCoRAPIController.kt
  7. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  8. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  9. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt
  10. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt
  11. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt
  12. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/DataTypes.kt
  13. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/DayCardView.kt
  14. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/LessonLinearLayout.kt
  15. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/MealLinearLayout.kt
  16. 28
      app/src/main/res/layouts/activities/xml/shortcuts.xml
  17. 14
      app/src/main/res/values-de-rDE/strings.xml
  18. 10
      app/src/main/res/values/strings.xml

2
README.md

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

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

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/controller/NFCMensaCard.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/controller/PreferencesController.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/controller/TCoRAPIController.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/DataTypes.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/DayCardView.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/LessonLinearLayout.kt

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

2
app/src/main/java/org/mosad/seil0/projectlaogai/uicomponents/MealLinearLayout.kt

@ -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
app/src/main/res/layouts/activities/xml/shortcuts.xml

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

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

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

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

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

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