Java Examples for com.facebook.drawee.view.SimpleDraweeView

The following java examples will help you to understand the usage of com.facebook.drawee.view.SimpleDraweeView. These source code samples are taken from different open source projects.

Example 1
Project: DouYu-master  File: HomeNgBarAdapter.java View source code
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
    ViewHolder holder = null;
    if (view == null) {
        view = mInflater.inflate(R.layout.item_gridview, viewGroup, false);
        holder = new ViewHolder();
        holder.proName = (TextView) view.findViewById(R.id.tv_item_name);
        holder.imgIcon = (SimpleDraweeView) view.findViewById(R.id.img_item_gridview);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }
    final int pos = position + mIndex * mPagerSize;
    if (pos == 15) {
        holder.proName.setText("全部分类");
        holder.imgIcon.setImageURI(Uri.parse("res://com.team.zhuoke/" + R.mipmap.more_icon));
    } else {
        holder.proName.setText(mHomeCate.get(pos).getTag_name());
        holder.imgIcon.setImageURI(Uri.parse(mHomeCate.get(pos).getIcon_url()));
    }
    view.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (pos == 15) {
                Toast.makeText(context, "你点击了" + "全部分类", Toast.LENGTH_LONG).show();
            } else {
                Intent intent = new Intent(context, HomeColumnMoreListActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("title", mHomeCate.get(pos).getTag_name());
                bundle.putString("cate_id", mHomeCate.get(pos).getTag_id());
                intent.putExtras(bundle);
                context.startActivity(intent);
            }
        }
    });
    return view;
}
Example 2
Project: AndroidScreenSlidePager-master  File: SlidePageFragment.java View source code
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_slide_page, container, false);
    SimpleDraweeView view = (SimpleDraweeView) rootView.findViewById(R.id.pic);
    Bundle arguments = getArguments();
    if (arguments != null) {
        String url = arguments.getString(PIC_URL);
        view.setImageURI(Uri.parse(url));
    }
    return rootView;
}
Example 3
Project: Boring-master  File: PlayMusicActivity.java View source code
@Override
public void findView() {
    EventBus.getDefault().register(this);
    mPlayControlCommand = new ClientPlayControlCommand(this);
    mPlayModeCommand = new ClientPlayModeCommand(this);
    mPlayQueueCommand = new ClientPlayQueueControlCommand(this);
    mClientReceiver = new ClientReceiverPresenter(this);
    mClientReceiver.setPlayView(this);
    mDbOperator = new MusicDbOperator(DbManager.getLiteOrm(), this, SimpleSong.class);
    mToolBar = (SToolBar) findViewById(R.id.toolbar);
    mSeekBar = (MediaSeekBar) findViewById(R.id.seek_bar);
    mPlayControlView = (MusicPlayControlView) findViewById(R.id.control_view);
    mTvPlayedTime = (TextView) findViewById(R.id.tv_has_play_time);
    mTvLeftTime = (TextView) findViewById(R.id.tv_left_time);
    mSdvAlbum = (SimpleDraweeView) findViewById(R.id.ac_play_music_sdv_album);
    mTvMusicName = (LyricView) findViewById(R.id.ac_play_tv_music_name);
    mPovMusicPlayControl = (PlayOperatorView) findViewById(R.id.ac_play_music_pov);
}
Example 4
Project: Date_Android-master  File: DetailActivityVu.java View source code
@Override
protected void onCreate() {
    setView(R.layout.activity_detail);
    intent = new Intent();
    intent.setClass(context, InfoActivityPresenter.class);
    joinedFace1 = (SimpleDraweeView) rootView.findViewById(R.id.author_report_face_detail1);
    joinedFace2 = (SimpleDraweeView) rootView.findViewById(R.id.author_report_face_detail2);
    joinedFace3 = (SimpleDraweeView) rootView.findViewById(R.id.author_report_face_detail3);
    joinedFace4 = (SimpleDraweeView) rootView.findViewById(R.id.author_report_face_detail4);
    joinedName1 = (TextView) rootView.findViewById(R.id.author_report_name_detail1);
    joinedName2 = (TextView) rootView.findViewById(R.id.author_report_name_detail2);
    joinedName3 = (TextView) rootView.findViewById(R.id.author_report_name_detail3);
    joinedName4 = (TextView) rootView.findViewById(R.id.author_report_name_detail4);
    authorFace = (SimpleDraweeView) rootView.findViewById(R.id.author_face_detail);
    socreLove = (LoveView) rootView.findViewById(R.id.user_star_container);
    authorName = (TextView) rootView.findViewById(R.id.author_name_detail);
    authorGender = (ImageView) rootView.findViewById(R.id.author_gender_detail);
    title = (TextView) rootView.findViewById(R.id.title_detail);
    content = (TextView) rootView.findViewById(R.id.content_detail);
    place = (TextView) rootView.findViewById(R.id.address_detail);
    time = (TextView) rootView.findViewById(R.id.date_detail);
    cost = (TextView) rootView.findViewById(R.id.cost_detail);
    grade = (TextView) rootView.findViewById(R.id.grade_detail);
    sex = (TextView) rootView.findViewById(R.id.sex_detail);
    number = (TextView) rootView.findViewById(R.id.number_detail);
    more = (TextView) rootView.findViewById(R.id.more_detail);
    collectionBtn = (TextView) rootView.findViewById(R.id.collection_detail);
    reportBtn = (TextView) rootView.findViewById(R.id.report_detail);
    llJoined = (LinearLayout) rootView.findViewById(R.id.include_joined_detail);
    $(R.id.author_detail).setOnClickListener(this);
    joinedFace1.setOnClickListener(this);
    joinedFace2.setOnClickListener(this);
    joinedFace3.setOnClickListener(this);
    joinedFace4.setOnClickListener(this);
    authorFace.setOnClickListener(this);
    more.setOnClickListener(this);
    collectionBtn.setOnClickListener(this);
    reportBtn.setOnClickListener(this);
}
Example 5
Project: Git.NB-master  File: IssueDetailActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    issueUrl = intent.getStringExtra(ISSUE_URL);
    issue = intent.getParcelableExtra(ISSUE);
    repos = intent.getParcelableExtra(HotReposFragment.REPOS);
    setContentView(R.layout.activity_issue_detail);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar_layout);
    user_background = (SimpleDraweeView) findViewById(R.id.user_background);
    user_avatar = (SimpleDraweeView) findViewById(R.id.user_avatar);
    issue_title = (TextView) findViewById(R.id.issue_title);
    AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout);
    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {

        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
            //The Refresh must be only active when the offset is zero :
            getSwipeRefreshLayout().setEnabled(verticalOffset == 0);
            float alpha = Math.abs(verticalOffset / (appBarLayout.getHeight() - getToolbar().getHeight() - getResources().getDimension(R.dimen.system_ui_height)));
            if (user_avatar != null)
                user_avatar.setAlpha(1 - alpha);
            if (issue_title != null)
                issue_title.setAlpha(1 - alpha);
            if (alpha > 0.8f) {
                mCollapsingToolbarLayout.setTitle(issue.title);
            } else {
                mCollapsingToolbarLayout.setTitle("");
            }
        }
    });
}
Example 6
Project: PicsHouse-Android-master  File: TabNotificationFragment.java View source code
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tab_notification, container, false);
    Uri uri = Uri.parse("https://raw.githubusercontent.com/facebook/fresco/gh-pages/static/fresco-logo.png");
    SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.my_image_view);
    draweeView.setImageURI(uri);
    return view;
}
Example 7
Project: SprintNBA-master  File: JCVideoPlayerStandard.java View source code
@Override
protected void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    backButton.setVisibility(View.INVISIBLE);
    thumbImageView = (SimpleDraweeView) findViewById(R.id.thumb);
    coverImageView = (ImageView) findViewById(R.id.cover);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
    thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);
}
Example 8
Project: Chateau-master  File: FullScreenImageActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_image);
    final SimpleDraweeView mImageView = (SimpleDraweeView) findViewById(R.id.view_image_image);
    final int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
    final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources()).setFadeDuration(shortAnimTime).setProgressBarImage(new ImageLoadingDrawable(getResources())).setFailureImage(getResources().getDrawable(R.drawable.ic_upload_failed), ScalingUtils.ScaleType.CENTER_INSIDE).setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER).build();
    mImageView.setHierarchy(hierarchy);
    mImageView.setImageURI(getIntent().getParcelableExtra(EXTRA_IMAGE_URI));
}
Example 9
Project: Dragger-master  File: ViewUtil.java View source code
public static void bind(final SimpleDraweeView view, String url) {
    if (url != null) {
        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).setImageType(ImageRequest.ImageType.SMALL).build();
        DraweeController draweeController = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequest).setOldController(view.getController()).setAutoPlayAnimations(true).build();
        view.setController(draweeController);
    }
}
Example 10
Project: fresco-master  File: MediaVariationsFragment.java View source code
private void populateThumb(View rootView, @IdRes int viewId, final Size size) {
    final SimpleDraweeView draweeView = (SimpleDraweeView) rootView.findViewById(viewId);
    loadThumb(draweeView, size, ImageRequest.RequestLevel.DISK_CACHE);
    draweeView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            loadThumb(draweeView, size, ImageRequest.RequestLevel.FULL_FETCH);
        }
    });
}
Example 11
Project: Frescodemo-master  File: GifActivity.java View source code
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_simple_gif);
    mImageView = (SimpleDraweeView) findViewById(R.id.gifview);
    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    GenericDraweeHierarchy hierarchy = builder.build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(Uri.parse(url)).setAutoPlayAnimations(true).build();
    mImageView.setHierarchy(hierarchy);
    mImageView.setController(controller);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
        return;
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
Example 12
Project: JD-Test-master  File: HomeMultipleRecycleAdapter.java View source code
private void bindTypeMiddleBannerData(BaseViewHolder helper, final HomeIndex.ItemInfoListBean item, int position) {
    BGABanner banner = helper.getView(R.id.middle_banner);
    banner.setDelegate(new BGABanner.Delegate<View, HomeIndex.ItemInfoListBean.ItemContentListBean>() {

        @Override
        public void onBannerItemClick(BGABanner banner, View itemView, HomeIndex.ItemInfoListBean.ItemContentListBean model, int position) {
            Toast.makeText(itemView.getContext(), "" + item.itemContentList.get(position).clickUrl, Toast.LENGTH_SHORT).show();
        }
    });
    banner.setAdapter(new BGABanner.Adapter<View, HomeIndex.ItemInfoListBean.ItemContentListBean>() {

        @Override
        public void fillBannerItem(BGABanner banner, View itemView, HomeIndex.ItemInfoListBean.ItemContentListBean model, int position) {
            SimpleDraweeView simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.type_item_middle_banner_content);
            simpleDraweeView.setImageURI(Uri.parse(model.imageUrl));
        }
    });
    banner.setData(R.layout.homerecycle_middle_banner_content, item.itemContentList, null);
}
Example 13
Project: ListItemFold-master  File: ItemDataAdapter.java View source code
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.item_data, null);
        ViewHolder viewHolder = new ViewHolder();
        viewHolder.myImageView = (SimpleDraweeView) convertView.findViewById(R.id.my_image_view);
        viewHolder.myTitle = (TextView) convertView.findViewById(R.id.my_title);
        viewHolder.myContent = (TextView) convertView.findViewById(R.id.my_content);
        GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(context.getResources());
        GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setPlaceholderImage(new ColorDrawable(0xf2f2f2)).setProgressBarImage(new CircularProgressDrawable()).build();
        viewHolder.myImageView.setHierarchy(hierarchy);
        convertView.setTag(viewHolder);
    }
    initializeViews(getItem(position), (ViewHolder) convertView.getTag());
    return convertView;
}
Example 14
Project: LKShop-master  File: DetailContentFragment.java View source code
private void createDialog() {
    final TextView dialog_product_sum;
    View view = LayoutInflater.from(mcontext).inflate(R.layout.product_detail_dialog_content, null);
    dialog_product_sum = ((TextView) view.findViewById(R.id.dialog_product_sum));
    if (productDetailData.getPhoneColor() != -1 && productDetailData.getPhoneCarrieroperator() != -1 && productDetailData.getPhoneStorage() != -1) {
        ((TextView) view.findViewById(R.id.dialog_phone_color)).setText(BaseUtils.transform("color", String.valueOf(productDetailData.getPhoneColor())));
        ((TextView) view.findViewById(R.id.dialog_phone_carrieroperator)).setText(BaseUtils.transform("carrieroperator", String.valueOf(productDetailData.getPhoneCarrieroperator())));
        ((TextView) view.findViewById(R.id.dialog_phone_stroage)).setText(BaseUtils.transform("storage", String.valueOf(productDetailData.getPhoneStorage())));
    } else {
        ((LinearLayout) view.findViewById(R.id.phone_detail_layout)).setVisibility(View.GONE);
    }
    if (productDetailData != null) {
        ((TextView) view.findViewById(R.id.dialog_price)).setText("ï¿¥ " + productDetailData.getPrice());
        ((TextView) view.findViewById(R.id.dialog_product_name)).setText(productDetailData.getProductName());
        ((SimpleDraweeView) view.findViewById(R.id.product_dialog_img)).setImageURI(Uri.parse(productDetailData.getImg()));
    }
    Holder holder = new ViewHolder(view);
    OnClickListener clickListener = new OnClickListener() {

        @Override
        public void onClick(DialogPlus dialog, View view) {
            switch(view.getId()) {
                case R.id.dialog_close:
                    dialog.dismiss();
                    break;
                case R.id.dialog_ok:
                    int sum = Integer.parseInt(dialog_product_sum.getText().toString());
                    if (uid > 0 && pid > 0 && sum > 0) {
                        DBManager.getManager(mcontext).addShopping(pid, uid, sum);
                        upadteAddShoppingState();
                    }
                    dialog.dismiss();
                    break;
                case R.id.dialog_product_sum_add:
                    dialog_product_sum.setText(String.valueOf(Integer.parseInt(dialog_product_sum.getText().toString()) + 1));
                    break;
                case R.id.dialog_product_sum_sub:
                    if (Integer.parseInt(dialog_product_sum.getText().toString()) > 1) {
                        dialog_product_sum.setText(String.valueOf(Integer.parseInt(dialog_product_sum.getText().toString()) - 1));
                    }
                    break;
            }
        }
    };
    DialogPlus dialogPlus = DialogPlus.newDialog(mcontext).setContentHolder(holder).setGravity(Gravity.BOTTOM).setFooter(R.layout.product_detail_dialog_footer).setCancelable(true).setOnClickListener(clickListener).create();
    dialogPlus.show();
}
Example 15
Project: SearchPictureTool-master  File: ImageLoopAdapter.java View source code
@Override
public View getView(final ViewGroup container, final int position) {
    View view = LayoutInflater.from(container.getContext()).inflate(R.layout.view_rollviewpager_, null);
    SimpleDraweeView mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.viewPager_img);
    mSimpleDraweeView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Bundle bundle = new Bundle();
            bundle.putString("search", banners.get(position).getSearchTip());
            bundle.putString("imagUrl", banners.get(position).getImageUrl());
            Intent intent = new Intent();
            intent.putExtra("search", bundle);
            intent.setClass(container.getContext(), SearchResultActivity.class);
            container.getContext().startActivity(intent);
        }
    });
    mSimpleDraweeView.setImageURI(Uri.parse(banners.get(position).getImageUrl()));
    return view;
}
Example 16
Project: weishijie-develop-master  File: PictureHolder.java View source code
public void showImage(SimpleDraweeView iv_pic, SimpleDraweeView moveView, final ViewGroup container, final View fl) {
    if (iv_pic == null || moveView == null)
        return;
    if (iv_pic.getTag() != null && moveView.getTag() != null && (boolean) iv_pic.getTag() && (boolean) moveView.getTag()) {
        //X轴平移
        ObjectAnimator translationX = ObjectAnimator.ofFloat(moveView, "translationX", 0, (ScreenUtils.getInstance(mContext).getWidth() / 2 - (mData.x + mData.width / 2)));
        //Y轴平移
        ObjectAnimator translationY = ObjectAnimator.ofFloat(moveView, "translationY", 0, (ScreenUtils.getInstance(mContext).getHeight() / 2 - (mData.y + mData.height / 2)));
        //X轴缩放
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(moveView, "scaleX", 1.0f, ScreenUtils.getInstance(mContext).getWidth() * 1.0f / mData.width);
        //Y轴缩放
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(moveView, "scaleY", 1.0f, ScreenUtils.getInstance(mContext).getWidth() * 0.8f / mData.height);
        AnimatorSet set = new AnimatorSet();
        set.setDuration(300);
        set.setInterpolator(new LinearInterpolator());
        set.playTogether(translationX, translationY, scaleX, scaleY);
        set.addListener(new Animator.AnimatorListener() {

            @Override
            public void onAnimationStart(Animator animation) {
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                container.setVisibility(View.INVISIBLE);
                container.removeAllViews();
                fl.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationCancel(Animator animation) {
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
            }
        });
        set.start();
    }
}
Example 17
Project: aMatch-master  File: CardContainer.java View source code
public void addUrlListener(final View view) {
    final SimpleDraweeView companyImage = ((SimpleDraweeView) view.findViewById(R.id.image));
    companyImage.setOnTouchListener(new View.OnTouchListener() {

        private Rect rect;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch(event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    companyImage.setColorFilter(Color.argb(50, 0, 0, 0));
                    rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
                    mIsUrlPressedDown = true;
                    break;
                case MotionEvent.ACTION_UP:
                    if (rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) {
                        companyImage.setColorFilter(Color.argb(0, 0, 0, 0));
                        mIsUrlPressedDown = false;
                        WebView webView = (WebView) view.findViewById(R.id.web);
                        WebSettings settings = webView.getSettings();
                        settings.setSupportZoom(true);
                        settings.setBuiltInZoomControls(true);
                        AutofitTextView textView = (AutofitTextView) view.findViewById(R.id.description);
                        if (webView.getVisibility() == GONE) {
                            textView.setVisibility(GONE);
                            if (webView.getUrl() == null) {
                                webView.setWebViewClient(new WebViewClient());
                                webView.loadUrl("http://www.careercup.com" + getTopCardModel().getId());
                            }
                            webView.setVisibility(VISIBLE);
                        } else {
                            textView.setVisibility(VISIBLE);
                            webView.setVisibility(GONE);
                        }
                    }
                    break;
                case MotionEvent.ACTION_MOVE:
                    if (!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) {
                        companyImage.setColorFilter(Color.argb(0, 0, 0, 0));
                        mIsUrlPressedDown = false;
                    }
            }
            return true;
        }
    });
}
Example 18
Project: BGABanner-Android-master  File: FrescoDemoActivity.java View source code
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fresco_demo);
    setTitle("FrescoDemo");
    mContentBanner = (BGABanner) findViewById(R.id.banner_fresco_demo_content);
    mContentBanner.setDelegate(new BGABanner.Delegate<CardView, String>() {

        @Override
        public void onBannerItemClick(BGABanner banner, CardView itemView, String model, int position) {
            Toast.makeText(banner.getContext(), "点击了第" + (position + 1) + "页", Toast.LENGTH_SHORT).show();
        }
    });
    mContentBanner.setAdapter(new BGABanner.Adapter<CardView, String>() {

        @Override
        public void fillBannerItem(BGABanner banner, CardView itemView, String model, int position) {
            SimpleDraweeView simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.sdv_item_fresco_content);
            simpleDraweeView.setImageURI(Uri.parse(model));
        }
    });
    App.getInstance().getEngine().fetchItemsWithItemCount(5).enqueue(new Callback<BannerModel>() {

        @Override
        public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
            BannerModel bannerModel = response.body();
            //                mContentBanner.setData(R.layout.item_fresco, bannerModel.imgs, bannerModel.tips);
            mContentBanner.setData(R.layout.item_fresco, bannerModel.imgs, null);
        }

        @Override
        public void onFailure(Call<BannerModel> call, Throwable t) {
            Toast.makeText(App.getInstance(), "网络数�加载失败", Toast.LENGTH_SHORT).show();
        }
    });
}
Example 19
Project: cnode-android-master  File: UserInfoFragment.java View source code
//获�布局内容
private void initLayout(View view) {
    ((SimpleDraweeView) view.findViewById(R.id.avatar)).setImageURI(Uri.parse(UrlHelper.resolve(UrlHelper.HOST, avatar_url)), sActivity);
    ((TextView) view.findViewById(R.id.loginname)).setText(username);
    String[] columnTabs = getResources().getStringArray(R.array.user_column_tab);
    ArrayList<UserTopicListFragment> fragments = new ArrayList<>();
    for (int i = 0; i < columnTabs.length; i++) {
        Bundle bundle = new Bundle();
        bundle.putString(Params.TAB, columnTabs[i]);
        UserTopicListFragment fragment = (UserTopicListFragment) SimpleFactory.createFragment(UserTopicListFragment.class.getSimpleName(), bundle);
        fragments.add(i, fragment);
    }
    viewPager = (ViewPager) view.findViewById(R.id.view_pager);
    pagerAdapter = new UserColumnPagerAdapter(getChildFragmentManager(), fragments, getResources().getStringArray(R.array.user_column_title));
    viewPager.setAdapter(pagerAdapter);
    viewPager.setOffscreenPageLimit(pagerAdapter.getCount() - 1);
    tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
    tabs.setViewPager(viewPager);
    tabs.setTextSize(CommonUtils.sp2px(14));
    tabs.setTabBackground(android.R.color.transparent);
    tabs.setOnPageChangeListener(this);
    updateTabStatus();
}
Example 20
Project: ExpandablePager-master  File: BookFragment.java View source code
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.page, container, false);
    rootView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
    ((TextView) rootView.findViewById(R.id.text)).setText(myBook.getDescription());
    ((TextView) rootView.findViewById(R.id.header_title)).setText(myBook.getTitle());
    ((TextView) rootView.findViewById(R.id.header_subtitle)).setText(myBook.getAuthor());
    ((SimpleDraweeView) rootView.findViewById(R.id.header_img)).setImageURI(Uri.parse(myBook.getUrl()));
    if (rootView.findViewById(R.id.cell_img) != null)
        ((SimpleDraweeView) rootView.findViewById(R.id.cell_img)).setImageURI(Uri.parse(myBook.getUrl()));
    TextView rating = ((TextView) rootView.findViewById(R.id.page_rating));
    setSpan(rating, "\\d\\.\\d / \\d\\.\\d");
    TextView reviews = ((TextView) rootView.findViewById(R.id.page_reviews));
    setSpan(reviews, "\\d+");
    TextView comments = ((TextView) rootView.findViewById(R.id.page_comments));
    setSpan(comments, "\\d+,*\\d+");
    return rootView;
}
Example 21
Project: PrismView-master  File: ViewUtil.java View source code
public static void bind(final SimpleDraweeView view, String url) {
    if (url != null) {
        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).setImageType(ImageRequest.ImageType.SMALL).build();
        DraweeController draweeController = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequest).setOldController(view.getController()).setAutoPlayAnimations(true).build();
        view.setController(draweeController);
    }
}
Example 22
Project: Android-Ptr-Comparison-master  File: CommonListAdapter.java View source code
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        if (getItemViewType(position) == TYPE_NORMAL) {
            convertView = View.inflate(mContext, R.layout.list_item, null);
            holder.draweeView = (SimpleDraweeView) convertView.findViewById(R.id.image);
            holder.title = (TextView) convertView.findViewById(R.id.title);
            holder.content = (TextView) convertView.findViewById(R.id.content);
        } else {
            convertView = View.inflate(mContext, R.layout.list_item_with_horcroll, null);
            holder.recyclerView = (RecyclerView) convertView.findViewById(R.id.recycler_view);
        }
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    setViewData(position, holder);
    return convertView;
}
Example 23
Project: ant-master  File: InitializeUtil.java View source code
@Override
public void displayImageView(ImageView imageView, Uri uri, Drawable placeholder, int width, int height) {
    if (imageView instanceof SimpleDraweeView) {
        SimpleDraweeView simpleDraweeView = (SimpleDraweeView) imageView;
        ResizeOptions options = new ResizeOptions(width, height);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(options).build();
        PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(simpleDraweeView.getController()).setImageRequest(request).build();
        simpleDraweeView.setController(controller);
    }
}
Example 24
Project: GeekBand-Android-1501-Homework-master  File: WriteFootprintContentActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_write_footprint_content);
    editText = (EditText) findViewById(R.id.act_write_footprint_content_edt);
    imageView = (SimpleDraweeView) findViewById(R.id.act_write_footprint_content_iv);
    imageView.setOnClickListener(this);
//init();
}
Example 25
Project: Leisure-master  File: BaseDetailsActivity.java View source code
protected void initView() {
    /**
         * 测试用 �正�代� ---By MummyDing
         */
    //对toolbar进行下移
    int height = DisplayUtil.getScreenHeight(LeisureApplication.AppContext);
    LinearLayout ll = (LinearLayout) findViewById(R.id.stbar);
    LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams) ll.getLayoutParams();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        llp.height = (int) (height * 0.03);
        ll.setLayoutParams(llp);
    }
    mainContent = (FrameLayout) findViewById(R.id.main_content);
    scrollView = (NestedScrollView) findViewById(R.id.scrollView);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBarTopPic = (ProgressBar) findViewById(R.id.progressBarTopPic);
    networkBtn = (ImageButton) findViewById(R.id.networkBtn);
    topImage = (SimpleDraweeView) findViewById(R.id.topImage);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    getSupportActionBar().setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.top_gradient));
    contentView = (WebView) findViewById(R.id.content_view);
    contentView.getSettings().setJavaScriptEnabled(true);
    // 开�缓存
    contentView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    contentView.getSettings().setDomStorageEnabled(true);
    contentView.getSettings().setDatabaseEnabled(true);
    contentView.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            hideLoading();
        }

        @Override
        public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
            displayNetworkError();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            contentView.loadUrl(url);
            return false;
        }
    });
    if (HttpUtil.isWIFI == false) {
        contentView.getSettings().setBlockNetworkImage(Settings.getInstance().getBoolean(Settings.NO_PIC_MODE, false));
    } else {
        // fix issue #13
        contentView.getSettings().setBlockNetworkImage(false);
    }
    /**
         * 网络异常就显示
         */
    networkBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            networkBtn.setVisibility(View.GONE);
            progressBar.setVisibility(View.VISIBLE);
            onDataRefresh();
        }
    });
    onDataRefresh();
}
Example 26
Project: osm-contributor-master  File: ImageAdapter.java View source code
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    SimpleDraweeView image = new SimpleDraweeView(context);
    image.setImageURI(Uri.parse(photosUrl.get(position)));
    image.setLayoutParams(new ViewGroup.LayoutParams((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 110, context.getResources().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 110, context.getResources().getDisplayMetrics())));
    return image;
}
Example 27
Project: appboy-android-sdk-master  File: FrescoLibraryUtils.java View source code
/**
   * Helper method for setting the controller on a simple Drawee View. By default, gif urls are set
   * to autoplay and tap to retry is on for all images.
   *
   * @param simpleDraweeView   the fresco SimpleDraweeView in which to display the image
   * @param imageUrl           the URL of the image resource
   * @param aspectRatio        the desired aspect ratio of the image
   * @param respectAspectRatio if true, the aspect ratio of the image will be set to that of the value of aspectRatio. If false, the aspect ratio
   *                           will be set to that of the downloaded image dimensions.
   * @param controllerListener the controllerListener to use, or null if the default should be used.
   */
public static void setDraweeControllerHelper(final SimpleDraweeView simpleDraweeView, final String imageUrl, final float aspectRatio, final boolean respectAspectRatio, ControllerListener<ImageInfo> controllerListener) {
    if (StringUtils.isNullOrBlank(imageUrl)) {
        AppboyLogger.w(TAG, "The url set for the Drawee controller was null. Controller not set.");
        return;
    }
    if (simpleDraweeView == null) {
        AppboyLogger.w(TAG, "The SimpleDraweeView set for the Drawee controller was null. Controller not set.");
        return;
    }
    // Selectively cancel network loading based on the Appboy network state
    ImageRequest.RequestLevel requestLevel = Appboy.getOutboundNetworkRequestsOffline() ? ImageRequest.RequestLevel.DISK_CACHE : ImageRequest.RequestLevel.FULL_FETCH;
    AppboyLogger.d(TAG, "Setting Fresco image request level to: " + requestLevel);
    // we get the dimensions, set the aspect ratio of the image based on respectAspectRatio.
    if (controllerListener == null) {
        controllerListener = new BaseControllerListener<ImageInfo>() {

            @Override
            public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                if (imageInfo == null) {
                    return;
                }
                final float imageAspectRatio;
                if (respectAspectRatio) {
                    imageAspectRatio = aspectRatio;
                } else {
                    // Get the image aspect ratio from the imageInfo
                    imageAspectRatio = imageInfo.getWidth() / imageInfo.getHeight();
                }
                // Set this aspect ratio on the drawee itself on the UI thread
                simpleDraweeView.post(new Runnable() {

                    @Override
                    public void run() {
                        simpleDraweeView.setAspectRatio(imageAspectRatio);
                    }
                });
            }
        };
    }
    // will throw a NPE. We catch this below to safeguard against this gracefully.
    try {
        Uri uri = getFrescoUri(imageUrl);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).setLowestPermittedRequestLevel(requestLevel).build();
        DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(uri).setAutoPlayAnimations(true).setTapToRetryEnabled(true).setControllerListener(controllerListener).setImageRequest(request).build();
        simpleDraweeView.setController(controller);
    } catch (NullPointerException e) {
        AppboyLogger.e(TAG, "Fresco controller builder could not be retrieved. Fresco most likely prematurely shutdown.", e);
    } catch (Exception e) {
        AppboyLogger.e(TAG, "Fresco controller builder could not be retrieved. Fresco most likely prematurely shutdown.", e);
    }
}
Example 28
Project: AirPlayer-master  File: SingleItemChildFragment.java View source code
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(getRootViewId(), container, false);
    mToolbar = (Toolbar) rootView.findViewById(R.id.collapsing_toolbar);
    mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    setupFab(rootView);
    mDraweeView = (SimpleDraweeView) rootView.findViewById(R.id.head_image);
    setupDraweeView();
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
    this.setupRecyclerView(mRecyclerView);
    return rootView;
}
Example 29
Project: apps-android-wikipedia-master  File: SearchResultsFragment.java View source code
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.item_search_result, parent, false);
    }
    TextView pageTitleText = (TextView) convertView.findViewById(R.id.page_list_item_title);
    SearchResult result = (SearchResult) getItem(position);
    GoneIfEmptyTextView descriptionText = (GoneIfEmptyTextView) convertView.findViewById(R.id.page_list_item_description);
    View redirectContainer = convertView.findViewById(R.id.page_list_item_redirect_container);
    if (TextUtils.isEmpty(result.getRedirectFrom())) {
        redirectContainer.setVisibility(View.GONE);
        descriptionText.setText(StringUtils.capitalize(result.getPageTitle().getDescription()));
    } else {
        redirectContainer.setVisibility(View.VISIBLE);
        descriptionText.setVisibility(View.GONE);
        TextView redirectText = (TextView) convertView.findViewById(R.id.page_list_item_redirect);
        redirectText.setText(String.format(getString(R.string.search_redirect_from), result.getRedirectFrom()));
    }
    // highlight search term within the text
    String displayText = result.getPageTitle().getDisplayText();
    int startIndex = indexOf(displayText, currentSearchTerm);
    if (startIndex >= 0) {
        displayText = displayText.substring(0, startIndex) + "<strong>" + displayText.substring(startIndex, startIndex + currentSearchTerm.length()) + "</strong>" + displayText.substring(startIndex + currentSearchTerm.length(), displayText.length());
        pageTitleText.setText(StringUtil.fromHtml(displayText));
    } else {
        pageTitleText.setText(displayText);
    }
    ViewUtil.loadImageUrlInto((SimpleDraweeView) convertView.findViewById(R.id.page_list_item_image), result.getPageTitle().getThumbUrl());
    // continue searching!
    if (position == (totalResults.size() - 1)) {
        if (lastFullTextResults == null) {
            // the first full text search
            doFullTextSearch(currentSearchTerm, null, false);
        } else if (lastFullTextResults.getContinueOffset() != null) {
            // subsequent full text searches
            doFullTextSearch(currentSearchTerm, lastFullTextResults.getContinueOffset(), false);
        }
    }
    return convertView;
}
Example 30
Project: BigImageViewer-master  File: FrescoImageLoader.java View source code
@Override
public View showThumbnail(BigImageView parent, Uri thumbnail, int scaleType) {
    SimpleDraweeView thumbnailView = (SimpleDraweeView) LayoutInflater.from(parent.getContext()).inflate(R.layout.ui_fresco_thumbnail, parent, false);
    DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(thumbnail).build();
    switch(scaleType) {
        case BigImageView.INIT_SCALE_TYPE_CENTER_CROP:
            thumbnailView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
            break;
        case BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE:
            thumbnailView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE);
        default:
            break;
    }
    thumbnailView.setController(controller);
    return thumbnailView;
}
Example 31
Project: DanmukuLight-master  File: MainActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 建议放到Application的onCreate方法中进行�始化
    Phoenix.init(this);
    setContentView(R.layout.activity_main);
    SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.sdv_cover);
    ViewGroup.LayoutParams layoutParams = simpleDraweeView.getLayoutParams();
    layoutParams.width = DensityUtil.getDisplayWidth(this);
    layoutParams.height = DensityUtil.getDisplayHeight(this);
    String url = "http://ww2.sinaimg.cn/large/610dc034jw1fa42ktmjh4j20u011hn8g.jpg";
    Phoenix.with(simpleDraweeView).setWidth(DensityUtil.getDisplayWidth(this)).setHeight(DensityUtil.getDisplayHeight(this)).load(url);
    mDanMuHelper = new DanMuHelper(this);
    // 全站弹幕(广播)
    mDanMuContainerBroadcast = (DanMuView) findViewById(R.id.danmaku_container_broadcast);
    mDanMuContainerBroadcast.prepare();
    mDanMuHelper.add(mDanMuContainerBroadcast);
    // 当�房间内的弹幕
    mDanMuContainerRoom = (DanMuView) findViewById(R.id.danmaku_container_room);
    mDanMuContainerRoom.prepare();
    mDanMuHelper.add(mDanMuContainerRoom);
    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            DanmakuEntity danmakuEntity = new DanmakuEntity();
            danmakuEntity.setType(DanmakuEntity.DANMAKU_TYPE_USERCHAT);
            danmakuEntity.setName("å°?A");
            danmakuEntity.setAvatar("http://q.qlogo.cn/qqapp/100229475/E573B01150734A02F25D8E9C76AFD138/100");
            danmakuEntity.setLevel(23);
            danmakuEntity.setText("滚滚长江东�水,浪花淘尽英雄~~");
            addRoomDanmaku(danmakuEntity);
        }
    });
    findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String jsonStr = "{\"type\":306,\"name\":\"\",\"text\":\"�喜�A在�马过河的房间12200031赠�幸�礼物-300棒棒糖,中奖500�,获得5000钻石。\",\"richText\":[{\"type\":\"text\",\"content\":\"�喜\",\"color\":\"89F9DF\"},{\"type\":\"text\",\"content\":\"�A\"},{\"type\":\"text\",\"content\":\"在\",\"color\":\"89F9DF\"},{\"type\":\"text\",\"content\":\"�马过河\"},{\"type\":\"text\",\"content\":\"的房间\",\"color\":\"89F9DF\"},{\"type\":\"text\",\"content\":12200031},{\"type\":\"text\",\"content\":\"赠�\",\"color\":\"89F9DF\"},{\"type\":\"icon_gift\",\"extend\":\"text\",\"gift_id\":3816,\"content\":\"300棒棒糖\"},{\"type\":\"text\",\"content\":\",中奖\",\"color\":\"89F9DF\"},{\"type\":\"text\",\"content\":\"500�\",\"color\":\"FFED0A\"},{\"type\":\"text\",\"content\":\",获得\",\"color\":\"89F9DF\"},{\"type\":\"text\",\"content\":\"5000钻石。\",\"color\":\"FFED0A\"}],\"live_id\":\"1220003114804106040\"}";
            Gson json = new Gson();
            DanmakuEntity danmakuEntity = json.fromJson(jsonStr, DanmakuEntity.class);
            danmakuEntity.setType(DanmakuEntity.DANMAKU_TYPE_SYSTEM);
            addDanmaku(danmakuEntity);
        }
    });
}
Example 32
Project: OpenEyes-master  File: MyAdapter.java View source code
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    HomePicEntity.IssueListEntity.ItemListEntity itemListEntity = mItemList.get(position);
    int type = getItemViewType(position);
    String feed = "1";
    String title = "1";
    String category = "1";
    int duration = 0;
    String text = "1";
    mHolder = new ViewHolder();
    mHolder2 = new ViewHolder2();
    switch(type) {
        case VIDEO:
            //得到��类型所需�的数�
            feed = itemListEntity.getData().getCover().getFeed();
            title = itemListEntity.getData().getTitle();
            category = itemListEntity.getData().getCategory();
            category = "#" + category + "  /  ";
            duration = itemListEntity.getData().getDuration();
            int last = duration % 60;
            String stringLast;
            if (last <= 9) {
                stringLast = "0" + last;
            } else {
                stringLast = last + "";
            }
            String durationString;
            int minit = duration / 60;
            if (minit < 10) {
                durationString = "0" + minit;
            } else {
                durationString = "" + minit;
            }
            String stringTime = durationString + "' " + stringLast + '"';
            //设置布局
            View view = LayoutInflater.from(mContext).inflate(R.layout.list_home_vedio_item, parent, false);
            convertView = view;
            if (convertView == null) {
                mHolder.imageView = (ImageView) convertView.findViewById(R.id.iv);
                mHolder.tvTitle = (TextView) convertView.findViewById(R.id.tv_title);
                mHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time);
                convertView.setTag(mHolder);
            } else {
                if (convertView.getTag() instanceof ViewHolder) {
                    mHolder = (ViewHolder) convertView.getTag();
                } else {
                    convertView = view;
                    mHolder.imageView = (ImageView) convertView.findViewById(R.id.iv);
                    mHolder.tvTitle = (TextView) convertView.findViewById(R.id.tv_title);
                    mHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time);
                    convertView.setTag(mHolder);
                }
            }
            //set data
            Uri uri = Uri.parse(feed);
            SimpleDraweeView draweeView = (SimpleDraweeView) convertView.findViewById(R.id.iv);
            draweeView.setImageURI(uri);
            mHolder.tvTitle.setText(title);
            mHolder.tvTime.setText(category + stringTime);
            return convertView;
        case TEXT:
            convertView = LayoutInflater.from(mContext).inflate(R.layout.list_home_text_item, parent, false);
            TextView textView = (TextView) convertView.findViewById(R.id.tv_home_text);
            //set data
            text = itemListEntity.getData().getText();
            textView.setText(text);
            String image = mItemList.get(position).getData().getImage();
            if (!TextUtils.isEmpty(image)) {
                textView.setTextSize(20);
                textView.setText("-Weekend  special-");
            }
            return convertView;
        default:
            return null;
    }
}
Example 33
Project: Pumelo-master  File: ImageLoaderWrapper.java View source code
/**
     * 加载图片
     *
     * @param view             图片控件
     * @param url              图片url
     * @param allowRetry       失败�是��许点击�试加载
     * @param listener         图片加载监�
     * @param allowProgressive 是��许图片加载�进�显示(目�仅支�jpeg格�)
     * @param isAutoPlay       是��许加载完图片�自动播放(仅支�webP/GIF格�)
     */
public static void loadImage(SimpleDraweeView view, String url, boolean allowRetry, ControllerListener listener, boolean allowProgressive, boolean isAutoPlay) {
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).setProgressiveRenderingEnabled(allowProgressive).build();
    DraweeController draweeController = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequest).setOldController(view.getController()).setTapToRetryEnabled(allowRetry).setAutoPlayAnimations(isAutoPlay).setControllerListener(listener).build();
    view.setController(draweeController);
}
Example 34
Project: RecyclerRenderers-master  File: ViewUtil.java View source code
public static void bind(final SimpleDraweeView view, String uri) {
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).build();
    DraweeController draweeController = Fresco.newDraweeControllerBuilder().setImageRequest(imageRequest).setOldController(view.getController()).setAutoPlayAnimations(true).build();
    view.setController(draweeController);
}
Example 35
Project: remusic-master  File: RadioDetailActivity.java View source code
private void setHeaderView() {
    albumArt = (ImageView) findViewById(R.id.album_art);
    albumTitle = (TextView) findViewById(R.id.album_title);
    albumArtSmall = (SimpleDraweeView) findViewById(R.id.playlist_art);
    LinearLayout downAll = (LinearLayout) headerViewContent.findViewById(R.id.playlist_down);
    downAll.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(RadioDetailActivity.this).setTitle("�下载音��").setPositiveButton(RadioDetailActivity.this.getString(R.string.sure), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    int len = mList.size();
                    for (int i = 0; i < len; i++) {
                        Down.downMusic(MainApplication.context, mList.get(i).getSong_id(), mList.get(i).getSong_name(), artistName);
                    }
                    dialog.dismiss();
                }
            }).setNegativeButton(RadioDetailActivity.this.getString(R.string.cancel), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).show();
        }
    });
}
Example 36
Project: CommonUtilLibrary-master  File: FrescoUtils.java View source code
/**
     * 自定义图片尺寸
     * @param draweeView 显示的控件
     * @param uriString 地�
     * @param width 50
     * @param height 50
     */
public static void changeImgSize(SimpleDraweeView draweeView, String uriString, int width, int height) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString)).setResizeOptions(new ResizeOptions(width, height)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setAutoPlayAnimations(// other setters
    true).build();
    draweeView.setController(controller);
}
Example 37
Project: Conquer-master  File: NotifyUtils.java View source code
/**
	 * 有人看到你的任务时,想与你一起上任务是�过�的�片
	 * @param context
	 * @param card
	 */
public static void showGoudaToast(final Context context, final Card card) {
    /** 接�到该类消�本地用户就会就由User�为BmobChatUser,丢失一下信�,还没解决 */
    final WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    final View view = View.inflate(context, R.layout.toast_gouda_notify, null);
    ImageView iv_bell = (ImageView) view.findViewById(R.id.iv_bell);
    TextView tv_type = (TextView) view.findViewById(R.id.tv_type);
    TextView tv_from = (TextView) view.findViewById(R.id.tv_from);
    SimpleDraweeView iv_avatar = (SimpleDraweeView) view.findViewById(R.id.iv_avatar);
    TextView tv_zixitime = (TextView) view.findViewById(R.id.tv_zixitime);
    TextView tv_zixiname = (TextView) view.findViewById(R.id.tv_zixiname);
    TextView tv_content = (TextView) view.findViewById(R.id.tv_content);
    tv_type.setText("勾�任务");
    tv_from.setText("�自:" + card.getFnick());
    tv_zixitime.setText(TaskUtil.getZixiDateS(card.getTime()) + " " + TaskUtil.getZixiTimeS(card.getTime()));
    tv_zixiname.setText(card.getZixiName());
    tv_content.setText(card.getContent());
    iv_avatar.setImageURI(Uri.parse(card.getFavatar()));
    // 铃铛动画
    iv_bell.setBackgroundResource(R.drawable.alert_bell_anim);
    AnimationDrawable draw = (AnimationDrawable) iv_bell.getBackground();
    draw.start();
    final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    DisplayMetrics metrics = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(metrics);
    params.height = metrics.heightPixels / 2;
    params.width = WindowManager.LayoutParams.MATCH_PARENT;
    params.gravity = Gravity.BOTTOM;
    params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
    // params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
    // WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
    // | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
    params.format = PixelFormat.TRANSLUCENT;
    params.type = WindowManager.LayoutParams.TYPE_PHONE;
    params.windowAnimations = android.R.style.Animation_InputMethod;
    wm.addView(view, params);
    // 监�点击事件
    // 忽略按钮
    view.findViewById(R.id.ib_decline).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            removeMyToast(wm, view);
        }
    });
    // 拉黑按钮
    view.findViewById(R.id.iv_add_black).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            removeMyToast(wm, view);
            BmobUserManager.getInstance(context).addBlack(card.getFusername(), new UpdateListener() {

                @Override
                public void onSuccess() {
                    T.show(context, "黑å??å?•æ·»åŠ æˆ?功!");
                    // �新设置下内存中�存的好�列表
                    CustomApplication.getInstance().setContactList(CollectionUtils.list2map(BmobDB.create(context).getContactList()));
                    BmobDB.create(context).addBlack(card.getFusername());
                }

                @Override
                public void onFailure(int arg0, String arg1) {
                    T.show(context, "黑å??å?•æ·»åŠ å¤±è´¥:" + arg1);
                }
            });
        }
    });
    // ��按钮
    view.findViewById(R.id.iv_accept).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            removeMyToast(wm, view);
            final BmobInvitation invitation = new BmobInvitation(card.getFid(), card.getFusername(), "", "", System.currentTimeMillis(), 1);
            BmobUserManager.getInstance(context).agreeAddContact(invitation, new UpdateListener() {

                @Override
                public void onSuccess() {
                    saveCard(context, card);
                    BmobUserManager.getInstance(context).queryCurrentContactList(new FindListener<BmobChatUser>() {

                        @Override
                        public void onError(int arg0, String arg1) {
                            L.i("查询好�列表失败:" + arg1);
                        }

                        @Override
                        public void onSuccess(List<BmobChatUser> arg0) {
                            T.show(context, "已将" + card.getFnick() + "添加为陪�");
                            // �存到application中方便比较
                            CustomApplication.getInstance().setContactList(CollectionUtils.list2map(arg0));
                        }
                    });
                // BmobDB.create(context).saveContact(invitation);
                // CustomApplication.getInstance().setContactList(CollectionUtils.list2map(BmobDB.create(context).getContactList()));
                }

                @Override
                public void onFailure(int arg0, String arg1) {
                    T.show(context, "��添加好�失敗:" + arg1);
                }
            });
        }
    });
}
Example 38
Project: TLint-master  File: PostActivity.java View source code
private void updatePicsUI() {
    if (selectImages.isEmpty()) {
        scrollView.setVisibility(View.GONE);
        llPics.setVisibility(View.GONE);
    } else {
        scrollView.setVisibility(View.VISIBLE);
        llPics.setVisibility(View.VISIBLE);
        llPics.removeAllViews();
        for (String path : selectImages) {
            View itemView = View.inflate(this, R.layout.item_post_pic, null);
            SimpleDraweeView ivPic = (SimpleDraweeView) itemView.findViewById(R.id.ivPic);
            itemView.setTag(path);
            itemView.setOnClickListener(onPictureClickListener);
            ivPic.setImageURI(Uri.fromFile(new File(path)));
            llPics.addView(itemView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
        }
    }
}
Example 39
Project: tongnews-master  File: HomeFragment.java View source code
@Override
public void bindViewData(View itemView, Object o) {
    TagsView tags = (TagsView) itemView.findViewById(R.id.tags);
    SimpleDraweeView imageView = (SimpleDraweeView) itemView.findViewById(R.id.image);
    TextView time = (TextView) itemView.findViewById(R.id.time);
    TextView title = (TextView) itemView.findViewById(R.id.title);
    TextView shortDescription = (TextView) itemView.findViewById(R.id.short_description);
    TextView author = (TextView) itemView.findViewById(R.id.author);
    PostsProvider.Post homeListItemData = (PostsProvider.Post) o;
    imageView.setImageURI(Uri.parse(homeListItemData.getImageUrl()));
    title.setText(homeListItemData.getTitle());
    time.setText(homeListItemData.getTime());
    shortDescription.setText(homeListItemData.getShortDiscription());
    author.setText(homeListItemData.getAuthor());
    tags.init(homeListItemData.getTags(), null);
}
Example 40
Project: android-adDialog-master  File: AdManager.java View source code
@Override
public Object instantiateItem(ViewGroup container, int position) {
    AdInfo advInfo = advInfoListList.get(position);
    View rootView = context.getLayoutInflater().inflate(R.layout.viewpager_item, null);
    final ViewGroup errorView = (ViewGroup) rootView.findViewById(R.id.error_view);
    final ViewGroup loadingView = (ViewGroup) rootView.findViewById(R.id.loading_view);
    final SimpleDraweeView simpleDraweeView = (SimpleDraweeView) rootView.findViewById(R.id.simpleDraweeView);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    container.addView(rootView, params);
    simpleDraweeView.setTag(advInfo);
    simpleDraweeView.setOnClickListener(imageOnClickListener);
    ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {

        @Override
        public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable anim) {
            if (imageInfo == null) {
                return;
            }
            errorView.setVisibility(View.GONE);
            loadingView.setVisibility(View.GONE);
            simpleDraweeView.setVisibility(View.VISIBLE);
        }

        @Override
        public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) {
            Log.i("##########", "onIntermediateImageSet()");
        }

        @Override
        public void onFailure(String id, Throwable throwable) {
            errorView.setVisibility(View.VISIBLE);
            loadingView.setVisibility(View.GONE);
            simpleDraweeView.setVisibility(View.GONE);
        }
    };
    Uri uri = Uri.parse(advInfo.getActivityImg());
    DraweeController controller = Fresco.newDraweeControllerBuilder().setControllerListener(controllerListener).setUri(uri).build();
    simpleDraweeView.setController(controller);
    return rootView;
}
Example 41
Project: H-Viewer-master  File: MainActivity.java View source code
@Override
public void onIntermediateImageSet(String id, ImageInfo imageInfo) {
    Animatable animatable = ((SimpleDraweeView) backdrop).getController().getAnimatable();
    if (animatable != null)
        animatable.start();
    if (headerImageUri == null || headerImageUri.getPath().endsWith("header.jpg"))
        return;
    if (headerImageUri.getScheme().startsWith("http")) {
        ImageLoader.loadBitmapFromUrl(MainActivity.this, headerImageUri.toString(), null, null, new BaseBitmapDataSubscriber() {

            @Override
            protected void onNewResultImpl(Bitmap bitmap) {
                DocumentFile documentFile = FileHelper.createFileIfNotExist("header.jpg", rootDir, "image");
                try {
                    FileHelper.saveBitmapToFile(bitmap, documentFile);
                    Logger.d("HeaderImage", "Header image saved!");
                } catch (IOException e) {
                    e.printStackTrace();
                    Logger.d("HeaderImage", "Header image save failed!");
                }
            }

            @Override
            protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
                Logger.d("HeaderImage", "Header image save failed!");
            }
        });
    } else {
        Logger.d("HeaderImage", "headerImageUrl : " + headerImageUri.toString());
        DocumentFile imageFile = DocumentFile.fromSingleUri(mContext, headerImageUri);
        DocumentFile documentFile = FileHelper.createFileIfNotExist("header.jpg", rootDir, "image");
        try {
            InputStream in = DocumentUtil.getFileInputSteam(MainActivity.this, imageFile);
            FileHelper.writeFromInputStream(in, documentFile);
            Logger.d("HeaderImage", "Header image saved!");
        } catch (Exception e) {
            e.printStackTrace();
            Logger.d("HeaderImage", "Header image save failed!");
        }
    }
}
Example 42
Project: NodeFlow-master  File: LocationFlowLayout.java View source code
@Override
protected View getContentView(Node<?> node) {
    Location data = (Location) node.getData();
    ViewGroup v = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.node_content, this, false);
    ((TextView) v.findViewById(R.id.content_title)).setText(data.getName());
    ((TextView) v.findViewById(R.id.content_subtitle)).setText("Population " + data.getPopulation());
    ((TextView) v.findViewById(R.id.content_subtitle2)).setText("Density " + data.getDensity());
    ((TextView) v.findViewById(R.id.content_subtitle3)).setText("Area " + data.getArea());
    ((TextView) v.findViewById(R.id.content_subtitle4)).setText("Timezone " + data.getTimezone());
    ((TextView) v.findViewById(R.id.content_text)).setText(data.getDescription());
    if (data.getUrl() != null && !data.getUrl().isEmpty()) {
        Uri uri = Uri.parse(data.getUrl());
        ((SimpleDraweeView) v.findViewById(R.id.content_image)).setImageURI(uri);
    }
    return v;
}
Example 43
Project: FanXin2.0_IM-master  File: SocialMainAdapter.java View source code
@SuppressLint("InflateParams")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (position == 0) {
        View view = inflater.inflate(R.layout.item_header_social_main, null);
        final RelativeLayout ll_msg = (RelativeLayout) view.findViewById(R.id.ll_msg);
        ll_msg.setVisibility(View.VISIBLE);
        ll_msg.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                ll_msg.setVisibility(View.GONE);
                Toast.makeText(context, "点击消�并跳转...", Toast.LENGTH_LONG).show();
                ;
            }
        });
        return view;
    } else {
        convertView = inflater.inflate(R.layout.item_social_main, parent, false);
        ViewHolder holder = (ViewHolder) convertView.getTag();
        if (holder == null) {
            holder = new ViewHolder();
            holder.tv_nick = (TextView) convertView.findViewById(R.id.tv_nick);
            holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
            holder.iv_avatar = (SimpleDraweeView) convertView.findViewById(R.id.sdv_image);
            holder.image_1 = (SimpleDraweeView) convertView.findViewById(R.id.image_1);
            holder.image_2 = (SimpleDraweeView) convertView.findViewById(R.id.image_2);
            holder.image_3 = (SimpleDraweeView) convertView.findViewById(R.id.image_3);
            holder.image_4 = (SimpleDraweeView) convertView.findViewById(R.id.image_4);
            holder.image_5 = (SimpleDraweeView) convertView.findViewById(R.id.image_5);
            holder.image_6 = (SimpleDraweeView) convertView.findViewById(R.id.image_6);
            holder.image_7 = (SimpleDraweeView) convertView.findViewById(R.id.image_7);
            holder.image_8 = (SimpleDraweeView) convertView.findViewById(R.id.image_8);
            holder.image_9 = (SimpleDraweeView) convertView.findViewById(R.id.image_9);
            holder.ll_one = (LinearLayout) convertView.findViewById(R.id.ll_one);
            holder.ll_two = (LinearLayout) convertView.findViewById(R.id.ll_two);
            holder.ll_three = (LinearLayout) convertView.findViewById(R.id.ll_three);
            holder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
            holder.tv_location = (TextView) convertView.findViewById(R.id.tv_location);
            holder.iv_pop = (ImageView) convertView.findViewById(R.id.iv_pop);
            holder.tv_goodmembers = (TextView) convertView.findViewById(R.id.tv_goodmembers);
            holder.ll_goodmembers = (LinearLayout) convertView.findViewById(R.id.ll_goodmembers);
            holder.tv_commentmembers = (TextView) convertView.findViewById(R.id.tv_commentmembers);
            holder.view_pop = (View) convertView.findViewById(R.id.view_pop);
            holder.tv_delete = (TextView) convertView.findViewById(R.id.tv_delete);
            convertView.setTag(holder);
        }
        final View view_pop = holder.view_pop;
        JSONObject json = users.get(position - 1);
        if (json == null || json.size() == 0) {
            users.remove(position - 1);
            this.notifyDataSetChanged();
        }
        final String userID = json.getString("userID");
        String content = json.getString("content");
        String imageStr = json.getString("imageStr");
        String location = json.getString("location");
        final String sID = json.getString("sID");
        // String token = json.getString("token");
        String rel_time = json.getString("time");
        // 设置删除键
        if (userID.equals(myuserID)) {
            holder.tv_delete.setVisibility(View.VISIBLE);
            holder.tv_delete.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    showPhotoDialog(position - 1, sID);
                // users.remove(position - 1);
                // this.notifyDataSetChanged();
                }
            });
        } else {
            holder.tv_delete.setVisibility(View.GONE);
        }
        // 设置昵称。
        String nick = userID;
        String avatar = "";
        if (userID.equals(myuserID)) {
            nick = myNick;
            avatar = myAvatar;
        } else {
            User user = MYApplication.getInstance().getContactList().get(userID);
            if (user != null) {
                nick = user.getNick();
                avatar = user.getAvatar();
            }
        }
        holder.tv_nick.setText(nick);
        holder.iv_avatar.setImageURI(Uri.parse(Constant.URL_Avatar + avatar));
        holder.tv_nick.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, SocialFriendActivity.class).putExtra("friendID", userID));
            }
        });
        // 设置头�.....
        // 设置文章中的图片
        System.out.print("imageStr--->>" + imageStr);
        if (!imageStr.equals("0")) {
            String[] images = imageStr.split("split");
            int imNumb = images.length;
            holder.image_1.setVisibility(View.VISIBLE);
            holder.image_1.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[0]));
            holder.image_1.setOnClickListener(new ImageListener(images, 0));
            Log.e("imNumb--->>", String.valueOf(imNumb));
            // 四张图的时间情况比较特殊
            if (imNumb == 4) {
                holder.image_2.setVisibility(View.VISIBLE);
                holder.image_2.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[1]));
                holder.image_2.setOnClickListener(new ImageListener(images, 1));
                holder.image_4.setVisibility(View.VISIBLE);
                holder.image_4.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[2]));
                holder.image_4.setOnClickListener(new ImageListener(images, 2));
                holder.image_5.setVisibility(View.VISIBLE);
                holder.image_5.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[3]));
                holder.image_5.setOnClickListener(new ImageListener(images, 3));
            } else {
                if (imNumb > 1) {
                    holder.image_2.setVisibility(View.VISIBLE);
                    holder.image_2.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[1]));
                    holder.image_2.setOnClickListener(new ImageListener(images, 1));
                    if (imNumb > 2) {
                        holder.image_3.setVisibility(View.VISIBLE);
                        holder.image_3.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[2]));
                        holder.image_3.setOnClickListener(new ImageListener(images, 2));
                        if (imNumb > 3) {
                            holder.image_4.setVisibility(View.VISIBLE);
                            holder.image_4.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[3]));
                            holder.image_4.setOnClickListener(new ImageListener(images, 3));
                            if (imNumb > 4) {
                                holder.image_5.setVisibility(View.VISIBLE);
                                holder.image_5.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[4]));
                                holder.image_5.setOnClickListener(new ImageListener(images, 4));
                                if (imNumb > 5) {
                                    holder.image_6.setVisibility(View.VISIBLE);
                                    holder.image_6.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[5]));
                                    holder.image_6.setOnClickListener(new ImageListener(images, 5));
                                    if (imNumb > 6) {
                                        holder.image_7.setVisibility(View.VISIBLE);
                                        holder.image_7.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[6]));
                                        holder.image_7.setOnClickListener(new ImageListener(images, 6));
                                        if (imNumb > 7) {
                                            holder.image_8.setVisibility(View.VISIBLE);
                                            holder.image_8.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[7]));
                                            holder.image_8.setOnClickListener(new ImageListener(images, 7));
                                            if (imNumb > 8) {
                                                holder.image_9.setVisibility(View.VISIBLE);
                                                holder.image_9.setImageURI(Uri.parse(Constant.URL_SOCIAL_PHOTO + images[8]));
                                                holder.image_9.setOnClickListener(new ImageListener(images, 8));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // 显示�置
        if (location != null && !location.equals("0")) {
            holder.tv_location.setVisibility(View.VISIBLE);
            holder.tv_location.setText(location);
        }
        // 显示文章内容
        // .setText(content);
        setUrlTextView(content, holder.tv_content);
        final ImageView iv_temp = holder.iv_pop;
        final LinearLayout ll_goodmembers_temp = holder.ll_goodmembers;
        // 点赞评论的数�
        final JSONArray goodArray = json.getJSONArray("good");
        final JSONArray commentArray = json.getJSONArray("comment");
        // 点赞
        setGoodTextClick(holder.tv_goodmembers, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
        boolean is_good_temp = true;
        for (int i = 0; i < goodArray.size(); i++) {
            JSONObject json_good = goodArray.getJSONObject(i);
            if (json_good.getString("userID").equals(myuserID)) {
                is_good_temp = false;
            }
        }
        if (commentArray != null && commentArray.size() != 0) {
            holder.tv_commentmembers.setVisibility(View.VISIBLE);
            setCommentTextClick(holder.tv_commentmembers, commentArray, view_pop, goodArray.size());
        }
        final boolean is_good = is_good_temp;
        String goodStr = "赞";
        if (!is_good) {
            goodStr = "�消";
        }
        iv_temp.setTag(goodStr);
        final TextView tv_commentmembers_temp = holder.tv_commentmembers;
        final TextView tv_good_temp = holder.tv_goodmembers;
        iv_temp.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                AddPopWindow addPopWindow = new AddPopWindow((SocialMainActivity) context, iv_temp, new ClickCallBack() {

                    @Override
                    public void clicked(int type) {
                        // 点击�消
                        if (type == 1) {
                            if (((String) iv_temp.getTag()).equals("赞")) {
                                setGood(sID, tv_good_temp, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
                                iv_temp.setTag("�消");
                            } else {
                                cancelGood(sID, tv_good_temp, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
                                iv_temp.setTag("赞");
                            }
                        } else {
                            // 点击评论
                            showCommentEditText(sID, tv_commentmembers_temp, commentArray, view_pop, goodArray.size());
                        }
                    }
                });
                addPopWindow.showPopupWindow(iv_temp);
            }
        });
        // 显示时间
        holder.tv_time.setText(getTime(rel_time, MYApplication.getInstance().getTime()));
        return convertView;
    }
}
Example 44
Project: FanXin3.0-master  File: SocialMainAdapter.java View source code
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (position == 0) {
        View view = inflater.inflate(R.layout.fx_item_moments_header, null, false);
        ImageView iv_avatar = (ImageView) view.findViewById(R.id.iv_avatar);
        Glide.with(context).load(FXConstant.URL_AVATAR + myAvatar).diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(R.drawable.fx_default_useravatar).into(iv_avatar);
        return view;
    } else {
        convertView = inflater.inflate(R.layout.item_social_main, parent, false);
        ViewHolder holder = (ViewHolder) convertView.getTag();
        if (holder == null) {
            holder = new ViewHolder();
            holder.tv_nick = (TextView) convertView.findViewById(R.id.tv_nick);
            holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
            holder.iv_avatar = (SimpleDraweeView) convertView.findViewById(R.id.sdv_image);
            holder.image_1 = (SimpleDraweeView) convertView.findViewById(R.id.image_1);
            holder.image_2 = (SimpleDraweeView) convertView.findViewById(R.id.image_2);
            holder.image_3 = (SimpleDraweeView) convertView.findViewById(R.id.image_3);
            holder.image_4 = (SimpleDraweeView) convertView.findViewById(R.id.image_4);
            holder.image_5 = (SimpleDraweeView) convertView.findViewById(R.id.image_5);
            holder.image_6 = (SimpleDraweeView) convertView.findViewById(R.id.image_6);
            holder.image_7 = (SimpleDraweeView) convertView.findViewById(R.id.image_7);
            holder.image_8 = (SimpleDraweeView) convertView.findViewById(R.id.image_8);
            holder.image_9 = (SimpleDraweeView) convertView.findViewById(R.id.image_9);
            holder.ll_one = (LinearLayout) convertView.findViewById(R.id.ll_one);
            holder.ll_two = (LinearLayout) convertView.findViewById(R.id.ll_two);
            holder.ll_three = (LinearLayout) convertView.findViewById(R.id.ll_three);
            holder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
            holder.tv_location = (TextView) convertView.findViewById(R.id.tv_location);
            holder.iv_pop = (ImageView) convertView.findViewById(R.id.iv_pop);
            holder.tv_goodmembers = (TextView) convertView.findViewById(R.id.tv_goodmembers);
            holder.ll_goodmembers = (LinearLayout) convertView.findViewById(R.id.ll_goodmembers);
            holder.tv_commentmembers = (TextView) convertView.findViewById(R.id.tv_commentmembers);
            holder.view_pop = (View) convertView.findViewById(R.id.view_pop);
            holder.tv_delete = (TextView) convertView.findViewById(R.id.tv_delete);
            convertView.setTag(holder);
        }
        final View view_pop = holder.view_pop;
        JSONObject json = users.get(position - 1);
        if (json == null || json.size() == 0) {
            users.remove(position - 1);
            this.notifyDataSetChanged();
        }
        final String userID = json.getString("userID");
        String content = json.getString("content");
        String imageStr = json.getString("imageStr");
        String location = json.getString("location");
        final String sID = json.getString("sID");
        // String token = json.getString("token");
        String rel_time = json.getString("time");
        // 设置删除键
        if (userID.equals(myuserID)) {
            holder.tv_delete.setVisibility(View.VISIBLE);
            holder.tv_delete.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    showPhotoDialog(position - 1, sID);
                // users.remove(position - 1);
                // this.notifyDataSetChanged();
                }
            });
        } else {
            holder.tv_delete.setVisibility(View.GONE);
        }
        // 设置昵称。
        String nick = userID;
        String avatar = "";
        if (userID.equals(myuserID)) {
            nick = myNick;
            avatar = myAvatar;
        } else {
            EaseUser user = DemoHelper.getInstance().getContactList().get(userID);
            if (user != null) {
                nick = user.getNick();
                avatar = user.getAvatar();
            }
        }
        holder.tv_nick.setText(nick);
        holder.iv_avatar.setImageURI(Uri.parse(FXConstant.URL_AVATAR + avatar));
        holder.tv_nick.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, SocialFriendActivity.class).putExtra("friendID", userID));
            }
        });
        // 设置头�.....
        // 设置文章中的图片
        System.out.print("imageStr--->>" + imageStr);
        if (!imageStr.equals("0")) {
            String[] images = imageStr.split("split");
            int imNumb = images.length;
            holder.image_1.setVisibility(View.VISIBLE);
            holder.image_1.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[0]));
            holder.image_1.setOnClickListener(new ImageListener(images, 0));
            Log.e("imNumb--->>", String.valueOf(imNumb));
            // 四张图的时间情况比较特殊
            if (imNumb == 4) {
                holder.image_2.setVisibility(View.VISIBLE);
                holder.image_2.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[1]));
                holder.image_2.setOnClickListener(new ImageListener(images, 1));
                holder.image_4.setVisibility(View.VISIBLE);
                holder.image_4.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[2]));
                holder.image_4.setOnClickListener(new ImageListener(images, 2));
                holder.image_5.setVisibility(View.VISIBLE);
                holder.image_5.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[3]));
                holder.image_5.setOnClickListener(new ImageListener(images, 3));
            } else {
                if (imNumb > 1) {
                    holder.image_2.setVisibility(View.VISIBLE);
                    holder.image_2.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[1]));
                    holder.image_2.setOnClickListener(new ImageListener(images, 1));
                    if (imNumb > 2) {
                        holder.image_3.setVisibility(View.VISIBLE);
                        holder.image_3.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[2]));
                        holder.image_3.setOnClickListener(new ImageListener(images, 2));
                        if (imNumb > 3) {
                            holder.image_4.setVisibility(View.VISIBLE);
                            holder.image_4.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[3]));
                            holder.image_4.setOnClickListener(new ImageListener(images, 3));
                            if (imNumb > 4) {
                                holder.image_5.setVisibility(View.VISIBLE);
                                holder.image_5.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[4]));
                                holder.image_5.setOnClickListener(new ImageListener(images, 4));
                                if (imNumb > 5) {
                                    holder.image_6.setVisibility(View.VISIBLE);
                                    holder.image_6.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[5]));
                                    holder.image_6.setOnClickListener(new ImageListener(images, 5));
                                    if (imNumb > 6) {
                                        holder.image_7.setVisibility(View.VISIBLE);
                                        holder.image_7.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[6]));
                                        holder.image_7.setOnClickListener(new ImageListener(images, 6));
                                        if (imNumb > 7) {
                                            holder.image_8.setVisibility(View.VISIBLE);
                                            holder.image_8.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[7]));
                                            holder.image_8.setOnClickListener(new ImageListener(images, 7));
                                            if (imNumb > 8) {
                                                holder.image_9.setVisibility(View.VISIBLE);
                                                holder.image_9.setImageURI(Uri.parse(FXConstant.URL_SOCIAL_PHOTO + images[8]));
                                                holder.image_9.setOnClickListener(new ImageListener(images, 8));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // 显示�置
        if (location != null && !location.equals("0")) {
            holder.tv_location.setVisibility(View.VISIBLE);
            holder.tv_location.setText(location);
        }
        // 显示文章内容
        // .setText(content);
        setUrlTextView(content, holder.tv_content);
        final ImageView iv_temp = holder.iv_pop;
        final LinearLayout ll_goodmembers_temp = holder.ll_goodmembers;
        // 点赞评论的数�
        final JSONArray goodArray = json.getJSONArray("good");
        final JSONArray commentArray = json.getJSONArray("comment");
        // 点赞
        setGoodTextClick(holder.tv_goodmembers, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
        boolean is_good_temp = true;
        for (int i = 0; i < goodArray.size(); i++) {
            JSONObject json_good = goodArray.getJSONObject(i);
            if (json_good.getString("userID").equals(myuserID)) {
                is_good_temp = false;
            }
        }
        if (commentArray != null && commentArray.size() != 0) {
            holder.tv_commentmembers.setVisibility(View.VISIBLE);
            setCommentTextClick(holder.tv_commentmembers, commentArray, view_pop, goodArray.size());
        }
        final boolean is_good = is_good_temp;
        String goodStr = "赞";
        if (!is_good) {
            goodStr = "�消";
        }
        iv_temp.setTag(goodStr);
        final TextView tv_commentmembers_temp = holder.tv_commentmembers;
        final TextView tv_good_temp = holder.tv_goodmembers;
        iv_temp.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                AddPopWindow addPopWindow = new AddPopWindow((SocialMainActivity) context, iv_temp, new AddPopWindow.ClickCallBack() {

                    @Override
                    public void clicked(int type) {
                        // 点击�消
                        if (type == 1) {
                            if (((String) iv_temp.getTag()).equals("赞")) {
                                setGood(sID, tv_good_temp, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
                                iv_temp.setTag("�消");
                            } else {
                                cancelGood(sID, tv_good_temp, goodArray, ll_goodmembers_temp, view_pop, commentArray.size());
                                iv_temp.setTag("赞");
                            }
                        } else {
                            // 点击评论
                            showCommentEditText(sID, tv_commentmembers_temp, commentArray, view_pop, goodArray.size());
                        }
                    }
                });
                addPopWindow.showPopupWindow(iv_temp);
            }
        });
        // 显示时间
        holder.tv_time.setText(getTime(rel_time, DemoApplication.getInstance().getTime()));
        holder.iv_avatar.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, UserDetailsActivity.class).putExtra(FXConstant.JSON_KEY_HXID, userID));
            }
        });
        return convertView;
    }
}
Example 45
Project: JieCaoVideoPlayer-master  File: JCVideoPlayerStandardFresco.java View source code
@Override
public void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progress);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    //        thumbImageView = (SimpleDraweeView) findViewById(R.id.thumb);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
    tinyBackImageView = (ImageView) findViewById(R.id.back_tiny);
    //        thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);
    tinyBackImageView.setOnClickListener(this);
}
Example 46
Project: MobilePlayer1020-master  File: JCVideoPlayerStandardFresco.java View source code
@Override
public void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    thumbImageView = (SimpleDraweeView) findViewById(R.id.thumb);
    coverImageView = (ImageView) findViewById(R.id.cover);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
    tinyBackImageView = (ImageView) findViewById(R.id.back_tiny);
    thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);
    tinyBackImageView.setOnClickListener(this);
}
Example 47
Project: banner-master  File: FrescoImageLoader.java View source code
//æ??ä¾›createImageView 方法,方便fresco自定义ImageView
@Override
public ImageView createImageView(Context context) {
    SimpleDraweeView simpleDraweeView = new SimpleDraweeView(context);
    return simpleDraweeView;
}
Example 48
Project: ImageLoader-master  File: FrescoImageLoader.java View source code
//æ??ä¾›createImageView 方法,方便fresco自定义ImageView
@Override
public ImageView createImageView(Context context) {
    SimpleDraweeView simpleDraweeView = new SimpleDraweeView(context);
    return simpleDraweeView;
}
Example 49
Project: FrescoImageViewer-master  File: DemoActivity.java View source code
protected void init() {
    posters = Demo.getPosters();
    descriptions = Demo.getDescriptions();
    for (int i = 0; i < ids.length; i++) {
        SimpleDraweeView drawee = (SimpleDraweeView) findViewById(ids[i]);
        initDrawee(drawee, i);
    }
}
Example 50
Project: react-native-navigation-master  File: CollapsingTopBarBackground.java View source code
private void createBackDropImage() {
    backdrop = new SimpleDraweeView(getContext());
    setImageSource();
    backdrop.setScaleType(ImageView.ScaleType.CENTER_CROP);
    backdrop.setFitsSystemWindows(true);
    addView(backdrop, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
}
Example 51
Project: Facebook-Fresco-master  File: Fresco.java View source code
private static void initializeDrawee(Context context) {
    sDraweeControllerBuilderSupplier = new PipelineDraweeControllerBuilderSupplier(context);
    SimpleDraweeView.initialize(sDraweeControllerBuilderSupplier);
}
Example 52
Project: MVVMLight-master  File: ViewBindingAdapter.java View source code
@BindingAdapter({ "uri" })
public static void setImageUri(SimpleDraweeView simpleDraweeView, String uri) {
    if (!TextUtils.isEmpty(uri)) {
        simpleDraweeView.setImageURI(Uri.parse(uri));
    }
}
Example 53
Project: DesignDemo-master  File: CheeseDetailActivity.java View source code
private void loadBackdrop() {
    final SimpleDraweeView mDraweeView = (SimpleDraweeView) findViewById(R.id.backdrop);
    mDraweeView.getHierarchy().setActualImageFocusPoint(new PointF(0.5f, 0.35f));
    mDraweeView.setImageURI(Uri.parse(mImageUrl));
}
Example 54
Project: Diary-master  File: DiaryPhotoLayout.java View source code
public SimpleDraweeView getPhoto() {
    return SDV_diary_new_photo;
}
Example 55
Project: MyDiary-master  File: DiaryPhotoLayout.java View source code
public SimpleDraweeView getPhoto() {
    return SDV_diary_new_photo;
}
Example 56
Project: huabanDemo-master  File: ImageLoadBuilder.java View source code
public static ImageLoadBuilder Start(Context mContext, SimpleDraweeView mSimpleDraweeView, String mUrl) {
    return new ImageLoadBuilder(mContext, mSimpleDraweeView, mUrl);
}
Example 57
Project: MDPlayer-master  File: MeizhiListFragment.java View source code
/**
         * 绑定数�
         *
         * @param holder
         * @param position
         */
@Override
protected void bindData(BaseRecyclerViewHolder holder, int position) {
    SimpleDraweeView imageView = ((ViewHolder) holder).image;
    //            Picasso.with(getActivity()).load("http://tnfs.tngou.net/image"+getItemData(position).getImg()).into(imageView);
    imageView.setImageURI("http://tnfs.tngou.net/image" + getItemData(position).getImg());
}
Example 58
Project: S1-Go-master  File: ImageLoader.java View source code
public void displayImage(@DrawableRes int resId, ImageView imageView) {
    if (!(imageView instanceof SimpleDraweeView)) {
        imageView.setImageResource(resId);
    } else {
        displayImage(resourceToUri(resId), imageView);
    }
}