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

News ViewPager fix, Editable event note WIP

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