use styled warning for message error. fixes #3428
This commit is contained in:
parent
7ada794e6e
commit
bf7d50692c
|
@ -196,7 +196,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
|
|||
public static Conversation getSuggestion(Activity activity) {
|
||||
final Conversation exception;
|
||||
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
|
||||
if (fragment != null && fragment instanceof ConversationsOverviewFragment) {
|
||||
if (fragment instanceof ConversationsOverviewFragment) {
|
||||
exception = ((ConversationsOverviewFragment) fragment).swipedConversation.peek();
|
||||
} else {
|
||||
exception = null;
|
||||
|
@ -206,7 +206,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
|
|||
|
||||
public static Conversation getSuggestion(Activity activity, Conversation exception) {
|
||||
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
|
||||
if (fragment != null && fragment instanceof ConversationsOverviewFragment) {
|
||||
if (fragment instanceof ConversationsOverviewFragment) {
|
||||
List<Conversation> conversations = ((ConversationsOverviewFragment) fragment).conversations;
|
||||
if (conversations.size() > 0) {
|
||||
Conversation suggestion = conversations.get(0);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
|||
public void onAvatarPublicationFailed(int res) {
|
||||
runOnUiThread(() -> {
|
||||
hintOrWarning.setText(res);
|
||||
hintOrWarning.setTextColor(getWarningTextColor());
|
||||
hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
|
||||
hintOrWarning.setVisibility(View.VISIBLE);
|
||||
publishing = false;
|
||||
togglePublishButton(true, R.string.publish);
|
||||
|
@ -208,7 +208,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
|||
if (bm == null) {
|
||||
togglePublishButton(false, R.string.publish);
|
||||
this.hintOrWarning.setVisibility(View.VISIBLE);
|
||||
this.hintOrWarning.setTextColor(getWarningTextColor());
|
||||
this.hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
|
||||
this.hintOrWarning.setText(R.string.error_publish_avatar_converting);
|
||||
return;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
|||
} else {
|
||||
togglePublishButton(false, R.string.publish);
|
||||
this.hintOrWarning.setVisibility(View.VISIBLE);
|
||||
this.hintOrWarning.setTextColor(getWarningTextColor());
|
||||
this.hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
|
||||
if (account.getStatus() == Account.State.ONLINE) {
|
||||
this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support);
|
||||
} else {
|
||||
|
|
|
@ -92,8 +92,6 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
public XmppConnectionService xmppConnectionService;
|
||||
public boolean xmppConnectionServiceBound = false;
|
||||
|
||||
protected int mColorRed;
|
||||
|
||||
protected static final String FRAGMENT_TAG_DIALOG = "dialog";
|
||||
|
||||
private boolean isCameraFeatureAvailable = false;
|
||||
|
@ -400,9 +398,6 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
ExceptionHelper.init(getApplicationContext());
|
||||
new EmojiService(this).init();
|
||||
this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
|
||||
|
||||
mColorRed = ContextCompat.getColor(this, R.color.red800);
|
||||
|
||||
this.mTheme = findTheme();
|
||||
setTheme(this.mTheme);
|
||||
|
||||
|
@ -767,15 +762,6 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public int getWarningTextColor() {
|
||||
return this.mColorRed;
|
||||
}
|
||||
|
||||
public int getPixel(int dp) {
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
return ((int) (dp * metrics.density));
|
||||
}
|
||||
|
||||
public boolean copyTextToClipboard(String text, int labelResId) {
|
||||
ClipboardManager mClipBoardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
String label = getResources().getString(labelResId);
|
||||
|
|
|
@ -242,7 +242,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
|||
break;
|
||||
}
|
||||
if (error && type == SENT) {
|
||||
if (darkBackground) {
|
||||
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Warning_OnDark);
|
||||
} else {
|
||||
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Warning);
|
||||
}
|
||||
} else {
|
||||
if (darkBackground) {
|
||||
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
<item name="android:textColorLink">?android:textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Conversations.Body1.Warning" parent="TextAppearance.AppCompat.Body1">
|
||||
<item name="android:textColor">?color_warning</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Conversations.Body1.Linkified" parent="TextAppearance.AppCompat.Body1">
|
||||
<item name="android:textSize">?TextSizeBody1</item>
|
||||
</style>
|
||||
|
@ -112,7 +116,11 @@
|
|||
</style>
|
||||
|
||||
<style name="TextAppearance.Conversations.Caption.Warning" parent="TextAppearance.Conversations.Caption">
|
||||
<item name="android:textColor">@color/red800</item>
|
||||
<item name="android:textColor">@color/red_a700</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Conversations.Caption.Warning.OnDark" parent="TextAppearance.Conversations.Caption">
|
||||
<item name="android:textColor">@color/red_a100</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Conversations.Caption.Highlight" parent="TextAppearance.Conversations.Caption">
|
||||
|
|
Loading…
Reference in a new issue