Java Code Examples for com.socks.jiandan.view.imageloader.ImageLoadProxy

The following examples show how to use com.socks.jiandan.view.imageloader.ImageLoadProxy. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: JianDan   Source File: JDApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    mContext = this;
    ImageLoadProxy.initImageLoader(this);

    if (BuildConfig.DEBUG) {
        Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL);
    }

    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());

}
 
Example 2
Source Project: JianDan_OkHttpWithVolley   Source File: JDApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    mContext = this;
    ImageLoadProxy.initImageLoader(this);

    if (BuildConfig.DEBUG) {
        Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL);
    }
}
 
Example 3
Source Project: JianDan_OkHttpWithVolley   Source File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(getActivity()).watch(this);
    RequestManager.cancelAll(this);
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 4
Source Project: JianDan_OkHttpWithVolley   Source File: FreshNewsAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) {
    this.mActivity = activity;
    this.isLargeMode = isLargeMode;
    this.mLoadFinisCallBack = loadFinisCallBack;
    this.mLoadResultCallBack = loadResultCallBack;
    mFreshNews = new ArrayList<>();

    int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small;
    options = ImageLoadProxy.getOptions4PictureList(loadingResource);
}
 
Example 5
@Override
protected void onDestroy() {
    super.onDestroy();
    if (connection != null && connection.isConnected()) {
        connection.disconnect();
    }

    if (img.getVisibility() == View.VISIBLE) {
        ImageLoadProxy.getImageLoader().cancelDisplayTask(img);
    }
}
 
Example 6
Source Project: JianDan   Source File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(getActivity()).watch(this);
    RequestManager.cancelAll(this);
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 7
Source Project: JianDan   Source File: FreshNewsAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) {
    this.mActivity = activity;
    this.isLargeMode = isLargeMode;
    this.mLoadFinisCallBack = loadFinisCallBack;
    this.mLoadResultCallBack = loadResultCallBack;
    mFreshNews = new ArrayList<>();

    int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small;
    options = ImageLoadProxy.getOptions4PictureList(loadingResource);
}
 
Example 8
Source Project: JianDan   Source File: ImageDetailActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    if (connection != null && connection.isConnected()) {
        connection.disconnect();
    }

    if (img.getVisibility() == View.VISIBLE) {
        ImageLoadProxy.getImageLoader().cancelDisplayTask(img);
    }
}
 
Example 9
Source Project: JianDanRxJava   Source File: FreshNewsAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public FreshNewsAdapter(BaseActivity activity, LoadFinishCallBack<Object> loadFinisCallBack, LoadResultCallBack loadResultCallBack) {
    this.mActivity = activity;
    this.isLargeMode = SPHelper.getBoolean(SettingFragment.ENABLE_FRESH_BIG, true);
    this.mLoadFinisCallBack = loadFinisCallBack;
    this.mLoadResultCallBack = loadResultCallBack;
    mFreshNews = new ArrayList<>();

    int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small;
    options = ImageLoadProxy.getOptions4PictureList(loadingResource);
}
 
Example 10
Source Project: JianDanRxJava   Source File: JDApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    mContext = this;

    refWatcher = LeakCanary.install(this);
    ImageLoadProxy.initImageLoader(this);
    initHttpClient();
    SPHelper.init(mContext);
    KLog.init(BuildConfig.DEBUG);
}
 
Example 11
Source Project: JianDanRxJava   Source File: ImageDetailActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    if (connection != null && connection.isConnected()) {
        connection.disconnect();
    }

    if (img.getVisibility() == View.VISIBLE) {
        ImageLoadProxy.getImageLoader().cancelDisplayTask(img);
    }
}
 
Example 12
Source Project: JianDan_OkHttp   Source File: JDApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    mContext = this;
    ImageLoadProxy.initImageLoader(this);

    if (BuildConfig.DEBUG) {
        Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL);
    }
}
 
Example 13
Source Project: JianDan_OkHttp   Source File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(getActivity()).watch(this);
    RequestManager.cancelAll(this);
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 14
Source Project: JianDan_OkHttp   Source File: FreshNewsAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) {
    this.mActivity = activity;
    this.isLargeMode = isLargeMode;
    this.mLoadFinisCallBack = loadFinisCallBack;
    this.mLoadResultCallBack = loadResultCallBack;
    mFreshNews = new ArrayList<>();

    int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small;
    options = ImageLoadProxy.getOptions4PictureList(loadingResource);
}
 
Example 15
Source Project: JianDan_OkHttp   Source File: ImageDetailActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    if (connection != null && connection.isConnected()) {
        connection.disconnect();
    }

    if (img.getVisibility() == View.VISIBLE) {
        ImageLoadProxy.getImageLoader().cancelDisplayTask(img);
    }
}
 
Example 16
Source Project: JianDan_OkHttpWithVolley   Source File: PictureFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    //清除内存缓存,避免由于内存缓存造成的图片显示不完整
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 17
Source Project: JianDan   Source File: PictureFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    //清除内存缓存,避免由于内存缓存造成的图片显示不完整
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 18
Source Project: JianDanRxJava   Source File: BaseFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    JDApplication.getRefWatcher(getActivity()).watch(this);
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 19
Source Project: JianDanRxJava   Source File: PictureAdapter.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onBindViewHolder(final PictureViewHolder holder, final int position) {

    final Picture picture = mPictures.get(position);
    String picUrl = picture.getPics()[0];

    if (picUrl.endsWith(".gif")) {
        holder.img_gif.setVisibility(View.VISIBLE);
        //非WIFI网络情况下,GIF图只加载缩略图,详情页才加载真实图片
        if (!isWifiConnected) {
            picUrl = picUrl.replace("mw600", "small").replace("mw1200", "small").replace
                    ("large", "small");
        }
    } else {
        holder.img_gif.setVisibility(View.GONE);
    }

    holder.progress.setProgress(0);
    holder.progress.setVisibility(View.VISIBLE);

    ImageLoadProxy.displayImageList(picUrl, holder.img, R.drawable.ic_loading_large, new
                    SimpleImageLoadingListener() {
                        @Override
                        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                            super.onLoadingComplete(imageUri, view, loadedImage);
                            holder.progress.setVisibility(View.GONE);
                        }
                    },
            (imageUri, view, current, total) -> holder.progress.setProgress((int) (current * 100f / total)));

    if (TextUtil.isNull(picture.getText_content().trim())) {
        holder.tv_content.setVisibility(View.GONE);
    } else {
        holder.tv_content.setVisibility(View.VISIBLE);
        holder.tv_content.setText(picture.getText_content().trim());
    }

    holder.img.setOnClickListener(v -> IntentHelper.toImageDetailActivity(mActivity, picture));

    holder.tv_author.setText(picture.getComment_author());
    holder.tv_time.setText(String2TimeUtil.dateString2GoodExperienceFormat(picture.getComment_date()));
    holder.tv_like.setText(picture.getVote_positive());
    holder.tv_comment_count.setText(picture.getComment_counts());

    //用于恢复默认的文字
    holder.tv_like.setTypeface(Typeface.DEFAULT);
    holder.tv_like.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));
    holder.tv_support_des.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));

    holder.tv_unlike.setText(picture.getVote_negative());
    holder.tv_unlike.setTypeface(Typeface.DEFAULT);
    holder.tv_unlike.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));
    holder.tv_un_support_des.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));

    holder.img_share.setOnClickListener(v -> new MaterialDialog.Builder(mActivity)
            .items(R.array.picture_dialog)
            .backgroundColor(mActivity.getResources().getColor(JDApplication.COLOR_OF_DIALOG))
            .contentColor(JDApplication.COLOR_OF_DIALOG_CONTENT)
            .itemsCallback((dialog, view, which, text) -> {

                switch (which) {
                    case 0:
                        ShareUtil.sharePicture(mActivity, picture
                                .getPics()[0]);
                        break;
                    case 1:
                        FileUtil.savePicture(picture
                                .getPics()[0], mSaveFileCallBack);
                        break;
                }
            })
            .show());

    holder.ll_comment.setOnClickListener(v -> {
        Intent intent = new Intent(mActivity, CommentListActivity.class);
        intent.putExtra(BaseActivity.DATA_THREAD_KEY, "comment-" + picture.getComment_ID());
        mActivity.startActivity(intent);
    });

    setAnimation(holder.card, position);

}
 
Example 20
Source Project: JianDan_OkHttp   Source File: PictureFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    //清除内存缓存,避免由于内存缓存造成的图片显示不完整
    ImageLoadProxy.getImageLoader().clearMemoryCache();
}
 
Example 21
/**
 * 如果需要显示图片,需要设置这几个参数,快速滑动时,暂停图片加载
 *
 * @param pauseOnScroll
 * @param pauseOnFling
 */
public void setOnPauseListenerParams(boolean pauseOnScroll, boolean pauseOnFling) {
    addOnScrollListener(new AutoLoadScrollListener(ImageLoadProxy.getImageLoader(), pauseOnScroll, pauseOnFling));
}
 
Example 22
Source Project: JianDan   Source File: AutoLoadRecyclerView.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 如果需要显示图片,需要设置这几个参数,快速滑动时,暂停图片加载
 *
 * @param pauseOnScroll
 * @param pauseOnFling
 */
public void setOnPauseListenerParams(boolean pauseOnScroll, boolean pauseOnFling) {
    addOnScrollListener(new AutoLoadScrollListener(ImageLoadProxy.getImageLoader(), pauseOnScroll, pauseOnFling));
}
 
Example 23
Source Project: JianDanRxJava   Source File: AutoLoadRecyclerView.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 如果需要显示图片,需要设置这几个参数,快速滑动时,暂停图片加载
 *
 * @param pauseOnScroll
 * @param pauseOnFling
 */
public void setOnPauseListenerParams(boolean pauseOnScroll, boolean pauseOnFling) {
    addOnScrollListener(new AutoLoadScrollListener(ImageLoadProxy.getImageLoader(), pauseOnScroll, pauseOnFling));
}
 
Example 24
Source Project: JianDan_OkHttp   Source File: AutoLoadRecyclerView.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 如果需要显示图片,需要设置这几个参数,快速滑动时,暂停图片加载
 *
 * @param pauseOnScroll
 * @param pauseOnFling
 */
public void setOnPauseListenerParams(boolean pauseOnScroll, boolean pauseOnFling) {
    addOnScrollListener(new AutoLoadScrollListener(ImageLoadProxy.getImageLoader(), pauseOnScroll, pauseOnFling));
}