import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.content.ClipData;
+import android.content.ClipDescription;
import android.content.Context;
import android.content.Intent;
import android.content.ActivityNotFoundException;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ImageView.ScaleType;
import android.widget.Toast;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.net.Uri;
-import android.util.Log;
public class DirContentActivity extends Fragment implements OnItemClickListener,
OnSetingsChangeListener,
} else if(!mShowGrid) {
mDelegate = new DataAdapter(mContext, R.layout.list_content_layout, mData);
mList.setVisibility(View.VISIBLE);
- mList.setOnItemClickListener(this);
mList.setAdapter(mDelegate);
+ mList.setOnItemClickListener(this);
mList.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
v.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View v) {
int ret = mMultiSelect.clearFileEntry(file.getPath());
mMultiSelectView.removeViewAt(ret);
}
}
if(file.isDirectory() && !mActionModeSelected ) {
- if (mThumbnail != null)
+ if (mThumbnail != null) {
+ mThumbnail.setCancelThumbnails(true);
mThumbnail = null;
+ }
addBackButton(name, true);
if(mActionModeSelected || mMultiSelectOn)
return;
- if (mThumbnail != null)
+ if (mThumbnail != null) {
+ mThumbnail.setCancelThumbnails(true);
mThumbnail = null;
+ }
mData = mFileMang.setHomeDir(name);
mDelegate.notifyDataSetChanged();
if(mActionModeSelected || mMultiSelectOn)
return;
+ if (mThumbnail != null) {
+ mThumbnail.setCancelThumbnails(true);
+ mThumbnail = null;
+ }
+
if(index != (mPathView.getChildCount() - 1)) {
while(index < mPathView.getChildCount() - 1)
mPathView.removeViewAt(mPathView.getChildCount() - 1);
import android.content.Context;
import android.view.View;
-import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
-import android.util.Log;
import java.util.ArrayList;
import java.io.File;
public void cancelMultiSelect() {
mFileList.clear();
mFileList = null;
- mInstance = null;
-
- Log.e("MULTISELECT", "cancel called");
+ mInstance = null;
}
private void setImage(String extension, ImageView image) {
private ArrayList<String> mFiles;
private String mDir;
private Handler mHandler;
+ private boolean mStop = false;
public ThumbnailCreator(int width, int height) {
mHeight = height;
public BitmapDrawable isBitmapCached(String name) {
return mCacheMap.get(name);
}
+
+ public void createNewThumbnail(ArrayList<String> files, String dir, Handler handler) {
+ this.mFiles = files;
+ this.mDir = dir;
+ this.mHandler = handler;
+ }
+
+ public void setCancelThumbnails(boolean stop) {
+ mStop = stop;
+ }
@Override
public void run() {
int len = mFiles.size();
- for (int i = 0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
+ if (mStop) {
+ mStop = false;
+ mFiles = null;
+ return;
+ }
+
final File file = new File(mDir + "/" + mFiles.get(i));
if (isImageFile(file.getName())) {
}
}
- public void createNewThumbnail(ArrayList<String> files, String dir, Handler handler) {
- this.mFiles = files;
- this.mDir = dir;
- this.mHandler = handler;
- }
-
private boolean isImageFile(String file) {
String ext = file.substring(file.lastIndexOf(".") + 1);