Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some time dialog not open fully and some content hides. #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ package me.adawoud.bottomsheettimepicker

import android.os.Build
import android.os.Bundle
import android.support.design.widget.BottomSheetBehavior
import android.support.design.widget.BottomSheetDialog
import android.support.design.widget.BottomSheetDialogFragment
import android.support.design.widget.CoordinatorLayout
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TabHost
import kotlinx.android.synthetic.main.time_range_picker.*
import me.adawoud.bottomsheetpickers.R


@Suppress("DEPRECATION") // We deal with it below
class BottomSheetTimeRangePicker : BottomSheetDialogFragment() {
private lateinit var listener: OnTimeRangeSelectedListener
Expand Down Expand Up @@ -71,6 +76,18 @@ class BottomSheetTimeRangePicker : BottomSheetDialogFragment() {
endHour = hourOfDay
endMinute = minute
}
if (fullScreen){
dialog.setOnShowListener { dialog ->
val d = dialog as BottomSheetDialog
val bottomSheet =
d.findViewById<FrameLayout>(R.id.design_bottom_sheet)
val lyout = bottomSheet!!.parent as CoordinatorLayout
val behavior: BottomSheetBehavior<*> =
BottomSheetBehavior.from(bottomSheet)
behavior.peekHeight = bottomSheet!!.height
lyout.parent.requestLayout()
}
}
}

override fun onStart() {
Expand Down Expand Up @@ -261,6 +278,7 @@ class BottomSheetTimeRangePicker : BottomSheetDialogFragment() {
private const val TAG_START_TIME = "TAG_START_TIME"
private const val TAG_END_TIME = "TAG_END_TIME"
private val timeRangePicker = BottomSheetTimeRangePicker()
private var fullScreen = false

/**
* Sets the text of the Start and End time tabs.
Expand Down Expand Up @@ -334,6 +352,10 @@ class BottomSheetTimeRangePicker : BottomSheetDialogFragment() {
return this
}

fun setFullScreen(){
fullScreen=true
}

/**
* Returns a TimeRangePicker that's displayed as a BottomSheetDialog
*
Expand Down