Java Code Examples for android.widget.ImageView.setOnLongClickListener()

The following are Jave code examples for showing how to use setOnLongClickListener() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Huochexing12306   File: AboutAty.java   View Source Code Vote up 7 votes
private void initViews() {
	TextView tvInfo1 = (TextView)findViewById(R.id.info);
	memberLayout = (LinearLayout)findViewById(R.id.about_memberLayout);
	teamLogo = (ImageView)findViewById(R.id.about_teamLogo);
	btnEmail = (Button)findViewById(R.id.email);
	btnEmail.setOnClickListener(this);
	btnQQ = (Button)findViewById(R.id.about_btnQQ);
	btnQQ.setOnClickListener(this);
	llytSinaWeibo = (LinearLayout)findViewById(R.id.about_llytSinaWeiBo);
	llytSinaWeibo.setOnClickListener(this);
	tvSinaWeibo = (TextView)findViewById(R.id.about_sinaWeiBo);
	
	String strInfo1 = "应用版本:V"+MyUtils.getVersionName(this);
	tvInfo1.setText(Html.fromHtml(strInfo1));
	String strEmail = "[email protected]";
	btnEmail.setText(Html.fromHtml("<u>联系邮箱: "+strEmail+"</u>"));
	btnEmail.setTag(strEmail);
	btnQQ.setText(Html.fromHtml("<u>" + strQQ + "</u>"));
	tvSinaWeibo.setText(Html.fromHtml("<u>@"+strSinaWeibo+"</u>"));
	teamLogo.setOnLongClickListener(new View.OnLongClickListener() {
		@Override
		public boolean onLongClick(View v) {
			memberLayout.setVisibility(memberLayout.isShown() ? View.GONE : View.VISIBLE);
			return false;
		}
	});
}
 
Example 2
Project: SaveImage2SystemAlbum   File: ImageFragment.java   View Source Code Vote up 7 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_image, container, false);

    ImageView imageView = (ImageView) rootView.findViewById(R.id.image);
    String url = getData();
    if(url.toLowerCase().endsWith(".gif")) {
        Glide.with(this).load(url).asGif().into(imageView);
    } else {
        Glide.with(this).load(url).into(imageView);
    }
    imageView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            SaveImageDialogFragment.show(getActivity(), getData());
            return true;
        }
    });

    return rootView;
}
 
Example 3
Project: Trinity-App   File: NavDrawerFragment.java   View Source Code Vote up 7 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_nav_drawer, container, false);

    ImageView imageView = (ImageView) view.findViewById(R.id.nav_drawer_image);
    imageView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            Toast.makeText(getActivity(), "Thanks for downloading the app! Developed by Trinity Infotech Committee.", Toast.LENGTH_LONG).show();
            return true;
        }
    });

    return view;
}
 
Example 4
Project: LaunchEnr   File: PageIndicatorLineCaret.java   View Source Code Vote up 6 votes
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle);
    mAllAppsHandle.setImageDrawable(getCaretDrawable());
    mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
    mAllAppsHandle.setOnClickListener(mLauncher);
    mAllAppsHandle.setOnLongClickListener(mLauncher);
    mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler);
    mLauncher.setAllAppsButton(mAllAppsHandle);
}
 
Example 5
Project: Ucount   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // litepal
    Connector.getDatabase();

    // 获得包名和资源,方便后面的程序使用
    PACKAGE_NAME = getApplicationContext().getPackageName();
    resources = getResources();

    showBtn = (Button) findViewById(R.id.show_money_button);
    addBtn = (CircleButton) findViewById(R.id.add_button);
    ioItemRecyclerView = (RecyclerView) findViewById(R.id.in_and_out_items);
    headerImg = (ImageView) findViewById(R.id.header_img);
    monthlyCost = (TextView) findViewById(R.id.monthly_cost_money);
    monthlyEarn = (TextView) findViewById(R.id.monthly_earn_money);

    // 设置按钮监听
    showBtn.setOnClickListener(new ButtonListener());
    addBtn.setOnClickListener(new ButtonListener());

    // 设置首页header图片长按以更换图片
    headerImg.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            selectPictureFromGallery();
            return false;
        }
    });

    setImageForHeader();
}
 
Example 6
Project: Mire   File: ActivitySetWallpapers.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_set_image);
	Preferences.makeAppFullscreen(this, Color.TRANSPARENT);
	
	setEnter();
	if (savedInstanceState != null) 
	{
           image = savedInstanceState.getString(URL);
           title = savedInstanceState.getString(NAME);
		text = savedInstanceState.getString(TEXT);
       }
	
	Bundle bundle = getIntent().getExtras();
       if (bundle != null)
	{
           image = bundle.getString(URL);
           title = bundle.getString(NAME);
		text = bundle.getString(TEXT);
       }
	
	wallpaper = (DoubleTapImageView)findViewById(R.id.id_image);
	progress = (ProgressBar)findViewById(R.id.id_progress);
	apply = (ImageView)findViewById(R.id.id_apply);
	
	mColor = Preferences.getAttributeColor(this, R.attr.colorAccent);
	anim = AnimationUtils.loadAnimation(this, R.anim.slide_left_from_right);
	_anim = AnimationUtils.loadAnimation(this, R.anim.slide_right_from_left);
	
	exitTransition = ActivityTransition.with(this.getIntent())
	    .to(this, wallpaper, "walls")
	    .duration(300)
	    .start(savedInstanceState);
	
	apply.setOnLongClickListener(applyLongClick);
}
 
Example 7
Project: tumbviewer   File: VideoPhotoPostVH.java   View Source Code Vote up 6 votes
public VideoPhotoPostVH(View itemView, ExoPlayerInstance playerInstance) {
    super(itemView);
    playerView = (CommonExoPlayerView) itemView.findViewById(R.id.post_video);
    playerView.setPlayerInstance(playerInstance);
    playerView.setOnClickListener(this);
    downloadView = (ImageView) itemView.findViewById(R.id.post_download);
    downloadView.setOnClickListener(this);
    downloadView.setOnLongClickListener(this);
}
 
Example 8
Project: XposedNavigationBar   File: BtnFuncFactory.java   View Source Code Vote up 6 votes
/**
 * 创建按钮并且设置对应功能
 *
 * @param line
 * @param sc
 */
public void createBtnAndSetFunc(LinearLayout line, ShortCut sc) {
    int iconScale = DataHook.iconScale;
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    p.weight = 1;
    p.gravity = Gravity.CENTER;

    Context context = line.getContext();
    ImageView btn = new ImageView(context);

    String iconPath = sc.getIconPath();
    Bitmap iconBitmap = null;
    if (iconPath != null) {
        iconBitmap = ImageUtil.zoomBitmap(iconPath, iconScale);
    }
    if (iconBitmap == null) {
        iconBitmap = ImageUtil.byte2Bitmap(mMapImgRes.get(sc.getCode()));
        iconBitmap = ImageUtil.zommBitmap(iconBitmap, iconScale);
    }
    btn.setImageBitmap(iconBitmap);

    ColorStateList colorStateList = createColorStateList(0xffffffff, 0xffffff00, 0xff0000ff, 0xffff0000);
    RippleDrawable ripple = new RippleDrawable(colorStateList, null, null);
    btn.setBackground(ripple);
    btn.setScaleType(ImageView.ScaleType.CENTER);
    btn.setOnClickListener(getBtnFuncOfName(sc));
    btn.setOnLongClickListener(getBtnLongFuncOfName(sc.getCode()));

    line.addView(btn, p);
}
 
Example 9
Project: FlickLauncher   File: PageIndicatorLineCaret.java   View Source Code Vote up 6 votes
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle);
    mAllAppsHandle.setImageDrawable(getCaretDrawable());
    mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
    mAllAppsHandle.setOnClickListener(mLauncher);
    mAllAppsHandle.setOnLongClickListener(mLauncher);
    mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler);
    mLauncher.setAllAppsButton(mAllAppsHandle);
}
 
Example 10
Project: SimpleUILauncher   File: PageIndicatorLineCaret.java   View Source Code Vote up 6 votes
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle);
    mAllAppsHandle.setImageDrawable(getCaretDrawable());
    mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
    mAllAppsHandle.setOnClickListener(mLauncher);
    mAllAppsHandle.setOnLongClickListener(mLauncher);
    mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler);
    mLauncher.setAllAppsButton(mAllAppsHandle);
}
 
Example 11
Project: Mire   File: ActivityDialogWallpaperChoiceOptions.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.dialog_wallpaper_choice_options);
	Preferences.makeAppFullscreen(this, Color.TRANSPARENT);
	
	container = (ViewGroup)findViewById(ids[1]);
	if (!CircularRevealTransformEnter.setup(this, container))
	{
		MorphTransform.setup(this, container, ContextCompat.getColor(this, R.color.white), getResources().getDimensionPixelSize(R.dimen.dialog_corners));
	}
	
	if (savedInstanceState != null) 
	{
           image = savedInstanceState.getString(URL);
           title = savedInstanceState.getString(NAME);
		text = savedInstanceState.getString(TEXT);
		colorPalette = savedInstanceState.getInt(COLOR);
       }

	Bundle bundle = getIntent().getExtras();
       if (bundle != null)
	{
           image = bundle.getString(URL);
           title = bundle.getString(NAME);
		text = bundle.getString(TEXT);
		colorPalette = bundle.getInt(COLOR);
       }
	
	window = (LinearLayout)findViewById(ids[0]);
	apply = (ImageView)findViewById(ids[2]);
	apply.setImageDrawable(DrawableHelper.getTintedDrawable(ActivityDialogWallpaperChoiceOptions.this, R.drawable.ic_check_circle_accent_24dp, colorPalette));
	
	save = (ImageView)findViewById(ids[3]);
	save.setImageDrawable(DrawableHelper.getTintedDrawable(ActivityDialogWallpaperChoiceOptions.this, R.drawable.ic_save_accent_24dp, colorPalette));
	
	window.setOnClickListener(this);
	container.setOnClickListener(this);
	apply.setOnClickListener(this);
	save.setOnClickListener(this);
	apply.setOnLongClickListener(this);
	save.setOnLongClickListener(this);
}