added Timetable and Moodle shortcut, cleaned up activity init
This commit is contained in:
parent
8f5a4dd1b3
commit
bed3f5d978
|
@ -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
|
||||
|
|
|
@ -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,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,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,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,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,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,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,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,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,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,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,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,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,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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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…
Reference in New Issue