Commit 14e17b78 authored by Grigory Fedorov's avatar Grigory Fedorov

New light color theme, account and icon colors, chat balloons.

parent f6e4a957
...@@ -4,7 +4,6 @@ import android.app.Fragment; ...@@ -4,7 +4,6 @@ import android.app.Fragment;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
...@@ -23,7 +22,6 @@ import android.widget.ListView; ...@@ -23,7 +22,6 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.xabber.android.data.SettingsManager; import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.extension.cs.ChatStateManager; import com.xabber.android.data.extension.cs.ChatStateManager;
import com.xabber.android.data.message.MessageItem; import com.xabber.android.data.message.MessageItem;
import com.xabber.android.data.message.MessageManager; import com.xabber.android.data.message.MessageManager;
...@@ -76,11 +74,6 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl ...@@ -76,11 +74,6 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
listView.setAdapter(chatMessageAdapter); listView.setAdapter(chatMessageAdapter);
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);
ColorDrawable background = new ColorDrawable(getActivity().getResources().getIntArray(
R.array.account_chat_background)[AccountManager.getInstance().getColorLevel(account)]);
background.setAlpha(64);
view.setBackgroundDrawable(background);
inputView = (EditText) view.findViewById(R.id.chat_input); inputView = (EditText) view.findViewById(R.id.chat_input);
......
...@@ -238,8 +238,8 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter ...@@ -238,8 +238,8 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter
TextView textView = (TextView) view.findViewById(R.id.message_text); TextView textView = (TextView) view.findViewById(R.id.message_text);
textView.setTextAppearance(activity, appearanceStyle); textView.setTextAppearance(activity, appearanceStyle);
textView.getBackground().setAlpha(127);
textView.setText(builder); textView.setText(builder);
textView.getBackground().setLevel(AccountManager.getInstance().getColorLevel(account));
String time = StringUtils.getSmartTimeText(activity, messageItem.getTimestamp()); String time = StringUtils.getSmartTimeText(activity, messageItem.getTimestamp());
...@@ -260,11 +260,11 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter ...@@ -260,11 +260,11 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter
ImageView messageStatusIcon = (ImageView) view.findViewById(R.id.message_status_icon); ImageView messageStatusIcon = (ImageView) view.findViewById(R.id.message_status_icon);
messageStatusIcon.setVisibility(View.VISIBLE); messageStatusIcon.setVisibility(View.VISIBLE);
int messageIcon = R.drawable.ic_done_white_18dp; int messageIcon = R.drawable.ic_message_delivered_18dp;
if (messageItem.isError()) { if (messageItem.isError()) {
messageIcon = R.drawable.ic_clear_white_18dp; messageIcon = R.drawable.ic_message_has_error_18dp;
} else if (!messageItem.isSent()) { } else if (!messageItem.isSent()) {
messageIcon = R.drawable.ic_redo_white_18dp; messageIcon = R.drawable.ic_message_not_sent_18dp;
} else if (!messageItem.isDelivered()) { } else if (!messageItem.isDelivered()) {
messageStatusIcon.setVisibility(View.INVISIBLE); messageStatusIcon.setVisibility(View.INVISIBLE);
} }
......
package com.xabber.android.ui.helper; package com.xabber.android.ui.helper;
import android.content.res.TypedArray;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
...@@ -29,6 +30,7 @@ public class ContactTitleActionBarInflater { ...@@ -29,6 +30,7 @@ public class ContactTitleActionBarInflater {
private int defaultStatusBarColor; private int defaultStatusBarColor;
private Animation shakeAnimation = null; private Animation shakeAnimation = null;
private ColorDrawable defaultActionBarBackground;
public ContactTitleActionBarInflater(ActionBarActivity activity) { public ContactTitleActionBarInflater(ActionBarActivity activity) {
this.activity = activity; this.activity = activity;
...@@ -39,10 +41,9 @@ public class ContactTitleActionBarInflater { ...@@ -39,10 +41,9 @@ public class ContactTitleActionBarInflater {
accountStatusBarColors = activity.getResources().getIntArray(R.array.account_status_bar); accountStatusBarColors = activity.getResources().getIntArray(R.array.account_status_bar);
ActionBar actionBar = activity.getSupportActionBar(); ActionBar actionBar = activity.getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBarView = LayoutInflater.from(activity).inflate(R.layout.contact_title, null); actionBarView = LayoutInflater.from(activity).inflate(R.layout.contact_title, null);
...@@ -55,9 +56,15 @@ public class ContactTitleActionBarInflater { ...@@ -55,9 +56,15 @@ public class ContactTitleActionBarInflater {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
defaultStatusBarColor = window.getStatusBarColor(); defaultStatusBarColor = window.getStatusBarColor();
} }
TypedArray a = activity.getTheme().obtainStyledAttributes(R.style.Theme, new int[] {R.attr.colorPrimary});
int attributeResourceId = a.getResourceId(0, 0);
defaultActionBarBackground = new ColorDrawable(activity.getResources().getColor(attributeResourceId));
} }
public void update(AbstractContact abstractContact) { public void update(AbstractContact abstractContact) {
activity.getSupportActionBar().setDisplayShowCustomEnabled(true);
activity.getSupportActionBar().setDisplayShowTitleEnabled(false); activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
actionBarView.setVisibility(View.VISIBLE); actionBarView.setVisibility(View.VISIBLE);
...@@ -71,13 +78,17 @@ public class ContactTitleActionBarInflater { ...@@ -71,13 +78,17 @@ public class ContactTitleActionBarInflater {
} }
public void restoreDefaultTitleView(String title) { public void restoreDefaultTitleView(String title) {
activity.getSupportActionBar().setDisplayShowCustomEnabled(false);
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
actionBarView.setVisibility(View.GONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(defaultStatusBarColor); window.setStatusBarColor(defaultStatusBarColor);
} }
activity.getSupportActionBar().setBackgroundDrawable(null);
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
actionBarView.setVisibility(View.GONE); activity.getSupportActionBar().setBackgroundDrawable(defaultActionBarBackground);
activity.setTitle(title); activity.setTitle(title);
} }
......
...@@ -54,6 +54,7 @@ public class ContactTitleInflater { ...@@ -54,6 +54,7 @@ public class ContactTitleInflater {
titleView.setBackgroundDrawable(new ColorDrawable(accountActionBarColors[ titleView.setBackgroundDrawable(new ColorDrawable(accountActionBarColors[
AccountManager.getInstance().getColorLevel(abstractContact.getAccount())])); AccountManager.getInstance().getColorLevel(abstractContact.getAccount())]));
nameView.setTextColor(activity.getResources().getColor(R.color.primary_text_default_material_dark));
nameView.setText(abstractContact.getName()); nameView.setText(abstractContact.getName());
statusModeView.setImageLevel(abstractContact.getStatusMode().getStatusLevel()); statusModeView.setImageLevel(abstractContact.getStatusMode().getStatusLevel());
avatarView.setImageDrawable(abstractContact.getAvatar()); avatarView.setImageDrawable(abstractContact.getAvatar());
......
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/message_incoming_green" android:minLevel="0" android:maxLevel="0" />
<item android:drawable="@drawable/message_incoming_orange" android:minLevel="1" android:maxLevel="1" />
<item android:drawable="@drawable/message_incoming_red" android:minLevel="2" android:maxLevel="2" />
<item android:drawable="@drawable/message_incoming_blue" android:minLevel="3" android:maxLevel="3" />
</level-list>
\ No newline at end of file
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
android:layout_marginRight="48dp" android:layout_marginRight="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
android:background="@drawable/msg_in" android:background="@drawable/message_incoming"
android:text="Some text\n line \nrgregrere" android:text="Some text\n line \nrgregrere"
/> />
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="4dip"> >
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -28,11 +28,20 @@ ...@@ -28,11 +28,20 @@
android:smoothScrollbar="false" android:smoothScrollbar="false"
android:divider="@null" android:divider="@null"
android:dividerHeight="0dp" android:dividerHeight="0dp"
android:layout_above="@+id/chat_input" android:layout_above="@+id/input_layout"
tools:listitem="@layout/chat_viewer_outgoing_message" tools:listitem="@layout/chat_viewer_outgoing_message"
android:listSelector="@android:color/transparent" android:listSelector="@android:color/transparent"
/> />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/input_layout"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="@color/white"
>
<EditText <EditText
android:id="@+id/chat_input" android:id="@+id/chat_input"
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine" android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
...@@ -45,23 +54,18 @@ ...@@ -45,23 +54,18 @@
android:fadingEdge="vertical" android:fadingEdge="vertical"
android:focusable="true" android:focusable="true"
android:descendantFocusability="beforeDescendants" android:descendantFocusability="beforeDescendants"
android:layout_weight="1"
android:layout_alignParentLeft="true" />
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/chat_send"
android:layout_toStartOf="@+id/chat_send" />
<ImageButton <ImageButton
android:id="@+id/chat_send" android:id="@+id/chat_send"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:padding="8dp" android:padding="8dp"
android:src="@drawable/ic_send_white_24dp" android:src="@drawable/ic_button_send_24dp"
android:background="@null" android:background="@null"
android:contentDescription="@string/chat_send" /> android:contentDescription="@string/chat_send" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
android:minWidth="160dp" android:minWidth="160dp"
android:text="Some text\n line \nrgregrere" android:text="Some text\n line \nrgregrere"
android:background="@drawable/msg_out" android:background="@drawable/message_outgoing"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" /> android:layout_alignParentEnd="true" />
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
android:layout_alignBottom="@+id/message_time" android:layout_alignBottom="@+id/message_time"
android:layout_toLeftOf="@+id/message_time" android:layout_toLeftOf="@+id/message_time"
android:src="@drawable/ic_done_white_18dp" android:src="@drawable/ic_message_delivered_18dp"
/> />
</RelativeLayout> </RelativeLayout>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize" android:layout_height="?android:attr/actionBarSize"
android:orientation="horizontal" android:orientation="horizontal"
android:background="@color/green_500"
> >
<ImageView <ImageView
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:singleLine="true" android:singleLine="true"
android:layout_weight="1" android:layout_weight="1"
android:textColor="@color/primary_text_default_material_dark"
android:text="name" android:text="name"
android:textStyle="bold" /> android:textStyle="bold" />
<LinearLayout <LinearLayout
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
android:src="@drawable/ic_security" android:src="@drawable/ic_security"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="visible" android:visibility="gone"
android:padding="3dp" android:padding="3dp"
/> />
...@@ -64,6 +66,7 @@ ...@@ -64,6 +66,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/primary_text_default_material_dark"
android:text="status" android:text="status"
/> />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<array name="account_action_bar"> <array name="account_action_bar">
<item>@color/teal_500</item> <item>@color/green_500</item>
<item>@color/deep_orange_500</item> <item>@color/orange_500</item>
<item>@color/pink_500</item> <item>@color/red_500</item>
<item>@color/dark_purple_500</item> <item>@color/blue_500</item>
</array> </array>
<array name="account_status_bar"> <array name="account_status_bar">
<item>@color/teal_700</item> <item>@color/green_700</item>
<item>@color/deep_orange_700</item> <item>@color/orange_700</item>
<item>@color/pink_700</item> <item>@color/red_700</item>
<item>@color/dark_purple_700</item> <item>@color/blue_700</item>
</array> </array>
<array name="account_chat_background"> <array name="account_chat_background">
<item>@color/teal_900</item> <item>@color/green_50</item>
<item>@color/deep_orange_900</item> <item>@color/orange_50</item>
<item>@color/pink_900</item> <item>@color/red_50</item>
<item>@color/dark_purple_900</item> <item>@color/blue_50</item>
</array> </array>
<color name="account_disabled">@color/black_dividers</color> <color name="account_disabled">@color/black_dividers</color>
<color name="group_expander">@color/blue_grey_800</color> <color name="group_expander">@color/blue_grey_100</color>
</resources> </resources>
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
along with this program. If not, see http://www.gnu.org/licenses/. along with this program. If not, see http://www.gnu.org/licenses/.
--> -->
<resources> <resources>
<style name="Theme" parent="Theme.AppCompat"> <style name="Theme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="expanderGroupColor">?android:attr/textColorPrimary</item> <item name="expanderGroupColor">?android:attr/textColorPrimary</item>
<item name="expanderAccountColor">?android:attr/textColorPrimaryInverse</item> <item name="expanderAccountColor">?android:attr/textColorPrimaryInverse</item>
<item name="expanderIndicator">@drawable/expander_indicator_dark</item> <item name="expanderIndicator">@drawable/expander_indicator_dark</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment