Commit f4b716b6 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'develop' into feature/tablet_design

Conflicts:
	app/src/main/java/com/xabber/android/ui/ContactList.java
parents c77acef0 22b85505
...@@ -7,8 +7,8 @@ android { ...@@ -7,8 +7,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 22 targetSdkVersion 22
versionCode 183 versionCode 184
versionName '1.0.11' versionName '1.0.12'
} }
compileOptions { compileOptions {
......
...@@ -64,7 +64,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -64,7 +64,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
boolean isInputEmpty = true; boolean isInputEmpty = true;
private EditText inputView; private EditText inputView;
private ChatMessageAdapter chatMessageAdapter; private ChatMessageAdapter chatMessageAdapter;
private boolean skipOnTextChanges; private boolean skipOnTextChanges = false;
private String account; private String account;
private String user; private String user;
private ImageButton sendButton; private ImageButton sendButton;
...@@ -78,6 +78,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -78,6 +78,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
private AbstractContact abstractContact; private AbstractContact abstractContact;
private LinearLayoutManager layoutManager; private LinearLayoutManager layoutManager;
private MessageItem clickedMessageItem; private MessageItem clickedMessageItem;
private AccountPainter accountPainter;
public static ChatViewerFragment newInstance(String account, String user) { public static ChatViewerFragment newInstance(String account, String user) {
ChatViewerFragment fragment = new ChatViewerFragment(); ChatViewerFragment fragment = new ChatViewerFragment();
...@@ -135,8 +136,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -135,8 +136,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
setHasOptionsMenu(true); setHasOptionsMenu(true);
AccountPainter accountPainter = new AccountPainter(getActivity()); accountPainter = new AccountPainter(getActivity());
toolbar.setBackgroundColor(accountPainter.getAccountMainColor(account));
sendButton = (ImageButton) view.findViewById(R.id.button_send_message); sendButton = (ImageButton) view.findViewById(R.id.button_send_message);
sendButton.setImageResource(R.drawable.ic_button_send_inactive_24dp); sendButton.setImageResource(R.drawable.ic_button_send_inactive_24dp);
...@@ -189,15 +189,6 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -189,15 +189,6 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
} }
}); });
inputView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
ChatStateManager.getInstance().onPaused(account, user);
}
}
});
inputView.addTextChangedListener(new TextWatcher() { inputView.addTextChangedListener(new TextWatcher() {
@Override @Override
...@@ -379,6 +370,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -379,6 +370,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
public void updateChat() { public void updateChat() {
ContactTitleInflater.updateTitle(contactTitleView, getActivity(), abstractContact); ContactTitleInflater.updateTitle(contactTitleView, getActivity(), abstractContact);
toolbar.setBackgroundColor(accountPainter.getAccountMainColor(account));
int itemCountBeforeUpdate = chatMessageAdapter.getItemCount(); int itemCountBeforeUpdate = chatMessageAdapter.getItemCount();
chatMessageAdapter.onChange(); chatMessageAdapter.onChange();
scrollChat(itemCountBeforeUpdate); scrollChat(itemCountBeforeUpdate);
......
...@@ -4,9 +4,13 @@ import android.app.AlertDialog; ...@@ -4,9 +4,13 @@ import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.widget.Toolbar;
import android.text.InputType; import android.text.InputType;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import com.xabber.android.R; import com.xabber.android.R;
...@@ -17,19 +21,50 @@ import com.xabber.android.data.roster.RosterContact; ...@@ -17,19 +21,50 @@ import com.xabber.android.data.roster.RosterContact;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.dialog.ContactDeleteDialogFragment; import com.xabber.android.ui.dialog.ContactDeleteDialogFragment;
public class ContactEditor extends ContactViewer { public class ContactEditor extends ContactViewer implements Toolbar.OnMenuItemClickListener {
public static Intent createIntent(Context context, String account, String user) { public static Intent createIntent(Context context, String account, String user) {
return new EntityIntentBuilder(context, ContactEditor.class) return new EntityIntentBuilder(context, ContactEditor.class)
.setAccount(account).setUser(user).build(); .setAccount(account).setUser(user).build();
} }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = contactTitleExpandableToolbarInflater.getToolbar();
RosterContact rosterContact = RosterManager.getInstance().getRosterContact(getAccount(), getBareAddress());
if (rosterContact != null) {
toolbar.inflateMenu(R.menu.contact_viewer);
toolbar.setOnMenuItemClickListener(this);
}
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavUtils.navigateUpFromSameTask(ContactEditor.this);
}
});
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.contact_viewer, menu); RosterContact rosterContact = RosterManager.getInstance().getRosterContact(getAccount(), getBareAddress());
if (rosterContact != null) {
getMenuInflater().inflate(R.menu.contact_viewer, menu);
}
return true; return true;
} }
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
......
...@@ -28,7 +28,9 @@ import android.os.Handler; ...@@ -28,7 +28,9 @@ import android.os.Handler;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.Gravity; import android.view.Gravity;
...@@ -78,7 +80,7 @@ import java.util.Collection; ...@@ -78,7 +80,7 @@ import java.util.Collection;
*/ */
public class ContactList extends MainBasicActivity implements OnAccountChangedListener, public class ContactList extends MainBasicActivity implements OnAccountChangedListener,
View.OnClickListener, OnChoosedListener, OnContactClickListener, ChatScroller.ChatScrollerListener, View.OnClickListener, OnChoosedListener, OnContactClickListener, ChatScroller.ChatScrollerListener,
ChatScroller.ChatScrollerProvider { ChatScroller.ChatScrollerProvider, Toolbar.OnMenuItemClickListener {
/** /**
* Select contact to be invited to the room was requested. * Select contact to be invited to the room was requested.
...@@ -109,7 +111,6 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi ...@@ -109,7 +111,6 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi
private boolean isDualPanelView; private boolean isDualPanelView;
private ChatScroller chatScroller; private ChatScroller chatScroller;
public static Intent createPersistentIntent(Context context) { public static Intent createPersistentIntent(Context context) {
Intent intent = new Intent(context, ContactList.class); Intent intent = new Intent(context, ContactList.class);
intent.setAction("android.intent.action.MAIN"); intent.setAction("android.intent.action.MAIN");
...@@ -162,18 +163,18 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi ...@@ -162,18 +163,18 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi
} }
toolbar.setOnClickListener(this); toolbar.setOnClickListener(this);
setSupportActionBar(toolbar);
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.application_title_short, R.string.application_title_short); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.application_title_short, R.string.application_title_short);
drawerLayout.setDrawerListener(drawerToggle); drawerLayout.setDrawerListener(drawerToggle);
getSupportActionBar().setHomeButtonEnabled(true); toolbar.inflateMenu(R.menu.contact_list);
setUpSearchView(toolbar.getMenu());
toolbar.setOnMenuItemClickListener(this);
barPainter = new BarPainter(this, toolbar); barPainter = new BarPainter(this, toolbar);
barPainter.setDefaultColor(); barPainter.setDefaultColor();
setTitle(getString(R.string.application_title_full)); toolbar.setTitle(R.string.application_title_full);
if (savedInstanceState != null) { if (savedInstanceState != null) {
sendText = savedInstanceState.getString(SAVED_SEND_TEXT); sendText = savedInstanceState.getString(SAVED_SEND_TEXT);
...@@ -354,13 +355,13 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi ...@@ -354,13 +355,13 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.contact_list, menu); getMenuInflater().inflate(R.menu.contact_list, menu);
setUpSearchView(menu); menu.findItem(R.id.action_search).setVisible(false);
return true; return true;
} }
private void setUpSearchView(final Menu menu) { private void setUpSearchView(final Menu menu) {
searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setQueryHint("Search contact"); searchView.setQueryHint(getString(R.string.contact_search_hint));
searchView.setOnCloseListener(new SearchView.OnCloseListener() { searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override @Override
...@@ -381,14 +382,12 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi ...@@ -381,14 +382,12 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi
@Override @Override
public boolean onMenuItemActionCollapse(MenuItem item) { public boolean onMenuItemActionCollapse(MenuItem item) {
LogManager.i(this, "onMenuItemActionCollapse");
searchView.setQuery("", true); searchView.setQuery("", true);
searchView.clearFocus(); searchView.clearFocus();
return true; return true;
} }
}); });
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
...@@ -404,6 +403,11 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi ...@@ -404,6 +403,11 @@ public class ContactList extends MainBasicActivity implements OnAccountChangedLi
}); });
} }
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (drawerToggle.onOptionsItemSelected(item)) { if (drawerToggle.onOptionsItemSelected(item)) {
......
...@@ -43,10 +43,9 @@ import java.util.List; ...@@ -43,10 +43,9 @@ import java.util.List;
public class ContactViewer extends ManagedActivity implements public class ContactViewer extends ManagedActivity implements
OnContactChangedListener, OnAccountChangedListener { OnContactChangedListener, OnAccountChangedListener {
protected ContactTitleExpandableToolbarInflater contactTitleExpandableToolbarInflater;
private String account; private String account;
private String bareAddress; private String bareAddress;
private ContactTitleExpandableToolbarInflater contactTitleExpandableToolbarInflater;
private TextView contactNameView; private TextView contactNameView;
public static Intent createIntent(Context context, String account, String user) { public static Intent createIntent(Context context, String account, String user) {
......
...@@ -101,12 +101,13 @@ public class StatusEditor extends ManagedListActivity implements OnItemClickList ...@@ -101,12 +101,13 @@ public class StatusEditor extends ManagedListActivity implements OnItemClickList
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);
registerForContextMenu(listView); registerForContextMenu(listView);
adapter = new StatusEditorAdapter(this); adapter = new StatusEditorAdapter(this);
setListAdapter(adapter);
View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.status_history_footer, null, false); View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.status_history_footer, null, false);
footerView.findViewById(R.id.clear_status_history_button).setOnClickListener(this); footerView.findViewById(R.id.clear_status_history_button).setOnClickListener(this);
listView.addFooterView(footerView); listView.addFooterView(footerView);
setListAdapter(adapter);
statusTextView = (EditText) findViewById(R.id.status_text); statusTextView = (EditText) findViewById(R.id.status_text);
statusModeView = (Spinner) findViewById(R.id.status_icon); statusModeView = (Spinner) findViewById(R.id.status_icon);
statusModeView.setAdapter(new StatusModeAdapter(this)); statusModeView.setAdapter(new StatusModeAdapter(this));
...@@ -191,10 +192,6 @@ public class StatusEditor extends ManagedListActivity implements OnItemClickList ...@@ -191,10 +192,6 @@ public class StatusEditor extends ManagedListActivity implements OnItemClickList
case R.id.action_change_status: case R.id.action_change_status:
changeStatus(); changeStatus();
return true; return true;
case R.id.action_clear_status_history:
clearStatusHistory();
return true;
} }
return false; return false;
} }
......
...@@ -42,6 +42,7 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi ...@@ -42,6 +42,7 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi
private int avatarRadius; private int avatarRadius;
private int contactTitlePaddingBottomBig; private int contactTitlePaddingBottomBig;
private int contactTitlePaddingBottomSmall; private int contactTitlePaddingBottomSmall;
private Toolbar toolbar;
public ContactTitleExpandableToolbarInflater(AppCompatActivity activity) { public ContactTitleExpandableToolbarInflater(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
...@@ -49,9 +50,7 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi ...@@ -49,9 +50,7 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi
public void onCreate(AbstractContact abstractContact) { public void onCreate(AbstractContact abstractContact) {
activity.setContentView(R.layout.expandable_contact_title_activity); activity.setContentView(R.layout.expandable_contact_title_activity);
activity.setSupportActionBar((Toolbar) activity.findViewById(R.id.toolbar_overlay)); toolbar = (Toolbar) activity.findViewById(R.id.toolbar_overlay);
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
avatarView = activity.findViewById(R.id.avatar); avatarView = activity.findViewById(R.id.avatar);
contactNamePanel = activity.findViewById(R.id.contact_name_panel); contactNamePanel = activity.findViewById(R.id.contact_name_panel);
...@@ -182,9 +181,9 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi ...@@ -182,9 +181,9 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi
} }
titleView.setPadding(paddingLeft, 0, paddingLeft, 0); titleView.setPadding(paddingLeft, 0, paddingLeft, 0);
} }
public Toolbar getToolbar() {
return toolbar;
}
} }
<?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
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
<!--for text selection toolbar to be above usual toolbar --> <!--for text selection toolbar to be above usual toolbar -->
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<!-- for hardware button menu -->
<item name="panelBackground">?attr/colorPrimary</item>
</style> </style>
<style name="ToolbarTitle" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"> <style name="ToolbarTitle" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
......
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