List of usage examples for android.widget ImageView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:br.com.projeto.icebeer.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); // evento botao3 Button botao = (Button) view.findViewById(R.id.bt3); botao.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { botaoSelecionado(BT3);/* w ww.j a va 2s . co m*/ } }); // evento botao4 botao = (Button) view.findViewById(R.id.bt4); botao.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { botaoSelecionado(BT4); } }); // evento botao5 botao = (Button) view.findViewById(R.id.bt5); botao.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { botaoSelecionado(BT5); } }); ImageView imgLigar = (ImageView) view.findViewById(R.id.imgLigar); imgLigar.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { statusPower = !statusPower; ImageView _imgLigar = (ImageView) v.findViewById(R.id.imgLigar); if (statusPower) { _imgLigar.setImageResource(R.drawable.ic_ligado_150px); startTimer(); } else { _imgLigar.setImageResource(R.drawable.ic_desligado_150px); stoptimertask(); } } }); return view; }
From source file:com.micabyte.android.app.BaseFragment.java
@SuppressWarnings("ConstantConditions") protected ImageView setImageView(int resId) { final ImageView v = (ImageView) getView().findViewById(resId); v.setOnClickListener(this); return v;/*from w w w . j a v a2 s. c o m*/ }
From source file:nl.frankkie.hwcon2016.activities.AboutAppActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about_app); // Show the Up button in the action bar. Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar); mToolbar.setTitle(getTitle());/*w w w .j a va2 s . c o m*/ setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); //Fill data TextView version = (TextView) findViewById(R.id.aboutapp_version); String versionString = ""; try { versionString = "Version: " + this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName + "-" + this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException nnfe) { nnfe.printStackTrace(); ACRA.getErrorReporter().handleException(nnfe); } version.setText(versionString); final View btnViewLicences = findViewById(R.id.aboutapp_viewlicences); btnViewLicences.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showLicenceInfo(); } }); btnViewLicences.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mGoogleApiClient.isConnected()) { Games.Achievements.unlock(mGoogleApiClient, getString(R.string.achievement_another_easter_egg)); } Toast.makeText(AboutAppActivity.this, R.string.another_easteregg_found, Toast.LENGTH_LONG).show(); return true; } }); //Easter Egg stuff ImageView image = (ImageView) findViewById(R.id.aboutapp_frankkienl_image); image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { timesClicked++; if (timesClicked >= 10) { Intent i = new Intent(AboutAppActivity.this, EasterEggActivity.class); startActivity(i); timesClicked = 0; //reset } } }); initGoogleApi(); }
From source file:com.telestax.mayday_customer.fragment.CustomerOfferFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View viewInfo = inflater.inflate(R.layout.customer_offer, container, false); // Initialize UI mImageViewCustomerMayDayCall = (ImageView) viewInfo.findViewById(R.id.imageView_customer_three_mayday); ImageView imageViewCustomerOfferBack = (ImageView) viewInfo .findViewById(R.id.imageView_customer_offer_back); mImageViewCustomerMayDayCall.setOnClickListener(this); imageViewCustomerOfferBack.setOnClickListener(this); String mayDayAction = MainActivity.getMaydaySharePref(getActivity()); if (mayDayAction != null) { if (mayDayAction.equalsIgnoreCase(Constant.YES)) { mImageViewCustomerMayDayCall.setVisibility(View.INVISIBLE); } else {// ww w . ja v a 2s . c o m mImageViewCustomerMayDayCall.setVisibility(View.VISIBLE); } } mInitReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mImageViewCustomerMayDayCall.setVisibility(View.VISIBLE); } }; //Register broadcast receiver LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mInitReceiver, new IntentFilter(Constant.BROADCAST_INTENT)); return viewInfo; }
From source file:com.kaku.weac.fragment.RingSelectFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fm_ring_select, container, false); // ?/*from w ww.ja v a 2 s . co m*/ ViewGroup viewGroup = (ViewGroup) view.findViewById(R.id.ring_select_llyt); // ? MyUtil.setBackground(viewGroup, getActivity()); // Fragment initFragment(); // ViewPager initViewPager(view); // ImageView actionCancel = (ImageView) view.findViewById(R.id.ring_select_cancel); actionCancel.setOnClickListener(this); // ? TextView actionSave = (TextView) view.findViewById(R.id.ring_select_save); actionSave.setOnClickListener(this); return view; }
From source file:com.mastercard.masterpasswallet.adapters.CardPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { final Card card = mCards.get(position); View view = LayoutInflater.from(mContext).inflate(R.layout.partial_payment_card, null); ImageView cardImage = (ImageView) view.findViewById(R.id.img_card); cardImage.setImageResource(card.getCardImageFull()); TextView cardPan = (TextView) view.findViewById(R.id.txt_card_pan); cardPan.setText(mContext.getString(R.string.masked_pan, " " + card.getPANEnding())); TextView cardName = (TextView) view.findViewById(R.id.txt_card_name); cardName.setText(card.getCardName()); cardName.setVisibility(View.VISIBLE); // Show/hide overlay to indicate if card is suspended or not View inactiveOverlay = view.findViewById(R.id.img_overlay); if (card.IsActive()) { inactiveOverlay.setVisibility(View.GONE); } else {/*from w w w . j ava 2 s .c o m*/ inactiveOverlay.setVisibility(View.VISIBLE); } // Set actions if (mListener != null) { // Configure card info action ImageView imgInfo = (ImageView) view.findViewById(R.id.img_info); imgInfo.setVisibility(View.VISIBLE); imgInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListener.showCardInfo(card); } }); // Configure making card default ImageView imgDefaultCard = (ImageView) view.findViewById(R.id.img_default_card); imgDefaultCard.setVisibility(View.VISIBLE); if (card.isDefault(PaymentContext.CONTACTLESS)) { imgDefaultCard.setImageResource(R.drawable.ic_favourite_selected); } else { imgDefaultCard.setImageResource(R.drawable.ic_favourite_deselected); } imgDefaultCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListener.makeDefaultcard(card); } }); } // Configure card balance View layBalance = view.findViewById(R.id.lay_balance); layBalance.setVisibility(View.VISIBLE); TextView txtBalanceType = (TextView) view.findViewById(R.id.tvBalanceType); TextView txtBalance = (TextView) view.findViewById(R.id.tvBalance); if (card.isCreditCard()) { txtBalanceType.setText("Current Balance:"); } else { txtBalanceType.setText("Available Balance:"); } DecimalFormat decimalFormat = new DecimalFormat("$##,##0.00"); String amount = decimalFormat.format(card.getCardBalance() / 100f); txtBalance.setText(amount); // Add the layout to the container container.addView(view); return view; }
From source file:com.ijunes.transitions.StoryDetailActivity.java
/** * Given a view group, then populate with the content from the node which has been loaded * into mItem/* w ww. j a v a 2 s. co m*/ * @param viewGroup The ViewGroup to populate with the content */ private void addContentToViewGroup(ViewGroup viewGroup) { if (mItem != null) { TextView contentTextView = (TextView) viewGroup.findViewById(R.id.item1); if (contentTextView != null) { contentTextView.setText(getResources().getText(mItem.contentResourceId)); } ListView contentListView = (ListView) findViewById(R.id.story_detail_list); if (contentListView instanceof ParallaxListView) { View galleryLayout = null; if (tabPosition == 1) { galleryLayout = getLayoutInflater().inflate(R.layout.header_layout, null); } else if (tabPosition == 0) { galleryLayout = getLayoutInflater().inflate(R.layout.header_layout_small, null); } if (galleryLayout != null) { ImageView imageView = (ImageView) galleryLayout.findViewById(R.id.story_image); imageView.setOnClickListener(this); ((ParallaxListView) contentListView).addParallaxedHeaderView(galleryLayout); } } TextView titleTextView = (TextView) viewGroup.findViewById(R.id.item2); if (titleTextView != null) { titleTextView.setText(mItem.title); } } }
From source file:de.kirchnerei.bicycle.battery.BatteryEditFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mDate = (EditText) view.findViewById(R.id.battery_date); mAverageSpeed = (EditText) view.findViewById(R.id.battery_average_speed); mMileage = (EditText) view.findViewById(R.id.battery_mileage); mLeftover = (EditText) view.findViewById(R.id.battery_leftover); mDate.setKeyListener(null);// w w w .jav a 2s. c om View.OnClickListener datePickerListener = new View.OnClickListener() { @Override public void onClick(View v) { doPickBatteryDate(); } }; ImageView datePicker = (ImageView) view.findViewById(R.id.battery_datepicker); datePicker.setOnClickListener(datePickerListener); mDate.setOnClickListener(datePickerListener); // update the current date from property "item" updateDate(null); }
From source file:kr.popcorn.sharoom.activity.Fragment.User.IconPageIndicator.java
public void notifyDataSetChanged() { mIconsLayout.removeAllViews();/*from www . j a va2s .co m*/ IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter(); int count = iconAdapter.getCount(); for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int index = ((ViewGroup) v.getParent()).indexOfChild(v); onPageSelected(index); //Log.d("aaa", index + " indicator selected : long click"); //TODO show alternative tab list to change tab } }); mIconsLayout.addView(view); } if (mSelectedIndex > count) { mSelectedIndex = count - 1; } setCurrentItem(mSelectedIndex); requestLayout(); }
From source file:kr.popcorn.sharoom.activity.Fragment.Host.H_IconPageIndicator.java
public void notifyDataSetChanged() { mIconsLayout.removeAllViews();/* www. ja va2 s .c o m*/ H_IconPagerAdapter iconAdapter = (H_IconPagerAdapter) mViewPager.getAdapter(); int count = iconAdapter.getCount(); for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int index = ((ViewGroup) v.getParent()).indexOfChild(v); onPageSelected(index); //Log.d("aaa", index + " indicator selected : long click"); //TODO show alternative tab list to change tab } }); mIconsLayout.addView(view); } if (mSelectedIndex > count) { mSelectedIndex = count - 1; } setCurrentItem(mSelectedIndex); requestLayout(); }