use of com.xabber.android.ui.color.StatusBarPainter in project xabber-android by redsolution.
the class ContactViewer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
// View information about contact from system contact list
Uri data = getIntent().getData();
if (data != null && "content".equals(data.getScheme())) {
List<String> segments = data.getPathSegments();
if (segments.size() == 2 && "data".equals(segments.get(0))) {
Long id;
try {
id = Long.valueOf(segments.get(1));
} catch (NumberFormatException e) {
id = null;
}
if (id != null)
// FIXME: Will be empty while application is loading
for (RosterContact rosterContact : RosterManager.getInstance().getContacts()) if (id.equals(rosterContact.getViewId())) {
account = rosterContact.getAccount();
bareAddress = rosterContact.getUser();
break;
}
}
}
} else {
account = getAccount(getIntent());
bareAddress = getUser(getIntent());
}
if (bareAddress != null && bareAddress.equalsIgnoreCase(GroupManager.IS_ACCOUNT)) {
bareAddress = Jid.getBareAddress(AccountManager.getInstance().getAccount(account).getRealJid());
}
if (account == null || bareAddress == null) {
Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
finish();
return;
}
setContentView(R.layout.contact_viewer);
if (savedInstanceState == null) {
Fragment fragment;
if (MUCManager.getInstance().hasRoom(account, bareAddress)) {
fragment = ConferenceInfoFragment.newInstance(account, bareAddress);
} else {
fragment = ContactVcardViewerFragment.newInstance(account, bareAddress);
}
getFragmentManager().beginTransaction().add(R.id.scrollable_container, fragment).commit();
}
bestContact = RosterManager.getInstance().getBestContact(account, bareAddress);
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavUtils.navigateUpFromSameTask(ContactViewer.this);
}
});
StatusBarPainter statusBarPainter = new StatusBarPainter(this);
statusBarPainter.updateWithAccountName(account);
final int accountMainColor = ColorManager.getInstance().getAccountPainter().getAccountMainColor(account);
contactTitleView = findViewById(R.id.contact_title_expanded);
findViewById(R.id.status_icon).setVisibility(View.GONE);
contactTitleView.setBackgroundColor(accountMainColor);
TextView contactNameView = (TextView) findViewById(R.id.name);
contactNameView.setVisibility(View.INVISIBLE);
collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(bestContact.getName());
collapsingToolbar.setBackgroundColor(accountMainColor);
collapsingToolbar.setContentScrimColor(accountMainColor);
}
use of com.xabber.android.ui.color.StatusBarPainter in project xabber-android by redsolution.
the class ContactActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
account = getAccount(getIntent());
user = getUser(getIntent());
AccountItem accountItem = AccountManager.getInstance().getAccount(this.account);
if (accountItem == null) {
LogManager.e(LOG_TAG, "Account item is null " + account);
finish();
return;
}
if (user != null && user.getBareJid().equals(account.getFullJid().asBareJid())) {
try {
user = UserJid.from(accountItem.getRealJid().asBareJid());
} catch (UserJid.UserJidCreateException e) {
LogManager.exception(this, e);
}
}
if (account == null || user == null) {
Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
finish();
return;
}
setContentView(R.layout.activity_contact);
if (savedInstanceState == null) {
Fragment fragment;
if (MUCManager.getInstance().hasRoom(account, user)) {
fragment = ConferenceInfoFragment.newInstance(account, user.getJid().asEntityBareJidIfPossible());
} else {
fragment = ContactVcardViewerFragment.newInstance(account, user);
}
getFragmentManager().beginTransaction().add(R.id.scrollable_container, fragment).commit();
}
bestContact = RosterManager.getInstance().getBestContact(account, user);
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
StatusBarPainter statusBarPainter = new StatusBarPainter(this);
statusBarPainter.updateWithAccountName(account);
final int accountMainColor = ColorManager.getInstance().getAccountPainter().getAccountMainColor(account);
contactTitleView = findViewById(R.id.contact_title_expanded);
findViewById(R.id.ivStatus).setVisibility(View.GONE);
contactTitleView.setBackgroundColor(accountMainColor);
TextView contactNameView = (TextView) findViewById(R.id.name);
contactNameView.setVisibility(View.INVISIBLE);
collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(bestContact.getName());
collapsingToolbar.setBackgroundColor(accountMainColor);
collapsingToolbar.setContentScrimColor(accountMainColor);
}
use of com.xabber.android.ui.color.StatusBarPainter in project xabber-android by redsolution.
the class ChatActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogManager.i(LOG_TAG, "onCreate " + savedInstanceState);
setContentView(R.layout.activity_chat);
getWindow().setBackgroundDrawable(null);
contactTitleView = findViewById(R.id.contact_title);
contactTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectPage(2, true);
}
});
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setOverflowIcon(getResources().getDrawable(R.drawable.ic_overflow_menu_white_24dp));
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(ChatActivity.this);
}
});
showcaseView = findViewById(R.id.showcaseView);
statusBarPainter = new StatusBarPainter(this);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getInitialChatFromIntent();
getSelectedPageDataFromIntent();
if (savedInstanceState != null) {
restoreInstanceState(savedInstanceState);
}
initChats();
}
use of com.xabber.android.ui.color.StatusBarPainter in project xabber-android by redsolution.
the class ChatViewer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing()) {
return;
}
setContentView(R.layout.chat_viewer);
statusBarPainter = new StatusBarPainter(this);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getInitialChatFromIntent();
getSelectedPageDataFromIntent();
if (savedInstanceState != null) {
restoreInstanceState(savedInstanceState);
}
initChats();
}
Aggregations