Giter VIP home page Giter VIP logo

webcachedimageview's People

Contributors

leocadiotine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webcachedimageview's Issues

NullPointerException while inflating WebCachedImageView

Hello there

I am currently working on an app and I am using this framework to get Images from the web. Unfortunately this framework throws an exception while inflating the WebCachedImageView. It is caused by a NullPointerException while getting the External Cache dir. According to the Android Context API the Method getExternalCacheDir(), which you are using and probably is returning null, returns null in case there is no external storage is mounted. To ensure that this is the problem, I’ve tested the application on a Device using an SD card as external storage and one without. Both are throwing the same following exception:

08-10 14:20:54.985  12255-12255/ch.upndown.upndown E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{ch.upndown.upndown/ch.upndown.upndown.MainActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class com.android.internal.widget.ActionBarOverlayLayout
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
            at android.app.ActivityThread.access$700(ActivityThread.java:159)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:5419)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class com.android.internal.widget.ActionBarOverlayLayout
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
            at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3553)
            at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3616)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:357)
            at android.app.Activity.setContentView(Activity.java:1956)
            at ch.upndown.upndown.MainActivity.onCreate(MainActivity.java:18)
            at android.app.Activity.performCreate(Activity.java:5372)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
            at android.app.ActivityThread.access$700(ActivityThread.java:159)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:5419)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
            at io.leocad.webcachedimageview.CacheManager.getCacheDir(CacheManager.java:117)
            at io.leocad.webcachedimageview.CacheManager.<init>(CacheManager.java:85)
            at io.leocad.webcachedimageview.CacheManager.getInstance(CacheManager.java:43)
            at android.view.WebCachedImageView.init(WebCachedImageView.java:84)
            at android.view.WebCachedImageView.<init>(WebCachedImageView.java:37)
            at ch.upndown.upndown.MainActivity.onCreateView(MainActivity.java:39)
            at android.app.Activity.onCreateView(Activity.java:4924)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
            at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3553)
            at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3616)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:357)
            at android.app.Activity.setContentView(Activity.java:1956)
            at ch.upndown.upndown.MainActivity.onCreate(MainActivity.java:18)
            at android.app.Activity.performCreate(Activity.java:5372)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
            at android.app.ActivityThread.access$700(ActivityThread.java:159)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:5419)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
            at dalvik.system.NativeStart.main(Native Method)

The code in the layout file:

<WebCachedImageView
    android:id="@+id/website_images"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_marginBottom="5dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="5dp"/>

Best Regards
Huo

Error initializing

Im try you library. Im use Emulator, API level 17, add WebCachedImageView to ListView throw ListViewAdapter

public View getView(int pos, View child, ViewGroup parent) {
        Holder mHolder;
        LayoutInflater layoutInflater;
        if (child == null) {
            layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            child = layoutInflater.inflate(R.layout.sent_listview_item, null);
            mHolder = new Holder();
            mHolder.txt_fileName    = (TextView) child.findViewById(R.id.txt_sentLV_fileName);
            mHolder.img_preview     = (WebCachedImageView) child.findViewById(R.id.wciv);
            child.setTag(mHolder);
        } else {
            mHolder = (Holder) child.getTag();
        }
        mHolder.txt_fileName.setText(fileName.get(pos));
        return child;
    }

    public class Holder {
        WebCachedImageView img_preview;
        TextView txt_fileName;
    }

And I get this error:

11-28 15:47:51.767: ERROR/AndroidRuntime(1432): FATAL EXCEPTION: AsyncTask #1
        java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:299)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
        at java.util.concurrent.FutureTask.run(FutureTask.java:239)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
        Caused by: java.lang.NoClassDefFoundError: com.jakewharton.DiskLruCache
        at io.leocad.webcachedimageview.CacheManager$2.doInBackground(CacheManager.java:93)
        at io.leocad.webcachedimageview.CacheManager$2.doInBackground(CacheManager.java:86)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        ... 4 more

I htink error at this:

mDiskCache = DiskLruCache.open(cacheDir, 1, 1, DISK_CACHE_SIZE);

https://github.com/leocadiotine/WebCachedImageView/blob/master/code/src/io/leocad/webcachedimageview/CacheManager.java#L93
Plase help me

How to cacheImage when imageurl in JSON?

Direct image url is ok, I can cache it easily using this library. But my image url is listed in json, I can display it normally. But I happen to have problem to cache the image this way. Please advice.

Q: Use caching image from Cache in another ImageView

Hi!
Tell me plase, Is there a way Use caching image from Cache in another WebCachedImageView, because caching encoded filenames and I can not directly access the downloaded file, since I do not know his new filename, that would show this picture to a another ImageView.
Or how set disable encoded filename?
Thank you!

A bug in BitmapWorkerTask.cancelPotentialWork

I suppose Strings are not to be checked using == or != operator. Following code would be better:
BitmapWorkerTask task = getBitmapWorkerTask();
if(task != null) {
if(task.url != null) {
if(task.url.equals(url))
return false;
else
task.cancel(true);
}
}
return true;

Adding a WebCachedImageView programatically

Hi there! I try add a WebCachedImageView programatically in the instantiateItem method of my PageAdapter like this:

@OverRide
public Object instantiateItem(ViewGroup container, int position) {
WebCachedImageView imageView = new WebCachedImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageUrl(images.get(position).getUrl());
((ViewPager) container).addView(imageView, 0);
return imageView;
}

I tried in several ways with several ScaleType's but the result was the same, show only a color, or nothing. Then I changed the method to this:

@OverRide
public Object instantiateItem(ViewGroup container, int position) {
WebCachedImageView imageView = (WebCachedImageView) inflater.inflate(R.layout.item_viewpager_page, null);
imageView.setImageUrl(images.get(position).getUrl());
((ViewPager) container).addView(imageView, 0);
return imageView;
}

And now It's working, but isn't too nice given that I have to inflate a new View in each instantiateItem call. Maybe I'm using wrong the library?. Thanks, your library rulez 👯

Cache image cap when 404

Hello, please tell me in my case.
How to implement a replacement cap image if it was removed on server and receives the response 404

Error:(33, 13) Failed to resolve: io.leocad:webcachedimageview:2.0.0

I get the following error:
Error:(33, 13) Failed to resolve: io.leocad:webcachedimageview:2.0.0
Show in File
Show in Project Structure dialog

Here are the details:
classpath 'com.android.tools.build:gradle:2.2.3'

compileSdkVersion 23
buildToolsVersion '23.0.3'

defaultConfig {
    applicationId "com.saediworks.maruti"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 13
    multiDexEnabled true
    versionName "1.12"
}
buildTypes {
    release {
        minifyEnabled false
         consumerProguardFiles 'proguard-rules.txt'
    }
}

repositories {
maven { url 'http://leocad.io/mvn' }
}

dependencies {
compile 'io.leocad:webcachedimageview:2.0.0'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.