Commit 87a771c7 authored by Grigory Fedorov's avatar Grigory Fedorov

Status editor changed significantly. Full screen dialog style, bottom action bar, new layout.

parent fe36595f
...@@ -33,8 +33,7 @@ import com.xabber.androiddev.R; ...@@ -33,8 +33,7 @@ import com.xabber.androiddev.R;
* *
* @author alexander.ivanov * @author alexander.ivanov
*/ */
public class StatusEditorAdapter extends BaseAdapter implements public class StatusEditorAdapter extends BaseAdapter implements UpdatableAdapter {
UpdatableAdapter {
private final Activity activity; private final Activity activity;
private final ArrayList<SavedStatus> statuses; private final ArrayList<SavedStatus> statuses;
...@@ -42,7 +41,7 @@ public class StatusEditorAdapter extends BaseAdapter implements ...@@ -42,7 +41,7 @@ public class StatusEditorAdapter extends BaseAdapter implements
public StatusEditorAdapter(Activity activity) { public StatusEditorAdapter(Activity activity) {
super(); super();
this.activity = activity; this.activity = activity;
statuses = new ArrayList<SavedStatus>(); statuses = new ArrayList<>();
} }
@Override @Override
...@@ -64,17 +63,16 @@ public class StatusEditorAdapter extends BaseAdapter implements ...@@ -64,17 +63,16 @@ public class StatusEditorAdapter extends BaseAdapter implements
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view; View view;
if (convertView == null) { if (convertView == null) {
view = activity.getLayoutInflater().inflate( view = activity.getLayoutInflater().inflate(R.layout.status_editor_item, parent, false);
R.layout.status_editor_item, parent, false);
} else { } else {
view = convertView; view = convertView;
} }
final SavedStatus status = (SavedStatus) getItem(position); final SavedStatus status = (SavedStatus) getItem(position);
((ImageView) view.findViewById(R.id.icon)).setImageLevel(status ((ImageView) view.findViewById(R.id.icon)).setImageLevel(status.getStatusMode().getStatusLevel());
.getStatusMode().getStatusLevel());
String text = status.getStatusText(); String text = status.getStatusText();
if ("".equals(text)) if ("".equals(text)) {
text = activity.getString(R.string.empty_status); text = activity.getString(R.string.empty_status);
}
((TextView) view.findViewById(R.id.name)).setText(text); ((TextView) view.findViewById(R.id.name)).setText(text);
return view; return view;
} }
......
...@@ -38,13 +38,12 @@ public class StatusModeAdapter extends BaseAdapter { ...@@ -38,13 +38,12 @@ public class StatusModeAdapter extends BaseAdapter {
public StatusModeAdapter(Activity activity) { public StatusModeAdapter(Activity activity) {
super(); super();
this.activity = activity; this.activity = activity;
statusModes = new ArrayList<StatusMode>(); statusModes = new ArrayList<>();
statusModes.add(StatusMode.chat); statusModes.add(StatusMode.chat);
statusModes.add(StatusMode.available); statusModes.add(StatusMode.available);
statusModes.add(StatusMode.away); statusModes.add(StatusMode.away);
statusModes.add(StatusMode.xa); statusModes.add(StatusMode.xa);
statusModes.add(StatusMode.dnd); statusModes.add(StatusMode.dnd);
// statusModes.add(StatusMode.invisible);
statusModes.add(StatusMode.unavailable); statusModes.add(StatusMode.unavailable);
} }
...@@ -65,18 +64,15 @@ public class StatusModeAdapter extends BaseAdapter { ...@@ -65,18 +64,15 @@ public class StatusModeAdapter extends BaseAdapter {
private void updateView(int position, View view) { private void updateView(int position, View view) {
StatusMode statusMode = (StatusMode) getItem(position); StatusMode statusMode = (StatusMode) getItem(position);
((ImageView) view.findViewById(R.id.icon)).setImageLevel(statusMode ((ImageView) view.findViewById(R.id.icon)).setImageLevel(statusMode.getStatusLevel());
.getStatusLevel()); ((TextView) view.findViewById(R.id.name)).setText(statusMode.getStringID());
((TextView) view.findViewById(R.id.name)).setText(statusMode
.getStringID());
} }
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view; View view;
if (convertView == null) { if (convertView == null) {
view = activity.getLayoutInflater().inflate( view = activity.getLayoutInflater().inflate(R.layout.status_mode_item, parent, false);
R.layout.status_mode_item, parent, false);
} else { } else {
view = convertView; view = convertView;
} }
...@@ -86,14 +82,6 @@ public class StatusModeAdapter extends BaseAdapter { ...@@ -86,14 +82,6 @@ public class StatusModeAdapter extends BaseAdapter {
@Override @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) { public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view; return getView(position, convertView, parent);
if (convertView == null) {
view = activity.getLayoutInflater().inflate(
R.layout.status_mode_dropdown, parent, false);
} else {
view = convertView;
}
updateView(position, view);
return view;
} }
} }
...@@ -68,4 +68,9 @@ public class ActionBarPainter { ...@@ -68,4 +68,9 @@ public class ActionBarPainter {
} }
} }
} }
public int getAccountColor(String account) {
return accountActionBarColors[AccountManager.getInstance().getColorLevel(account)];
}
} }
...@@ -12,20 +12,92 @@ ...@@ -12,20 +12,92 @@
You should have received a copy of the GNU General Public License, You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/. along with this program. If not, see http://www.gnu.org/licenses/.
--> -->
<LinearLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
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"
> >
<include layout="@layout/toolbar_default"/> <include layout="@layout/toolbar_default"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:id="@+id/top_toolbar"
/>
<ListView <include layout="@layout/toolbar_default"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content"
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:id="@+id/bottom_toolbar"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="4dip" /> android:layout_below="@id/top_toolbar"
android:layout_above="@id/bottom_toolbar"
android:padding="8dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:layout_alignParentTop="true"
android:id="@+id/top_panel"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/new_status"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<Spinner
android:id="@+id/status_icon"
android:prompt="@string/status_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/status_text_hint"
android:paddingLeft="34dp"
android:singleLine="true"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/saved_statuses"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:id="@+id/saved_statuses_textview"
/>
</LinearLayout>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/top_panel"
/>
</RelativeLayout>
</LinearLayout> </RelativeLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/status_icon"
android:prompt="@string/status_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/status_text_hint"
/>
<Button
android:id="@+id/ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/status_editor"
/>
</LinearLayout>
...@@ -13,24 +13,29 @@ ...@@ -13,24 +13,29 @@
along with this program. If not, see http://www.gnu.org/licenses/. along with this program. If not, see http://www.gnu.org/licenses/.
--> -->
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="48dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="4dip"> >
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="24dip" android:layout_width="wrap_content"
android:layout_height="24dip" android:layout_height="wrap_content"
android:src="@drawable/ic_status" /> android:src="@drawable/ic_status"
android:paddingLeft="8dp"
android:paddingRight="8dp"
/>
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="42dip" android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="online" android:text="online"
android:textAppearance="?android:attr/textAppearanceMedium"
/> />
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="4dip">
<ImageView
android:id="@+id/icon"
android:layout_width="24dip"
android:layout_height="24dip"
android:layout_marginLeft="10dip"
android:src="@drawable/ic_status"
/>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="42dip"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:text="online"
/>
</LinearLayout>
...@@ -15,26 +15,31 @@ ...@@ -15,26 +15,31 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="48dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="4dip"> >
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="24dip" android:layout_width="wrap_content"
android:layout_height="24dip" android:layout_height="wrap_content"
android:src="@drawable/ic_status" android:src="@drawable/ic_status"
android:paddingLeft="8dp"
android:paddingRight="8dp"
/> />
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="online" android:text="online"
android:textAppearance="?android:attr/textAppearanceMedium"
/> />
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_clear_status_history"
android:title="@string/clear_status_history"
app:showAsAction="always"
android:orderInCategory="90"
/>
</menu>
\ No newline at end of file
...@@ -4,15 +4,7 @@ ...@@ -4,15 +4,7 @@
<item android:id="@+id/action_change_status" <item android:id="@+id/action_change_status"
android:title="@string/status_editor" android:title="@string/status_editor"
app:showAsAction="ifRoom" app:showAsAction="always"
android:icon="@drawable/ic_done_white_24dp"
android:orderInCategory="90" android:orderInCategory="90"
/> />
<item android:id="@+id/action_delete_status_message"
android:title="@string/clear_statuses"
app:showAsAction="never"
android:icon="@drawable/ic_delete_white_24dp"
android:orderInCategory="100"
/>
</menu> </menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_select_status"
android:title="@string/select_status" />
<item android:id="@+id/action_edit_status"
android:title="@string/edit_status" />
<item android:id="@+id/action_remove_status"
android:title="@string/remove_status" />
</menu>
\ No newline at end of file
...@@ -21,15 +21,19 @@ ...@@ -21,15 +21,19 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_context_menu.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_context_menu.png -->
<string name="select_status">Установить статус</string> <string name="select_status">Установить статус</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_editor">Сменить статус</string> <string name="status_editor">Установить статус</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_editor_for">Сменить статус для %s</string> <string name="status_editor_for">Сменить статус для %s</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_text_hint">Введите статус</string> <string name="status_text_hint">Введите статус-сообщение</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="unavailable">Не в сети</string> <string name="unavailable">Не в сети</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="unsubscribed">Не авторизован</string> <string name="unsubscribed">Не авторизован</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="xa">Давно отошел</string> <string name="xa">Давно отошел</string>
<string name="new_status">Новый статус</string>
<string name="saved_statuses">Сохранённые статусы</string>
<string name="clear_status_history">Очистить историю статусов</string>
</resources> </resources>
\ No newline at end of file
...@@ -21,15 +21,20 @@ ...@@ -21,15 +21,20 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_context_menu.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_context_menu.png -->
<string name="select_status">Set status</string> <string name="select_status">Set status</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_editor">Change status</string> <string name="status_editor">Set status</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_editor_for">Change status for %s</string> <string name="status_editor_for">Change status for %s</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor.png -->
<string name="status_text_hint">Set your status</string> <string name="status_text_hint">Enter status message</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="unavailable">Offline</string> <string name="unavailable">Offline</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="unsubscribed">Not authorized</string> <string name="unsubscribed">Not authorized</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png --> <!-- http://dl.dropbox.com/u/1029995/com.xabber.android/status_editor_status.png -->
<string name="xa">Away for a long time</string> <string name="xa">Away for a long time</string>
<string name="new_status">New status</string>
<string name="saved_statuses">Saved statuses</string>
<string name="clear_status_history">Clear status history</string>
</resources> </resources>
\ No newline at end of file
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