updated manage account activity to new colors

This commit is contained in:
Daniel Gultsch 2018-02-25 19:21:02 +01:00
parent ae2536adff
commit 6652135746
12 changed files with 29 additions and 28 deletions

View file

@ -2177,6 +2177,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
@Override @Override
public void success(Message message) { public void success(Message message) {
//TODO the following two call can be made before the callback
message.setEncryption(Message.ENCRYPTION_DECRYPTED); message.setEncryption(Message.ENCRYPTION_DECRYPTED);
activity.xmppConnectionService.sendMessage(message); activity.xmppConnectionService.sendMessage(message);
getActivity().runOnUiThread(() -> messageSent()); getActivity().runOnUiThread(() -> messageSent());

View file

@ -74,7 +74,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.manage_accounts); setContentView(R.layout.activity_manage_accounts);
if (savedInstanceState != null) { if (savedInstanceState != null) {
String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT); String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT);

View file

@ -43,7 +43,7 @@ public class ShareViaAccountActivity extends XmppActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.manage_accounts); setContentView(R.layout.activity_manage_accounts);
accountListView = (ListView) findViewById(R.id.account_list); accountListView = (ListView) findViewById(R.id.account_list);
this.mAccountAdapter = new AccountAdapter(this, accountList, false); this.mAccountAdapter = new AccountAdapter(this, accountList, false);

View file

@ -174,7 +174,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
getSupportActionBar().setHomeButtonEnabled(false); getSupportActionBar().setHomeButtonEnabled(false);
} }
setContentView(R.layout.share_with); setContentView(R.layout.activity_share_with);
setTitle(getString(R.string.title_activity_sharewith)); setTitle(getString(R.string.title_activity_sharewith));
mListView = findViewById(R.id.choose_conversation_list); mListView = findViewById(R.id.choose_conversation_list);

View file

@ -7,11 +7,11 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -24,6 +24,7 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.ui.ManageAccountActivity; import eu.siacs.conversations.ui.ManageAccountActivity;
import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.Color;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
public class AccountAdapter extends ArrayAdapter<Account> { public class AccountAdapter extends ArrayAdapter<Account> {
@ -67,7 +68,7 @@ public class AccountAdapter extends ArrayAdapter<Account> {
break; break;
case DISABLED: case DISABLED:
case CONNECTING: case CONNECTING:
statusView.setTextColor(activity.getSecondaryTextColor()); statusView.setTextColor(Color.get(activity,android.R.attr.textColorSecondary));
break; break;
default: default:
statusView.setTextColor(activity.getWarningTextColor()); statusView.setTextColor(activity.getWarningTextColor());

View file

@ -31,18 +31,17 @@ package eu.siacs.conversations.ui.util;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.TypedArray;
import android.support.annotation.AttrRes; import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt; import android.support.annotation.ColorInt;
import android.util.TypedValue;
public class Color { public class Color {
public static @ColorInt int get(Context context, @AttrRes int attr) { public static @ColorInt int get(Context context, @AttrRes int attr) {
TypedValue typedValue = new TypedValue(); TypedArray typedArray = context.obtainStyledAttributes(new int[]{attr});
Resources.Theme theme = context.getTheme(); int color = typedArray.getColor(0,0);
theme.resolveAttribute(attr, typedValue, true); typedArray.recycle();
return typedValue.data; return color;
} }
} }

View file

@ -22,7 +22,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@+id/account_image" android:layout_toRightOf="@+id/account_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="8dp" android:paddingLeft="@dimen/avatar_item_distance"
android:layout_toLeftOf="@+id/tgl_account_status" android:layout_toLeftOf="@+id/tgl_account_status"
android:layout_toStartOf="@+id/tgl_account_status"> android:layout_toStartOf="@+id/tgl_account_status">
@ -32,17 +32,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scrollHorizontally="false" android:scrollHorizontally="false"
android:singleLine="true" android:singleLine="true"
android:textColor="?attr/color_text_primary" android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
android:textSize="?attr/TextSizeHeadline" />
<TextView <TextView
android:id="@+id/account_status" android:id="@+id/account_status"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/account_status_unknown" android:text="@string/account_status_unknown"
android:textColor="?attr/color_text_secondary" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="?attr/TextSizeBody" />
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat

View file

@ -2,12 +2,15 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent"
android:background="?attr/color_background_primary">
<ListView <ListView
android:id="@+id/choose_contact_list" android:id="@+id/choose_contact_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:listitem="@layout/contact" /> tools:listitem="@layout/contact"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"/>
</LinearLayout> </LinearLayout>

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout 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">
<ScrollView <ScrollView
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -3,14 +3,14 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="?attr/color_background_secondary" > android:background="?attr/color_background_primary" >
<ListView <ListView
android:id="@+id/account_list" android:id="@+id/account_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@color/black12" android:divider="@android:color/transparent"
android:dividerHeight="1dp" > android:dividerHeight="0dp" >
</ListView> </ListView>
</LinearLayout> </LinearLayout>

View file

@ -8,6 +8,8 @@
android:id="@+id/choose_conversation_list" android:id="@+id/choose_conversation_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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"/>
</LinearLayout> </LinearLayout>

View file

@ -46,8 +46,7 @@
android:paddingRight="4dp" android:paddingRight="4dp"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:typeface="sans"/>
<RelativeLayout <RelativeLayout
android:id="@+id/conversation_lastwrapper" android:id="@+id/conversation_lastwrapper"