Search in sources :

Example 86 with Toolbar

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);
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar)

Example 87 with Toolbar

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);
}
Also used : BaseViewHolder(xyz.zpayh.adapter.BaseViewHolder) OnItemClickListener(xyz.zpayh.adapter.OnItemClickListener) ArrayList(java.util.ArrayList) Intent(android.content.Intent) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) BaseAdapter(xyz.zpayh.adapter.BaseAdapter) Toolbar(androidx.appcompat.widget.Toolbar)

Example 88 with Toolbar

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);
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) StaggeredGridLayoutManager(androidx.recyclerview.widget.StaggeredGridLayoutManager) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) OnItemLongClickListener(xyz.zpayh.adapter.OnItemLongClickListener) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) StaggeredGridLayoutManager(androidx.recyclerview.widget.StaggeredGridLayoutManager) MyMultiAdapter(xyz.zpayh.myadapter.adapter.MyMultiAdapter) Toolbar(androidx.appcompat.widget.Toolbar)

Example 89 with Toolbar

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();
}
Also used : EditText(android.widget.EditText) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) Toolbar(androidx.appcompat.widget.Toolbar)

Example 90 with Toolbar

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);
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)284 View (android.view.View)116 TextView (android.widget.TextView)58 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)43 Intent (android.content.Intent)39 NonNull (androidx.annotation.NonNull)36 Fragment (androidx.fragment.app.Fragment)33 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 Context (android.content.Context)25 ViewGroup (android.view.ViewGroup)25 EditText (android.widget.EditText)23 MenuItem (android.view.MenuItem)21 ImageView (android.widget.ImageView)20 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20