fixing up clear data dialog

Removing unused code
This commit is contained in:
ThomasSession 2024-08-30 09:49:48 +10:00
parent f90599451f
commit 706d1aadd8
5 changed files with 4 additions and 33 deletions

View File

@ -46,27 +46,7 @@ class SessionDialogBuilder(val context: Context) {
.apply { orientation = VERTICAL }
.also(dialogBuilder::setCustomTitle)
// Maximum height of the dialog. This comes into play in the Open URL dialog where we
// might have a a very, very long URL (which we provide a ScrollView for) - but without
// limiting the height of the dialog, the WRAP_CONTENT part can allow the dialog to be
// super tall!
// Note: I eye-balled this DP value for the max dialog height to make it match the
// height of regular not-scrollable dialogs.
val maxHeightInDp = 137
val scale = context.resources.displayMetrics.density
val maxHeightInPx = (maxHeightInDp * scale + 0.5f).toInt()
val contentView = LinearLayout(context).apply {
orientation = VERTICAL
// Limit the max height of the dialog to the above value
viewTreeObserver.addOnGlobalLayoutListener {
if (height > maxHeightInPx) {
layoutParams.height = maxHeightInPx
requestLayout()
}
}
}
private val contentView = LinearLayout(context).apply { orientation = VERTICAL }
private val buttonLayout = LinearLayout(context)
@ -157,8 +137,6 @@ class SessionDialogBuilder(val context: Context) {
fun cancelButton(listener: (() -> Unit) = {}) = button(android.R.string.cancel, R.string.AccessibilityId_cancel) { listener() }
fun copyUrlButton(listener: (() -> Unit) = {}) = button(android.R.string.copyUrl, R.string.AccessibilityId_copy) { listener() }
fun button(
@StringRes text: Int,
@StringRes contentDescriptionRes: Int = text,

View File

@ -62,9 +62,6 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
@Override
public @NonNull
ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// TODO: This will CRASH on Android 28 but it works on Android 34. The error is to do with a
// TODO: missing `secondary_text_material_dark` colour. Jira ticket: SES-2157
switch (viewType) {
case HEADER_TYPE:
return new HeaderViewHolder(callback, LayoutInflater.from(parent.getContext()).inflate(R.layout.reactions_bottom_sheet_dialog_fragment_recycler_header, parent, false));

View File

@ -40,14 +40,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/large_spacing"
android:orientation="horizontal">
<Button
style="@style/Widget.Session.Button.Dialog.DangerText"
android:id="@+id/clearAllDataButton"
android:layout_width="0dp"
android:layout_height="@dimen/small_button_height"
android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1"
android:text="@string/clear" />
@ -55,7 +54,7 @@
style="@style/Widget.Session.Button.Dialog.UnimportantText"
android:id="@+id/cancelButton"
android:layout_width="0dp"
android:layout_height="@dimen/small_button_height"
android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1"
android:text="@string/cancel" />

View File

@ -119,8 +119,4 @@
<color name="danger_light">#E12D19</color>
<color name="outdated_client_banner_background_color">#00F782</color>
<!-- ACL attempt to stop API 28 crashing on long-press of emoji - doesn't work though... -->
<color name="secondary_text_material_dark">#61FFFF</color>
</resources>

View File

@ -10,6 +10,7 @@
<dimen name="very_large_font_size">26sp</dimen>
<!-- Element Sizes -->
<dimen name="dialog_button_height">60dp</dimen>
<dimen name="small_button_height">34dp</dimen>
<dimen name="medium_button_height">38dp</dimen>
<dimen name="large_button_height">54dp</dimen>