List of usage examples for android.view View setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.github.fi3te.iliasdownloader.model.adapter.SimpleFileRecyclerAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View root = inflater.inflate(R.layout.simple_file_list_entry, viewGroup, false); ViewHolder holder = new ViewHolder(root); root.setOnClickListener(onClickListener); return holder; }
From source file:com.baggy.dashclock.nowplayingextension.SimplePagedTabsHelper.java
public void addTab(CharSequence label, int contentViewId) { View tabView = LayoutInflater.from(mContext).inflate(R.layout.tab, mTabContainer, false); ((TextView) tabView.findViewById(R.id.tab)).setText(label); tabView.setOnClickListener(mTabClickListener); int position = mTabContentIds.size(); tabView.setSelected(mPager.getCurrentItem() == position); mTabPositions.put(tabView, position); mTabContainer.addView(tabView);// ww w . j a v a 2 s . c om mTabContentIds.add(contentViewId); }
From source file:com.appsimobile.appsihomeplugins.dashclock.ui.SimplePagedTabsHelper.java
public void addTab(CharSequence label, int contentViewId) { View tabView = LayoutInflater.from(mContext).inflate(R.layout.tab, mTabContainer, false); ((TextView) tabView.findViewById(R.id.tab)).setText(label); tabView.setOnClickListener(mTabClickListener); int position = mTabContentIds.size(); tabView.setSelected(mPager.getCurrentItem() == position); mTabPositions.put(tabView, position); mTabContainer.addView(tabView);//from w w w . ja v a 2 s . c om mTabContentIds.add(contentViewId); mAdapter.notifyDataSetChanged(); }
From source file:com.bdenney.locl.fragment.LightboxFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View root = inflater.inflate(R.layout.fragment_lightbox, container, false); if (root != null) { mPhotoView = (PhotoView) root.findViewById(R.id.image); mBlogNameView = (TextView) root.findViewById(R.id.blog_name); if (mBlogNameView != null) { mBlogNameView.setText(getBlogName()); }/*w w w .j av a 2 s . co m*/ final View attribution = root.findViewById(R.id.attribution_view); if (attribution != null) { attribution.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(getBlogUri()); startActivity(intent); } }); } mAvatarView = (ImageView) root.findViewById(R.id.avatar); new LoadAvatarTask(getBlogName()).execute(); } return root; }
From source file:com.coinblesk.client.backup.BackupActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); setContentView(R.layout.activity_backup); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//ww w . ja v a 2 s .co m if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); } View v; if ((v = findViewById(R.id.backup_backup_touch)) != null) v.setOnClickListener(new BackupClickListener()); if ((v = findViewById(R.id.backup_restore_touch)) != null) v.setOnClickListener(new RestoreClickListener()); if ((v = findViewById(R.id.backup_refresh_touch)) != null) v.setOnClickListener(new RefreshClickListener()); }
From source file:bbct.android.common.activity.FilterCards.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.filter_cards, container, false); // set title//from w w w . jav a 2s.co m String format = this.getString(R.string.bbct_title); String filterCardsTitle = this.getString(R.string.filter_cards_title); String title = String.format(format, filterCardsTitle); Activity activity = Objects.requireNonNull(getActivity()); activity.setTitle(title); for (int id : CHECKBOXES) { View checkBox = view.findViewById(id); checkBox.setOnClickListener(this.onCheckBoxClick); } // restore input fields state if (savedInstanceState != null) { ArrayList<Integer> enabledFields = savedInstanceState.getIntegerArrayList(INPUT_EXTRA); if (enabledFields != null) { for (int i : enabledFields) { CheckBox cb = view.findViewById(CHECKBOXES[i]); cb.setChecked(true); EditText et = view.findViewById(TEXT_FIELDS[i]); et.setEnabled(true); } } } return view; }
From source file:com.chess.genesis.activity.MsgBoxFrag.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { initBaseContentFrag(container);/*from w w w .j a va 2 s.c om*/ final View view = inflater.inflate(R.layout.fragment_msgbox, container, false); net = new NetworkClient(act, new Handler(this)); progress = new ProgressMsg(act); // restore settings settings = (savedInstanceState != null) ? savedInstanceState : getArguments(); gameid = settings.getString("gameid"); final View btn = view.findViewById(R.id.submit_msg); btn.setOnClickListener(this); // disable touch on tabtext view.findViewById(R.id.tabtxt).setOnTouchListener(null); // set list adapters msglist_adapter = new MsgListAdapter(act, gameid); msglist_view = (ListView) view.findViewById(R.id.msg_list); msglist_view.setAdapter(msglist_adapter); // set empty view item final View empty = MsgListAdapter.getEmptyView(act); ((ViewGroup) msglist_view.getParent()).addView(empty); msglist_view.setEmptyView(empty); // scroll to bottom msglist_view.setSelection(msglist_view.getCount() - 1); return view; }
From source file:com.abid_mujtaba.fetchheaders.AccountsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.accounts_menu, menu); MenuItem item = menu.findItem(R.id.menu_add_account); // We gain access to the menu item and through it to its action view (the actionLayout definied in the menu layout) View itemView = MenuItemCompat.getActionView(item); if (itemView != null) { itemView.setOnClickListener(new View.OnClickListener() { // To make the menu item work when it has an actionView we must explicitly attach a clicklistener to the actionview otherwise nothing happens when the menu is pressed @Override // Note: With this implementation we do NOT need an onOptionItemSelected method public void onClick(View view) { startActivity(new Intent("com.abid_mujtaba.fetchheaders.AccountSettingActivity")); }/*from www . jav a2 s. c om*/ }); } return true; }
From source file:com.awesome.byunghwa.app.popularmoviesapp2.adapter.MovieListRecyclerViewAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler, parent, false); v.setOnClickListener(this); return new ViewHolder(v); }
From source file:android.example.com.animationdemos.ZoomActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_zoom); // Hook up clicks on the thumbnail views. final View thumb1View = findViewById(R.id.thumb_button_1); thumb1View.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . ja v a2s .c o m*/ public void onClick(View view) { zoomImageFromThumb(thumb1View, R.drawable.image1); } }); final View thumb2View = findViewById(R.id.thumb_button_2); thumb2View.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { zoomImageFromThumb(thumb2View, R.drawable.image2); } }); // Retrieve and cache the system's default "short" animation time. mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); }