Compare commits
2 Commits
eca4e6bdcb
...
c322f321cf
Author | SHA1 | Date |
---|---|---|
Paul Schaub | c322f321cf | |
Paul Schaub | adea44aaa1 |
|
@ -8,10 +8,10 @@ import androidx.appcompat.widget.Toolbar;
|
|||
|
||||
import org.mercury_im.messenger.R;
|
||||
import org.mercury_im.messenger.android.crypto.ikey.IkeyBackupCreationFragment;
|
||||
import org.mercury_im.messenger.android.ui.base.MercuryActivity;
|
||||
import org.mercury_im.messenger.android.ui.account.login.IkeyBackupRestoreOrSkipFragment;
|
||||
import org.mercury_im.messenger.android.ui.account.login.IkeyKeyInfoFragment;
|
||||
import org.mercury_im.messenger.android.ui.account.login.IkeySetupNavigator;
|
||||
import org.mercury_im.messenger.android.ui.base.MercuryActivity;
|
||||
import org.mercury_im.messenger.android.util.ArgumentUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
|
@ -150,7 +150,7 @@ public class AccountDetailsFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void observeViewModel() {
|
||||
viewModel.getIkeyFingerprint().observe(getViewLifecycleOwner(), this::displayIkeyFingerprint);
|
||||
viewModel.getIkeyFingerprint().observe(getViewLifecycleOwner(), this::displayIkeyFingerprintAndDecisionButton);
|
||||
viewModel.getLocalFingerprint().observe(getViewLifecycleOwner(), this::displayLocalOxFingerprint);
|
||||
viewModel.getRemoteFingerprints().observe(getViewLifecycleOwner(), this::displayOtherOxFingerprints);
|
||||
|
||||
|
@ -223,4 +223,17 @@ public class AccountDetailsFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void displayIkeyFingerprintAndDecisionButton(Optional<OpenPgpV4Fingerprint> fingerprint) {
|
||||
displayIkeyFingerprint(fingerprint);
|
||||
displayIkeyDecisionPublishButton(fingerprint);
|
||||
}
|
||||
|
||||
private void displayIkeyDecisionPublishButton(Optional<OpenPgpV4Fingerprint> fingerprint) {
|
||||
if (fingerprint.isPresent()) {
|
||||
ikeySendDecisions.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ikeySendDecisions.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.mercury_im.messenger.android.ui.account.login;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -21,6 +23,9 @@ import java.util.UUID;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
import static android.app.Activity.RESULT_CANCELED;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class IkeyBackupRestoreOrSkipFragment extends Fragment {
|
||||
|
||||
@BindView(R.id.btn_restore)
|
||||
|
@ -69,6 +74,7 @@ public class IkeyBackupRestoreOrSkipFragment extends Fragment {
|
|||
Toast.makeText(getContext(), opt.getItem(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
scanButton.setOnClickListener(v -> startQrCodeScanIntent());
|
||||
}
|
||||
|
||||
public void onRestore() {
|
||||
|
@ -79,4 +85,36 @@ public class IkeyBackupRestoreOrSkipFragment extends Fragment {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public void startQrCodeScanIntent() {
|
||||
try {
|
||||
|
||||
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
|
||||
intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); // "PRODUCT_MODE for bar codes
|
||||
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Uri marketUri = Uri.parse("market://details?id=com.google.zxing.client.android");
|
||||
Intent marketIntent = new Intent(Intent.ACTION_VIEW,marketUri);
|
||||
startActivity(marketIntent);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 0) {
|
||||
|
||||
if (resultCode == RESULT_OK) {
|
||||
String contents = data.getStringExtra("SCAN_RESULT");
|
||||
backupCodeEditText.setText(contents);
|
||||
}
|
||||
if(resultCode == RESULT_CANCELED){
|
||||
//handle cancel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ToggleableFingerprintsAdapter extends RecyclerView.Adapter<Toggleab
|
|||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.view_openpgp_4_fingerprint_toggleable, parent, false);
|
||||
.inflate(R.layout.view_openpgp_4_fingerprint_info_toggleable, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,37 +119,83 @@
|
|||
android:layout_height="wrap_content"
|
||||
tools:text="vanitasvitae@jabberhead.tk"/>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Categories"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/contact_groups"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:chipSpacing="4dp">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:chipStrokeColor="@color/black"
|
||||
android:text="Work"/>
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dungeons n' Dragons"/>
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_add_to_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mark Mercury Seven"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Categories"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/contact_groups"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:chipSpacing="4dp">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:chipStrokeColor="@color/black"
|
||||
android:text="Work"/>
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dungeons n' Dragons"/>
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_add_to_group"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mark Mercury Seven"/>
|
||||
</LinearLayout>
|
||||
android:text="Identity Key"
|
||||
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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="8dp"
|
||||
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>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_height="match_parent"
|
||||
tools:context=".android.ui.MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<include layout="@layout/view_toolbar_top" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/appbar_layout"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_navigation">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/view_toolbar_bottom" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -25,10 +25,8 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/appbar_layout"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_navigation">
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/view_toolbar_bottom" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
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: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"
|
||||
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>
|
|
@ -29,7 +29,7 @@
|
|||
android:id="@+id/fingerprint_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/view_openpgp_4_fingerprint_toggleable"
|
||||
tools:listitem="@layout/view_openpgp_4_fingerprint_info_toggleable"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/fingerprint"
|
||||
layout="@layout/view_openpgp_4_fingerprint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="2018-03-01T15:26:12Z"
|
||||
app:layout_constraintStart_toStartOf="@id/fingerprint"
|
||||
app:layout_constraintEnd_toEndOf="@id/fingerprint"
|
||||
app:layout_constraintTop_toBottomOf="@id/fingerprint"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@id/fingerprint_timestamp" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
Loading…
Reference in New Issue