mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
fix: submit segment dialog closes when there are no segments yet
This commit is contained in:
parent
81bdd71558
commit
a47eac5352
@ -5,9 +5,9 @@ import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isGone
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.github.libretube.BuildConfig
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.api.JsonHelper
|
||||
import com.github.libretube.api.RetrofitInstance
|
||||
@ -148,7 +148,7 @@ class SubmitSegmentDialog : DialogFragment() {
|
||||
val binding = _binding ?: return@withContext
|
||||
|
||||
if (segments.isEmpty()) {
|
||||
dismiss()
|
||||
binding.voteSegmentContainer.isGone = true
|
||||
Toast.makeText(context, R.string.no_segments_found, Toast.LENGTH_SHORT).show()
|
||||
return@withContext
|
||||
}
|
||||
|
@ -7,111 +7,127 @@
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingTop="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sb_create_segment"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/create_segment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/start_time">
|
||||
android:text="@string/sb_create_segment"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/start_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/end_time">
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/end_time"
|
||||
android:layout_width="match_parent"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/start_time">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/start_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/end_time">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/end_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.github.libretube.ui.views.DropdownMenu
|
||||
android:id="@+id/segment_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint="@string/segment_type"
|
||||
app:icon="@drawable/ic_frame" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/create_segment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:text="@string/sb_create_segment" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.github.libretube.ui.views.DropdownMenu
|
||||
android:id="@+id/segment_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint="@string/segment_type"
|
||||
app:icon="@drawable/ic_frame" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/create_segment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:text="@string/sb_create_segment" />
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:id="@+id/vote_segment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/vote_for_segment"
|
||||
android:textSize="24sp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.libretube.ui.views.DropdownMenu
|
||||
android:id="@+id/segments_dropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint="@string/segment"
|
||||
app:icon="@drawable/ic_frame" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/vote_for_segment"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal">
|
||||
<com.github.libretube.ui.views.DropdownMenu
|
||||
android:id="@+id/segments_dropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint="@string/segment"
|
||||
app:icon="@drawable/ic_frame" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/upvote"
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:checked="true"
|
||||
android:text="@string/upvote" />
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/downvote"
|
||||
<RadioButton
|
||||
android:id="@+id/upvote"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:checked="true"
|
||||
android:text="@string/upvote" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/downvote"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="@string/downvote" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/undo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/undo" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/vote_segment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="@string/downvote" />
|
||||
android:layout_gravity="end"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:text="@string/vote_for_segment" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/undo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/undo" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/vote_segment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:text="@string/vote_for_segment" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user