• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NineGridView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.lzy.ninegrid.NineGridView的典型用法代码示例。如果您正苦于以下问题:Java NineGridView类的具体用法?Java NineGridView怎么用?Java NineGridView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NineGridView类属于com.lzy.ninegrid包,在下文中一共展示了NineGridView类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_super_cache);
    initToolBar(toolbar, true, "强大的缓存");

    NineGridView.setImageLoader(new GlideImageLoader());

    ArrayList<NewsTabFragment> fragments = new ArrayList<>();
    NewsTabFragment fragment1 = NewsTabFragment.newInstance();
    fragment1.setTitle("Android");
    fragments.add(fragment1);
    NewsTabFragment fragment2 = NewsTabFragment.newInstance();
    fragment2.setTitle("iOS");
    fragments.add(fragment2);
    NewsTabFragment fragment3 = NewsTabFragment.newInstance();
    fragment3.setTitle("前端");
    fragments.add(fragment3);
    MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), fragments);
    viewPager.setAdapter(adapter);
    viewPager.setOffscreenPageLimit(fragments.size());
    tab.setupWithViewPager(viewPager);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:SuperCacheActivity.java


示例2: ThroughtViewHolder

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
ThroughtViewHolder(View view) {
    super(view);
    mIvTour = (ImageView) view.findViewById(R.id.iv_tour);
    mIvGender = (ImageView) view.findViewById(R.id.image_gender);
    mTvName = (TextView) view.findViewById(R.id.tv_name);
    mTvTime = (TextView) view.findViewById(R.id.tv_time);
    mTvContent = (TextView) view.findViewById(R.id.tv_content);
    mTvCommentCount = (TextView) view.findViewById(R.id.tv_comment_count);
    mTvViewCount = (TextView) view.findViewById(R.id.tv_view_count);
    mPhotoRecycler = (NineGridView) view.findViewById(R.id.nineGrid);
    mCommentRecycler = (RecyclerView) view.findViewById(R.id.recycler_view);
    mCommentRe = (LinearLayout) view.findViewById(R.id.re_comment);
    mLlRote = (LinearLayout) view.findViewById(R.id.ll_rote);
    mLlRote.setOnClickListener(view1 -> {
        if (mOnItemClick!=null){
            mOnItemClick.OnItemClickListener(view1,getLayoutPosition(),mResultsBeen.get(getLayoutPosition()));
        }
    });
}
 
开发者ID:wuyinlei,项目名称:MyHearts,代码行数:20,代码来源:ThroughtAdapter.java


示例3: convert

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
protected void convert(BaseViewHolder baseViewHolder, final GankModel model) {
    baseViewHolder.setText(R.id.title, model.desc)//
            .setText(R.id.desc, model.desc)//
            .setText(R.id.pubDate, model.publishedAt.toString())//
            .setText(R.id.source, model.source);

    View view = baseViewHolder.getConvertView();
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            WebActivity.runActivity(mContext, model.desc, model.url);
        }
    });

    NineGridView nineGrid = baseViewHolder.getView(R.id.nineGrid);
    ArrayList<ImageInfo> imageInfo = new ArrayList<>();
    if (model.images != null) {
        for (String image : model.images) {
            ImageInfo info = new ImageInfo();
            info.setThumbnailUrl(image);
            info.setBigImageUrl(image);
            imageInfo.add(info);
        }
    }
    nineGrid.setAdapter(new NineGridViewClickAdapter(mContext, imageInfo));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:NewsAdapter.java


示例4: instantiateItem

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
    public Object instantiateItem(ViewGroup container, int position) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_photoview, container, false);
        final ProgressBar pb = (ProgressBar) view.findViewById(R.id.pb);
        final PhotoView imageView = (PhotoView) view.findViewById(R.id.pv);

        ImageInfo info = this.imageInfo.get(position);
        imageView.setOnPhotoTapListener(this);
        showExcessPic(info, imageView);

        //如果需要加载的loading,需要自己改写,不能使用这个方法
        NineGridView.getImageLoader().onDisplayImage(view.getContext(), imageView, info.bigImageUrl);

//        pb.setVisibility(View.VISIBLE);
//        Glide.with(context).load(info.bigImageUrl)//
//                .placeholder(R.drawable.ic_default_image)//
//                .error(R.drawable.ic_default_image)//
//                .diskCacheStrategy(DiskCacheStrategy.ALL)//
//                .listener(new RequestListener<String, GlideDrawable>() {
//                    @Override
//                    public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//
//                    @Override
//                    public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//                }).into(imageView);

        container.addView(view);
        return view;
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:36,代码来源:ImagePreviewAdapter.java


示例5: showExcessPic

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
/** 展示过度图片 */
private void showExcessPic(ImageInfo imageInfo, PhotoView imageView) {
    //先获取大图的缓存图片
    Bitmap cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.bigImageUrl);
    //如果大图的缓存不存在,在获取小图的缓存
    if (cacheImage == null) cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.thumbnailUrl);
    //如果没有任何缓存,使用默认图片,否者使用缓存
    if (cacheImage == null) {
        imageView.setImageResource(R.drawable.ic_default_image);
    } else {
        imageView.setImageBitmap(cacheImage);
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:14,代码来源:ImagePreviewAdapter.java


示例6: onImageItemClick

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
protected void onImageItemClick(Context context, NineGridView nineGridView, int index, List<ImageInfo> imageInfo) {
    for (int i = 0; i < imageInfo.size(); i++) {
        ImageInfo info = imageInfo.get(i);
        View imageView;
        if (i < nineGridView.getMaxSize()) {
            imageView = nineGridView.getChildAt(i);
        } else {
            //如果图片的数量大于显示的数量,则超过部分的返回动画统一退回到最后一个图片的位置
            imageView = nineGridView.getChildAt(nineGridView.getMaxSize() - 1);
        }
        info.imageViewWidth = imageView.getWidth();
        info.imageViewHeight = imageView.getHeight();
        int[] points = new int[2];
        imageView.getLocationInWindow(points);
        info.imageViewX = points[0];
        info.imageViewY = points[1] - statusHeight;
    }

    Intent intent = new Intent(context, ImagePreviewActivity.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable(ImagePreviewActivity.IMAGE_INFO, (Serializable) imageInfo);
    bundle.putInt(ImagePreviewActivity.CURRENT_ITEM, index);
    intent.putExtras(bundle);
    context.startActivity(intent);
    ((Activity) context).overridePendingTransition(0, 0);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:28,代码来源:NineGridViewClickAdapter.java


示例7: onCreate

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Bmob.initialize(this,Constant.BMOB_KEY);
    // 使用推送服务时的初始化操作
    BmobInstallation.getCurrentInstallation().save();
    // 启动推送服务
    BmobPush.startWork(this);
    NineGridView.setImageLoader(new GlideImageLoader());
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:11,代码来源:MyApp.java


示例8: BnItemViewHolder

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
public BnItemViewHolder(View itemView, int viewType) {
    super(itemView);
    this.viewType = viewType;

    ViewStub viewStub = (ViewStub) itemView.findViewById(R.id.viewStub);
    switch (viewType) {
        case TYPE_URL:// 链接view
            viewStub.setLayoutResource(R.layout.viewstub_urlbody_layout);
            viewStub.inflate();
            LinearLayout urlBodyView = (LinearLayout) itemView.findViewById(R.id.urlBody);
            if (urlBodyView != null) {
                urlBody = urlBodyView;
                urlImageIv = (ImageView) itemView.findViewById(R.id.urlImageIv);
                urlContentTv = (TextView) itemView.findViewById(R.id.urlContentTv);
            }
            break;
        case TYPE_IMAGE:// 图片view
            viewStub.setLayoutResource(R.layout.viewstub_imgbody_layout);
            viewStub.inflate();
            NineGridView nineGridView = (NineGridView) itemView.findViewById(R.id.ngv);
            if (nineGridView != null) {
                this.nineGridView = nineGridView;
            }
            break;
        case TYPE_VIDEO:
            viewStub.setLayoutResource(R.layout.viewstub_videobody_layout);
            viewStub.inflate();

            BnVideoView videoBody = (BnVideoView) itemView.findViewById(R.id.videoView);
            if (videoBody != null) {
                this.videoView = videoBody;
            }
            break;
        default:
            break;
    }
    headIv = (ImageView) itemView.findViewById(R.id.headIv);
    nameTv = (TextView) itemView.findViewById(R.id.nameTv);
    digLine = itemView.findViewById(R.id.lin_dig);

    contentTv = (ExpandTextView) itemView.findViewById(R.id.contentTv);
    urlTipTv = (TextView) itemView.findViewById(R.id.urlTipTv);
    timeTv = (TextView) itemView.findViewById(R.id.timeTv);
    deleteBtn = (TextView) itemView.findViewById(R.id.deleteBtn);
    snsBtn = (ImageView) itemView.findViewById(R.id.snsBtn);
    praiseListView = (PraiseListView) itemView.findViewById(R.id.praiseListView);

    digCommentBody = (LinearLayout) itemView.findViewById(R.id.digCommentBody);
    commentList = (CommentListView) itemView.findViewById(R.id.commentList);

    snsPopupWindow = new SnsPopupWindow(itemView.getContext());

}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:54,代码来源:BNAdapter.java


示例9: initWithGlide

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
public static void initWithGlide(){
    NineGridView.setImageLoader(new GlideImageLoader());
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:4,代码来源:NineGridHelper.java


示例10: setList

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
public static void setList(Context context, NineGridView nineGridView, List<ImageInfo> images){
    nineGridView.setAdapter(new NineGridViewClickAdapter(context, images));
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:4,代码来源:NineGridHelper.java


示例11: onCreate

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();

        mInstance = this;

        dbManager = new DBManager(getApplicationContext());
        dbManager.openDatabase();

        NineGridView.setImageLoader(new PicassoImageLoader());

        Bmob.initialize(this, "6d7ed6a006f2606890427bf70345cdb9");

        if (flag == true) {
            flag = false;
            BmobUpdateAgent.initAppVersion();
        }

        JPushInterface.init(this);            // 初始化 JPush


        //短信验证

        SMSSDK.initSDK(this, ManifestUtil.getMetaDataValue(this, "mob_sms_appKey"),
                ManifestUtil.getMetaDataValue(this, "mob_sms_appSecrect"));


        OkGo.init(this);

        //以下设置的所有参数是全局参数,同样的参数可以在请求的时候再设置一遍,那么对于该请求来讲,请求中的参数会覆盖全局参数
        //好处是全局参数统一,特定请求可以特别定制参数
        try {
            //以下都不是必须的,根据需要自行选择,一般来说只需要 debug,缓存相关,cookie相关的 就可以了
            OkGo.getInstance()

                    //打开该调试开关,控制台会使用 红色error 级别打印log,并不是错误,是为了显眼,不需要就不要加入该行
                    .debug("OkGo")

                    //如果使用默认的 60秒,以下三行也不需要传
                    .setConnectTimeout(OkGo.DEFAULT_MILLISECONDS)  //全局的连接超时时间
                    .setReadTimeOut(OkGo.DEFAULT_MILLISECONDS)     //全局的读取超时时间
                    .setWriteTimeOut(OkGo.DEFAULT_MILLISECONDS)    //全局的写入超时时间

                    //可以全局统一设置缓存模式,默认是不使用缓存,可以不传,具体其他模式看 github 介绍 https://github.com/jeasonlzy0216/
                    .setCacheMode(CacheMode.NO_CACHE)

                    //可以全局统一设置缓存时间,默认永不过期,具体使用方法看 github 介绍
                    .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)

                    //如果不想让框架管理cookie,以下不需要
//                .setCookieStore(new MemoryCookieStore())                //cookie使用内存缓存(app退出后,cookie消失)
                    .setCookieStore(new PersistentCookieStore());        //cookie持久化存储,如果cookie不过期,则一直有效

            //可以设置https的证书,以下几种方案根据需要自己设置
//                    .setCertificates()                                  //方法一:信任所有证书(选一种即可)
//                    .setCertificates(getAssets().open("srca.cer"))      //方法二:也可以自己设置https证书(选一种即可)
//                    .setCertificates(getAssets().open("aaaa.bks"), "123456", getAssets().open("srca.cer"))//方法三:传入bks证书,密码,和cer证书,支持双向加密

            //可以添加全局拦截器,不会用的千万不要传,错误写法直接导致任何回调不执行
//                .addInterceptor(new Interceptor() {
//                    @Override
//                    public Response intercept(Chain chain) throws IOException {
//                        return chain.proceed(chain.request());
//                    }
//                })

            //这两行同上,不需要就不要传
            // .addCommonHeaders(headers)                                         //设置全局公共头
            // .addCommonParams(params);                                          //设置全局公共参数
        } catch (Exception e) {
            e.printStackTrace();
        }
        // initUser();
        //  Fresco.initialize(this);

//ID1105704769

        //    mTencent = Tencent.createInstance("1105704769", this);


    }
 
开发者ID:wuyinlei,项目名称:MyHearts,代码行数:82,代码来源:MyApplication.java


示例12: initView

import com.lzy.ninegrid.NineGridView; //导入依赖的package包/类
@Override
    public void initView() {
        eventid = getIntent().getStringExtra("eventid");
        mCommentCount = Integer.parseInt(getIntent().getStringExtra("commentCount"));

        totalPage = mCommentCount / 30 + 1;
        this.mLlrote = (LinearLayout) findViewById(R.id.ll_rote);
        this.mRecomment = (LinearLayout) findViewById(R.id.re_comment);
        this.mRecyclerview = (RecyclerView) findViewById(R.id.recycler_view);

        mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh);
        mRefreshLayout.setColorSchemeColors(Color.YELLOW, Color.RED, Color.BLUE, Color.GREEN);
        mRefreshLayout.post(() -> mRefreshLayout.setRefreshing(true));
        mRefreshLayout.setOnRefreshListener(this);

        FullyLinearLayoutManager manager = new FullyLinearLayoutManager(this) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        };
        mRecyclerview.setLayoutManager(manager);
        mRecyclerview.setItemAnimator(new SlideInOutTopItemAnimator(mRecyclerview));
        mCommentAdapter = new CircleFriendsCommentAdapter(this, mCircleFriendsComments);
        mRecyclerview.setAdapter(mCommentAdapter);

//        //滑动到底部自动加载更多(如果后面还有数据的话)
//        mRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
//            @Override
//            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
//                super.onScrollStateChanged(recyclerView, newState);
//
//                int lastVisiableItemPosition = manager.findLastVisibleItemPosition();
//                int itemNum = manager.getItemCount();
//                if (lastVisiableItemPosition + 1 == manager.getItemCount()) {
//                    if (!isLoading) {
//                        isLoading = true;
//                        CustomPrograss.show(CircleFriendsActivity.this,
//                                getResources().getString(R.string.loading), false, null);
//                        new Handler().postDelayed(() -> {
//                            getMoreData();
//                            isLoading = false;
//                            CustomPrograss.disMiss();
//                            // mMemberAdapter.notifyItemRemoved(mMemberAdapter.getItemCount());
//                        }, 3000);
//                    }
//                }
//            }
//        });

        this.mTvviewcount = (TextView) findViewById(R.id.tv_view_count);
        this.mIvcomment = (ImageView) findViewById(R.id.iv_comment);
        this.mTvcommentcount = (TextView) findViewById(R.id.tv_comment_count);
        this.mIvtype = (ImageView) findViewById(R.id.iv_type);
        this.mNineGrid = (NineGridView) findViewById(R.id.nineGrid);
        this.mTvcontent = (TextView) findViewById(R.id.tv_content);
        this.mImagegender = (ImageView) findViewById(R.id.image_gender);
        this.mTvtime = (TextView) findViewById(R.id.tv_time);
        this.mTvname = (TextView) findViewById(R.id.tv_name);
        this.mIvtour = (ImageView) findViewById(R.id.iv_tour);

        this.mIcBack = (ImageView) findViewById(R.id.ic_back);
        this.mIcReport = (ImageView) findViewById(R.id.ic_report);

        mScrollView = (MyScrollview) findViewById(R.id.scrollView);
        mScrollView.setVisibility(View.INVISIBLE);
        mScrollView.setOnZdyScrollViewListener(() -> {
            //加载更多数据
            CustomPrograss.show(CircleFriendsActivity.this,
                    getResources().getString(R.string.loading), false, null);
            new Handler().postDelayed(() -> getMoreData(),1000);
        });
    }
 
开发者ID:wuyinlei,项目名称:MyHearts,代码行数:74,代码来源:CircleFriendsActivity.java



注:本文中的com.lzy.ninegrid.NineGridView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamHeader类代码示例发布时间:2022-05-23
下一篇:
Java DefaultHttpClient类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap