本文整理匯總了Java中pl.droidsonroids.gif.GifImageView類的典型用法代碼示例。如果您正苦於以下問題:Java GifImageView類的具體用法?Java GifImageView怎麽用?Java GifImageView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GifImageView類屬於pl.droidsonroids.gif包,在下文中一共展示了GifImageView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_gif);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(false);
}
setTitle(R.string.title_show_gif);
mGifImageView = (GifImageView) findViewById(R.id.gif_image_view);
try {
GifDrawable drawable = new GifDrawable(Config.GIF_SAVE_PATH);
drawable.start();
drawable.setLoopCount(10);
mGifImageView.setBackground(drawable);
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: initView
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
private View initView(View convertView, int itemViewType, ViewGroup parent, ViewHolder viewHolder) {
switch (itemViewType) {
case TYPE_IMAGE://圖片
convertView = View.inflate(context, R.layout.all_image_item, null);
viewHolder.iv_image_icon = (ImageView) convertView.findViewById(R.id.iv_image_icon);
break;
case TYPE_TEXT://文字
convertView = View.inflate(context, R.layout.all_text_item, null);
break;
case TYPE_GIF://gif
convertView = View.inflate(context, R.layout.all_gif_item, null);
viewHolder.iv_image_gif = (GifImageView) convertView.findViewById(R.id.iv_image_gif);
break;
case TYPE_AD://軟件廣告
convertView = View.inflate(context, R.layout.all_ad_item, null);
viewHolder.btn_install = (Button) convertView.findViewById(R.id.btn_install);
viewHolder.iv_image_icon = (ImageView) convertView.findViewById(R.id.iv_image_icon);
break;
}
return convertView;
}
示例3: onDestroyView
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
public void onDestroyView() {
if (image != null) {
if (image instanceof GifImageView) {
((GifImageView) image).setImageURI(null);
// } else if (image instanceof PhotoView) {
// try {
// ((SubsamplingScaleImageView) image).setImageDrawable(null);
// } catch (Exception e) {
// Global.errorLog(e);
// }
}
}
super.onDestroyView();
}
示例4: init
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
private void init() {
View view = View
.inflate(getContext(), R.layout.emptyview_content, null);
img = (GifImageView) view.findViewById(R.id.img_error_layout);
tv = (TextView) view.findViewById(R.id.tv_error_layout);
setBackgroundColor(-1);
setOnClickListener(this);
if (getVisibility() == View.GONE) {
setErrorType(HIDE_LAYOUT);
} else {
setErrorType(NETWORK_LOADING);
}
img.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (clickEnable && listener != null) {
listener.onClick(v);
}
}
});
this.addView(view);
}
示例5: onCreate
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.build();
mGoogleApiClient.connect();
//init Button
GifImageView btnAlpha = (GifImageView) findViewById(R.id.imageView);
btnAlpha.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onButtonClicked(view);
}
});
}
示例6: onCreate
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
test_gif = (GifImageView) findViewById(R.id.test_gif);
//設置圖片數據
test_gif.setImageResource(R.drawable.ui_bg_03);
final android.widget.MediaController mediaController = new android.widget.MediaController(this);
mediaController.setMediaPlayer((GifDrawable) test_gif.getDrawable());
test_gif.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mediaController.show();
//Snackbar.make(test_gif, "可以點擊哦", Snackbar.LENGTH_LONG).show();
}
});
}
示例7: displayGif
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
/**
* 加載gif圖片
*/
private void displayGif(final GifImageView gifView, byte[] res) {
gifView.setVisibility(View.VISIBLE);
try {
GifDrawable gifFromBytes = new GifDrawable(res);
gifView.setImageDrawable(gifFromBytes);
} catch (IOException e) {
gifView.setImageResource(R.mipmap.default_img_rect);
}
gifView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
aty.finish();
}
});
}
示例8: onLoadFailed
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
public void onLoadFailed(final Activity activity, String errorText,ShowRefreshViewListener showRefreshViewListener){
if (hashMap_activity_loadView.containsKey(activity)){
if (!hashMap_activity_isSuccess.get(activity)){
View loadView=hashMap_activity_loadView.get(activity);
LinearLayout loadretry_parent=(LinearLayout)loadView.findViewById(R.id.loadretry_parent);
final GifImageView gifImageView=(GifImageView)loadView.findViewById(R.id.loadretry_gifview);
final TextView tv_error=(TextView)loadView.findViewById(R.id.loadretry_tv_error);
final RTextView tv_retry=(RTextView)loadView.findViewById(R.id.loadretry_tv_retry);
setGifImageView(activity,gifImageView,true);
tv_error.setText(errorText);
tv_retry.setVisibility(View.VISIBLE);
tv_retry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (loadRetryRefreshConfig !=null){
if (!TextUtils.isEmpty(loadRetryRefreshConfig.getLoadText())){
tv_error.setText(loadRetryRefreshConfig.getLoadText());
}
}
setGifImageView(activity,gifImageView,false);
tv_retry.setVisibility(View.INVISIBLE);
hashMap_activity_loadRetryListener.get(activity).loadAndRetry();
}
});
}else{
showRefreshViewListener.colseRefreshView();
}
}
}
示例9: initViews
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
private void initViews() {
imageIcon = (ImageView) findViewById(R.id.image_icon);
titleTxt = (TextView) findViewById(R.id.flash_projects_title_txt);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
spinnerBar = (ProgressBar) findViewById(R.id.spinnerBar);
messageTxt = (TextView) findViewById(R.id.messageTxt);
layoutBottom = (LinearLayout) findViewById(R.id.popup_bottom_layout);
okButton = (Button) findViewById(R.id.imageButtonOk);
cancelButton = (Button) findViewById(R.id.imageButtonCancel);
affirmationOKButton = (Button) findViewById(R.id.affirmationOKBtn);
// Error / Flash animation
gifImageView = (GifImageView) findViewById(R.id.pop_up_gif_image_view);
setupFontStyle();
}
示例10: initViews
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
private void initViews() {
mLogoLayout = (RelativeLayout) findViewById(R.id.splash_screen_logo_layout);
mDevByText = (TextView) findViewById(R.id.splash_screen_devby_text);
mLogo = (ImageView) findViewById(R.id.splash_screen_logo);
mGifImageLayout = (RelativeLayout) findViewById(R.id.splash_screen_gif_image_layout);
mGifImageFirstFrame = (ImageView) findViewById(R.id.splash_screen_gif_image_first_frame);
mGifImage = (GifImageView) findViewById(R.id.splash_screen_gif_image);
mLastAnimStepHandler = new Handler();
findViewById(R.id.splash_screen_layout).setOnClickListener(this);
}
示例11: onCreate
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help_video);
initToolbar();
gifImageView = (GifImageView) findViewById(R.id.gif_view);
Bundle bundle = getIntent().getExtras();
int gifId = bundle.getInt("gifId");
gifImageView.setImageResource(gifId);
}
示例12: initImage
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
private void initImage() {
Context context = getActivity();
View root = getView();
if (root != null) {
mImageView = (GifImageView) root.findViewById(R.id.imgHero);
mImageView.setOnClickListener(this);
File externalFilesDir;
String dir;
externalFilesDir = Environment.getExternalStorageDirectory();
if (externalFilesDir == null) {
externalFilesDir = new File(context.getFilesDir().getPath() + getActivity().getPackageName() + "/files");
} else {
externalFilesDir = new File(externalFilesDir, "/Android/data/" + getActivity().getPackageName() + "/files");
}
dir = externalFilesDir.getAbsolutePath();
dir += File.separator + "anim" + File.separator;
File gifFile = new File(dir + mHero.getDotaId() + File.separator, "anim.gif");
if (gifFile.exists()) {
try {
GifDrawable gifFromFile = new GifDrawable(gifFile);
mImageView.setImageDrawable(gifFromFile);
((ImageView) root.findViewById(R.id.imgPortraitOverlay)).setImageResource(R.drawable.herogif_overlay);
} catch (IOException ignored) {
}
} else {
((ImageView) root.findViewById(R.id.imgPortraitOverlay)).setImageResource(R.drawable.heroprimaryportrait_overlay);
Glide.with(context).load(SteamUtils.getHeroPortraitImage(mHero.getDotaId())).into(mImageView);
}
}
}
示例13: destroyItem
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
GifImageView gifView = (GifImageView) ((View) object).findViewById(R.id.gifHero);
if (gifView.getDrawable() instanceof GifDrawable) {
((GifDrawable) gifView.getDrawable()).recycle();
}
gifView.setImageDrawable(null);
container.removeView((View) object);
}
示例14: withPlayingGifDrawable
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
public static Matcher<View> withPlayingGifDrawable() {
return new BoundedMatcher<View, View>(View.class) {
@Override
public boolean matchesSafely(View view) {
GifImageView gifImageView = (GifImageView) view.findViewById(R.id.gif_image);
return ((GifDrawable) gifImageView.getDrawable()).isPlaying();
}
@Override
public void describeTo(Description description) {
description.appendText("with gif image view playing");
}
};
}
示例15: withGifDrawable
import pl.droidsonroids.gif.GifImageView; //導入依賴的package包/類
public static Matcher<View> withGifDrawable() {
return new BoundedMatcher<View, View>(View.class) {
@Override
public boolean matchesSafely(View view) {
GifImageView gifImageView = (GifImageView) view.findViewById(R.id.gif_image);
return gifImageView.getDrawable() != null;
}
@Override
public void describeTo(Description description) {
description.appendText("with a not null drawable");
}
};
}