Commit 439aded4 authored by Filip Wiesner's avatar Filip Wiesner

News ViewPager fix, Editable event note WIP

parent e77895a0
...@@ -3,6 +3,7 @@ package com.cvut.blackbird.flows.detail ...@@ -3,6 +3,7 @@ package com.cvut.blackbird.flows.detail
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.os.Bundle import android.os.Bundle
import android.text.InputType
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
...@@ -65,7 +66,7 @@ class EventDetailFragment : Fragment() { ...@@ -65,7 +66,7 @@ class EventDetailFragment : Fragment() {
detail_teachersContent.text = event.linked?.teachers?.firstOrNull() ?: "None" detail_teachersContent.text = event.linked?.teachers?.firstOrNull() ?: "None"
detail_parallelContent.text = if (event.parallel.isNotBlank()) event.parallel else "-" detail_parallelContent.text = if (event.parallel.isNotBlank()) event.parallel else "-"
detail_roomContent.text = event.linked?.room ?: "None" detail_roomContent.text = event.linked?.room ?: "None"
detail_noteContent.text = event.note?.cs ?: "None" detail_noteContent.setText(event.note?.cs ?: "None")
refreshPinTint() refreshPinTint()
} }
...@@ -84,7 +85,6 @@ class EventDetailFragment : Fragment() { ...@@ -84,7 +85,6 @@ class EventDetailFragment : Fragment() {
append("${teacher.firstName} ${teacher.lastName}\n") append("${teacher.firstName} ${teacher.lastName}\n")
} }
detail_teachersContent.text = teachersText.dropLast(1) detail_teachersContent.text = teachersText.dropLast(1)
} }
private fun onPinnedStateChange() = event.apply { private fun onPinnedStateChange() = event.apply {
......
...@@ -41,10 +41,10 @@ abstract class BlackBirdModel { ...@@ -41,10 +41,10 @@ abstract class BlackBirdModel {
Log.d(BlackBirdAC.LOG_TAG, "Token refreshed") Log.d(BlackBirdAC.LOG_TAG, "Token refreshed")
Success(Unit) Success(Unit)
} else { } else {
Failure(response.errorBody()?.string() ?: "No error message") Failure(response.errorBody()?.string() ?: "No error message")
} }
} catch (e: Throwable) { } catch (e: Throwable) {
Failure(e.localizedMessage) Failure(e.localizedMessage)
} }
} }
...@@ -56,8 +56,10 @@ abstract class BlackBirdModel { ...@@ -56,8 +56,10 @@ abstract class BlackBirdModel {
result = if (response.isSuccessful && response.body() != null) { result = if (response.isSuccessful && response.body() != null) {
Success(response.body()!!) Success(response.body()!!)
} else { } else {
if (response.code() == 401 && refreshToken() is Success) if (response.code() == 401)
fetch(call.clone()) //Clone to not get "Already executed" exception if (refreshToken() is Success)
fetch(call.clone()) //Clone to not get "Already executed" exception
else Failure("Could not refresh token")
else else
Failure(response.errorBody()?.string() ?: "No error message") Failure(response.errorBody()?.string() ?: "No error message")
} }
......
...@@ -200,137 +200,150 @@ ...@@ -200,137 +200,150 @@
</LinearLayout> </LinearLayout>
<LinearLayout <ScrollView
android:id="@+id/detail_eventDetailsLayout" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="0dp"
android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_infoLinLayout"> app:layout_constraintTop_toBottomOf="@+id/detail_headerLayout">
<TextView <LinearLayout
android:id="@+id/detail_teachersTitle" android:id="@+id/detail_eventDetailsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp" android:layout_marginStart="16dp"
android:fontFamily="sans-serif-condensed" android:layout_marginTop="16dp"
android:text="Teachers" android:layout_marginEnd="16dp"
android:textAllCaps="false" android:orientation="vertical"
android:textSize="16sp" android:paddingTop="32dp"
android:textStyle="italic" /> android:paddingBottom="8dp">
<View <TextView
android:id="@+id/detail_teachersDivider" android:id="@+id/detail_teachersTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1.5dp" android:layout_height="wrap_content"
android:background="?android:attr/listDivider" /> android:layout_marginBottom="2dp"
android:fontFamily="sans-serif-condensed"
android:text="Teachers"
android:textAllCaps="false"
android:textSize="16sp"
android:textStyle="italic" />
<TextView <View
android:id="@+id/detail_teachersContent" android:id="@+id/detail_teachersDivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1.5dp"
android:layout_marginStart="8dp" android:background="?android:attr/listDivider" />
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed"
android:gravity="end"
android:lineSpacingExtra="4sp"
android:textSize="22sp"
android:textStyle="bold"
tools:text="Petr Křemen\nMartin Balík" />
<TextView <TextView
android:id="@+id/detail_parallelTitle" android:id="@+id/detail_teachersContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginStart="8dp"
android:layout_marginBottom="2dp" android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:text="Parallel num." android:gravity="end"
android:textAllCaps="false" android:lineSpacingExtra="4sp"
android:textSize="16sp" android:textColor="@android:color/white"
android:textStyle="italic" /> android:textSize="22sp"
android:textStyle="bold"
tools:text="Petr Křemen\nMartin Balík" />
<View <TextView
android:id="@+id/detail_parallelDivider" android:id="@+id/detail_parallelTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1.5dp" android:layout_height="wrap_content"
android:background="?android:attr/listDivider" /> android:layout_marginTop="12dp"
android:layout_marginBottom="2dp"
android:fontFamily="sans-serif-condensed"
android:text="Parallel num."
android:textAllCaps="false"
android:textSize="16sp"
android:textStyle="italic" />
<TextView <View
android:id="@+id/detail_parallelContent" android:id="@+id/detail_parallelDivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1.5dp"
android:layout_marginStart="8dp" android:background="?android:attr/listDivider" />
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed"
android:gravity="end"
android:textSize="22sp"
android:textStyle="bold"
tools:text="71" />
<TextView <TextView
android:id="@+id/detail_roomTitle" android:id="@+id/detail_parallelContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginStart="8dp"
android:layout_marginBottom="2dp" android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:text="Room" android:gravity="end"
android:textAllCaps="false" android:textColor="@android:color/white"
android:textSize="16sp" android:textSize="22sp"
android:textStyle="italic" /> android:textStyle="bold"
tools:text="71" />
<View <TextView
android:id="@+id/detail_roomDivider" android:id="@+id/detail_roomTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1.5dp" android:layout_height="wrap_content"
android:background="?android:attr/listDivider" /> android:layout_marginTop="12dp"
android:layout_marginBottom="2dp"
android:fontFamily="sans-serif-condensed"
android:text="Room"
android:textAllCaps="false"
android:textSize="16sp"
android:textStyle="italic" />
<TextView <View
android:id="@+id/detail_roomContent" android:id="@+id/detail_roomDivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1.5dp"
android:layout_marginStart="8dp" android:background="?android:attr/listDivider" />
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed"
android:gravity="end"
android:textSize="22sp"
android:textStyle="bold"
tools:text="T2:C3-337" />
<TextView <TextView
android:id="@+id/detail_noteTitle" android:id="@+id/detail_roomContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginStart="8dp"
android:layout_marginBottom="2dp" android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:text="Note" android:gravity="end"
android:textAllCaps="false" android:textColor="@android:color/white"
android:textSize="16sp" android:textSize="22sp"
android:textStyle="italic" /> android:textStyle="bold"
tools:text="T2:C3-337" />
<View <TextView
android:id="@+id/detail_noteDivider" android:id="@+id/detail_noteTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1.5dp" android:layout_height="wrap_content"
android:background="?android:attr/listDivider" /> android:layout_marginTop="12dp"
android:layout_marginBottom="2dp"
android:fontFamily="sans-serif-condensed"
android:text="Note"
android:textAllCaps="false"
android:textSize="16sp"
android:textStyle="italic" />
<TextView <View
android:id="@+id/detail_noteContent" android:id="@+id/detail_noteDivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1.5dp"
android:layout_marginStart="8dp" android:background="?android:attr/listDivider" />
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-condensed" <EditText
android:gravity="end" android:id="@+id/detail_noteContent"
android:textSize="22sp" android:layout_width="match_parent"
android:textStyle="bold" android:layout_height="wrap_content"
tools:text="Posledni termin" /> android:layout_marginStart="8dp"
</LinearLayout> android:layout_marginEnd="8dp"
android:background="@android:color/transparent"
android:fontFamily="sans-serif-condensed"
android:gravity="end"
android:textColor="@android:color/white"
android:textSize="22sp"
android:textStyle="bold"
tools:text="Posledni termin" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/news_ic" app:layout_constraintStart_toEndOf="@+id/news_ic"
app:layout_constraintTop_toTopOf="@+id/news_ic" app:layout_constraintTop_toTopOf="@+id/news_ic" />
android:animateLayoutChanges="true"/>
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/news_dotTabs" android:id="@+id/news_dotTabs"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment