mirror of
https://codeberg.org/Mercury-IM/Mercury-IM
synced 2025-02-07 20:06:24 +01:00
Fix some layouts
This commit is contained in:
parent
748c77c092
commit
cfad3b602e
7 changed files with 124 additions and 91 deletions
|
@ -25,11 +25,13 @@ import com.google.android.material.chip.Chip;
|
|||
import com.google.android.material.chip.ChipGroup;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
|
||||
import org.mercury_im.messenger.android.ui.openpgp.OpenPgpV4FingerprintFormatter;
|
||||
import org.mercury_im.messenger.android.ui.openpgp.ToggleableFingerprintsAdapter;
|
||||
import org.mercury_im.messenger.core.Messenger;
|
||||
import org.mercury_im.messenger.R;
|
||||
import org.mercury_im.messenger.android.ui.chat.ChatActivity;
|
||||
import org.mercury_im.messenger.android.util.ColorUtil;
|
||||
import org.mercury_im.messenger.core.util.Optional;
|
||||
import org.mercury_im.messenger.core.viewmodel.openpgp.FingerprintViewItem;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -77,10 +79,16 @@ public class ContactDetailFragment extends Fragment {
|
|||
@BindView(R.id.fingerprint_list)
|
||||
RecyclerView fingerprintRecyclerView;
|
||||
|
||||
@BindView(R.id.contact_fingerprints)
|
||||
@BindView(R.id.card_contact_fingerprints)
|
||||
MaterialCardView fingerprintsLayout;
|
||||
|
||||
private ContactDetailViewModel viewModel;
|
||||
@BindView(R.id.card_ikey_fingerprint)
|
||||
MaterialCardView ikeyLayout;
|
||||
|
||||
@BindView(R.id.fingerprint)
|
||||
TextView ikeyFingerprint;
|
||||
|
||||
private ToggleableFingerprintsAdapter fingerprintsAdapter;
|
||||
|
||||
@Nullable
|
||||
|
@ -184,6 +192,15 @@ public class ContactDetailFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void setIkeyFingerprint(Optional<FingerprintViewItem> fingerprintViewItemOptional) {
|
||||
if (fingerprintViewItemOptional.isPresent()) {
|
||||
ikeyLayout.setVisibility(View.VISIBLE);
|
||||
ikeyFingerprint.setText(OpenPgpV4FingerprintFormatter.formatOpenPgpV4Fingerprint(fingerprintViewItemOptional.getItem().getFingerprint()));
|
||||
} else {
|
||||
ikeyLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setFingerprints(List<FingerprintViewItem> fingerprints) {
|
||||
LOGGER.log(Level.INFO, "Display fingerprints: " + Arrays.asList(fingerprints.toArray()));
|
||||
fingerprintsLayout.setVisibility(fingerprints.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
|
|
|
@ -48,12 +48,6 @@
|
|||
android:clipToPadding="false"
|
||||
app:layout_constraintTop_toBottomOf="@id/jid">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
|
||||
android:text="Encryption Keys" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/layout_ikey"
|
||||
|
@ -63,8 +57,7 @@
|
|||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="4dp">
|
||||
style="@style/Widget.Theme.Mercury.CardView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -115,13 +108,19 @@
|
|||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
|
||||
android:text="Encryption Keys" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="4dp">
|
||||
style="@style/Widget.Theme.Mercury.CardView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -135,7 +134,7 @@
|
|||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Device Key"
|
||||
android:text="This Device"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -173,26 +172,45 @@
|
|||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<include layout="@layout/view_fingerprints_card_toggleable"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/other_fingerprints_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/other_fingerprints_card"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
style="@style/Widget.Theme.Mercury.CardView">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btn_send_ikey_element"
|
||||
android:layout_gravity="end"
|
||||
android:text="Publish Decisions" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Other Devices" />
|
||||
|
||||
<include layout="@layout/view_fingerprints_card_toggleable"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btn_send_ikey_element"
|
||||
android:layout_gravity="end"
|
||||
android:text="Publish Decisions" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -12,16 +12,15 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:background="@color/lightThemeBackground">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Theme.Mercury.CardView"
|
||||
android:id="@+id/card_contact_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
card_view:cardElevation="4dp"
|
||||
card_view:cardCornerRadius="6dp">
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -89,17 +88,17 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Theme.Mercury.CardView"
|
||||
android:id="@+id/card_used_account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardCornerRadius="6dp">
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -110,13 +109,13 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Used Account"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
|
||||
android:text="Used Account"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
tools:text="vanitasvitae@jabberhead.tk"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -160,16 +159,19 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Theme.Mercury.CardView"
|
||||
android:id="@+id/card_ikey_fingerprint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="6dp">
|
||||
android:layout_marginBottom="6dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -185,7 +187,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/contact_ikey_fingerprint"
|
||||
layout="@layout/view_openpgp_4_fingerprint_info_toggleable"
|
||||
|
@ -200,16 +201,40 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<include layout="@layout/view_fingerprints_card_toggleable"
|
||||
android:id="@+id/contact_fingerprints"
|
||||
android:layout_height="wrap_content"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Theme.Mercury.CardView"
|
||||
android:id="@+id/card_contact_fingerprints"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="64dp"/>
|
||||
android:layout_marginBottom="80dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Devices" />
|
||||
|
||||
<include layout="@layout/view_fingerprints_card_toggleable"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="4dp">
|
||||
style="@style/Widget.Theme.Mercury.CardView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,43 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/fingerprint_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Other Devices"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/fingerprint_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/view_openpgp_4_fingerprint_info_toggleable"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
tools:listitem="@layout/view_openpgp_4_fingerprint_info_toggleable"
|
||||
android:layout_centerHorizontal="true"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:cardCornerRadius="4dp"
|
||||
app:cardElevation="4dp">
|
||||
style="@style/Widget.Theme.Mercury.CardView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -20,4 +20,11 @@
|
|||
<item name="android:autoLink">web</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Theme.Mercury.CardView"
|
||||
parent="CardView">
|
||||
<item name="cardCornerRadius">4dp</item>
|
||||
<item name="cardElevation">4dp</item>
|
||||
<item name="android:padding">12dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
Reference in a new issue