mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 19:42:44 +01:00
Add fullscreen mode to homework dialog (#806)
This commit is contained in:
parent
52d66ac30b
commit
f7b5b9c413
@ -1,6 +1,8 @@
|
|||||||
package io.github.wulkanowy.ui.modules.homework.details
|
package io.github.wulkanowy.ui.modules.homework.details
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View.GONE
|
||||||
|
import android.view.View.VISIBLE
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import io.github.wulkanowy.data.db.entities.Homework
|
import io.github.wulkanowy.data.db.entities.Homework
|
||||||
@ -29,6 +31,10 @@ class HomeworkDetailsAdapter @Inject constructor() :
|
|||||||
|
|
||||||
var onAttachmentClickListener: (url: String) -> Unit = {}
|
var onAttachmentClickListener: (url: String) -> Unit = {}
|
||||||
|
|
||||||
|
var onFullScreenClickListener = {}
|
||||||
|
|
||||||
|
var onFullScreenExitClickListener = {}
|
||||||
|
|
||||||
override fun getItemCount() = 1 + if (attachments.isNotEmpty()) attachments.size + 1 else 0
|
override fun getItemCount() = 1 + if (attachments.isNotEmpty()) attachments.size + 1 else 0
|
||||||
|
|
||||||
override fun getItemViewType(position: Int) = when (position) {
|
override fun getItemViewType(position: Int) = when (position) {
|
||||||
@ -61,6 +67,16 @@ class HomeworkDetailsAdapter @Inject constructor() :
|
|||||||
homeworkDialogSubject.text = homework?.subject
|
homeworkDialogSubject.text = homework?.subject
|
||||||
homeworkDialogTeacher.text = homework?.teacher
|
homeworkDialogTeacher.text = homework?.teacher
|
||||||
homeworkDialogContent.text = homework?.content
|
homeworkDialogContent.text = homework?.content
|
||||||
|
homeworkDialogFullScreen.setOnClickListener {
|
||||||
|
homeworkDialogFullScreen.visibility = GONE
|
||||||
|
homeworkDialogFullScreenExit.visibility = VISIBLE
|
||||||
|
onFullScreenClickListener()
|
||||||
|
}
|
||||||
|
homeworkDialogFullScreenExit.setOnClickListener {
|
||||||
|
homeworkDialogFullScreen.visibility = VISIBLE
|
||||||
|
homeworkDialogFullScreenExit.visibility = GONE
|
||||||
|
onFullScreenExitClickListener()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import io.github.wulkanowy.data.db.entities.Homework
|
import io.github.wulkanowy.data.db.entities.Homework
|
||||||
@ -63,6 +65,8 @@ class HomeworkDetailsDialog : BaseDialogFragment<DialogHomeworkBinding>(), Homew
|
|||||||
layoutManager = LinearLayoutManager(context)
|
layoutManager = LinearLayoutManager(context)
|
||||||
adapter = detailsAdapter.apply {
|
adapter = detailsAdapter.apply {
|
||||||
onAttachmentClickListener = { context.openInternetBrowser(it, ::showMessage) }
|
onAttachmentClickListener = { context.openInternetBrowser(it, ::showMessage) }
|
||||||
|
onFullScreenClickListener = { dialog?.window?.setLayout(MATCH_PARENT, MATCH_PARENT) }
|
||||||
|
onFullScreenExitClickListener = { dialog?.window?.setLayout(WRAP_CONTENT, WRAP_CONTENT) }
|
||||||
homework = this@HomeworkDetailsDialog.homework
|
homework = this@HomeworkDetailsDialog.homework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,6 @@ class LoginRecoverFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
binding.loginRecoverWebView.destroy()
|
|
||||||
presenter.onDetachView()
|
presenter.onDetachView()
|
||||||
|
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
|
5
app/src/main/res/drawable/ic_fullscreen.xml
Normal file
5
app/src/main/res/drawable/ic_fullscreen.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/ic_fullscreen_exit.xml
Normal file
5
app/src/main/res/drawable/ic_fullscreen_exit.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M5,16h3v3h2v-5L5,14v2zM8,8L5,8v2h5L10,5L8,5v3zM14,19h2v-3h3v-2h-5v5zM16,8L16,5h-2v5h5L19,8h-3z"/>
|
||||||
|
</vector>
|
@ -1,4 +1,5 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -7,6 +8,29 @@
|
|||||||
android:paddingTop="20dp"
|
android:paddingTop="20dp"
|
||||||
android:paddingEnd="20dp">
|
android:paddingEnd="20dp">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/homework_dialog_full_screen"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:srcCompat="@drawable/ic_fullscreen"
|
||||||
|
app:tint="?colorOnBackground"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/homework_dialog_full_screen_exit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:srcCompat="@drawable/ic_fullscreen_exit"
|
||||||
|
app:tint="?colorOnBackground"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user