private void loadImage(IdentifyLicense entity) {
    if (!UIUtils.isEmpty(entity.getIdentifyImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getIdentifyImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getIdentifyImage())))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_face));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_face_2)).setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.identity_card_face)
          .listener(new ImageLoaderListener(context, null))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_face));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_face_2)).setText("点击上传");
    }

    if (!UIUtils.isEmpty(entity.getIdentifyBackImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getIdentifyBackImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getIdentifyBackImage())))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_back));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_back_2)).setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.identity_card_back)
          .listener(new ImageLoaderListener(context, null))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_back));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_back_2)).setText("点击上传");
    }
  }
Esempio n. 2
0
  @Override
  public void onBindViewHolder(final ViewHolder holder, int position) {
    Tweet tweet = mTweets.get(position);

    String thumbnail = tweet.getUser().getProfileImageUrl();
    String name = tweet.getUser().getName();
    String screenName = "@" + tweet.getUser().getScreenName();
    String body = tweet.getBody();
    String timeStamp = Utils.getTimeStamp(tweet.getCreatedAt());

    ImageView iv = holder.image;

    iv.setImageResource(0);
    Glide.with(context).load(thumbnail).fitCenter().into(iv);

    String mediaUrl = tweet.getMediaURL();
    if (mediaUrl == null || mediaUrl.isEmpty()) {
      holder.media.setVisibility(View.GONE);
    } else {
      Glide.with(context)
          .load(mediaUrl)
          .placeholder(R.drawable.placeholder_tweet)
          .centerCrop()
          .into(holder.media);
    }

    holder.name.setText(name);
    holder.screenName.setText(screenName);
    holder.body.setText(body);
    holder.timeStamp.setText(timeStamp);
  }
Esempio n. 3
0
  public ScoresAdapter(
      Context context,
      Cursor cursor,
      int flags,
      Fragment fragment,
      ScoresAdapterScrollHandler scrollHandler) {
    super(context, cursor, flags);
    mScrollHandler = scrollHandler;
    //        Log.v(LOG_TAG, "ScoresAdapter, " + "context = [" + context + "], cursor = [" + cursor
    // + "], flags = [" + flags + "]");

    // create requestBuilder for svg-glide-usage as described here:
    // https://github.com/bumptech/glide/tree/v3.6.0/samples/svg/src/main/java/com/bumptech/svgsample/app
    // uses androidsvg: http://mvnrepository.com/artifact/com.caverock/androidsvg/1.2.1
    requestBuilder =
        Glide.with(fragment)
            .using(
                Glide.buildStreamModelLoader(Uri.class, fragment.getActivity()), InputStream.class)
            .from(Uri.class)
            .as(SVG.class)
            .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
            .sourceEncoder(new StreamEncoder())
            .cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
            .decoder(new SvgDecoder())
            .placeholder(R.drawable.image_loading)
            .error(R.drawable.no_icon)
            .animate(android.R.anim.fade_in)
            .listener(new SvgSoftwareLayerSetter<Uri>());
  }
Esempio n. 4
0
  @Override
  public void initData(ImageView avatar, TextView nick, ImageView iv_album) {
    User user = User.getCurrentUser(User.class);

    String avatarurl = user.getString(UserDao.AVATARURL);
    if (avatarurl != null) {
      Glide.with(mContext)
          .load(user.getString(UserDao.AVATARURL))
          .bitmapTransform(new CropCircleTransformation(mContext))
          .diskCacheStrategy(DiskCacheStrategy.ALL)
          .into(avatar);
    }
    if (user.getBackground() != null) {
      Glide.with(mContext)
          .load(user.getBackground())
          .crossFade()
          .diskCacheStrategy(DiskCacheStrategy.ALL)
          .fitCenter()
          .into(iv_album);
    }
    if (user.getBackground() == null && user.getLoverBackGround() != null) {
      Glide.with(mContext)
          .load(user.getLoverBackGround())
          .crossFade()
          .diskCacheStrategy(DiskCacheStrategy.ALL)
          .fitCenter()
          .into(iv_album);
    }
    nick.setText(user.getString(UserDao.NICK));
  }
Esempio n. 5
0
  @Override
  public void onBindViewHolder(GiphyViewHolder holder, int position) {
    GiphyImage image = images.get(position);

    holder.modelReady = false;
    holder.image = image;
    holder.thumbnail.setAspectRatio(image.getGifAspectRatio());
    holder.gifProgress.setVisibility(View.GONE);

    DrawableRequestBuilder<String> thumbnailRequest = Glide.with(context).load(image.getStillUrl());

    if (Util.isLowMemory(context)) {
      Glide.with(context)
          .load(image.getStillUrl())
          .placeholder(
              new ColorDrawable(
                  Util.getRandomElement(MaterialColor.values()).toConversationColor(context)))
          .diskCacheStrategy(DiskCacheStrategy.ALL)
          .into(holder.thumbnail);

      holder.setModelReady();
    } else {
      Glide.with(context)
          .load(image.getGifUrl())
          .thumbnail(thumbnailRequest)
          .placeholder(
              new ColorDrawable(
                  Util.getRandomElement(MaterialColor.values()).toConversationColor(context)))
          .diskCacheStrategy(DiskCacheStrategy.ALL)
          .listener(holder)
          .into(holder.thumbnail);
    }
  }
    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holderr, int position) {
      final ViewHolder holder = (ViewHolder) holderr;
      holder.mChallenge = mChallenges.get(position);
      holder.mChallengeCardName.setText(
          splitstring(holder.mChallenge.getType()) + " " + context.getString(R.string.challenge));

      StringBuilder builder = new StringBuilder();
      SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
      String date = format.format(holder.mChallenge.getDate());
      builder.append(context.getString(R.string.date)).append(" ").append(date);
      builder
          .append("\n")
          .append(context.getString(R.string.challengeDone))
          .append(" ")
          .append(
              holder.mChallenge.isDone()
                  ? context.getString(R.string.yes)
                  : context.getString(R.string.no));
      if (holder.mChallenge.isDone()) {
        builder
            .append("\n")
            .append(context.getString(R.string.earnedPoints))
            .append(" ")
            .append(holder.mChallenge.getEarnings());
      } else {
        builder.append("\n").append(context.getString(R.string.earnedPoints)).append(" ").append(0);
      }

      holder.mChallengeCardDetails.setText(builder.toString());

      switch (holder.mChallenge.getType()) {
        case "Restaurant":
          Glide.with(context)
              .load(R.drawable.restaurant)
              .centerCrop()
              .into(holder.mChallengeCardImage);
          break;
        case "Recipe":
        case "CreativeCooking":
        case "RegionRecipe":
          Glide.with(context)
              .load(Uri.parse(holder.mChallenge.getThumbnail()))
              .centerCrop()
              .into(holder.mChallengeCardImage);
          break;
        case "Suikervrij":
          Glide.with(context).load(R.drawable.nosugar).fitCenter().into(holder.mChallengeCardImage);
          break;
      }

      //            holder.mView.setOnClickListener(new View.OnClickListener() {
      //                @Override
      //                public void onClick(View v) {
      //                    //TODO Eventueel onclick voor details?
      //                }
      //            });
    }
    @Override
    public void onBindViewHolder(final ComicViewHolder comicViewHolder, int i) {
      comicViewHolder.articleTitle.setText(titles.get(i));
      String title = titles.get(i);
      int n = mTitles.size() - mTitles.indexOf(title);

      int id = 0;
      switch (titles.get(i)) {
        case "Jupiter Descending":
          id = R.mipmap.jupiter_descending;
          break;
        case "Jupiter Submarine":
          id = R.mipmap.jupiter_submarine;
          break;
        case "New Horizons":
          id = R.mipmap.new_horizons;
          break;
        case "Proton Earth, Electron Moon":
          id = R.mipmap.proton_earth;
          break;
        case "Sunbeam":
          id = R.mipmap.sun_beam;
          break;
        case "Space Jetta":
          id = R.mipmap.jetta;
          break;
        case "Europa Water Siphon":
          id = R.mipmap.straw;
          break;
      }
      if (id != 0) {
        comicViewHolder.thumbnail.setImageDrawable(ContextCompat.getDrawable(getActivity(), id));
        return;
      }

      if (!prefHelper.fullOfflineWhatIf()) {
        Glide.with(getActivity()).load(imgs.get(i)).into(comicViewHolder.thumbnail);
      } else {
        File sdCard = prefHelper.getOfflinePath();
        File dir = new File(sdCard.getAbsolutePath() + "/easy xkcd/what if/overview");
        File file = new File(dir, String.valueOf(n) + ".png");

        Glide.with(getActivity()).load(file).into(comicViewHolder.thumbnail);
      }

      if (prefHelper.invertColors()) {
        float[] colorMatrix_Negative = {
          -1.0f, 0, 0, 0, 255, // red
          0, -1.0f, 0, 0, 255, // green
          0, 0, -1.0f, 0, 255, // blue
          0, 0, 0, 1.0f, 0 // alpha
        };
        ColorFilter cf = new ColorMatrixColorFilter(colorMatrix_Negative);
        comicViewHolder.thumbnail.setColorFilter(cf);
      }
    }
Esempio n. 8
0
 public void clear() {
   if (current != null) {
     Glide.clear(current);
     mainHandler.removeCallbacks(current);
   }
   if (next != null) {
     Glide.clear(next);
     mainHandler.removeCallbacks(next);
   }
 }
Esempio n. 9
0
  private GenericRequestBuilder buildDraftGlideRequest(Slide slide, MasterSecret masterSecret) {
    final DrawableTypeRequest<?> request;
    if (masterSecret == null) request = Glide.with(getContext()).load(slide.getThumbnailUri());
    else
      request =
          Glide.with(getContext()).load(new DecryptableUri(masterSecret, slide.getThumbnailUri()));

    return request
        .transform(new RoundedCorners(getContext(), false, radius, backgroundColorHint))
        .listener(new PduThumbnailSetListener(slide.getPart()));
  }
 @SuppressWarnings("unused")
 public void onEventMainThread(@NonNull ProfilePhotoUpdatedEvent event) {
   if (null == event.getUri()) {
     Glide.with(this).load(R.drawable.xsie).into(viewHolder.profileImage);
   } else {
     Glide.with(this)
         .load(event.getUri())
         .skipMemoryCache(true) // URI is re-used in subsequent events; disable caching
         .diskCacheStrategy(DiskCacheStrategy.NONE)
         .into(viewHolder.profileImage);
   }
 }
Esempio n. 11
0
 @Override
 public boolean dispatchTouchEvent(MotionEvent ev) {
   Log.i(TAG, "dispatchTouchEvent ");
   switch (ev.getAction()) {
     case MotionEvent.ACTION_DOWN:
       Glide.with(this).pauseRequests();
       break;
     case MotionEvent.ACTION_UP:
       Glide.with(this).resumeRequests();
       break;
   }
   return super.dispatchTouchEvent(ev);
 }
Esempio n. 12
0
  public PostAdapterDelegate(Activity activity, int viewType) {
    super(viewType);

    App.getAppComponent(activity).inject(this);
    mLayoutInflater = activity.getLayoutInflater();
    // loading avatars is prior to images in replies
    mAvatarRequestBuilder =
        Glide.with(activity)
            .from(String.class)
            .error(R.drawable.ic_avatar_placeholder)
            .priority(Priority.HIGH)
            .transform(new CenterCrop(Glide.get(activity).getBitmapPool()));
  }
Esempio n. 13
0
 private void initItem3(View v, DayBean bean) {
   ImageView iv2 = (ImageView) v.findViewById(R.id.iv2);
   ImageView iv1 = (ImageView) v.findViewById(R.id.iv1);
   Glide.with(getContext())
       .load(bean.getSrc()[0])
       .placeholder(R.mipmap.bg)
       .error(R.mipmap.bg)
       .into(iv1);
   Glide.with(getContext())
       .load(bean.getSrc()[1])
       .placeholder(R.mipmap.bg)
       .error(R.mipmap.bg)
       .into(iv2);
   Log.e(TAG, "url=" + bean.getSrc()[0]);
 }
Esempio n. 14
0
 @Override
 public void onBindViewHolder(final PhotoCardViewHolder viewHolder, final int position) {
   viewHolder.rootView.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           int[] screenLocation = new int[2];
           viewHolder.mPhoto.getLocationOnScreen(screenLocation);
           int orientation = context.getResources().getConfiguration().orientation;
           if (viewHolder.mPhoto.getDrawable() == null) {
             Log.v("DRAWABLE", "NULL DRAWABLE ON PHOTO_CARD_ADAPTER");
           } else {
             Log.v("DRAWABLE", "DRAWABLE ON PHOTO_CARD_ADAPTER IS OK");
           }
           EventBus.getDefault().postSticky(viewHolder.mPhoto.getDrawable());
           EventBus.getDefault()
               .post(
                   new OpenSinglePhotoFragmentEvent(
                       new PhotoListResponse(dataSet),
                       position,
                       orientation,
                       screenLocation[0],
                       screenLocation[1],
                       viewHolder.mPhoto.getWidth(),
                       viewHolder.mPhoto.getHeight()));
         }
       });
   Glide.with(context)
       .load(dataSet.get(position).getPhotoUrl())
       .centerCrop()
       .into(viewHolder.mPhoto);
 }
Esempio n. 15
0
  @Override
  protected void banderDataAndListner() {
    Glide.with(this)
        .load(CommonCache.get().getImageUrl(childTypeId))
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .into(imageView);
    mListView.addHeaderView(imageView);
    articleListAdapter = new ArticleListAdapter(articleList, getActivity());
    mListView.setAdapter(articleListAdapter);

    mPullToRefreshLayout.setOnRefreshListener(
        new PullToRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
            page = 1;
            getArticleListByNet();
          }

          @Override
          public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
            getArticleListByNet();
          }
        });

    mPullToRefreshLayout.setHfBackgroundColor(CommonCache.get().getColorByType(childTypeId));
  }
Esempio n. 16
0
  @Override
  public void onLoadFinished(android.support.v4.content.Loader<Cursor> loader, Cursor data) {
    if (!data.moveToFirst()) {
      return;
    }

    String bookTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.TITLE));
    ((TextView) rootView.findViewById(R.id.bookTitle)).setText(bookTitle);

    String bookSubTitle =
        data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.SUBTITLE));
    ((TextView) rootView.findViewById(R.id.bookSubTitle)).setText(bookSubTitle);

    String authors = data.getString(data.getColumnIndex(AlexandriaContract.AuthorEntry.AUTHOR));
    String[] authorsArr = authors.split(",");
    ((TextView) rootView.findViewById(R.id.authors)).setLines(authorsArr.length);
    ((TextView) rootView.findViewById(R.id.authors)).setText(authors.replace(",", "\n"));
    String imgUrl = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.IMAGE_URL));
    ImageView imageView = (ImageView) rootView.findViewById(R.id.bookCover);
    if (Patterns.WEB_URL.matcher(imgUrl).matches()) {
      // using Glide instead of DownloadImage Task
      Glide.with(this).load(imgUrl).error(R.drawable.ic_launcher).crossFade().into(imageView);
    }

    String categories =
        data.getString(data.getColumnIndex(AlexandriaContract.CategoryEntry.CATEGORY));
    ((TextView) rootView.findViewById(R.id.categories)).setText(categories);

    rootView.findViewById(R.id.save_button).setVisibility(View.VISIBLE);
    rootView.findViewById(R.id.delete_button).setVisibility(View.VISIBLE);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (courseData == null || !isCoursewareAccessible) return;

    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig());
    Glide.with(CourseDashboardFragment.this)
        .load(headerImageUrl)
        .placeholder(R.drawable.edx_map_login)
        .transform(new TopAnchorFillWidthTransformation(getActivity()))
        .into(headerImageView);

    courseTextName.setText(courseData.getCourse().getName());
    CourseEntry course = courseData.getCourse();
    courseTextDetails.setText(course.getDescription(getActivity(), true));

    if (environment.getConfig().isShareCourseEnabled()) {
      shareButton.setVisibility(headerImageView.VISIBLE);
      shareButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              openShareMenu();
            }
          });
    }
  }
Esempio n. 18
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    int type = getItemViewType(position);
    if (convertView == null) {
      if (type == 0) {
        convertView = mInflater.inflate(R.layout.item_op, null);
      } else if (type == MediaEntity.IMAGE) {
        convertView = mInflater.inflate(R.layout.item_grid, null);
      } else if (type == MediaEntity.AUDIO) {
        convertView = mInflater.inflate(R.layout.item_grid, null);
      } else if (type == MediaEntity.VIDEO) {
        convertView = mInflater.inflate(R.layout.item_grid_video, null);
      } else {
        throw new IllegalArgumentException("no this kind of viewType");
      }
    }

    int folderType = mDataFolder.getType();
    if (position == 0) {
      ImageView img = (ImageView) convertView;
      if (folderType == MediaEntity.IMAGE) {
        img.setImageResource(R.mipmap.img_op_camera);
        img.setOnClickListener(v -> mActivity.toTakePhoto());
      } else if (type == MediaEntity.VIDEO) {
        img.setImageResource(R.mipmap.img_op_video);
        img.setOnClickListener(v -> mActivity.toMakeVideo());
      }
    } else {
      ImageView imgCover = (ImageView) convertView.findViewById(R.id.img);
      ImageView imgCheck = (ImageView) convertView.findViewById(R.id.img_check_box);
      int realPosition = position - 1;
      MediaEntity en = mDada.get(realPosition);
      imgCheck.setSelected(mediaManager.isSelected(en));
      imgCheck.setOnClickListener(v1 -> mediaManager.toggle(en));

      Glide.with(mActivity).load(en.getPath()).crossFade().into(imgCover);
      if (type == MediaEntity.IMAGE) {
        imgCover.setOnClickListener(
            v -> {
              if (mOnMediaClickListener == null) {
                ActivityImageShower.startActivity(mActivity, mDataFolder, realPosition);
              } else {
                mOnMediaClickListener.onMediaClick(en, realPosition);
              }
            });
      } else if (type == MediaEntity.VIDEO) {
        TextView txtTime = (TextView) convertView.findViewById(R.id.txt_time);
        txtTime.setText(getSecond(en.getDuration()));
        imgCover.setOnClickListener(
            v -> {
              if (mOnMediaClickListener == null) {
                ActivityVideoShower.startActivity(mActivity, en);
              } else {
                mOnMediaClickListener.onMediaClick(en, realPosition);
              }
            });
      }
    }
    return convertView;
  }
Esempio n. 19
0
  @Override
  public void onUpdate(User user) {
    if (mUserMenuItem != null) {
      mUserMenuItem.setEnabled(true);
    }

    if (mContext == null || mName == null || mBackpack == null || mAvatar == null) {
      return;
    }

    // Set the name
    mName.setText(user.getName());

    // Set the backpack value
    double bpValue = user.getBackpackValue();
    if (bpValue >= 0) {
      mBackpack.setText(
          String.format(
              "Backpack: %s",
              mContext.getString(R.string.currency_metal, String.valueOf(Math.round(bpValue)))));
    } else {
      mBackpack.setText("Private backpack");
    }

    // Download the avatar (if needed) and set it
    Glide.with(mContext)
        .load(user.getAvatarUrl())
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .transform(new CircleTransform(mContext))
        .into(mAvatar);
  }
Esempio n. 20
0
 /**
  * Simple function to load image to image view
  *
  * @param context
  * @param imageView
  * @param url url of image
  * @param onLoadFailImgResId drawable resource id if url image load fail
  */
 public void loadImage(Context context, ImageView imageView, String url, int onLoadFailImgResId) {
   if (url != null && !url.isEmpty()) {
     Glide.with(context)
         .load(url)
         .asBitmap()
         .diskCacheStrategy(DiskCacheStrategy.ALL)
         //                    .listener(new RequestListener<String, Bitmap>() {
         //                        @Override
         //                        public boolean onException(Exception e, String model,
         // Target<Bitmap> target, boolean isFirstResource) {
         //                            Log.e(TAG, "model: " + model);
         //                            Log.e(TAG, "isFirstResource: " + isFirstResource);
         //                            e.printStackTrace();
         //                            return false;
         //                        }
         //
         //                        @Override
         //                        public boolean onResourceReady(Bitmap resource, String model,
         // Target<Bitmap> target, boolean isFromMemoryCache, boolean isFirstResource) {
         //                            Log.d(TAG, "model: " + model);
         //                            Log.d(TAG, "isFirstResource: " + isFirstResource);
         //                            Log.d(TAG, "isFromMemoryCache: " + isFromMemoryCache);
         //                            return false;
         //                        }
         //                    })
         .placeholder(onLoadFailImgResId)
         .into(imageView);
   } else {
     Logger.w(ERR_EMPTY_URL);
     imageView.setImageResource(onLoadFailImgResId);
   }
 }
Esempio n. 21
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    ImageView imageView;
    if (convertView == null) {
      imageView = new ImageView(context);
      imageView.setLayoutParams(new GridView.LayoutParams(200, 200));
      imageView.setAdjustViewBounds(false);
      imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      imageView.setPadding(2, 2, 2, 2);
    } else {
      imageView = (ImageView) convertView;
    }
    /*
     * if(convertView == null){ convertView =
     * inflater.inflate(R.layout.gridview_album, parent ,false); }
     */

    // ImageView imgAlbum = (ImageView) convertView.findViewById(R.id.imgAlbum);

    Log.d("aaaa", "AlbumAdapter 훈련사진 URL은 " + albumURL.get(position));
    // Glide.with(convertView.getContext()).load(albumURL.get(position)).into(imgAlbum);
    Glide.with(context).load(albumURL.get(position)).into(imageView);
    return imageView;
  }
Esempio n. 22
0
  @Override
  public void onBindViewHolder(final ChatViewHolder holder, int position) {

    holder.mTextView.setText(
        mChats.get(position).getUserFirstname() + " " + mChats.get(position).getUserLastname());
    holder.mTextView2.setText(mChats.get(position).getBalance());
    holder.mBoundAvatar = mChats.get(position).getAvaUrl();
    holder.mBoundUserId = mChats.get(position).getChatUser2();

    holder.mView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Context context = v.getContext();
            Intent intent = new Intent(context, ChatDetailActivity.class);
            intent.putExtra(ChatDetailActivity.EXTRA_NAME, holder.mTextView.getText());
            intent.putExtra(ChatDetailActivity.EXTRA_AVATAR, holder.mBoundAvatar);
            intent.putExtra(ChatDetailActivity.EXTRA_BALANCE, holder.mTextView2.getText());
            intent.putExtra(ChatDetailActivity.EXTRA_ID, holder.mBoundUserId);

            context.startActivity(intent);
          }
        });

    Glide.with(holder.mImageView.getContext())
        .load(mChats.get(position).getAvaUrl())
        .fitCenter()
        .into(holder.mImageView);
  }
Esempio n. 23
0
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    super.getView(position, convertView, parent);
    ViewHolder holder = null;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.energhlist_item, parent, false);
      holder = new ViewHolder(convertView);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    final PositivityModel.ResultBean.ListBean positivityModel =
        (PositivityModel.ResultBean.ListBean) getItem(position);
    if (positivityModel != null) {
      holder.positiveSor.setText("来自:" + positivityModel.getSource());
      holder.positiveTitle.setText(positivityModel.getTitle());

      Glide.with(mContext)
          .load(positivityModel.getFirstImg())
          .placeholder(R.drawable.energy_default_img)
          .crossFade()
          .into(holder.positiveImg);
    }
    convertView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onclickListner.onClick0(v, positivityModel, position);
          }
        });

    return convertView;
  }
  @Override
  public View getView(int i, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
      LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
      convertView = inflater.inflate(R.layout.trailer_list_item, parent, false);
      holder = new ViewHolder();
      holder.videoIV = (ImageView) convertView.findViewById(R.id.videoIV);
      holder.trailerTV = (TextView) convertView.findViewById(R.id.trailerTV);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.trailerTV.setText("Trailer " + (i + 1));

    if (trailerList.get(i).getSite().equalsIgnoreCase("YouTube")) {

      Glide.with(mContext)
          .load(Constants.YOU_TUBE_IMAGE_BASE_URL + trailerList.get(i).getKey() + "/0.jpg")
          .fitCenter()
          .placeholder(R.color.trailer_color)
          .into(holder.videoIV);
    }

    return convertView;
  }
Esempio n. 25
0
 /**
  * Simple function to load image to image view
  *
  * @param context
  * @param imageView
  * @param url url of image
  */
 public void loadImage(Context context, ImageView imageView, String url) {
   if (url != null && !url.isEmpty()) {
     Glide.with(context).load(url).asBitmap().into(imageView);
   } else {
     Logger.w(ERR_EMPTY_URL);
   }
 }
  @Subscribe
  public void scanQRcodeEvent(ScanCodeEvent event) {
    progressBarLlyt = (ViewGroup) findViewById(R.id.progress_bar_llyt);
    progressBarLlyt.setVisibility(View.VISIBLE);

    String imagePath = event.getImageUrl();
    if (!TextUtils.isEmpty(imagePath)) {
      int myWidth = getResources().getDisplayMetrics().widthPixels;
      int myHeight = getResources().getDisplayMetrics().heightPixels;

      Glide.with(getApplicationContext())
          .load("file://" + imagePath)
          .asBitmap()
          .into(
              new SimpleTarget<Bitmap>(myWidth, myHeight) {
                @Override
                public void onResourceReady(
                    Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                  progressBarLlyt.setVisibility(View.GONE);

                  Result resultZxing =
                      new DecodeUtils(DecodeUtils.DECODE_DATA_MODE_ALL).decodeWithZxing(resource);
                  handleDecode(resultZxing, null);
                }
              });
    }
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (newAutoScroll == true) {
      Autoscroll((ListView) parent);
      Toast.makeText(context, "Autoscroll is called", Toast.LENGTH_SHORT).show();
    }
    newAutoScroll = false;

    // when we are at the end postion in a list, we have to make a new view so
    if (convertView == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(R.layout.single_row, parent, false);
    }

    TextView stringData = (TextView) convertView.findViewById(R.id.list_item_textView);
    ImageView imgageData = (ImageView) convertView.findViewById(R.id.list_item_imageView);

    int realPosition = position % sizeOfList;
    Item currentItem = listOfItems.get(realPosition);

    stringData.setText(currentItem.getName());
    Glide.with(context).load(currentItem.getImageId()).into(imgageData);

    return convertView;
  }
Esempio n. 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);

    setupDrawerContent();

    CollapsingToolbarLayout collapsingToolbar =
        (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(getResources().getString(R.string.app_name));

    final ImageView imageView = (ImageView) findViewById(R.id.backdrop);
    Glide.with(this).load(R.drawable.cheese_3).centerCrop().into(imageView);
  }
  @Override
  public void onBindViewHolder(final MyViewHolder holder, final int position) {

    final SchedualModel model = mSchedularlist.get(position);

    String text =
        "<font color=#cc0029>"
            + model.getMatchTeam1()
            + "</font> <font color=#000000> VS </font> <font color=#ffcc00>"
            + model.getMatchTeam2()
            + "</font>";

    holder.team1.setText("" + model.getMatchTeam1());
    holder.team2.setText("" + model.getMatchTeam2());
    holder.time.setText("" + model.getMatchDate());
    holder.location.setText("" + model.getGroundName());
    holder.matchTitle.setText("Match" + model.getMatchId());

    Picasso.with(context)
        .load(IMAGE_URL + model.getMatchTeam1Flag() + "1")
        .error(context.getResources().getDrawable(R.drawable.launcher))
        .into(holder.thumbTeam1);
    Glide.with(context)
        .load(IMAGE_URL + model.getMatchTeam2Flag() + "2")
        .error(context.getResources().getDrawable(R.drawable.launcher))
        .into(holder.thumbTeam2);
    Log.i("result", "" + IMAGE_URL + model.getMatchTeam1Flag());

    //
  }
  private void updateMetadata(final Movie movie) {
    final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder();

    String title = movie.getTitle().replace("_", " -");

    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title);
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, movie.getDescription());
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, movie.getCardImageUrl());

    // And at minimum the title and artist for legacy support
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title);
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, movie.getStudio());

    Glide.with(this)
        .load(Uri.parse(movie.getCardImageUrl()))
        .asBitmap()
        .into(
            new SimpleTarget<Bitmap>(500, 500) {
              @Override
              public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
                metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap);
                mSession.setMetadata(metadataBuilder.build());
              }
            });
  }