use of androidx.appcompat.widget.Toolbar in project zype-android by zype.
the class PlaylistActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (getIntent() != null) {
parentId = getIntent().getStringExtra(BundleConstants.PARENT_ID);
} else {
throw new IllegalStateException("Playlist Id can not be empty");
}
updateTitle();
mTvEmpty = (TextView) findViewById(R.id.empty);
// mTvEmpty.setText("Yo");
mListView = (ListView) findViewById(R.id.list_playlist);
mListView.setOnItemClickListener(this);
mAdapter = new PlaylistCursorAdapter(this, PlaylistCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, null, null);
mListView.setAdapter(mAdapter);
}
use of androidx.appcompat.widget.Toolbar in project SherlockAdapter by EvilBT.
the class MainActivity method initView.
private void initView() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mRecyclerView = (RecyclerView) findViewById(R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
final BaseAdapter<String> adapter = new BaseAdapter<String>() {
@Override
public int getLayoutRes(int index) {
return R.layout.item_list;
}
@Override
public void convert(BaseViewHolder holder, String data, int index) {
holder.setText(R.id.tv_act_title, data);
}
@Override
public void bind(BaseViewHolder holder, int layoutRes) {
holder.setClickable(R.id.app_root, true);
}
};
adapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(@NonNull View view, int adapterPosition) {
String action = adapter.getData(adapterPosition);
Intent intent = new Intent();
intent.setAction(action);
startActivity(intent);
}
});
mRecyclerView.setAdapter(adapter);
String[] list = getResources().getStringArray(R.array.activity_title);
final List<String> data = new ArrayList<>(list.length);
for (String s : list) {
data.add(s);
}
adapter.setData(data);
}
use of androidx.appcompat.widget.Toolbar in project SherlockAdapter by EvilBT.
the class MultiItemActivity method initView.
private void initView() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mGridLayoutManager = new GridLayoutManager(this, 3);
mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
final SwipeRefreshLayout refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refresh);
mRecyclerView = (RecyclerView) findViewById(R.id.list);
mRecyclerView.setLayoutManager(mGridLayoutManager);
mIsGrid = true;
mAdapter = new MyMultiAdapter();
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(@NonNull View view, final int adapterPosition) {
new AlertDialog.Builder(MultiItemActivity.this).setTitle("是否删除第" + adapterPosition + "项").setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mAdapter.removeData(adapterPosition);
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).create().show();
return true;
}
});
mData = new ArrayList<>();
initGridData();
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refreshLayout.postDelayed(new Runnable() {
@Override
public void run() {
mAdapter.setData(mData);
refreshLayout.setRefreshing(false);
}
}, 500);
}
});
}
use of androidx.appcompat.widget.Toolbar in project collect by opendatakit.
the class ChangesReasonPromptDialogFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Toolbar toolbar = getToolbar();
toolbar.setTitle(viewModel.getFormName());
toolbar.inflateMenu(R.menu.changes_reason_dialog);
EditText reasonField = view.findViewById(R.id.reason);
reasonField.setText(viewModel.getReason());
reasonField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
viewModel.setReason(editable.toString());
}
});
toolbar.setOnMenuItemClickListener(item -> {
viewModel.resumeSave();
return true;
});
reasonField.requestFocus();
}
use of androidx.appcompat.widget.Toolbar in project collect by opendatakit.
the class DeleteSavedFormActivity method onConfigurationChanged.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.notes);
}
Aggregations