コード例 #1
0
ファイル: IndexAdapter.java プロジェクト: jnksu/Demo
  protected void buildMultiPic(final GridLayout gridLayout) {
    gridLayout.setVisibility(View.VISIBLE);
    // 获取当前屏幕尺寸
    DisplayMetrics metrics = new DisplayMetrics();
    WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    windowManager.getDefaultDisplay().getMetrics(metrics);
    // 设置图片的宽度和高度
    int picWidth = metrics.widthPixels / 3 - 48;

    for (int i = 0; i < 9; i++) {
      // 获取View
      SimpleDraweeView simpleDraweeView = (SimpleDraweeView) gridLayout.getChildAt(i);
      // 设置布局参数
      GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
      layoutParams.width = picWidth;
      layoutParams.height = picWidth;
      layoutParams.setMargins(8, 8, 8, 8);
      simpleDraweeView.setLayoutParams(layoutParams);
      // 设置图片数据源
      simpleDraweeView.setImageURI(Uri.parse(Image.imageThumbUrls[i]));
      // 准备传递数据
      final ImageViewPageMessage imageViewPageMessage =
          new ImageViewPageMessage(Image.imageThumbUrls, i);
      simpleDraweeView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              EventBus.getDefault().postSticky(imageViewPageMessage);
              Intent intent = new Intent(mContext, ImageViewPagerActivity.class);
              mContext.startActivity(intent);
            }
          });
    }
  }
コード例 #2
0
ファイル: LDraweeView.java プロジェクト: lecion/Ewu
 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   if (mHeightRatio > 0.0) {
     int width = MeasureSpec.getSize(widthMeasureSpec);
     int height = (int) (width * mHeightRatio);
     super.setMeasuredDimension(width, height);
   } else {
     super.onMeasure(widthMeasureSpec, heightMeasureSpec);
   }
 }
コード例 #3
0
  private void setOrganization() {
    TextView repos_description = (TextView) findViewById(R.id.repos_description);
    TextView orga_name = (TextView) findViewById(R.id.orga_name);
    SimpleDraweeView orga_avatar = (SimpleDraweeView) findViewById(R.id.orga_avatar);

    if (orgs != null) {
      orga_name.setText(orgs.name);
      repos_description.setText(orgs.description);
      orga_avatar.setImageURI(Uri.parse(orgs.avatar_url));
    }

    TextView members = (TextView) findViewById(R.id.members);
    TextView events = (TextView) findViewById(R.id.events);
    TextView repositories = (TextView) findViewById(R.id.repositories);
    members.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(OrganizationDetailActivity.this, UserListActivity.class);
            Bundle bundle = new Bundle();
            bundle.putParcelable(ORGS, orgs);
            intent.putExtras(bundle);
            intent.putExtra(UserListActivity.USER_TYPE, UserListActivity.USER_TYPE_MEMBER);
            startActivity(intent);
          }
        });
    repositories.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(OrganizationDetailActivity.this, ReposListActivity.class);
            Bundle bundle = new Bundle();
            bundle.putParcelable(ORGS, orgs);
            intent.putExtras(bundle);
            intent.putExtra(ReposListActivity.REPOS_TYPE, ReposListActivity.REPOS_TYPE_ORGS);
            startActivity(intent);
          }
        });
    events.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(OrganizationDetailActivity.this, EventListActivity.class);
            Bundle bundle = new Bundle();
            bundle.putParcelable(ORGS, orgs);
            intent.putExtras(bundle);
            intent.putExtra(EventListActivity.EVENT_TYPE, EventListActivity.EVENT_TYPE_ORGS);
            startActivity(intent);
          }
        });
  }
コード例 #4
0
ファイル: MainActivity.java プロジェクト: eldk/fresco
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // GIF
    final ViewGroup gifControls = (ViewGroup) findViewById(R.id.gif_controls);
    updateAnimationControls(gifControls, null);

    mAnimatedGifView = (SimpleDraweeView) findViewById(R.id.animated_gif);
    Uri animatedGifUri =
        Uri.parse("http://s3.amazonaws.com/giphygifs/media/4aBQ9oNjgEQ2k/giphy.gif");

    final TextView gifInfo = (TextView) findViewById(R.id.gif_info);

    DraweeController gifController =
        Fresco.newDraweeControllerBuilder()
            .setUri(animatedGifUri)
            .setControllerListener(
                new BaseControllerListener<ImageInfo>() {
                  @Override
                  public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
                    updateAnimationControls(gifControls, anim);
                    gifInfo.setText(getAnimationInformation(anim));
                  }
                })
            .build();
    mAnimatedGifView.setController(gifController);

    // Animated WebP
    final ViewGroup webpControls = (ViewGroup) findViewById(R.id.webp_controls);
    updateAnimationControls(webpControls, null);

    mAnimatedWebpView = (SimpleDraweeView) findViewById(R.id.animated_webp);
    final TextView webpInfo = (TextView) findViewById(R.id.webp_info);

    Uri animatedWebpUri = Uri.parse("http://www.gstatic.com/webp/animated/1.webp");
    DraweeController webpController =
        Fresco.newDraweeControllerBuilder()
            .setUri(animatedWebpUri)
            .setControllerListener(
                new BaseControllerListener<ImageInfo>() {
                  @Override
                  public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
                    updateAnimationControls(webpControls, anim);
                    webpInfo.setText(getAnimationInformation(anim));
                  }
                })
            .build();
    mAnimatedWebpView.setController(webpController);
  }
コード例 #5
0
  @Override
  public void setData(RecommendContent data) {

    super.setData(data);
    recommendContent = data;
    simpleDraweeView1.setImageURI(Uri.parse(recommendContent.getImgUrl1()));
    simpleDraweeView2.setImageURI(Uri.parse(recommendContent.getImgUrl2()));
    title1.setText(recommendContent.getTitle1());
    title2.setText(recommendContent.getTitle2());
    content1.setText(recommendContent.getContent1());
    content2.setText(recommendContent.getContent2());
    cardView1.setOnClickListener(this);
    cardView2.setOnClickListener(this);
  }
コード例 #6
0
ファイル: LoginFragment.java プロジェクト: lzdragonix/amb
 @Override
 public void changeAvatar(String path) {
   if (TextUtils.isEmpty(path)) {
     return;
   }
   imgAvatar.setImageURI(Uri.parse(path));
 }
コード例 #7
0
 private void loadWebView() {
   frescoImage.setVisibility(View.GONE);
   image.setVisibility(View.GONE);
   webView.setVisibility(View.VISIBLE);
   webView.loadUrl(gifArray[index]);
   // TODO: test this from file as well
 }
コード例 #8
0
  private void bindData() {
    task = (Task) getIntent().getSerializableExtra("task");
    tv_name.setText(task.getName());
    tv_name.setSelection(tv_name.length());
    tv_time.setText(TaskUtil.getZixiTimeS(task.getTime()));
    int p = 4320 - TaskUtil.getDurationFromNow(task.getTime());
    if (p <= 0) p = 1;
    pb.setText(TaskUtil.getDescriptionTimeFromTimestamp(task.getTime()));
    if (task.getTime() <= System.currentTimeMillis()) {
      pb.setRoundWidth(0);
      pb.setText(TaskUtil.getZixiDateS(task.getTime()));
    } else {
      pb.setRoundWidth(PixelUtil.dp2px(6));
    }
    if (p < 100) p = 100; // 防止太小了
    pb.setProgressNoAnim(p);
    if (task.getImageUrl() != null) {
      iv_home_bg.setImageURI(Uri.parse(task.getImageUrl()));
    }

    materialMenu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    String path = task.getAudioUrl();
    if (path != null) {
      final ImageButton ib_play = (ImageButton) ll_audio.findViewById(R.id.ib_play);
      final ProgressBar pb = (ProgressBar) ll_audio.findViewById(R.id.pb2);
      ib_play.setTag("play");
      ib_play.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              ib_play.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      if (ib_play.getTag().equals("play")) {
                        ib_play.setImageResource(R.drawable.pause_audio);
                        ib_play.setTag("pause");
                        NotifyUtils.palyAudio(context, ib_play, pb, task.getAudioUrl());
                      } else {
                        ib_play.setTag("play");
                        ib_play.setImageResource(R.drawable.play_audio);
                        NotifyUtils.pauseAudio(ib_play);
                      }
                    }
                  });
            }
          });
    }
    if (task.getNote() != null) {
      ((TextView) findViewById(R.id.tv_note)).setText(task.getNote());
    }
  }
コード例 #9
0
 private boolean loadImage(
     final SimpleDraweeView imageView, final Cursor cursor, final Binding binding) {
   final String url = cursor.getString(binding.getColumnIndex());
   if (url != null) {
     imageView.setImageURI(Uri.parse(url));
   }
   return true;
 }
コード例 #10
0
ファイル: Fragment2.java プロジェクト: jinbolx/huaxiajuntuo
  @Override
  protected void initData() {
    String s = "res://com.example.jin.huaxiajuntuo/" + R.drawable.guide211;

    Uri uri = Uri.parse(s);
    System.out.println("22222" + uri);
    mSdv.setImageURI(uri);
  }
コード例 #11
0
 @Override
 public void onSuccess(ThemeContent json) {
   mSwipeRefreshLayout.setRefreshing(false);
   tv_description.setText(json.getDescription());
   draweeView.setImageURI(Uri.parse(json.getImage()));
   List<Editor> editors = json.getEditors();
   layout_icons.removeAllViews();
   if (editors != null && editors.size() > 0) {
     for (Editor ts : editors) {
       View view = _inflater.inflate(R.layout.layout_editor_icon, null);
       SimpleDraweeView imageView = (SimpleDraweeView) view.findViewById(R.id.img_icon);
       Uri uri = Uri.parse(ts.getAvatar());
       imageView.setImageURI(uri);
       layout_icons.addView(view);
     }
   }
   adapter.setLists(json.getStories());
 }
コード例 #12
0
  @Override
  public void onDataOk(String url, String data) {
    switch (url) {
      case Api.URL_HOME:
        Home home = JsonUtil.getEntity(data, Home.class);
        if (home == null) {
          return;
        }
        homeContent.setVisibility(View.VISIBLE);

        // 标题,如 VOL.1997
        sayingTitle.setText(home.strHpTitle);
        // 照片名称及作者简介
        textIllustrationAuthor.setText(home.strAuthor.replace("&", "\n"));
        // 日
        textDay.setText(TimeUtil.getDay(home.strMarketTime));
        // 月、年
        textMonth.setText(TimeUtil.getMonthAndYear(home.strMarketTime));
        // 内容
        textSaying.setText(home.strContent);
        // 喜欢的数量
        like_Saying.setText(home.strPn);
        // 插画

        ControllerListener controllerListener =
            new BaseControllerListener<ImageInfo>() {
              @Override
              public void onFailure(String id, Throwable throwable) {
                super.onFailure(id, throwable);
                TextToast.shortShow("加载失败:" + throwable.toString());
              }

              @Override
              public void onIntermediateImageSet(String id, ImageInfo imageInfo) {
                super.onIntermediateImageSet(id, imageInfo);
              }

              @Override
              public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                super.onFinalImageSet(id, imageInfo, animatable);
                if (imageInfo == null) {
                  return;
                }
                float rate = (float) imageInfo.getWidth() / (float) imageInfo.getHeight();
                dvIllustrator.setAspectRatio(rate);
              }
            };
        DraweeController controller =
            Fresco.newDraweeControllerBuilder()
                .setUri(Uri.parse(home.strThumbnailUrl))
                .setControllerListener(controllerListener)
                .build();
        dvIllustrator.setController(controller);
        break;
    }
  }
コード例 #13
0
 public ViewHolder(View itemView, boolean isFooter, Context context) {
   super(itemView);
   this.isFooter = isFooter;
   if (!this.isFooter) {
     tv_title = (TextView) itemView.findViewById(R.id.tv_title);
     sdv_picture = (SimpleDraweeView) itemView.findViewById(R.id.sdv_picture);
     sdv_picture.getHierarchy().setProgressBarImage(new CustomProgressBar(context));
     tv_picture_hint = (TextView) itemView.findViewById(R.id.tv_picture_hint);
   }
 }
コード例 #14
0
 private void setUserHeader() {
   if (userHeader == null) return;
   user = CommConfig.getConfig().loginedUser;
   int pos = user.iconUrl.indexOf("@");
   String userIcon = user.iconUrl;
   if (pos > 0) {
     userIcon = user.iconUrl.substring(0, pos);
   }
   userHeader.setImageURI(Uri.parse(userIcon));
 }
コード例 #15
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View view = _inflater.inflate(R.layout.fragment_main_item, null);
      Story s = lists.get(position);
      if (s != null) {
        TextView item_title = (TextView) view.findViewById(R.id.item_title);
        item_title.setText(s.getTitle());
        SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.item_image);
        List<String> imgs = s.getImages();
        if (imgs != null && imgs.size() > 0) {
          Uri uri = Uri.parse(imgs.get(0));
          draweeView.setImageURI(uri);
        } else {
          draweeView.setVisibility(View.GONE);
        }
        view.setOnClickListener(new onItemClickListener(s.getId()));
      }

      return view;
    }
コード例 #16
0
ファイル: AcContentActivity.java プロジェクト: npk/BlueTube
  public void onFragmentBack(final AcContentInfo.DataEntity.FullContentEntity fullContentEntity) {
    // 加载标题图片并点击播放默认第一个视频
    mTitleImg.setImageURI(Uri.parse(fullContentEntity.getCover()));
    mTitleImg.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            AcContentInfo.DataEntity.FullContentEntity.VideosEntity videosEntity =
                fullContentEntity.getVideos().get(0);

            VideoPlayActivity.startActivity(
                AcContentActivity.this,
                String.valueOf(videosEntity.getVideoId()),
                String.valueOf(videosEntity.getDanmakuId()),
                videosEntity.getSourceId(),
                videosEntity.getType());
          }
        });
    //        mCollapsingToolbarLayout.setTitle("AC" + fullContentEntity.getContentId());
  }
コード例 #17
0
ファイル: MainGridView.java プロジェクト: udong/android-app
 public void addTestView() {
   logo.setImageURI(Uri.parse(Constant.URLS[0]));
   clubName.setText("clubName");
   region.setText("region");
   leader.setText("leader");
   category.setText("category");
   memberCount.setText("현재 명");
   memberLimit.setText("제한 명");
   permission.setText("공개 동호회");
   this.exist = true;
 }
コード例 #18
0
ファイル: MainGridView.java プロジェクト: udong/android-app
 public void addPlusView() {
   logo.setImageURI(Uri.parse(Constant.URLS[1]));
   clubName.setText("동호회 생성");
   region.setVisibility(GONE);
   leader.setVisibility(GONE);
   category.setVisibility(GONE);
   memberCount.setVisibility(GONE);
   memberLimit.setVisibility(GONE);
   permission.setVisibility(GONE);
   this.exist = false;
 }
コード例 #19
0
ファイル: GifActivity.java プロジェクト: tsdl2013/FrescoDemo
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_gif);
   mImageView = (SimpleDraweeView) findViewById(R.id.gifview);
   DraweeController controller =
       Fresco.newDraweeControllerBuilder()
           .setUri(Uri.parse(url))
           .setAutoPlayAnimations(true)
           .build();
   mImageView.setController(controller);
 }
コード例 #20
0
ファイル: TopicAdapter.java プロジェクト: mutexliu/WeMe
 @Override
 public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
   if (holder instanceof ItemViewHolder) {
     ItemViewHolder item = (ItemViewHolder) holder;
     Post post = mPostList.get(position);
     item.avatar.setImageURI(Uri.parse(StrUtils.thumForID(post.userId)));
     item.avatar.setTag(post.userId);
     item.avatar.setOnClickListener(mListener);
     item.userName.setText(post.name);
     item.university.setText(post.school);
     item.time.setText(StrUtils.timeTransfer(post.timestamp));
     item.title.setText(post.title);
     item.content.setText(post.body);
     item.like_number.setText(post.likenumber);
     item.comment_number.setText(post.commentnumber);
     item.grid.removeAllViews();
     for (int i = 0; i < post.thumbnailUrl.size() && i < 4; i++) {
       String url = post.thumbnailUrl.get(i);
       SimpleDraweeView image = new SimpleDraweeView(mContext);
       item.grid.addView(image);
       image.setImageURI(Uri.parse(url));
       image.setId(imageID);
       image.setOnClickListener(mListener);
       try {
         JSONObject j = new JSONObject();
         JSONArray array = new JSONArray(post.imageUrl);
         j.put(AtyImage.KEY_ARRAY, array);
         j.put(AtyImage.KEY_INDEX, i);
         image.setTag(j.toString());
       } catch (JSONException e) {
         // ignore
       }
     }
     item.itemView.setTag(post);
     item.itemView.setOnClickListener(mListener);
   } else if (holder instanceof ProgressViewHolder) {
     ProgressViewHolder progress = (ProgressViewHolder) holder;
     progress.progressBar.setIndeterminate(true);
   }
 }
コード例 #21
0
ファイル: LDraweeView.java プロジェクト: lecion/Ewu
  // 正常
  private void setHierarchy() {
    if (mContext == null) {
      throw new IllegalArgumentException("Context is not null");
    }

    final GenericDraweeHierarchy hierarchy =
        new GenericDraweeHierarchyBuilder(mContext.getResources())
            .setFadeDuration(this.getFadeDuration())
            .setOverlay(this.getMyOverlay())
            .setActualImageScaleType(this.getDraweeViewScaleType())
            .setProgressBarImage(this.getProgressBar(), ScalingUtils.ScaleType.CENTER_INSIDE)
            .setPlaceholderImage(this.getPlaceholderDrawable(), ScalingUtils.ScaleType.CENTER_CROP)
            .build();
    super.setHierarchy(hierarchy);
  }
コード例 #22
0
ファイル: MainGridView.java プロジェクト: udong/android-app
 public void addView(JSONObject result) throws JSONException {
   logo.setImageURI(Uri.parse(result.getString("logoUrl")));
   clubName.setText(result.getString("clubName"));
   region.setText(result.getString("region"));
   leader.setText(result.getString("leader"));
   category.setText(result.getString("category"));
   memberCount.setText("현재 " + result.getInt("memberCount") + "명");
   memberLimit.setText("제한 " + result.getInt("memberLimit") + "명");
   if (result.getInt("permission") == 0) {
     permission.setText("공개 동호회");
   } else if (result.getInt("permission") == 1) {
     permission.setText("비공개 동호회");
   } else if (result.getInt("permission") == 2) {
     permission.setText("비밀 동호회");
   }
   this.exist = true;
 }
コード例 #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cicrcle_progress);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ProgressBarCircular progress = (ProgressBarCircular) findViewById(R.id.progress_bar);
    ViewGroup.LayoutParams params = progress.getLayoutParams();
    params.width = (int) (DensityUtil.gettDisplayWidth(this));
    params.height = (int) (DensityUtil.gettDisplayWidth(this));

    SimpleDraweeView mImage = (SimpleDraweeView) findViewById(R.id.image);
    mImage.setImageURI(
        Uri.parse(
            "http://h.hiphotos.baidu.com/image/h%3D300/sign=97028a6b4a086e0675a8394b32097b5a/023b5bb5c9ea15ce1948f653b0003af33b87b2c1.jpg"));

    SimpleDraweeView mImage2 = (SimpleDraweeView) findViewById(R.id.image2);
    mImage2.setImageURI(
        Uri.parse(
            "http://b.hiphotos.baidu.com/image/h%3D300/sign=592f8030ac18972bbc3a06cad6cd7b9d/267f9e2f0708283896096030bf99a9014c08f18a.jpg"));

    SimpleDraweeView mImage3 = (SimpleDraweeView) findViewById(R.id.image3);
    mImage3.setImageURI(
        Uri.parse(
            "http://b.hiphotos.baidu.com/image/h%3D300/sign=592f8030ac18972bbc3a06cad6cd7b9d/267f9e2f0708283896096030bf99a9014c08f18a.jpg"));

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (progress.getVisibility() != View.VISIBLE) {
              progress.setVisibility(View.VISIBLE);
              progress.postDelayed(
                  new Runnable() {
                    @Override
                    public void run() {
                      progress.showCircleView(
                          new ProgressBarCircular.IOnShowViewEndListener() {
                            @Override
                            public void onEnd() {}
                          });
                    }
                  },
                  1000);
            } else {
              progress.setVisibility(View.GONE);
            }
          }
        });
  }
コード例 #24
0
  private void setupCardView(Item item) {
    // Item item = Singleton.getInstance().getItems().items.get(pos);
    textViewTitle.setText(item.title);
    textViewDomain.setText(item.title);
    textViewFullUrl.setText(item.displayLink);
    textViewDateSaved.setText(item.kind);

    Uri uri = null;
    try {
      uri = Uri.parse(item.image.thumbnailLink);
    } catch (Exception e) {
      e.printStackTrace();
    }
    simpleDraweeView.setImageURI(uri);
    textViewDone.setOnClickListener(v -> onBackPressed());
    textViewCancel.setOnClickListener(v -> onBackPressed());
    textViewDelete.setOnClickListener(v -> onBackPressed());
  }
コード例 #25
0
 private void showAnim() {
   int y = getIntent().getIntExtra("y", 0);
   int[] loc = new int[2];
   layout_task.getLocationOnScreen(loc);
   L.d("y:" + y + "," + loc[1]);
   layout_task.setVisibility(View.VISIBLE);
   layout_task.setTranslationY(y - loc[1]);
   layout_task.animate().translationY(0).setDuration(400).start();
   iv_sort.animate().alpha(0).setDuration(400).start();
   iv_search.animate().alpha(0).setDuration(400).start();
   iv_home_bg.animate().alpha(1).setDuration(400).start();
   title_bg.animate().alpha(0).setDuration(400).start();
   ll_bottom.animate().alpha(1).setDuration(400).start();
   materialMenu.animateState(MaterialMenuDrawable.IconState.ARROW);
   String path = task.getAudioUrl();
   if (path != null) {
     ll_audio.animate().alpha(1).setDuration(300).start();
   }
 }
コード例 #26
0
  @Override
  public void onResume() {
    super.onResume();

    Bundle bundle = getArguments();
    final int posicion = bundle.getInt("posicion");

    DetalleImagen item = MainActivity.lista.get(posicion);

    ivImagen.setImageURI(Uri.parse(item.getRutaImagen()));
    lblTitulo.setText(item.getTitulo());

    btnAbrir.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(getActivity(), TerceroActivity.class);
            intent.putExtra("posicion", posicion);
            startActivity(intent);
          }
        });
  }
コード例 #27
0
ファイル: LDraweeView.java プロジェクト: lecion/Ewu
  private LDraweeView setControllerByType(final Uri uri, final String type) {
    uriPathTag = uri.toString();
    this.setImageFormat(uriPathTag);
    if (noRepeatLoadImage(uriPathTag)) {

      if ("NORMAL".equals(type)) {
        setHierarchy();
      } else if ("ROUND".equals(type)) {
        //                setRoundHierarchy();
      }

      final AbstractDraweeController controller =
          Fresco.newDraweeControllerBuilder()
              .setAutoPlayAnimations(this.getAutoPlayAnimations()) // 自动播放图片动画
              .setControllerListener(this.getControllerListener())
              .setImageRequest(getImageRequest(this, uri))
              .setOldController(this.getController())
              .build();
      super.setController(controller);
    }
    return this;
  }
コード例 #28
0
  public void onClearCacheClick(View view) {
    next();

    image.setImageResource(android.R.color.white);
    webView.loadUrl(""); // so that previous image would not show on next load
    webView.setVisibility(View.GONE);
    frescoImage.setVisibility(View.GONE);
    image.setVisibility(View.VISIBLE);

    webCheck.setChecked(false);
    glideCheck.setChecked(false);
    frescoCheck.setChecked(false);
    text.setText("Clearing cache");

    imageUtil.clearCache(
        new Runnable() {
          @Override
          public void run() {
            Toast.makeText(GifActivity.this, "CacheCleared", Toast.LENGTH_SHORT).show();
            text.setText("Select service");
          }
        });
  }
コード例 #29
0
ファイル: MainGridView.java プロジェクト: udong/android-app
  private void init(Context context) {
    this.mContext = context;
    Log.d(Constant.LOG, "메인 커스텀 리니어레이아웃");
    String infService = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li;
    li = (LayoutInflater) getContext().getSystemService(infService);
    li.inflate(R.layout.linear_main_gridview, this, true);

    logo = (SimpleDraweeView) findViewById(R.id.logo);
    clubName = (TextView) findViewById(R.id.clubName);
    region = (TextView) findViewById(R.id.region);
    leader = (TextView) findViewById(R.id.leader);
    category = (TextView) findViewById(R.id.category);
    memberCount = (TextView) findViewById(R.id.memberCount);
    memberLimit = (TextView) findViewById(R.id.memberLimit);
    permission = (TextView) findViewById(R.id.permission);

    Random ran = new Random();
    Uri uri = Uri.parse(Constant.URLS[ran.nextInt(34)]);
    logo.setImageURI(uri);

    setOnClickListener(this);
  }
コード例 #30
0
  // 实现setContentView方法
  @Override
  public void setContentView(View contentView, int position, HorizontalScrollView parent) {
    SimpleDraweeView userimg =
        (SimpleDraweeView) contentView.findViewById(R.id.petdiartycomment_userimg);
    TextView timeTv = (TextView) contentView.findViewById(R.id.petdiartycomment_time);
    TextView contentTv = (TextView) contentView.findViewById(R.id.petdiartycomment_content);
    TextView voicenameTv = (TextView) contentView.findViewById(R.id.petdiartycomment_voice_name);
    PercentRelativeLayout voiceRL =
        (PercentRelativeLayout) contentView.findViewById(R.id.petdiartycomment_voice);
    ImageView voiceImg = (ImageView) contentView.findViewById(R.id.petdiartycomment_voiceimg);
    TextView voiceText = (TextView) contentView.findViewById(R.id.petdiartycomment_voicetext);
    CommontObject commentObj = (CommontObject) getItem(position);
    if (commentObj != null) {
      AccountObject account = commentObj.getAccount();
      String name = "";
      if (account != null) {
        if (!CommonTextUtils.isEmpty(account.getIcoUrl())) {
          FrescoHelper.displayImageview(
              userimg,
              account.getIcoUrl() + CommonUtils.getAvatarSize(mContext),
              R.drawable.avatar_default_image,
              mContext.getResources(),
              true);
        } else {
          Uri uri = Uri.parse("res://mobi.jzcx.android.chongmi/" + R.drawable.avatar_default_image);
          userimg.setImageURI(uri);
        }
        name = account.getNickName();
      }
      if (!CommonTextUtils.isEmpty(commentObj.getTimeStamp())) {
        timeTv.setText(commentObj.getTimeStamp());
      } else {
        timeTv.setText("");
      }
      if (!CommonTextUtils.isEmpty(commentObj.getText())) {
        contentTv.setText(commentObj.getText());
      } else {
        contentTv.setText("");
      }
      // if (!CommonTextUtils.isEmpty(commentObj.getVoiceUrl())) {
      // voiceRL.setVisibility(View.VISIBLE);
      // contentTv.setVisibility(View.GONE);
      // } else {
      //
      // }
      voiceRL.setVisibility(View.GONE);
      contentTv.setVisibility(View.VISIBLE);
      if (!CommonTextUtils.isEmpty(name)) {
        voicenameTv.setText(name);
      } else {
        voicenameTv.setText("");
      }
      userimg.setOnClickListener(new userImgClick(account));

      // String localPath = FileUtils.VOICE +
      // DemoUtils.md5(commentObj.getVoiceUrl()) + ".amr";
      //
      // if (FileUtils.exists(localPath)) {
      // try {
      // long duration = CommonUtils.getAmrDuration(new File(localPath));
      // NumberFormat nf = NumberFormat.getNumberInstance();
      // nf.setMaximumFractionDigits(2);
      // voiceText.setText(nf.format(Double.valueOf(duration / 1000)));
      // } catch (IOException e) {
      // e.printStackTrace();
      // }
      // voiceRL.setOnClickListener(new VoicePlayClickListener(localPath,
      // voiceImg, this, mContext));
      // } else {
      // voiceText.setText("");
      // }
    }
  }