Skip to content

Commit

Permalink
Merge pull request #327 from loki-project/ui
Browse files Browse the repository at this point in the history
UI Cleanup Part 2/3
  • Loading branch information
nielsandriesse authored Sep 8, 2020
2 parents cc199b4 + 3f03d56 commit 1eb38a1
Show file tree
Hide file tree
Showing 28 changed files with 467 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

<corners android:radius="@dimen/medium_button_corner_radius" />

<stroke android:width="@dimen/border_thickness" android:color="?colorAccent" />
<stroke android:width="@dimen/border_thickness" android:color="@color/accent" />
</shape>
9 changes: 5 additions & 4 deletions res/layout-sw400dp/activity_pn_mode.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand Down Expand Up @@ -30,7 +31,7 @@
android:textColor="@color/text"
android:text="There are two ways Session can notify you of new messages." />

<LinearLayout
<org.thoughtcrime.securesms.loki.views.PNModeView
android:id="@+id/fcmOptionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -66,9 +67,9 @@
android:textStyle="bold"
android:text="@string/activity_pn_mode_recommended_option_tag" />

</LinearLayout>
</org.thoughtcrime.securesms.loki.views.PNModeView>

<LinearLayout
<org.thoughtcrime.securesms.loki.views.PNModeView
android:id="@+id/backgroundPollingOptionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -95,7 +96,7 @@
android:textColor="@color/text"
android:text="Session will occasionally check for new messages in the background. Full metadata protection is guaranteed, but message notifications will be unreliable." />

</LinearLayout>
</org.thoughtcrime.securesms.loki.views.PNModeView>

<View
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:clipChildren="false">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
Expand Down
3 changes: 2 additions & 1 deletion res/layout/activity_path.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="@dimen/large_spacing">
android:layout_margin="@dimen/large_spacing"
android:clipChildren="false">

<LinearLayout
android:id="@+id/pathRowsContainer"
Expand Down
9 changes: 5 additions & 4 deletions res/layout/activity_pn_mode.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand Down Expand Up @@ -30,7 +31,7 @@
android:textColor="@color/text"
android:text="There are two ways Session can notify you of new messages." />

<LinearLayout
<org.thoughtcrime.securesms.loki.views.PNModeView
android:id="@+id/fcmOptionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -66,9 +67,9 @@
android:textStyle="bold"
android:text="@string/activity_pn_mode_recommended_option_tag" />

</LinearLayout>
</org.thoughtcrime.securesms.loki.views.PNModeView>

<LinearLayout
<org.thoughtcrime.securesms.loki.views.PNModeView
android:id="@+id/backgroundPollingOptionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -95,7 +96,7 @@
android:textColor="@color/text"
android:text="Session will occasionally check for new messages in the background. Full metadata protection is guaranteed, but message notifications will be unreliable." />

</LinearLayout>
</org.thoughtcrime.securesms.loki.views.PNModeView>

<View
android:layout_width="match_parent"
Expand Down
6 changes: 6 additions & 0 deletions res/layout/conversation_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@
android:gravity="center_vertical"
android:orientation="horizontal">

<org.thoughtcrime.securesms.loki.views.ProfilePictureView
android:id="@+id/profilePictureView"
android:layout_width="@dimen/medium_profile_picture_size"
android:layout_height="@dimen/medium_profile_picture_size" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_spacing"
android:orientation="vertical">

<TextView
Expand Down
11 changes: 9 additions & 2 deletions res/layout/fragment_conversation_bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

<TextView
android:id="@+id/detailsTextView"
style="@style/BottomSheetActionItem"
android:drawableStart="@drawable/ic_info_outline_white_24dp"
android:drawableTint="?attr/colorControlNormal"
android:text="@string/details" />

<TextView
android:id="@+id/blockTextView"
style="@style/BottomSheetActionItem"
android:drawableStart="?attr/menu_block_icon"
android:text="@string/RecipientPreferenceActivity_block"
android:visibility="gone"
tools:visibility="visible"/>
tools:visibility="visible" />

<TextView
android:id="@+id/unblockTextView"
style="@style/BottomSheetActionItem"
android:drawableStart="?attr/menu_accept_icon"
android:text="@string/RecipientPreferenceActivity_unblock"
android:visibility="gone"
tools:visibility="visible"/>
tools:visibility="visible" />

<TextView
android:id="@+id/deleteTextView"
Expand Down
51 changes: 51 additions & 0 deletions res/layout/fragment_user_details_bottom_sheet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/large_spacing"
android:paddingRight="@dimen/large_spacing"
android:paddingBottom="@dimen/large_spacing"
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

<org.thoughtcrime.securesms.loki.views.ProfilePictureView
android:id="@+id/profilePictureView"
android:layout_width="@dimen/large_profile_picture_size"
android:layout_height="@dimen/large_profile_picture_size"
android:layout_marginTop="@dimen/large_spacing" />

<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_spacing"
android:textSize="@dimen/massive_font_size"
android:textStyle="bold"
android:textColor="@color/text"
android:text="Spiderman" />

<TextView
style="@style/SessionIDTextView"
android:id="@+id/publicKeyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/large_font_size"
android:layout_marginTop="@dimen/large_spacing"
android:textIsSelectable="true"
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />

<Button
style="@style/Widget.Session.Button.Common.ProminentOutline"
android:id="@+id/copyButton"
android:layout_width="wrap_content"
android:layout_height="@dimen/medium_button_height"
android:layout_marginTop="@dimen/medium_spacing"
android:paddingLeft="@dimen/large_spacing"
android:paddingRight="@dimen/large_spacing"
android:text="@string/copy" />

</LinearLayout>
1 change: 1 addition & 0 deletions res/layout/view_fake_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:layout_height="wrap_content"
android:paddingLeft="@dimen/very_large_spacing"
android:paddingRight="@dimen/very_large_spacing"
android:paddingBottom="@dimen/medium_spacing"
android:orientation="vertical">

<TextView
Expand Down
2 changes: 1 addition & 1 deletion res/values-notnight-v21/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


<color name="app_icon_background">#333132</color>
<color name="progress_bar_background">#0AFFFFFF</color>
<color name="progress_bar_background">#0A000000</color>
<color name="quote_not_found_background">#99FFFFFF</color>

</resources>
10 changes: 10 additions & 0 deletions res/values-notnight-v21/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@
<item name="android:textColor">@android:color/white</item>
</style>

<style name="FakeChatViewMessageBubble.Incoming">
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
<item name="android:elevation">4dp</item>
</style>

<style name="FakeChatViewMessageBubble.Outgoing">
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
<item name="android:elevation">4dp</item>
</style>

</resources>
1 change: 1 addition & 0 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<color name="compose_text_view_background">#141414</color>
<color name="quote_not_found_background">#99FFFFFF</color>
<color name="new_conversation_button_collapsed_background">#1F1F1F</color>
<color name="new_conversation_button_shadow">#077C44</color>
<color name="pn_option_background">#1B1B1B</color>
<color name="pn_option_border">#212121</color>
<color name="paths_building">#FFCE3A</color>
Expand Down
2 changes: 1 addition & 1 deletion res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dimen name="text_view_corner_radius">8dp</dimen>
<dimen name="fake_chat_view_bubble_width">224dp</dimen>
<dimen name="fake_chat_view_bubble_corner_radius">10dp</dimen>
<dimen name="fake_chat_view_height">234dp</dimen>
<dimen name="fake_chat_view_height">250dp</dimen>
<dimen name="setting_button_height">56dp</dimen>
<dimen name="dialog_corner_radius">12dp</dimen>
<dimen name="dialog_button_corner_radius">4dp</dimen>
Expand Down
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,6 @@

<string name="attachment">Attachment</string>
<string name="attachment_type_voice_message">Voice Message</string>
<string name="details">Details</string>

</resources>
2 changes: 2 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@

<style name="FakeChatViewMessageBubble.Incoming">
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
<item name="android:elevation">10dp</item>
</style>

<style name="FakeChatViewMessageBubble.Outgoing">
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
<item name="android:elevation">10dp</item>
</style>
<!-- Session -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
import org.thoughtcrime.securesms.loki.protocol.SessionManagementProtocol;
import org.thoughtcrime.securesms.loki.utilities.MentionManagerUtilities;
import org.thoughtcrime.securesms.loki.views.MentionCandidateSelectionView;
import org.thoughtcrime.securesms.loki.views.ProfilePictureView;
import org.thoughtcrime.securesms.loki.views.SessionRestoreBannerView;
import org.thoughtcrime.securesms.mediasend.Media;
import org.thoughtcrime.securesms.mediasend.MediaSendActivity;
Expand Down Expand Up @@ -234,6 +235,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -300,6 +302,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private AnimatingToggle buttonToggle;
private SendButton sendButton;
private ImageButton attachButton;
private ProfilePictureView profilePictureView;
private TextView titleTextView;
private TextView charactersLeft;
private ConversationFragment fragment;
Expand Down Expand Up @@ -527,6 +530,7 @@ protected void onResume() {
composeText.setTransport(sendButton.getSelectedTransport());

updateTitleTextView(recipient);
updateProfilePicture();
updateSubtitleTextView();
setActionBarColor(recipient.getColor());
updateInputUI(recipient, isSecureText, isDefaultSms);
Expand Down Expand Up @@ -621,6 +625,7 @@ public void onActivityResult(final int reqCode, int resultCode, Intent data) {
recipient = Recipient.from(this, data.getParcelableExtra(GroupCreateActivity.GROUP_ADDRESS_EXTRA), true);
recipient.addListener(this);
updateTitleTextView(recipient);
updateProfilePicture();
updateSubtitleTextView();
NotificationChannels.updateContactChannelName(this, recipient);
updateInputUI(recipient, isSecureText, isDefaultSms);
Expand Down Expand Up @@ -1654,6 +1659,7 @@ protected void onPostExecute(@NonNull Pair<IdentityRecordList, String> result) {
}

private void initializeViews() {
profilePictureView = findViewById(R.id.profilePictureView);
titleTextView = findViewById(R.id.titleTextView);
buttonToggle = ViewUtil.findById(this, R.id.button_toggle);
sendButton = ViewUtil.findById(this, R.id.send_button);
Expand Down Expand Up @@ -1872,6 +1878,7 @@ public void onModified(final Recipient recipient) {
Util.runOnMain(() -> {
Log.i(TAG, "onModifiedRun(): " + recipient.getRegistered());
updateTitleTextView(recipient);
updateProfilePicture();
updateSubtitleTextView();
// titleView.setVerified(identityRecords.isVerified());
updateInputUI(recipient, isSecureText, isDefaultSms);
Expand Down Expand Up @@ -3100,6 +3107,11 @@ private void updateTitleTextView(Recipient recipient) {
}
}

private void updateProfilePicture() {
profilePictureView.glide = GlideApp.with(this);
profilePictureView.update(recipient, threadId);
}

private void updateSubtitleTextView() {
muteIndicatorImageView.setVisibility(View.GONE);
subtitleTextView.setVisibility(View.VISIBLE);
Expand Down
10 changes: 10 additions & 0 deletions src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob
import org.thoughtcrime.securesms.loki.dialogs.ConversationOptionsBottomSheet
import org.thoughtcrime.securesms.loki.dialogs.LightThemeFeatureIntroBottomSheet
import org.thoughtcrime.securesms.loki.dialogs.MultiDeviceRemovalBottomSheet
import org.thoughtcrime.securesms.loki.dialogs.UserDetailsBottomSheet
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol
import org.thoughtcrime.securesms.loki.protocol.SessionResetImplementation
import org.thoughtcrime.securesms.loki.utilities.*
Expand Down Expand Up @@ -100,6 +101,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
profileButton.publicKey = publicKey
profileButton.update()
profileButton.setOnClickListener { openSettings() }
pathStatusViewContainer.disableClipping()
pathStatusViewContainer.setOnClickListener { showPath() }
// Set up seed reminder view
val isMasterDevice = (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == null)
Expand Down Expand Up @@ -271,6 +273,14 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
val thread = view.thread ?: return
val bottomSheet = ConversationOptionsBottomSheet()
bottomSheet.recipient = thread.recipient
bottomSheet.onViewDetailsTapped = {
bottomSheet.dismiss()
val userDetailsBottomSheet = UserDetailsBottomSheet()
val bundle = Bundle()
bundle.putString("publicKey", thread.recipient.address.toPhoneString())
userDetailsBottomSheet.arguments = bundle
userDetailsBottomSheet.show(supportFragmentManager, userDetailsBottomSheet.tag)
}
bottomSheet.onBlockTapped = {
bottomSheet.dismiss()
if (!thread.recipient.isBlocked) {
Expand Down
Loading

0 comments on commit 1eb38a1

Please sign in to comment.