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">
|
android:shape="rectangle">
|
||||||
|
|
||||||
<corners android:radius="4dp" />
|
<corners android:radius="4dp" />
|
||||||
<solid android:color="@color/core_grey_90" />
|
|
||||||
|
<solid android:color="@color/compose_view_background" />
|
||||||
</shape>
|
</shape>
|
@ -25,11 +25,10 @@
|
|||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
style="@style/Signal.Text.Caption"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textColor="?attr/conversation_item_sticky_date_text_color"
|
android:textColor="#99FFFFFF"
|
||||||
android:textAllCaps="true"
|
|
||||||
android:background="?attr/conversation_item_sticky_date_background"
|
android:background="?attr/conversation_item_sticky_date_background"
|
||||||
android:elevation="9dp"
|
android:elevation="10dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="March 1, 2015" />
|
tools:text="March 1, 2015" />
|
||||||
|
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
style="@style/Signal.Text.Caption"
|
android:textColor="#99FFFFFF"
|
||||||
android:textColor="?conversation_item_update_text_color"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textAllCaps="true"
|
|
||||||
tools:text="March 1, 2015" />
|
tools:text="March 1, 2015" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
||||||
|
android:paddingBottom="@dimen/medium_spacing"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
@ -109,7 +110,6 @@
|
|||||||
android:layout_marginTop="14dp"
|
android:layout_marginTop="14dp"
|
||||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||||
android:layout_marginEnd="@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"
|
style="@style/Signal.Text.Body"
|
||||||
android:textColor="?conversation_item_sent_text_primary_color"
|
android:textColor="?conversation_item_sent_text_primary_color"
|
||||||
android:textColorLink="?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:id="@+id/conversation_item_footer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||||
android:layout_marginEnd="@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:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
|
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="@dimen/very_small_font_size"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textColor="?linkpreview_secondary_text_color"
|
android:textColor="?linkpreview_secondary_text_color"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
app:layout_constraintStart_toEndOf="@+id/linkpreview_thumbnail"
|
||||||
|
@ -46,6 +46,8 @@ public class AttachmentTypeSelector extends PopupWindow {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static final String TAG = AttachmentTypeSelector.class.getSimpleName();
|
private static final String TAG = AttachmentTypeSelector.class.getSimpleName();
|
||||||
|
|
||||||
|
private final @NonNull Context context;
|
||||||
|
public int keyboardHeight;
|
||||||
private final @NonNull LoaderManager loaderManager;
|
private final @NonNull LoaderManager loaderManager;
|
||||||
private final @NonNull RecentPhotoViewRail recentRail;
|
private final @NonNull RecentPhotoViewRail recentRail;
|
||||||
private final @NonNull ImageView imageButton;
|
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) {
|
public AttachmentTypeSelector(@NonNull Context context, @NonNull LoaderManager loaderManager, @Nullable AttachmentClickedListener listener, int keyboardHeight) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
this.context = context;
|
||||||
|
this.keyboardHeight = keyboardHeight;
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.attachment_type_selector, null, true);
|
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.attachment_type_selector, null, true);
|
||||||
|
|
||||||
@ -97,18 +102,14 @@ public class AttachmentTypeSelector extends PopupWindow {
|
|||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setTouchable(true);
|
setTouchable(true);
|
||||||
|
|
||||||
int thresholdInDP = 200;
|
updateHeight();
|
||||||
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);
|
|
||||||
|
|
||||||
loaderManager.initLoader(1, null, recentRail);
|
loaderManager.initLoader(1, null, recentRail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(@NonNull Activity activity, final @NonNull View anchor) {
|
public void show(@NonNull Activity activity, final @NonNull View anchor) {
|
||||||
|
updateHeight();
|
||||||
|
|
||||||
if (Permissions.hasAll(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
if (Permissions.hasAll(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||||
recentRail.setVisibility(View.VISIBLE);
|
recentRail.setVisibility(View.VISIBLE);
|
||||||
loaderManager.restartLoader(1, null, recentRail);
|
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
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -421,7 +421,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
View rootView = findViewById(R.id.rootView);
|
View rootView = findViewById(R.id.rootView);
|
||||||
rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||||
int height = rootView.getRootView().getHeight() - rootView.getHeight();
|
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);
|
collapsedKeyboardHeight = Math.min(collapsedKeyboardHeight, height);
|
||||||
keyboardHeight = Math.max(expandedKeyboardHeight - collapsedKeyboardHeight, keyboardHeight);
|
keyboardHeight = Math.max(expandedKeyboardHeight - collapsedKeyboardHeight, keyboardHeight);
|
||||||
});
|
});
|
||||||
@ -1175,6 +1180,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
if (attachmentTypeSelector == null) {
|
if (attachmentTypeSelector == null) {
|
||||||
attachmentTypeSelector = new AttachmentTypeSelector(this, getSupportLoaderManager(), new AttachmentTypeListener(), keyboardHeight);
|
attachmentTypeSelector = new AttachmentTypeSelector(this, getSupportLoaderManager(), new AttachmentTypeListener(), keyboardHeight);
|
||||||
}
|
}
|
||||||
|
attachmentTypeSelector.keyboardHeight = keyboardHeight;
|
||||||
attachmentTypeSelector.show(this, attachButton);
|
attachmentTypeSelector.show(this, attachButton);
|
||||||
} else {
|
} else {
|
||||||
handleManualMmsRequired();
|
handleManualMmsRequired();
|
||||||
|
@ -70,7 +70,7 @@ class FriendRequestView(context: Context, attrs: AttributeSet?, defStyleAttr: In
|
|||||||
if (isUISetUp) { return }
|
if (isUISetUp) { return }
|
||||||
isUISetUp = true
|
isUISetUp = true
|
||||||
orientation = VERTICAL
|
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(topSpacer)
|
||||||
addView(label)
|
addView(label)
|
||||||
if (!message!!.isOutgoing) {
|
if (!message!!.isOutgoing) {
|
||||||
|
Loading…
Reference in New Issue
Block a user