當前位置: 首頁>>代碼示例>>Java>>正文


Java PhotoViewAttacher.setOnViewTapListener方法代碼示例

本文整理匯總了Java中uk.co.senab.photoview.PhotoViewAttacher.setOnViewTapListener方法的典型用法代碼示例。如果您正苦於以下問題:Java PhotoViewAttacher.setOnViewTapListener方法的具體用法?Java PhotoViewAttacher.setOnViewTapListener怎麽用?Java PhotoViewAttacher.setOnViewTapListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在uk.co.senab.photoview.PhotoViewAttacher的用法示例。


在下文中一共展示了PhotoViewAttacher.setOnViewTapListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View contentView = inflater.inflate(R.layout.fragment_image_preview, container, false);
    final ImageView imageView = (ImageView) contentView.findViewById(R.id.preview_image);
    final PhotoViewAttacher mAttacher = new PhotoViewAttacher(imageView);
    Glide.with(container.getContext())
            .load(new File(getArguments().getString(PATH)))
            .asBitmap()
            .into(new SimpleTarget<Bitmap>(480, 800) {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    imageView.setImageBitmap(resource);
                    mAttacher.update();
                }
            });
    mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            ImagePreviewActivity activity = (ImagePreviewActivity) getActivity();
            activity.switchBarVisibility();
        }
    });
    return contentView;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:ImagePreviewFragment.java

示例2: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
public View instantiateItem(ViewGroup container, int position) {
    MQImageView imageView = new MQImageView(container.getContext());
    container.addView(imageView, -1, -1);
    final PhotoViewAttacher photoViewAttacher = new PhotoViewAttacher(imageView);
    photoViewAttacher.setOnViewTapListener(MQPhotoPreviewActivity.this);
    imageView.setDrawableChangedCallback(new MQImageView$OnDrawableChangedCallback() {
        public void onDrawableChanged() {
            photoViewAttacher.update();
        }
    });
    MQConfig.getImageLoader(MQPhotoPreviewActivity.this).displayImage(imageView, (String)
            MQPhotoPreviewActivity.this.mPreviewImages.get(position), R.drawable
            .mq_ic_holder_dark, R.drawable.mq_ic_holder_dark, MQUtils.getScreenWidth
            (MQPhotoPreviewActivity.this), MQUtils.getScreenHeight(MQPhotoPreviewActivity
            .this), null);
    return imageView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:MQPhotoPreviewActivity.java

示例3: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
public View instantiateItem(ViewGroup container, int position) {
    MQImageView imageView = new MQImageView(container.getContext());
    container.addView(imageView, -1, -1);
    final PhotoViewAttacher photoViewAttacher = new PhotoViewAttacher(imageView);
    photoViewAttacher.setOnViewTapListener(MQPhotoPickerPreviewActivity.this);
    imageView.setDrawableChangedCallback(new MQImageView$OnDrawableChangedCallback() {
        public void onDrawableChanged() {
            photoViewAttacher.update();
        }
    });
    MQConfig.getImageLoader(MQPhotoPickerPreviewActivity.this).displayImage(imageView,
            (String) MQPhotoPickerPreviewActivity.this.mPreviewImages.get(position), R
                    .drawable.mq_ic_holder_dark, R.drawable.mq_ic_holder_dark, MQUtils
                    .getScreenWidth(MQPhotoPickerPreviewActivity.this), MQUtils
                    .getScreenHeight(MQPhotoPickerPreviewActivity.this), null);
    return imageView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:MQPhotoPickerPreviewActivity.java

示例4: setupPhotoAttacher

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
private void setupPhotoAttacher() {
    mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
    mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> hideOrShowToolbar());
    // @formatter:off
    mPhotoViewAttacher.setOnLongClickListener(v -> {
        new AlertDialog.Builder(PictureActivity.this)
                .setMessage(getString(R.string.ask_saving_picture))
                .setNegativeButton(android.R.string.cancel,
                        (dialog, which) -> dialog.dismiss())
                .setPositiveButton(android.R.string.ok,
                        (dialog, which) -> {
                            saveImageToGallery();
                            dialog.dismiss();
                        })
                .show();
        // @formatter:on
        return true;
    });
}
 
開發者ID:benchegnzhou,項目名稱:MeiZi_App,代碼行數:20,代碼來源:PictureActivity.java

示例5: onCreate

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_image_review);
    ButterKnife.inject(this);

    attacher = new PhotoViewAttacher(image);
    attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float v, float v2) {
            finish();
        }
    });
    final String path = getIntent().getExtras().getString("path");
    displayImage("file://" + path, image);

}
 
開發者ID:jianliaoim,項目名稱:talk-android,代碼行數:20,代碼來源:ImageReviewActivity.java

示例6: onCreate

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //如果沒有虛擬按鍵則設置為全屏
    if (!UIUtil.isHasNavigationBar(this)) {
        getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE |
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
                View.SYSTEM_UI_FLAG_FULLSCREEN);
    }
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(R.color.black);
    }
    mAttacher = new PhotoViewAttacher(mPhoto);
    mAttacher.setOnViewTapListener(new OnViewTapListener() {
        @Override public void onViewTap(View view, float x, float y) {
            hideBottomOption();
        }
    });
}
 
開發者ID:wavever,項目名稱:GankLock,代碼行數:22,代碼來源:PhotoActivity.java

示例7: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View contentView = inflater.inflate(R.layout.fragment_image_preview, container, false);
        final ImageView imageView = (ImageView) contentView.findViewById(R.id.preview_image);
        final PhotoViewAttacher mAttacher = new PhotoViewAttacher(imageView);
        Glide.with(container.getContext())
//                .load(new File(getArguments().getString(PATH)))
                .load(getArguments().getString(PATH))
                .asBitmap()
                .into(new SimpleTarget<Bitmap>(480, 800) {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        imageView.setImageBitmap(resource);
                        mAttacher.update();
                    }
                });
        mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
            @Override
            public void onViewTap(View view, float x, float y) {
                ImagePreviewActivity activity = (ImagePreviewActivity) getActivity();
                activity.switchBarVisibility();
            }
        });
        return contentView;
    }
 
開發者ID:yushiwo,項目名稱:Universal-Image-Selector,代碼行數:27,代碼來源:ImagePreviewFragment.java

示例8: setupPhotoAttacher

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
private void setupPhotoAttacher() {
        mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
        mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> onBackPressed());
        mPhotoViewAttacher.setOnLongClickListener(v -> {
            new AlertDialog.Builder(PictureActivity.this)
                    .setMessage(getString(R.string.ask_saving_picture))
                    .setNegativeButton(android.R.string.cancel,
                            (dialog, which) -> dialog.dismiss())
                    .setPositiveButton(android.R.string.ok,
                            (dialog, which) -> {
                                saveImageToGallery();
//                                TODO:保存圖片邏輯
                                dialog.dismiss();
                            })
                    .show();
            return true;
        });
    }
 
開發者ID:Dimon94,項目名稱:GanWuMei,代碼行數:19,代碼來源:PictureActivity.java

示例9: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View rootView = inflater.inflate(R.layout.photo_browser_image, container, false);

      imageView = (ImageView)rootView.findViewById(R.id.imageView);
      textView = (TextView)rootView.findViewById(R.id.textView);
      
      attacher = new PhotoViewAttacher(imageView);
      
      attacher.setOnViewTapListener(new OnViewTapListener() {			
	@Override
	public void onViewTap(View view, float x, float y) {
		((Loader)getActivity()).toggleActionBar();
	}
});
      
      
      if (caption == null || caption.isEmpty())
      	textView.setVisibility(View.INVISIBLE);
      else
      	textView.setText(caption);
      
      return rootView;
  }
 
開發者ID:Mobideck,項目名稱:appdeck-android,代碼行數:27,代碼來源:PhotoBrowserImage.java

示例10: onResourceReady

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
    mCircleProgressView.setVisibility(View.GONE);
    mCircleProgressView.stopSpinning();
    mImageView.setImageDrawable(resource);
    mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
    mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> getActivity().finish());

    return false;
}
 
開發者ID:HotBitmapGG,項目名稱:Acg,代碼行數:11,代碼來源:ImageDetailsFragment.java

示例11: setAttacher

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
public void setAttacher(ImageView imageView) {
    attacher = new PhotoViewAttacher(imageView);
    attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            imageOnClick(view);
        }
    });
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:10,代碼來源:GifViewHolder.java

示例12: onLoadingFailed

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
public void onLoadingFailed(String imageUri, View view,
		FailReason failReason) {
	mImageView.setScaleType(ImageView.ScaleType.CENTER);
	mProgress.setVisibility(View.GONE);
	PhotoViewAttacher photo = new PhotoViewAttacher(mImageView);
	photo.setMaxScale(8);
	photo.setOnPhotoTapListener(this);
	photo.setOnViewTapListener(this);
}
 
開發者ID:BigAppOS,項目名稱:BigApp_WordPress_Android,代碼行數:11,代碼來源:MediaDetailFragment.java

示例13: onLoadingComplete

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
	mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
	mProgress.setVisibility(View.GONE);
	PhotoViewAttacher photo = new PhotoViewAttacher(mImageView);
	photo.setMaxScale(10);
	photo.setOnPhotoTapListener(this);
	photo.setOnViewTapListener(this);
}
 
開發者ID:BigAppOS,項目名稱:BigApp_WordPress_Android,代碼行數:10,代碼來源:MediaDetailFragment.java

示例14: onCreate

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PictureActivityBinding binding =
            DataBindingUtil.setContentView(this, R.layout.picture_activity);

    String mGirlUrl = getIntent().getExtras().getString("url");

    ViewCompat.setTransitionName(binding.ivPhoto, "girl");

    Picasso.with(this).load(mGirlUrl)
            .into(binding.ivPhoto);

    background = new ColorDrawable(Color.BLACK);

    binding.pullBackLayout.getRootView().setBackground(background);

    PhotoViewAttacher mViewAttacher = new PhotoViewAttacher(binding.ivPhoto);

    binding.pullBackLayout.setPullCallBack(this);

    mViewAttacher.setOnViewTapListener((view, x, y) -> {
        if (systemUiIsShow) {
            hideSystemUI();
            systemUiIsShow = false;
        } else {
            showSystemUI();
            systemUiIsShow = true;
        }
    });
}
 
開發者ID:Assassinss,項目名稱:pretty-girl,代碼行數:32,代碼來源:PictureActivity.java

示例15: onCreate

import uk.co.senab.photoview.PhotoViewAttacher; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_viewer);
  unbinder = ButterKnife.bind(this);

  toolbar.inflateMenu(R.menu.menu_viewer);
  toolbar.setOnMenuItemClickListener(this);
  toolbar.setNavigationIcon(R.drawable.ic_close);
  toolbar.setNavigationOnClickListener(v -> finish());

  attacher = new PhotoViewAttacher(image);
  attacher.setOnPhotoTapListener(this);
  attacher.setOnViewTapListener((view, x, y) -> onPhotoTap(null, 0f, 0f));

  Glide.with(this).load(new File(getIntent().getData().getPath())).into(mTarget);

  if (toolbar != null) {
    new Handler()
        .postDelayed(
            () -> {
              if (toolbar != null) {
                onPhotoTap(null, 0f, 0f);
              }
            },
            2000);
  }
}
 
開發者ID:afollestad,項目名稱:photo-affix,代碼行數:29,代碼來源:ViewerActivity.java


注:本文中的uk.co.senab.photoview.PhotoViewAttacher.setOnViewTapListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。