use of com.xabber.android.ui.adapter.StatusModeAdapter in project xabber-android by redsolution.
the class StatusEditor method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing()) {
return;
}
actionWithItem = null;
setContentView(R.layout.status_editor);
Toolbar toolbar = (Toolbar) findViewById(R.id.top_toolbar);
toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
setTitle(null);
setSupportActionBar(toolbar);
Intent intent = getIntent();
account = StatusEditor.getAccount(intent);
BarPainter barPainter = new BarPainter(this, toolbar);
if (account != null) {
barPainter.updateWithAccountName(account);
} else {
barPainter.setDefaultColor();
}
ListView listView = getListView();
listView.setOnItemClickListener(this);
registerForContextMenu(listView);
adapter = new StatusEditorAdapter(this);
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);
listView.addFooterView(footerView);
setListAdapter(adapter);
statusTextView = (EditText) findViewById(R.id.status_text);
statusModeView = (Spinner) findViewById(R.id.status_icon);
statusModeView.setAdapter(new StatusModeAdapter(this));
savedStatusesTextView = findViewById(R.id.saved_statuses_textview);
StatusMode statusMode;
String statusText;
if (savedInstanceState == null) {
if (account == null) {
statusMode = SettingsManager.statusMode();
statusText = SettingsManager.statusText();
} else {
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
statusMode = accountItem.getFactualStatusMode();
statusText = accountItem.getStatusText();
}
} else {
statusMode = StatusMode.valueOf(savedInstanceState.getString(SAVED_MODE));
statusText = savedInstanceState.getString(SAVED_TEXT);
}
showStatus(statusMode, statusText);
}
Aggregations