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 } .apply { orientation = VERTICAL }
.also(dialogBuilder::setCustomTitle) .also(dialogBuilder::setCustomTitle)
// Maximum height of the dialog. This comes into play in the Open URL dialog where we private val contentView = LinearLayout(context).apply { orientation = VERTICAL }
// 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 buttonLayout = LinearLayout(context) 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 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( fun button(
@StringRes text: Int, @StringRes text: Int,
@StringRes contentDescriptionRes: Int = text, @StringRes contentDescriptionRes: Int = text,

View File

@ -62,9 +62,6 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
@Override @Override
public @NonNull public @NonNull
ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 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) { switch (viewType) {
case HEADER_TYPE: case HEADER_TYPE:
return new HeaderViewHolder(callback, LayoutInflater.from(parent.getContext()).inflate(R.layout.reactions_bottom_sheet_dialog_fragment_recycler_header, parent, false)); 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/large_spacing"
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
style="@style/Widget.Session.Button.Dialog.DangerText" style="@style/Widget.Session.Button.Dialog.DangerText"
android:id="@+id/clearAllDataButton" android:id="@+id/clearAllDataButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/clear" /> android:text="@string/clear" />
@ -55,7 +54,7 @@
style="@style/Widget.Session.Button.Dialog.UnimportantText" style="@style/Widget.Session.Button.Dialog.UnimportantText"
android:id="@+id/cancelButton" android:id="@+id/cancelButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" /> android:text="@string/cancel" />

View File

@ -119,8 +119,4 @@
<color name="danger_light">#E12D19</color> <color name="danger_light">#E12D19</color>
<color name="outdated_client_banner_background_color">#00F782</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> </resources>

View File

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