mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-11 18:54:21 +00:00
WIP
This commit is contained in:
parent
df61e9565c
commit
52dc8d6b63
@ -4,5 +4,6 @@
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_grey_90" />
|
||||
|
||||
<solid android:color="@color/compose_view_background" />
|
||||
</shape>
|
@ -25,11 +25,10 @@
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="?attr/conversation_item_sticky_date_text_color"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:background="?attr/conversation_item_sticky_date_background"
|
||||
android:elevation="9dp"
|
||||
android:elevation="10dp"
|
||||
android:visibility="gone"
|
||||
tools:text="March 1, 2015" />
|
||||
|
||||
|
@ -15,9 +15,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="?conversation_item_update_text_color"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
tools:text="March 1, 2015" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -37,6 +37,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
||||
android:paddingBottom="@dimen/medium_spacing"
|
||||
android:layout_gravity="end"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
@ -109,7 +110,6 @@
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="?conversation_item_sent_text_primary_color"
|
||||
android:textColorLink="?conversation_item_sent_text_primary_color"
|
||||
@ -140,10 +140,9 @@
|
||||
android:id="@+id/conversation_item_footer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
|
||||
|
@ -50,7 +50,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textColor="?linkpreview_secondary_text_color"
|
||||
android:alpha="0.6"
|
||||
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
||||
|
@ -46,6 +46,8 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = AttachmentTypeSelector.class.getSimpleName();
|
||||
|
||||
private final @NonNull Context context;
|
||||
public int keyboardHeight;
|
||||
private final @NonNull LoaderManager loaderManager;
|
||||
private final @NonNull RecentPhotoViewRail recentRail;
|
||||
private final @NonNull ImageView imageButton;
|
||||
@ -63,6 +65,9 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
public AttachmentTypeSelector(@NonNull Context context, @NonNull LoaderManager loaderManager, @Nullable AttachmentClickedListener listener, int keyboardHeight) {
|
||||
super(context);
|
||||
|
||||
this.context = context;
|
||||
this.keyboardHeight = keyboardHeight;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.attachment_type_selector, null, true);
|
||||
|
||||
@ -97,18 +102,14 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
setFocusable(true);
|
||||
setTouchable(true);
|
||||
|
||||
int thresholdInDP = 200;
|
||||
float scale = context.getResources().getDisplayMetrics().density;
|
||||
int thresholdInPX = (int)(thresholdInDP * scale);
|
||||
View contentView = ViewUtil.findById(layout, R.id.contentView);
|
||||
LinearLayout.LayoutParams contentViewLayoutParams = (LinearLayout.LayoutParams)contentView.getLayoutParams();
|
||||
contentViewLayoutParams.height = keyboardHeight > thresholdInPX ? keyboardHeight : LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
contentView.setLayoutParams(contentViewLayoutParams);
|
||||
updateHeight();
|
||||
|
||||
loaderManager.initLoader(1, null, recentRail);
|
||||
}
|
||||
|
||||
public void show(@NonNull Activity activity, final @NonNull View anchor) {
|
||||
updateHeight();
|
||||
|
||||
if (Permissions.hasAll(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
recentRail.setVisibility(View.VISIBLE);
|
||||
loaderManager.restartLoader(1, null, recentRail);
|
||||
@ -146,6 +147,16 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHeight() {
|
||||
int thresholdInDP = 120;
|
||||
float scale = context.getResources().getDisplayMetrics().density;
|
||||
int thresholdInPX = (int)(thresholdInDP * scale);
|
||||
View contentView = ViewUtil.findById(getContentView(), R.id.contentView);
|
||||
LinearLayout.LayoutParams contentViewLayoutParams = (LinearLayout.LayoutParams)contentView.getLayoutParams();
|
||||
contentViewLayoutParams.height = keyboardHeight > thresholdInPX ? keyboardHeight : LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
contentView.setLayoutParams(contentViewLayoutParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
|
@ -421,7 +421,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
View rootView = findViewById(R.id.rootView);
|
||||
rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||
int height = rootView.getRootView().getHeight() - rootView.getHeight();
|
||||
expandedKeyboardHeight = Math.max(expandedKeyboardHeight, height);
|
||||
int thresholdInDP = 120;
|
||||
float scale = getResources().getDisplayMetrics().density;
|
||||
int thresholdInPX = (int)(thresholdInDP * scale);
|
||||
if (expandedKeyboardHeight == 0 || height > thresholdInPX) {
|
||||
expandedKeyboardHeight = height;
|
||||
}
|
||||
collapsedKeyboardHeight = Math.min(collapsedKeyboardHeight, height);
|
||||
keyboardHeight = Math.max(expandedKeyboardHeight - collapsedKeyboardHeight, keyboardHeight);
|
||||
});
|
||||
@ -1175,6 +1180,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
if (attachmentTypeSelector == null) {
|
||||
attachmentTypeSelector = new AttachmentTypeSelector(this, getSupportLoaderManager(), new AttachmentTypeListener(), keyboardHeight);
|
||||
}
|
||||
attachmentTypeSelector.keyboardHeight = keyboardHeight;
|
||||
attachmentTypeSelector.show(this, attachButton);
|
||||
} else {
|
||||
handleManualMmsRequired();
|
||||
|
@ -70,7 +70,7 @@ class FriendRequestView(context: Context, attrs: AttributeSet?, defStyleAttr: In
|
||||
if (isUISetUp) { return }
|
||||
isUISetUp = true
|
||||
orientation = VERTICAL
|
||||
setPadding(resources.getDimension(R.dimen.large_spacing).toInt(), 0, resources.getDimension(R.dimen.large_spacing).toInt(), 0)
|
||||
setPadding(toPx(48, resources), 0, toPx(48, resources), 0)
|
||||
addView(topSpacer)
|
||||
addView(label)
|
||||
if (!message!!.isOutgoing) {
|
||||
|
Loading…
Reference in New Issue
Block a user