mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
fixing up clear data dialog
Removing unused code
This commit is contained in:
parent
f90599451f
commit
706d1aadd8
@ -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,
|
||||||
|
@ -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));
|
||||||
|
@ -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" />
|
||||||
|
|
||||||
|
@ -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>
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user