use text styles in more places

This commit is contained in:
Daniel Gultsch 2018-03-01 19:44:08 +01:00
parent a283d00013
commit 157ca65b0a
21 changed files with 102 additions and 95 deletions

View file

@ -965,7 +965,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mPgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId));
this.mPgpFingerprint.setOnClickListener(openPgp);
if ("pgp".equals(messageFingerprint)) {
this.getmPgpFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent));
this.getmPgpFingerprintDesc.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Highlight);
}
this.getmPgpFingerprintDesc.setOnClickListener(openPgp);
this.mPgpDeleteFingerprintButton.setOnClickListener(delete);
@ -976,10 +976,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (ownAxolotlFingerprint != null && Config.supportOmemo()) {
this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE);
if (ownAxolotlFingerprint.equals(messageFingerprint)) {
this.mOwnFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent));
this.mOwnFingerprintDesc.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Highlight);
this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint_selected_message);
} else {
this.mOwnFingerprintDesc.setTextColor(getSecondaryTextColor());
this.mOwnFingerprintDesc.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption);
this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint);
}
this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2)));

View file

@ -137,8 +137,8 @@ public abstract class OmemoActivity extends XmppActivity {
binding.tglTrust.setChecked(status.isTrusted());
if (status.isActive()) {
binding.key.setTextColor(getPrimaryTextColor());
binding.keyType.setTextColor(getSecondaryTextColor());
binding.key.setTextAppearance(this,R.style.TextAppearance_Conversations_Fingerprint);
binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption);
if (status.isVerified()) {
binding.verifiedFingerprint.setVisibility(View.VISIBLE);
binding.verifiedFingerprint.setAlpha(1.0f);
@ -164,8 +164,8 @@ public abstract class OmemoActivity extends XmppActivity {
toast = v -> hideToast();
}
} else {
binding.key.setTextColor(getTertiaryTextColor());
binding.keyType.setTextColor(getTertiaryTextColor());
binding.key.setTextAppearance(this,R.style.TextAppearance_Conversations_Fingerprint_Disabled);
binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Disabled);
toast = v -> replaceToast(getString(R.string.this_device_is_no_longer_in_use), false);
if (status.isVerified()) {
binding.tglTrust.setVisibility(View.GONE);
@ -188,7 +188,7 @@ public abstract class OmemoActivity extends XmppActivity {
binding.keyType.setVisibility(View.GONE);
}
if (highlight) {
binding.keyType.setTextColor(ContextCompat.getColor(this, R.color.accent));
binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Highlight);
binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message));
} else {
binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint));

View file

@ -778,10 +778,6 @@ public abstract class XmppActivity extends AppCompatActivity {
}
}
public int getTertiaryTextColor() {
return this.mTertiaryTextColor;
}
public int getSecondaryTextColor() {
return this.mSecondaryTextColor;
}

View file

@ -288,8 +288,13 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
break;
}
if (error && type == SENT) {
viewHolder.time.setTextColor(activity.getWarningTextColor());
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Waring);
} else {
if (darkBackground) {
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
} else {
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption);
}
viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground, false));
}
if (message.getEncryption() == Message.ENCRYPTION_NONE) {
@ -351,8 +356,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.image.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setText(text);
viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false));
viewHolder.messageBody.setTypeface(null, Typeface.ITALIC);
if (darkBackground) {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark);
} else {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary);
}
viewHolder.messageBody.setTextIsSelectable(false);
}
@ -361,10 +369,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.image.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setText(getContext().getString(
R.string.decryption_failed));
viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false));
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
if (darkBackground) {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark);
} else {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary);
}
viewHolder.messageBody.setTextIsSelectable(false);
}
@ -454,8 +463,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground, true));
if (darkBackground) {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_OnDark);
} else {
viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1);
}
viewHolder.messageBody.setHighlightColor(ContextCompat.getColor(activity, darkBackground
? (type == SENT || !mUseGreenBackground ? R.color.black26 : R.color.grey800) : R.color.grey500));
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
@ -704,7 +716,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.status_message.setText(DateUtils.formatDateTime(activity, message.getTimeSent(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR));
}
viewHolder.message_box.setBackgroundResource(activity.isDarkTheme() ? R.drawable.date_bubble_grey : R.drawable.date_bubble_white);
viewHolder.status_message.setTextColor(activity.getSecondaryTextColor());
return view;
} else if (type == STATUS) {
if ("LOAD_MORE".equals(message.getBody())) {

View file

@ -56,7 +56,11 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
}
private boolean init(ViewHolder viewHolder, Message message) {
viewHolder.runtime.setTextColor(this.messageAdapter.getMessageTextColor(viewHolder.darkBackground, false));
if (viewHolder.darkBackground) {
viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
} else {
viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption);
}
viewHolder.progress.setOnSeekBarChangeListener(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ColorStateList color = ContextCompat.getColorStateList(messageAdapter.getContext(), viewHolder.darkBackground ? R.color.white70 : R.color.bubble);

View file

@ -481,18 +481,14 @@
android:id="@+id/pgp_fingerprint"
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"/>
<TextView
android:id="@+id/pgp_fingerprint_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openpgp_key_id"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
</LinearLayout>
<ImageButton
@ -526,18 +522,13 @@
android:id="@+id/axolotl_fingerprint"
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"/>
<TextView
android:id="@+id/own_fingerprint_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/omemo_fingerprint"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
</LinearLayout>
<LinearLayout

View file

@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/color_background_primary">
android:background="?attr/color_background_secondary">
<android.support.v7.widget.CardView
android:layout_width="fill_parent"

View file

@ -32,9 +32,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:hint="@string/status_message"
android:inputType="textMultiLine"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:inputType="textMultiLine"/>
<Spinner
android:id="@+id/presence_show"
@ -48,9 +46,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="@string/all_accounts_on_this_device"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
android:text="@string/all_accounts_on_this_device"/>
<Button
android:id="@+id/change_presence"
@ -79,7 +75,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/card_padding_regular"/>
android:padding="@dimen/card_padding_list"/>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>

View file

@ -20,7 +20,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:fontFamily="monospace"
android:longClickable="true"
android:textAppearance="@style/TextAppearance.Conversations.Fingerprint"/>

View file

@ -12,13 +12,11 @@
android:id="@+id/warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="?attr/TextSizeBody"
android:textColor="?attr/color_text_primary"/>
android:textAppearance="@style/TextAppearance.Conversations.Body1"/>
<CheckBox
android:layout_marginTop="8dp"
android:id="@+id/trusted_source"
android:layout_width="wrap_content"
android:textColor="?attr/color_text_primary"
android:layout_height="wrap_content"
android:text="@string/i_followed_this_link_from_a_trusted_source" />

View file

@ -84,8 +84,7 @@
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/snackbar_action"
android:paddingLeft="24dp"
android:textColor="@color/white"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"/>
<TextView
android:id="@+id/snackbar_action"
@ -98,8 +97,7 @@
android:paddingRight="24dp"
android:paddingTop="16dp"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="?attr/TextSizeBody"
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"
android:textStyle="bold"/>
</RelativeLayout>

View file

@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="1dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:maxLines="1"
android:paddingBottom="1dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textSize="?attr/TextSizeInfo"
android:textColor="@color/white"
android:paddingTop="1dp"
android:textAllCaps="true"
android:maxLines="1"
android:layout_margin="2dp"
android:textAppearance="@style/TextAppearance.Conversations.Tag"
/>

View file

@ -18,10 +18,7 @@
android:layout_height="wrap_content"
android:autoLink="web"
android:longClickable="true"
android:textColor="?attr/color_text_primary"
android:textColorHighlight="@color/grey500"
android:textColorLink="@color/black87"
android:textSize="?attr/TextSizeBody"/>
android:textAppearance="@style/TextAppearance.Conversations.Body1"/>
<Button
android:id="@+id/download_button"
@ -54,8 +51,7 @@
android:layout_alignParentRight="true"
android:paddingBottom="16dp"
android:paddingRight="16dp"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
<SeekBar
android:id="@+id/progress"

View file

@ -17,9 +17,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColorLink="@color/black87"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"
android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary"
android:id="@+id/message_body" />
</LinearLayout>

View file

@ -53,9 +53,8 @@
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginRight="4sp"
android:textColor="@color/white70"
android:textStyle="bold"
android:textSize="?attr/TextSizeInfo" />
android:textAppearance="@style/TextAppearance.Conversations.Caption"
android:textStyle="bold"/>
<ImageView
android:id="@+id/security_indicator"
@ -84,8 +83,7 @@
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="@string/sending"
android:textColor="@color/white70"
android:textSize="?attr/TextSizeInfo" />
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -54,8 +54,7 @@
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="@string/sending"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo" />
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
<ImageView
android:id="@+id/security_indicator"

View file

@ -40,8 +40,6 @@
android:layout_toEndOf="@+id/message_photo"
android:layout_toRightOf="@+id/message_photo"
android:text="@string/contact_has_read_up_to_this_point"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"
android:textStyle="italic"/>
android:textAppearance="@style/TextAppearance.Conversations.Status"/>
</RelativeLayout>

View file

@ -3,13 +3,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/activatedBackgroundIndicator"
android:paddingTop="8dp"
android:paddingLeft="8dp"
android:paddingBottom="8dp"
android:padding="12dp"
android:id="@+id/presence_template">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
@ -31,8 +30,7 @@
android:paddingRight="4dp"
android:paddingTop="1dp"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="?attr/TextSizeInfo"
android:textAppearance="@style/TextAppearance.Conversations.Tag"
android:layout_marginTop="4dp"/>
</LinearLayout>
<ImageButton

View file

@ -3,7 +3,6 @@
<attr name="TextSizeInfo" format="dimension" />
<attr name="TextSizeBody" format="dimension" />
<attr name="TextSizeHeadline" format="dimension" />
<attr name="TextSeparation" format="dimension"/>
<attr name="IconSize" format="dimension"/>

View file

@ -1,9 +1,9 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
<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:fontFamily" tools:targetApi="jelly_bean">monospace</item>
<item name="android:typeface">monospace</item>
</style>
<style name="InputLabel" parent="TextAppearance.AppCompat.Caption">
@ -11,4 +11,37 @@
<item name="android:paddingLeft">@dimen/input_label_horizontal_spacing</item>
<item name="android:paddingRight">@dimen/input_label_horizontal_spacing</item>
</style>
<style name="TextAppearance.Conversations.Status" parent="TextAppearance.AppCompat.Caption">
<item name="android:textStyle">italic</item>
</style>
<style name="TextAppearance.Conversations.Tag" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">@color/white</item>
</style>
<style name="TextAppearance.Conversations.Caption.OnDark" parent="TextAppearance.Conversations.Caption">
<item name="android:textColor">@color/white70</item>
</style>
<style name="TextAppearance.Conversations.Caption" parent="TextAppearance.AppCompat.Caption">
</style>
<style name="TextAppearance.Conversations.Caption.Waring" parent="TextAppearance.Conversations.Caption">
<item name="android:textColor">@color/red800</item>
</style>
<style name="TextAppearance.Conversations.Caption.Highlight" parent="TextAppearance.Conversations.Caption">
<item name="android:textColor">?android:colorAccent</item>
</style>
<style name="TextAppearance.Conversations.Caption.Disabled" parent="TextAppearance.Conversations.Caption">
<item name="android:textColor">?android:textColorTertiary</item>
</style>
<style name="TextAppearance.Conversations.Fingerprint.Disabled" parent="TextAppearance.Conversations.Fingerprint">
<item name="android:textColor">?android:textColorTertiary</item>
</style>
<style name="TextAppearance.Conversations.Body1.OnDark" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColor">@color/white</item>
<item name="android:textColorLink">@color/white</item>
</style>
<style name="TextAppearance.Conversations.Body1.Secondary.OnDark" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColor">@color/white70</item>
</style>
<style name="TextAppearance.Conversations.Body1" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColorLink">?android:textColorPrimary</item>
</style>
</resources>

View file

@ -19,7 +19,6 @@
<item name="TextSizeBody">14sp</item>
<item name="TextSeparation">5sp</item>
<item name="IconSize">18sp</item>
<item name="TextSizeHeadline">20sp</item>
<item name="divider">@color/black12</item>
@ -99,7 +98,6 @@
<item name="TextSizeBody">14sp</item>
<item name="TextSeparation">5sp</item>
<item name="IconSize">18sp</item>
<item name="TextSizeHeadline">20sp</item>
<item name="divider">@color/white12</item>
@ -166,7 +164,6 @@
<item name="TextSizeBody">16sp</item>
<item name="TextSeparation">6sp</item>
<item name="IconSize">20sp</item>
<item name="TextSizeHeadline">22sp</item>
</style>
<style name="ConversationsTheme.Dark.LargerText" parent="ConversationsTheme.Dark">
@ -174,7 +171,6 @@
<item name="TextSizeBody">16sp</item>
<item name="IconSize">20sp</item>
<item name="TextSeparation">6sp</item>
<item name="TextSizeHeadline">22sp</item>
</style>
<style name="ConversationsTheme.FullScreen" parent="@style/Theme.AppCompat.Light">