List of usage examples for android.widget ImageView setOnLongClickListener
public void setOnLongClickListener(@Nullable OnLongClickListener l)
From source file:org.tanrabad.survey.presenter.view.MainActivityNavigation.java
private static void setupHeaderView(NavigationView navigationView) { View header = navigationView.getHeaderView(0); final User user = AccountUtils.getUser(); ImageView avatarImageView = (ImageView) header.findViewById(R.id.avatar_icon); avatarImageView.setOnLongClickListener(new View.OnLongClickListener() { @Override//from w w w .j a va2 s. c om public boolean onLongClick(View view) { Alert.lowLevel().show(user.getApiFilter()); return true; } }); TextView userNameTextView = (TextView) header.findViewById(R.id.username); userNameTextView.setText(user.getUsername()); TextView userFullNameTextView = (TextView) header.findViewById(R.id.user_fullname); userFullNameTextView.setText(String.format("%s %s", user.getFirstname(), user.getLastname())); Organization organization = BrokerOrganizationRepository.getInstance().findById(user.getOrganizationId()); TextView organizationTextView = (TextView) header.findViewById(R.id.organization); organizationTextView.setText(organization.getName()); }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View view) { if (mActionMode != null) return false; mActionMode = startActionMode(mActionModeCallback); return true; }/*from w ww .j a va 2 s. co m*/ }); }
From source file:org.jak_linux.dns66.main.StartFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_start, container, false); Switch switchOnBoot = (Switch) rootView.findViewById(R.id.switch_onboot); ImageView view = (ImageView) rootView.findViewById(R.id.start_button); view.setOnLongClickListener(new View.OnLongClickListener() { @Override//from w ww .j ava 2s . c o m public boolean onLongClick(View v) { if (AdVpnService.vpnStatus != AdVpnService.VPN_STATUS_STOPPED) { Log.i(TAG, "Attempting to disconnect"); Intent intent = new Intent(getActivity(), AdVpnService.class); intent.putExtra("COMMAND", org.jak_linux.dns66.vpn.Command.STOP.ordinal()); getActivity().startService(intent); } else { checkHostsFilesAndStartService(); } return true; } }); updateStatus(rootView, AdVpnService.vpnStatus); switchOnBoot.setChecked(MainActivity.config.autoStart); switchOnBoot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { MainActivity.config.autoStart = isChecked; FileHelper.writeSettings(getContext(), MainActivity.config); } }); return rootView; }
From source file:com.avalond.ad_blocak.main.StartFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_start, container, false); Switch switchOnBoot = (Switch) rootView.findViewById(R.id.switch_onboot); ImageView view = (ImageView) rootView.findViewById(R.id.start_button); TextView stateText = (TextView) rootView.findViewById(R.id.state_textview); stateText.setText(getString(AdVpnService.vpnStatusToTextId(AdVpnService.vpnStatus))); view.setOnLongClickListener(v -> { if (AdVpnService.vpnStatus != AdVpnService.VPN_STATUS_STOPPED) { Log.i(TAG, "Attempting to disconnect"); Intent intent = new Intent(getActivity(), AdVpnService.class); intent.putExtra("COMMAND", Command.STOP.ordinal()); getActivity().startService(intent); } else {/*from www . ja v a 2 s . c om*/ checkHostsFilesAndStartService(); } return true; }); switchOnBoot.setChecked(MainActivity.config.autoStart); switchOnBoot.setOnCheckedChangeListener((buttonView, isChecked) -> { MainActivity.config.autoStart = isChecked; FileHelper.writeSettings(getContext(), MainActivity.config); }); return rootView; }
From source file:com.emuneee.nctrafficcams.ui.fragments.CameraDetailFragment.java
@Override public void onResume() { super.onResume(); EasyTracker.getInstance(getActivity()).set(Fields.SCREEN_NAME, TAG); EasyTracker.getInstance(getActivity()).send(MapBuilder.createAppView().build()); View view = getView();/*from ww w . j ava 2 s . c o m*/ // set the variables TextView textViewTitle = (TextView) view.findViewById(R.id.text_view_detail_title); TextView textViewMetro = (TextView) view.findViewById(R.id.text_view_detail_metro); ImageView imageView = (ImageView) view.findViewById(R.id.image_view_detail); TextView textViewCoord = (TextView) view.findViewById(R.id.text_view_detail_coordinates); // populate the form imageView.setOnLongClickListener(new CameraItemLongClickListener()); textViewTitle.setText(mCamera.getTitle()); textViewMetro.setText(mCamera.getCity() + ", NC " + mCamera.getZipCode()); BigDecimal latitude = new BigDecimal(mCamera.getLatitude()).setScale(3, BigDecimal.ROUND_HALF_UP); BigDecimal longitude = new BigDecimal(mCamera.getLongitude()).setScale(3, BigDecimal.ROUND_HALF_UP); textViewCoord.setText( latitude + getString(R.string.latitude) + ", " + longitude + getString(R.string.longitude)); MainActivity.getImageWorker().loadImage(mCamera.getUrl(), imageView, mCamera); }
From source file:de.uulm.graphicalpasswords.openuyi.UYICreatePasswordActivity.java
private void removePicture(int index) { findViewById(R.id.uyi_save).setClickable(false); findViewById(R.id.uyi_save).setEnabled(false); ImageView orig = originalViews[index]; ImageView dist = distortedViews[index]; orig.setOnLongClickListener(null); dist.setOnLongClickListener(null);//from ww w. j a v a 2s . c om orig.setImageResource(R.drawable.oempty); dist.setImageResource(R.drawable.wempty); orig.setClickable(false); dist.setClickable(false); ((UYIImageAdapter) gallery.getAdapter()).addPicture(selectedPictures[index]); selectedPictures[index] = null; }
From source file:com.ferasinfotech.gwreader.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View.OnLongClickListener click_listener = new View.OnLongClickListener() { public boolean onLongClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW); String s = "https://www.grasswire.com"; if (mStoryID != 0) { s = s + "/story/" + mStoryID + "/x"; }/*from w w w. j a va 2 s . co m*/ i.setData(Uri.parse(s)); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); return true; } }; ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); // Picasso.with(getActivity()).setLoggingEnabled(true); // Picasso.with(getActivity()).setIndicatorsEnabled(true); ImageView cover_image = (ImageView) rootView.findViewById(R.id.story_image); Picasso.with(getActivity()).load(mCoverPhoto).into(cover_image); cover_image.setOnLongClickListener(click_listener); ((TextView) rootView.findViewById(R.id.story_title)).setText(mTitle); ((TextView) rootView.findViewById(R.id.story_headline)).setText(mHeadline); ((TextView) rootView.findViewById(R.id.story_summary)).setText(mSummary); Log.d("***DEBUG***", "Building page:" + mPageNumber); if (mStoryID != 0) { LinksAdapter adapter = new LinksAdapter(getActivity(), mStoryString); LinearLayout ll = (LinearLayout) rootView.findViewById(R.id.story_layout); for (int i = 0; i < adapter.getCount(); i++) { View listItem = adapter.getView(i, null, ll); ll.addView(listItem); } } return rootView; }
From source file:com.xxjwd.sjbg.MainActivity.java
private void doShowDownloadDialog() { Dialog builder = new Dialog(this); //builder.requestWindowFeature(Window.FEATURE_NO_TITLE); builder.setTitle("???"); builder.getWindow().setBackgroundDrawable( new ColorDrawable(android.graphics.Color.TRANSPARENT)); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override/* www. j ava 2 s . c o m*/ public void onDismiss(DialogInterface dialogInterface) { //nothing; } }); ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.erweima); imageView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://61.163.45.215:808/sjbg/download.html"); intent.setData(content_url); startActivity(intent); return true; } } ); builder.addContentView(imageView, new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); builder.show(); }
From source file:de.tudarmstadt.informatik.secuso.phishedu2.SwipeActivity.java
void updateUI(Activity v) { super.updateUI(v); final ViewPager mPager = (ViewPager) v.findViewById(R.id.pager); mPager.setAdapter(new SwipePageAdapter(getFragmentManager(), this)); mPager.setOnPageChangeListener(this); ImageView imgPrevious = (ImageView) v.findViewById(R.id.game_intro_arrow_back); imgPrevious.setOnClickListener(new OnClickListener() { @Override/*from ww w. j av a 2 s . com*/ public void onClick(View v) { mPager.setCurrentItem(mPager.getCurrentItem() - 1); } }); imgPrevious.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { mPager.setCurrentItem(0); return true; } }); ImageView imgNext = (ImageView) v.findViewById(R.id.game_intro_arrow_forward); imgNext.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setCurrentItem(mPager.getCurrentItem() + 1); } }); imgNext.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { mPager.setCurrentItem(getPageCount() - 1); return true; } }); Button bStartLevel = (Button) v.findViewById(R.id.game_intro_start_button); bStartLevel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onStartClick(); } }); bStartLevel.setText(this.startButtonText()); checkAndHideButtons(0); }
From source file:com.groundupworks.partyphotobooth.kiosk.KioskActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mKioskModeHelper = new KioskModeHelper(this); mPreferencesHelper = new PreferencesHelper(); mCurrentFrame = 1;/* w w w . java 2 s . co m*/ mTotalFrames = mPreferencesHelper.getPhotoStripTemplate(this).getNumPhotos(); // Show on top of lock screen. getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); setContentView(R.layout.activity_kiosk); // Configure button to exit Kiosk mode. ImageView exitButton = (ImageView) findViewById(R.id.kiosk_exit_button); mFlashScreen = findViewById(R.id.flash_screen); exitButton.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mKioskModeHelper.isPasswordRequired()) { showDialogFragment(KioskPasswordDialogFragment.newInstance()); } else { exitKioskMode(); } return true; } }); }