Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load from cloud #60

Open
TequilaZhang opened this issue Jun 12, 2014 · 6 comments
Open

load from cloud #60

TequilaZhang opened this issue Jun 12, 2014 · 6 comments

Comments

@TequilaZhang
Copy link

I have a default GestureImageView . when I load pic from cloud.I want pic to replace the default, it changed,but I still can see the old one.When I click, It show the picture from the cloud that I need.But I don not know Why I need click?

@shailendra123
Copy link

Very hard to say anything without having a look into code. can you post your query along with code at stackoverflow as well. will try to answer you there

@TequilaZhang
Copy link
Author

pic2

@TequilaZhang
Copy link
Author

@shailendra123 ,I have not enough reputation on stackoverflow,
and when click ,the pic changed clear

@TequilaZhang
Copy link
Author

@shailendra123 ,the girl is load from cloud,the file picture is the default, when i click ,it become clear.

@TequilaZhang
Copy link
Author

public class PreviewActivity extends ActivityWithTitleBar {

public final static String BUNDLE_KEY_FILE_METADATA = "PreviewFile";

private GestureImageView mPreviewImage;
private CommonFile mFile ;
//private FrameLayout mProgressBar;
private ProgressDialog mProgressDialog;
private Dialog mDeleteDialog;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    if(intent != null) {
        mFile = (CommonFile) intent.getSerializableExtra(BUNDLE_KEY_FILE_METADATA);     
    }
    mActionBar.setTitle(mFile.getFileName());
    //mProgressBar.setVisibility(View.VISIBLE);
    initDialog();

    if(mFile != null){

        mFile.getPreviewContent(R.drawable.thumnail_placeholder, mPreviewImage, new onCachedItemLoadListener<String, Bitmap>() {

            @Override
            public void onCachedItemLoadFinished(final String key,  final int errorCode) {
                if (BackupFileException.ErrorOk == errorCode) {
                    if (mFile.getCloudId().equals(key)) {
                        runOnUiThread(new Runnable() {
                            public void run() {
                                //mProgressBar.setVisibility(View.GONE);
                                mPreviewImage.redraw();;

                            }
                        });
                    }
                } else {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            //mProgressBar.setVisibility(View.GONE);
                        }
                    });
                }                   
            }

            @Override
            public void onCachedItemLoadProgress(String key,
                    long currentSize, long totalSize) {
            }
        });
    }
}

@TequilaZhang
Copy link
Author

@shailendra123
in getPreviewContent function:when the drawable is downloaded from cloud. it will call mPreviewImage.setImageDrawable(drawable )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants