Archived
Visual changes, mostly colour-related
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
package com.denizk0461.studip.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.denizk0461.studip.R
|
||||
import com.denizk0461.studip.model.StudIPEvent
|
||||
import com.denizk0461.studip.databinding.ItemEventBinding
|
||||
|
||||
class StudIPEventAdapter(events: List<StudIPEvent>, private val currentDay: Int) : RecyclerView.Adapter<StudIPEventAdapter.EventViewHolder>() {
|
||||
class StudIPEventAdapter(
|
||||
events: List<StudIPEvent>, private val currentDay: Int, private val onClickListener: OnClickListener
|
||||
) : RecyclerView.Adapter<StudIPEventAdapter.EventViewHolder>() {
|
||||
|
||||
private val filteredEvents: List<StudIPEvent> = events.filter { it.day == currentDay }
|
||||
|
||||
@@ -41,7 +42,20 @@ class StudIPEventAdapter(events: List<StudIPEvent>, private val currentDay: Int)
|
||||
// holder.binding.cardBackground.cardForegroundColor = Color.TRANSPARENT
|
||||
}
|
||||
|
||||
holder.binding.cardBackground.setOnClickListener {
|
||||
onClickListener.onClick(currentItem)
|
||||
}
|
||||
holder.binding.cardBackground.setOnLongClickListener {
|
||||
onClickListener.onLongClick(currentItem)
|
||||
true
|
||||
}
|
||||
|
||||
// TODO inflate view saying "no events!" or sth
|
||||
|
||||
}
|
||||
|
||||
interface OnClickListener {
|
||||
fun onClick(event: StudIPEvent)
|
||||
fun onLongClick(event: StudIPEvent)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.denizk0461.studip.model.StudIPEvent
|
||||
import com.denizk0461.studip.databinding.ItemEventPageBinding
|
||||
|
||||
class StudIPEventPageAdapter(private var events: List<StudIPEvent>) : RecyclerView.Adapter<StudIPEventPageAdapter.EventPageViewHolder>() {
|
||||
class StudIPEventPageAdapter(private var events: List<StudIPEvent>, private val onClickListener: StudIPEventAdapter.OnClickListener) : RecyclerView.Adapter<StudIPEventPageAdapter.EventPageViewHolder>() {
|
||||
|
||||
class EventPageViewHolder(val binding: ItemEventPageBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
@@ -25,7 +25,7 @@ class StudIPEventPageAdapter(private var events: List<StudIPEvent>) : RecyclerVi
|
||||
|
||||
holder.binding.pageRecyclerView.apply {
|
||||
layoutManager = LinearLayoutManager(holder.binding.root.context, LinearLayoutManager.VERTICAL, false)
|
||||
adapter = StudIPEventAdapter(events, currentDay = position) // TODO check if empty
|
||||
adapter = StudIPEventAdapter(events, currentDay = position, onClickListener) // TODO check if empty
|
||||
scheduleLayoutAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.NavHostFragment.Companion.findNavController
|
||||
import com.denizk0461.studip.R
|
||||
import com.denizk0461.studip.activity.FetcherActivity
|
||||
import com.denizk0461.studip.adapter.StudIPEventAdapter
|
||||
import com.denizk0461.studip.adapter.StudIPEventPageAdapter
|
||||
import com.denizk0461.studip.databinding.FragmentEventBinding
|
||||
import com.denizk0461.studip.model.StudIPEvent
|
||||
import com.denizk0461.studip.viewmodel.EventViewModel
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import java.util.*
|
||||
@@ -55,7 +57,14 @@ class EventFragment : Fragment() {
|
||||
else -> 0
|
||||
}
|
||||
|
||||
viewPagerAdapter = StudIPEventPageAdapter(listOf())//DummyData.events.toList())
|
||||
viewPagerAdapter = StudIPEventPageAdapter(listOf(), object : StudIPEventAdapter.OnClickListener {
|
||||
override fun onClick(event: StudIPEvent) {
|
||||
// do nothing
|
||||
}
|
||||
override fun onLongClick(event: StudIPEvent) {
|
||||
|
||||
}
|
||||
})//DummyData.events.toList())
|
||||
binding.viewPager.adapter = viewPagerAdapter
|
||||
|
||||
TabLayoutMediator(binding.dayTabLayout, binding.viewPager) { tab, position ->
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="?attr/colorPrimary" />
|
||||
<!-- <item android:state_checked="false" android:color="@color/your_color"/>-->
|
||||
</selector>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="true"
|
||||
android:color="@color/primaryLight" />
|
||||
<item android:state_pressed="true"
|
||||
android:state_enabled="false"
|
||||
android:color="@android:color/transparent" />
|
||||
<item android:state_enabled="false"
|
||||
android:color="@android:color/transparent" />
|
||||
</selector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
|
||||
</vector>
|
||||
@@ -42,6 +42,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:menu="@menu/nav_view_items"
|
||||
app:itemActiveIndicatorStyle="@style/NavigationViewItemIndicator"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
app:srcCompat="@drawable/refresh"
|
||||
app:backgroundTint="?attr/colorPrimary"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
<style name="Base.Theme.StudIPTimetable" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
|
||||
<!-- colour -->
|
||||
<item name="colorPrimary">@color/primaryDark</item>
|
||||
<item name="colorPrimary">@color/primaryLight</item>
|
||||
<item name="rippleColor">@color/primaryLight</item>
|
||||
|
||||
<item name="colorNavHighlight">@color/highlightLight</item>
|
||||
<!-- <item name="colorPrimaryOnContrast">@color/colorPrimaryOnContrastDark</item>-->
|
||||
</style>
|
||||
|
||||
<style name="NavigationViewItemIndicator" parent="Widget.Material3.BottomNavigationView.ActiveIndicator">
|
||||
<item name="android:color">@color/primaryLight</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<attr name="colorNavHighlight" format="color" />
|
||||
<attr name="colorPrimaryOnContrast" format="color" />
|
||||
</resources>
|
||||
@@ -3,6 +3,15 @@
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="primaryLight">#0F4759</color>
|
||||
<color name="primaryDark">#62CCE4</color>
|
||||
<!-- <color name="primaryLight">#0F4759</color>-->
|
||||
<!-- <color name="primaryDark">#62CCE4</color>-->
|
||||
|
||||
<color name="primaryDark">#B82729</color>
|
||||
<color name="primaryLight">#B2665A</color>
|
||||
|
||||
<color name="highlightDark">#871D1E</color>
|
||||
<color name="highlightLight">#CB9890</color>
|
||||
|
||||
<!-- <color name="colorPrimaryOnContrastLight">#E6898B</color>-->
|
||||
<!-- <color name="colorPrimaryOnContrastDark">#B77166</color>-->
|
||||
</resources>
|
||||
@@ -6,8 +6,16 @@
|
||||
<item name="fontFamily">@font/lato_regular</item>
|
||||
|
||||
<!-- colour -->
|
||||
<item name="colorPrimary">@color/primaryLight</item>
|
||||
<item name="colorPrimary">@color/primaryDark</item>
|
||||
<item name="rippleColor">@color/primaryDark</item>
|
||||
|
||||
<item name="colorNavHighlight">@color/highlightDark</item>
|
||||
<!-- <item name="colorPrimaryOnContrast">@color/colorPrimaryOnContrastLight</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Theme.StudIPTimetable" parent="Base.Theme.StudIPTimetable" />
|
||||
|
||||
<style name="NavigationViewItemIndicator" parent="Widget.Material3.BottomNavigationView.ActiveIndicator">
|
||||
<item name="android:color">@color/primaryDark</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user