migrated some views over to app compat text styles

This commit is contained in:
Daniel Gultsch 2018-02-28 22:18:33 +01:00
parent 562622393e
commit 71beb92dd3
12 changed files with 23 additions and 170 deletions

View file

@ -127,10 +127,6 @@ public abstract class OmemoActivity extends XmppActivity {
CompoundButton.OnCheckedChangeListener
onCheckedChangeListener) {
ContactKeyBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.contact_key, keys, true);
if (Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509) {
binding.key.setOnClickListener(v -> showX509Certificate(account, fingerprint));
binding.keyType.setOnClickListener(v -> showX509Certificate(account, fingerprint));
}
binding.tglTrust.setVisibility(View.VISIBLE);
registerForContextMenu(binding.getRoot());
binding.getRoot().setTag(R.id.TAG_ACCOUNT, account);
@ -214,37 +210,6 @@ public abstract class OmemoActivity extends XmppActivity {
builder.create().show();
}
private void showX509Certificate(Account account, String fingerprint) {
X509Certificate x509Certificate = account.getAxolotlService().getFingerprintCertificate(fingerprint);
if (x509Certificate != null) {
showCertificateInformationDialog(CryptoHelper.extractCertificateInformation(x509Certificate));
} else {
Toast.makeText(this, R.string.certificate_not_found, Toast.LENGTH_SHORT).show();
}
}
private void showCertificateInformationDialog(Bundle bundle) {
View view = getLayoutInflater().inflate(R.layout.certificate_information, null);
final String not_available = getString(R.string.certicate_info_not_available);
TextView subject_cn = (TextView) view.findViewById(R.id.subject_cn);
TextView subject_o = (TextView) view.findViewById(R.id.subject_o);
TextView issuer_cn = (TextView) view.findViewById(R.id.issuer_cn);
TextView issuer_o = (TextView) view.findViewById(R.id.issuer_o);
TextView sha1 = (TextView) view.findViewById(R.id.sha1);
subject_cn.setText(bundle.getString("subject_cn", not_available));
subject_o.setText(bundle.getString("subject_o", not_available));
issuer_cn.setText(bundle.getString("issuer_cn", not_available));
issuer_o.setText(bundle.getString("issuer_o", not_available));
sha1.setText(bundle.getString("sha1", not_available));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.certificate_information);
builder.setView(view);
builder.setPositiveButton(R.string.ok, null);
builder.create().show();
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);

View file

@ -162,9 +162,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/battery_optimizations_enabled"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/>
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:id="@+id/os_optimization_body"
@ -174,8 +172,7 @@
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text="@string/battery_optimizations_enabled_explained"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<Button
android:id="@+id/os_optimization_disable"
@ -599,18 +596,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/other_devices"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"
android:layout_margin="@dimen/list_padding"
android:textStyle="bold"/>
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:layout_margin="@dimen/list_padding"/>
<LinearLayout
android:id="@+id/other_device_keys"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal"
android:orientation="vertical"
android:showDividers="middle"></LinearLayout>
android:orientation="vertical"/>
<Button
android:id="@+id/clear_devices"

View file

@ -16,9 +16,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:textColor="?attr/color_text_primary"
android:textColorHint="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"
android:hint="@string/captcha_hint">
<requestFocus />

View file

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_subject"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"/>
<TextView
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_cn"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subject_cn"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_o"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subject_o"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_issuer"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"/>
<TextView
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_cn"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/issuer_cn"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_o"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/issuer_o"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/certificate_sha1"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sha1"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace"
android:fontFamily="monospace"/>
</LinearLayout>

View file

@ -50,10 +50,7 @@
android:id="@+id/key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="monospace"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace"
android:textAppearance="@style/TextAppearance.Conversations.Fingerprint"
android:visibility="gone"/>
</LinearLayout>

View file

@ -19,13 +19,10 @@
android:id="@+id/key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:fontFamily="monospace"
android:longClickable="true"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace"/>
android:textAppearance="@style/TextAppearance.Conversations.Fingerprint"/>
<TextView
android:id="@+id/key_type"
@ -34,8 +31,7 @@
android:clickable="true"
android:longClickable="true"
android:maxLines="1"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
</LinearLayout>
<LinearLayout

View file

@ -12,8 +12,7 @@
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="?attr/TextSizeBody"
android:textColor="?attr/color_text_primary"/>
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<CheckBox
android:layout_marginTop="8dp"
android:id="@+id/report_spam"

View file

@ -11,10 +11,9 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/color_text_primary"
android:paddingBottom="8dp"
android:text="@string/clear_histor_msg"
android:textSize="?attr/TextSizeBody" />
android:layout_marginBottom="8dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:text="@string/clear_histor_msg"/>
<CheckBox
android:id="@+id/end_conversation_checkbox"

View file

@ -28,32 +28,27 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_your_username"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/>
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/magic_create_text"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:hint="@string/username_hint"
android:inputType="textNoSuggestions"
android:textSize="?attr/TextSizeBody"/>
android:inputType="textNoSuggestions"/>
<TextView
android:id="@+id/full_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/your_full_jid_will_be"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:visibility="invisible"/>
<Button
android:id="@+id/create_account"

View file

@ -21,8 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/presence_status_message"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"

View file

@ -28,16 +28,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/welcome_header"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/>
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/welcome_text"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
<Button
android:id="@+id/create_account"
style="?android:attr/borderlessButtonStyle"

View file

@ -2,6 +2,10 @@
<style name="TextAppearance.Conversations.Body1.Secondary" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="TextAppearance.Conversations.Fingerprint" parent="TextAppearance.AppCompat.Body1">
<item name="android:fontFamily">monospace</item>
<item name="android:typeface">monospace</item>
</style>
<style name="InputLabel" parent="TextAppearance.AppCompat.Caption">
<item name="android:paddingBottom">@dimen/input_label_vertical_spacing</item>
<item name="android:paddingLeft">@dimen/input_label_horizontal_spacing</item>