Archived
Added German translation
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
package com.denizk0461.studip.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import com.denizk0461.studip.R
|
||||
@@ -86,21 +82,21 @@ class MainActivity : AppCompatActivity() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
return true
|
||||
}
|
||||
// override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
// // Inflate the menu; this adds items to the action bar if it is present.
|
||||
// menuInflater.inflate(R.menu.menu_main, menu)
|
||||
// return true
|
||||
// }
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
return when (item.itemId) {
|
||||
R.id.action_settings -> true
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
// override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// // Handle action bar item clicks here. The action bar will
|
||||
// // automatically handle clicks on the Home/Up button, so long
|
||||
// // as you specify a parent activity in AndroidManifest.xml.
|
||||
// return when (item.itemId) {
|
||||
// R.id.action_settings -> true
|
||||
// else -> super.onOptionsItemSelected(item)
|
||||
// }
|
||||
// }
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
val navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
@@ -108,14 +104,14 @@ class MainActivity : AppCompatActivity() {
|
||||
|| super.onSupportNavigateUp()
|
||||
}
|
||||
|
||||
private fun getFragmentByType(type: FragmentType): Fragment {
|
||||
// Log.d("AAA!", "help")
|
||||
return when (type) {
|
||||
FragmentType.SCHEDULE -> EventFragment()
|
||||
FragmentType.FOOD -> FoodFragment() // TODO once this fragment has been implemented
|
||||
FragmentType.SETTINGS -> SettingsFragment()
|
||||
}
|
||||
}
|
||||
// private fun getFragmentByType(type: FragmentType): Fragment {
|
||||
//// Log.d("AAA!", "help")
|
||||
// return when (type) {
|
||||
// FragmentType.SCHEDULE -> EventFragment()
|
||||
// FragmentType.FOOD -> FoodFragment()
|
||||
// FragmentType.SETTINGS -> SettingsFragment()
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun bottomIdToType(id: Int): FragmentType = when (id) {
|
||||
R.id.food -> FragmentType.FOOD
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.denizk0461.studip.adapter
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.denizk0461.studip.R
|
||||
@@ -49,20 +45,14 @@ class StudIPEventAdapter(
|
||||
theme.resolveAttribute(R.attr.colorPrimary, colorPrimary, true)
|
||||
theme.resolveAttribute(R.attr.colorTextHintLighter, colorTextHint, true)
|
||||
|
||||
// Log.d("eek!", holder.binding.cardBackground.strokeWidth.toString())
|
||||
|
||||
if (!isAnyCourseHighlighted && currentItem.isCurrentCourse(currentCalendar)) { // highlight
|
||||
isAnyCourseHighlighted = true
|
||||
// holder.binding.textTitle.setTextColor(colorHighlight.data)
|
||||
holder.binding.cardBackground.strokeColor = colorPrimary.data
|
||||
holder.binding.cardBackground.strokeWidth = 6
|
||||
// holder.binding.cardBackground.cardForegroundColor = holder.binding.root.context.getColorStateList(
|
||||
// R.color.list_card_selected)
|
||||
} else { // un-highlight
|
||||
// holder.binding.textTitle.setTextColor(colorUnhighlight.data)
|
||||
holder.binding.cardBackground.strokeColor = colorTextHint.data
|
||||
holder.binding.cardBackground.strokeWidth = 3
|
||||
// holder.binding.cardBackground.cardForegroundColor = Color.TRANSPARENT
|
||||
}
|
||||
|
||||
holder.binding.cardBackground.setOnClickListener {
|
||||
@@ -77,15 +67,9 @@ class StudIPEventAdapter(
|
||||
|
||||
}
|
||||
|
||||
private fun StudIPEvent.isCurrentCourse(calendar: Calendar): Boolean {
|
||||
// if (calendar.get(Calendar.DAY_OF_WEEK) == this.day.toCalendarDay()) {
|
||||
if (Calendar.THURSDAY == this.day.toCalendarDay()) {
|
||||
if ((calendar.get(Calendar.MINUTE) + calendar.get(Calendar.HOUR_OF_DAY) * 60) < this.timeslotEnd.parseToMinutes()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
private fun StudIPEvent.isCurrentCourse(calendar: Calendar): Boolean =
|
||||
(calendar.get(Calendar.DAY_OF_WEEK) == this.day.toCalendarDay()) &&
|
||||
((calendar.get(Calendar.MINUTE) + calendar.get(Calendar.HOUR_OF_DAY) * 60) < this.timeslotEnd.parseToMinutes())
|
||||
|
||||
// Converts day as defined in StudIPEvent.kt to day from Calendar
|
||||
private fun Int.toCalendarDay(): Int = when (this) {
|
||||
|
||||
Reference in New Issue
Block a user