mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-13 21:30:56 +00:00
Add bottom sheet dialog
This commit is contained in:
parent
d96664cb6a
commit
b61b4c581d
5
res/drawable/ic_edit_white_24dp.xml
Normal file
5
res/drawable/ic_edit_white_24dp.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
5
res/drawable/ic_phonelink_erase_white_24dp.xml
Normal file
5
res/drawable/ic_phonelink_erase_white_24dp.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M13,8.2l-1,-1 -4,4 -4,-4 -1,1 4,4 -4,4 1,1 4,-4 4,4 1,-1 -4,-4 4,-4zM19,1H9c-1.1,0 -2,0.9 -2,2v3h2V4h10v16H9v-2H7v3c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
22
res/layout/fragment_device_list_bottom_sheet.xml
Normal file
22
res/layout/fragment_device_list_bottom_sheet.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:behavior_hideable="true"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editDisplayNameText"
|
||||
style="@style/ActionItem"
|
||||
android:drawableStart="@drawable/ic_edit_white_24dp"
|
||||
android:text="@string/fragment_device_list_edit_display_name_title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unlinkDeviceText"
|
||||
style="@style/ActionItem"
|
||||
android:drawableStart="@drawable/ic_phonelink_erase_white_24dp"
|
||||
android:text="@string/fragment_device_list_unlink_device_title" />
|
||||
|
||||
</LinearLayout>
|
@ -115,4 +115,10 @@
|
||||
|
||||
<dimen name="recording_voice_lock_target">-150dp</dimen>
|
||||
|
||||
<dimen name="default_margin">16dp</dimen>
|
||||
<dimen name="drawable_padding">24dp</dimen>
|
||||
<dimen name="text_size">16sp</dimen>
|
||||
<dimen name="normal_padding">16dp</dimen>
|
||||
<dimen name="action_item_height">56dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
@ -1643,5 +1643,8 @@
|
||||
<string name="activity_conversation_copy_public_key_button_title">Copy public key</string>
|
||||
<!-- Conversation list activity -->
|
||||
<string name="activity_conversation_list_add_public_chat_button_title">Add Public Chat</string>
|
||||
<!-- Device list bottom sheet fragment -->
|
||||
<string name="fragment_device_list_edit_display_name_title">Edit display name</string>
|
||||
<string name="fragment_device_list_unlink_device_title">Unlink device</string>
|
||||
|
||||
</resources>
|
||||
|
@ -242,4 +242,15 @@
|
||||
<item name="colorControlActivated">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionItem">
|
||||
<item name="android:textSize">@dimen/text_size</item>
|
||||
<item name="android:drawablePadding">@dimen/drawable_padding</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">@dimen/action_item_height</item>
|
||||
<item name="android:padding">@dimen/normal_padding</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:selectable">true</item>
|
||||
<item name="android:foreground">?attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -133,6 +133,7 @@
|
||||
<item name="android:windowBackground">@color/loki_darkest_gray</item>
|
||||
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyleLight</item>
|
||||
<item name="android:alertDialogTheme">@style/AppCompatDialogStyleLight</item>
|
||||
<item name="bottomSheetDialogTheme">@style/Theme.MaterialComponents.Light.BottomSheetDialog</item>
|
||||
<!--<item name="android:windowContentOverlay">@drawable/compat_actionbar_shadow_background</item>-->
|
||||
|
||||
<item name="attachment_type_selector_background">@color/white</item>
|
||||
@ -317,6 +318,7 @@
|
||||
<item name="android:windowBackground">@color/loki_darkest_gray</item>
|
||||
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyleDark</item>
|
||||
<item name="android:alertDialogTheme">@style/AppCompatDialogStyleDark</item>
|
||||
<item name="bottomSheetDialogTheme">@style/Theme.MaterialComponents.BottomSheetDialog</item>
|
||||
|
||||
<item name="attachment_type_selector_background">@color/gray95</item>
|
||||
<item name="attachment_document_icon_small">@drawable/ic_document_small_dark</item>
|
||||
|
@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.loaders.DeviceListLoader;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.devicelist.Device;
|
||||
import org.thoughtcrime.securesms.loki.DeviceListBottomSheetFragment;
|
||||
import org.thoughtcrime.securesms.loki.MnemonicUtilities;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
@ -128,6 +129,9 @@ public class DeviceListFragment extends ListFragment
|
||||
final String deviceName = ((DeviceListItem)view).getDeviceName();
|
||||
final String deviceId = ((DeviceListItem)view).getDeviceId();
|
||||
|
||||
DeviceListBottomSheetFragment fragment = new DeviceListBottomSheetFragment();
|
||||
fragment.show(getFragmentManager(), fragment.getTag());
|
||||
/*
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(getActivity().getString(R.string.DeviceListActivity_unlink_s, deviceName));
|
||||
builder.setMessage(R.string.DeviceListActivity_by_unlinking_this_device_it_will_no_longer_be_able_to_send_or_receive);
|
||||
@ -139,6 +143,8 @@ public class DeviceListFragment extends ListFragment
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
@ -0,0 +1,24 @@
|
||||
package org.thoughtcrime.securesms.loki
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.BottomSheetDialogFragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import kotlinx.android.synthetic.main.fragment_device_list_bottom_sheet.*
|
||||
import network.loki.messenger.R
|
||||
|
||||
public class DeviceListBottomSheetFragment : BottomSheetDialogFragment() {
|
||||
var onEditTapped: (() -> Unit)? = null
|
||||
var onUnlinkTapped: (() -> Unit)? = null
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_device_list_bottom_sheet, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
editDisplayNameText.setOnClickListener { onEditTapped?.invoke() }
|
||||
unlinkDeviceText.setOnClickListener { onUnlinkTapped?.invoke() }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user