From 665213574637f087d0ab7b8c694ef485116ce83f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 25 Feb 2018 19:21:02 +0100 Subject: [PATCH] updated manage account activity to new colors --- .../siacs/conversations/ui/ConversationFragment.java | 1 + .../siacs/conversations/ui/ManageAccountActivity.java | 2 +- .../conversations/ui/ShareViaAccountActivity.java | 2 +- .../eu/siacs/conversations/ui/ShareWithActivity.java | 2 +- .../conversations/ui/adapter/AccountAdapter.java | 5 +++-- .../java/eu/siacs/conversations/ui/util/Color.java | 11 +++++------ src/main/res/layout/account_row.xml | 10 ++++------ src/main/res/layout/activity_choose_contact.xml | 7 +++++-- src/main/res/layout/activity_contact_details.xml | 4 +--- ...nage_accounts.xml => activity_manage_accounts.xml} | 6 +++--- .../{share_with.xml => activity_share_with.xml} | 4 +++- src/main/res/layout/conversation_list_row.xml | 3 +-- 12 files changed, 29 insertions(+), 28 deletions(-) rename src/main/res/layout/{manage_accounts.xml => activity_manage_accounts.xml} (70%) rename src/main/res/layout/{share_with.xml => activity_share_with.xml} (71%) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index bbc5f7a05..24164c67d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2177,6 +2177,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke @Override public void success(Message message) { + //TODO the following two call can be made before the callback message.setEncryption(Message.ENCRYPTION_DECRYPTED); activity.xmppConnectionService.sendMessage(message); getActivity().runOnUiThread(() -> messageSent()); diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index 86b1b4c71..72d9b5a3e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -74,7 +74,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda super.onCreate(savedInstanceState); - setContentView(R.layout.manage_accounts); + setContentView(R.layout.activity_manage_accounts); if (savedInstanceState != null) { String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT); diff --git a/src/main/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java index a05775f05..cbe85505f 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java @@ -43,7 +43,7 @@ public class ShareViaAccountActivity extends XmppActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.manage_accounts); + setContentView(R.layout.activity_manage_accounts); accountListView = (ListView) findViewById(R.id.account_list); this.mAccountAdapter = new AccountAdapter(this, accountList, false); diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index a7d7cfc09..6f4e866aa 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -174,7 +174,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer getSupportActionBar().setHomeButtonEnabled(false); } - setContentView(R.layout.share_with); + setContentView(R.layout.activity_share_with); setTitle(getString(R.string.title_activity_sharewith)); mListView = findViewById(R.id.choose_conversation_list); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java index 27242bec5..86838617f 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -7,11 +7,11 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.support.v7.widget.SwitchCompat; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; -import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; @@ -24,6 +24,7 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.ui.ManageAccountActivity; import eu.siacs.conversations.ui.XmppActivity; +import eu.siacs.conversations.ui.util.Color; import eu.siacs.conversations.utils.UIHelper; public class AccountAdapter extends ArrayAdapter { @@ -67,7 +68,7 @@ public class AccountAdapter extends ArrayAdapter { break; case DISABLED: case CONNECTING: - statusView.setTextColor(activity.getSecondaryTextColor()); + statusView.setTextColor(Color.get(activity,android.R.attr.textColorSecondary)); break; default: statusView.setTextColor(activity.getWarningTextColor()); diff --git a/src/main/java/eu/siacs/conversations/ui/util/Color.java b/src/main/java/eu/siacs/conversations/ui/util/Color.java index 795193be2..ac3dcaf6d 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/Color.java +++ b/src/main/java/eu/siacs/conversations/ui/util/Color.java @@ -31,18 +31,17 @@ package eu.siacs.conversations.ui.util; import android.content.Context; -import android.content.res.Resources; +import android.content.res.TypedArray; import android.support.annotation.AttrRes; import android.support.annotation.ColorInt; -import android.util.TypedValue; public class Color { public static @ColorInt int get(Context context, @AttrRes int attr) { - TypedValue typedValue = new TypedValue(); - Resources.Theme theme = context.getTheme(); - theme.resolveAttribute(attr, typedValue, true); - return typedValue.data; + TypedArray typedArray = context.obtainStyledAttributes(new int[]{attr}); + int color = typedArray.getColor(0,0); + typedArray.recycle(); + return color; } } diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index 3e6048a07..5de047403 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -22,7 +22,7 @@ android:layout_centerVertical="true" android:layout_toRightOf="@+id/account_image" android:orientation="vertical" - android:paddingLeft="8dp" + android:paddingLeft="@dimen/avatar_item_distance" android:layout_toLeftOf="@+id/tgl_account_status" android:layout_toStartOf="@+id/tgl_account_status"> @@ -32,17 +32,15 @@ android:layout_height="wrap_content" android:scrollHorizontally="false" android:singleLine="true" - android:textColor="?attr/color_text_primary" - android:textSize="?attr/TextSizeHeadline" /> + android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/> + android:textAppearance="@style/TextAppearance.AppCompat.Body2" + /> + android:layout_height="match_parent" + android:background="?attr/color_background_primary"> + tools:listitem="@layout/contact" + android:divider="@android:color/transparent" + android:dividerHeight="0dp"/> \ No newline at end of file diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml index 6f5f366d9..048466d42 100644 --- a/src/main/res/layout/activity_contact_details.xml +++ b/src/main/res/layout/activity_contact_details.xml @@ -1,7 +1,5 @@ - + + android:background="?attr/color_background_primary" > + android:divider="@android:color/transparent" + android:dividerHeight="0dp" > \ No newline at end of file diff --git a/src/main/res/layout/share_with.xml b/src/main/res/layout/activity_share_with.xml similarity index 71% rename from src/main/res/layout/share_with.xml rename to src/main/res/layout/activity_share_with.xml index 41b6033da..126d9bb6c 100644 --- a/src/main/res/layout/share_with.xml +++ b/src/main/res/layout/activity_share_with.xml @@ -8,6 +8,8 @@ android:id="@+id/choose_conversation_list" android:layout_width="match_parent" android:layout_height="match_parent" - tools:listitem="@layout/conversation_list_row" /> + tools:listitem="@layout/conversation_list_row" + android:divider="@android:color/transparent" + android:dividerHeight="0dp"/> \ No newline at end of file diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 019e878a5..31fc82c1e 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -46,8 +46,7 @@ android:paddingRight="4dp" android:maxLines="1" android:ellipsize="end" - android:textAppearance="@style/TextAppearance.AppCompat.Subhead" - android:typeface="sans"/> + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />