Skip to content

Commit df59425

Browse files
committed
change datasource selection, activitycreated
1 parent d3a91c7 commit df59425

File tree

10 files changed

+503
-419
lines changed

10 files changed

+503
-419
lines changed

PowerFileExplorer/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
44
package="net.gnu.explorer"
55
android:versionCode="64"
6-
android:versionName="1.0.6"
6+
android:versionName="1.0.7beta"
77
>
88

99
<!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle

PowerFileExplorer/src/main/java/com/amaze/filemanager/ui/LayoutElement.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import com.amaze.filemanager.filesystem.BaseFile;
2525
import com.amaze.filemanager.utils.OpenMode;
2626
import java.io.File;
27+
import java.io.*;
28+
import android.support.v4.content.*;
2729

28-
public class LayoutElement implements Parcelable {
30+
public class LayoutElement implements Parcelable, Serializable {
2931

3032
//private static final String CURRENT_YEAR = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
3133

@@ -149,6 +151,7 @@ public LayoutElement(Parcel im) {
149151
// lastModifiedStr = im.readString();
150152
//lengthStr = im.readString();
151153
length = im.readLong();
154+
mode = OpenMode.getOpenMode(im.readInt());
152155
bf = generateBaseFile();
153156
}
154157

@@ -175,6 +178,7 @@ public void writeToParcel(Parcel p1, int p2) {
175178
// p1.writeString(lastModifiedStr);
176179
//p1.writeString(lengthStr);
177180
p1.writeLong(length);
181+
p1.writeInt(mode.ordinal());
178182
}
179183

180184
public static final Parcelable.Creator<LayoutElement> CREATOR =

PowerFileExplorer/src/main/java/com/veinhorn/scrollgalleryview/ScreenSlidePagerAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {//}imple
2222

2323
private static final String TAG = "ScreenSlidePagerAdapter";
2424

25-
private final List<File> mListOfMedia;
25+
private final ArrayList<File> mListOfMedia;
2626
private final ViewPager viewPager;
2727
List<ComparableEntry<Integer, ImageFragment>> fragMap = new ArrayList<>(3);
2828
final GestureDetector.OnDoubleTapListener onDoubleTapListener;
@@ -31,7 +31,7 @@ public class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {//}imple
3131

3232
public ScreenSlidePagerAdapter(final FragmentManager fm,
3333
final ViewPager vp,
34-
final List<File> listOfMedia,
34+
final ArrayList<File> listOfMedia,
3535
final GestureDetector.OnDoubleTapListener onDoubleTapListener
3636
) {
3737
super(fm);

PowerFileExplorer/src/main/java/net/gnu/explorer/ArrAdapter.java

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@
4646
import net.gnu.util.FileUtil;
4747
import net.gnu.util.Util;
4848
import net.gnu.common.*;
49+
import java.util.*;
4950

5051
public class ArrAdapter extends RecyclerAdapter<LayoutElement, ArrAdapter.ViewHolder> {
5152

5253
private static final String TAG = "ArrAdapter";
5354

5455
private final int backgroundResource;
5556
private final ContentFragment contentFrag;
56-
57+
List<LayoutElement> dataSourceL2;
58+
5759
public void toggleChecked(final boolean checked) {
5860
if (checked) {
5961
contentFrag.allCbx.setSelected(true);
@@ -108,6 +110,13 @@ public ViewHolder(final View convertView) {
108110
public ArrAdapter(final ContentFragment fileFrag, final List<LayoutElement> objects) {
109111
super(objects);
110112
this.contentFrag = fileFrag;
113+
if (fileFrag.type == Frag.TYPE.EXPLORER) {
114+
if (fileFrag.slidingTabsFragment.side == SlidingTabsFragment.Side.LEFT) {
115+
dataSourceL2 = fileFrag.activity.dataSourceL2OfLeft;
116+
} else {
117+
dataSourceL2 = fileFrag.activity.dataSourceL2OfRight;
118+
}
119+
}
111120

112121
final int[] attrs = new int[]{R.attr.selectableItemBackground};
113122
final TypedArray typedArray = fileFrag.activity.obtainStyledAttributes(attrs);
@@ -209,10 +218,10 @@ public void onBindViewHolder(final ViewHolder holder, final int position) {
209218
boolean inDataSource2 = false;
210219
boolean isPartial = false;
211220
//Log.d(TAG, "dataSource2" + Util.collectionToString(dataSourceL2, true, "\n"));
212-
if (contentFrag.multiFiles && contentFrag.dataSourceL2 != null) {
221+
if (contentFrag.multiFiles && dataSourceL2 != null) {
213222
final String fPathD = fPath + "/";
214223
String f2Path;
215-
for (LayoutElement f2 : contentFrag.dataSourceL2) {
224+
for (LayoutElement f2 : dataSourceL2) {
216225
f2Path = f2.path;
217226
if (f2.equals(le) || fPath.startsWith(f2Path + "/")) {
218227
inDataSource2 = true;
@@ -632,15 +641,15 @@ public void onMenuModeChange(MenuBuilder menu) {}
632641
} else {
633642
final int id = v.getId();
634643
if (contentFrag.multiFiles) {// || fileFrag.suffix != null && fileFrag.suffix.length() == 0
635-
boolean inSelected = false;
636-
if (contentFrag.dataSourceL2 != null)
637-
for (LayoutElement st : contentFrag.dataSourceL2) {
638-
if (rowItem.path.equals(st.path) || fPath.startsWith(st.path + "/")) {
639-
inSelected = true;
640-
break;
641-
}
642-
}
643-
if (!inSelected) {
644+
// boolean inSelected = false;
645+
// if (dataSourceL2 != null)
646+
// for (LayoutElement st : dataSourceL2) {
647+
// if (rowItem.path.equals(st.path) || fPath.startsWith(st.path + "/")) {
648+
// inSelected = true;
649+
// break;
650+
// }
651+
// }
652+
// if (!inSelected) {
644653
if (id == R.id.icon) {
645654
contentFrag.tempPreviewL2 = rowItem;
646655
notifyDataSetChanged();
@@ -726,41 +735,41 @@ public void onMenuModeChange(MenuBuilder menu) {}
726735
contentFrag.selectionStatusTV.setText(contentFrag.selectedInList1.size()
727736
+ "/" + contentFrag.dataSourceL1.size());
728737
}
729-
} else { // inselected
730-
if (id == R.id.icon) { //dir
731-
contentFrag.tempPreviewL2 = rowItem;
732-
notifyDataSetChanged();
733-
if (f.isFile()) {
734-
load(rowItem, f, fPath, pos);
735-
} else if (contentFrag.slidingTabsFragment.side == SlidingTabsFragment.Side.LEFT) {//ContentFragment dir//fileFrag.type == -1
736-
if (contentFrag.activity.slideFrag2 != null) {
737-
Frag frag = contentFrag.activity.slideFrag2.getCurrentFragment();
738-
if (frag.type == Frag.TYPE.EXPLORER) {
739-
((ContentFragment)frag).changeDir(path, true);
740-
} else {
741-
contentFrag.activity.slideFrag2.setCurrentItem(contentFrag.activity.slideFrag2.indexOfAdapter(contentFrag.activity.curExplorerFrag), true);
742-
contentFrag.activity.curExplorerFrag.changeDir(path, true);
743-
}
744-
}
745-
} else {//dir
746-
//if (fileFrag.activity.slideFrag2 != null) {
747-
Frag frag = contentFrag.activity.slideFrag.getCurrentFragment();
748-
if (frag.type == Frag.TYPE.EXPLORER) {
749-
((ContentFragment)frag).changeDir(path, true);
750-
} else {
751-
contentFrag.activity.slideFrag.setCurrentItem(contentFrag.activity.slideFrag.indexOfAdapter(contentFrag.activity.curContentFrag), true);
752-
contentFrag.activity.curContentFrag.changeDir(path, true);
753-
}
754-
}
755-
} else if (f.isFile()) {
756-
// if (v.getId() == R.id.icon) {
757-
// contentFrag.tempPreviewL2 = rowItem;
738+
// } else { // inselected
739+
// if (id == R.id.icon) { //dir
740+
// contentFrag.tempPreviewL2 = rowItem;
741+
// notifyDataSetChanged();
742+
// if (f.isFile()) {
758743
// load(rowItem, f, fPath, pos);
759-
// } else {
760-
openFile(rowItem, f, fPath);
744+
// } else if (contentFrag.slidingTabsFragment.side == SlidingTabsFragment.Side.LEFT) {//ContentFragment dir//fileFrag.type == -1
745+
// if (contentFrag.activity.slideFrag2 != null) {
746+
// Frag frag = contentFrag.activity.slideFrag2.getCurrentFragment();
747+
// if (frag.type == Frag.TYPE.EXPLORER) {
748+
// ((ContentFragment)frag).changeDir(path, true);
749+
// } else {
750+
// contentFrag.activity.slideFrag2.setCurrentItem(contentFrag.activity.slideFrag2.indexOfAdapter(contentFrag.activity.curExplorerFrag), true);
751+
// contentFrag.activity.curExplorerFrag.changeDir(path, true);
752+
// }
753+
// }
754+
// } else {//dir
755+
// //if (fileFrag.activity.slideFrag2 != null) {
756+
// Frag frag = contentFrag.activity.slideFrag.getCurrentFragment();
757+
// if (frag.type == Frag.TYPE.EXPLORER) {
758+
// ((ContentFragment)frag).changeDir(path, true);
759+
// } else {
760+
// contentFrag.activity.slideFrag.setCurrentItem(contentFrag.activity.slideFrag.indexOfAdapter(contentFrag.activity.curContentFrag), true);
761+
// contentFrag.activity.curContentFrag.changeDir(path, true);
762+
// }
761763
// }
762-
}
763-
}
764+
// } else if (f.isFile()) {
765+
//// if (v.getId() == R.id.icon) {
766+
//// contentFrag.tempPreviewL2 = rowItem;
767+
//// load(rowItem, f, fPath, pos);
768+
//// } else {
769+
// openFile(rowItem, f, fPath);
770+
//// }
771+
// }
772+
// }
764773
} else { //!multifile no preview
765774
if (id == R.id.cbx) {
766775
// chọn mới đầu tiên
@@ -1144,8 +1153,8 @@ public boolean onLongClick(final View v) {
11441153
Log.d(TAG, "multiFiles " + contentFrag.multiFiles);
11451154

11461155
boolean inSelectedFiles = false;
1147-
if (contentFrag.dataSourceL2 != null)
1148-
for (LayoutElement st : contentFrag.dataSourceL2) {
1156+
if (dataSourceL2 != null)
1157+
for (LayoutElement st : dataSourceL2) {
11491158
if (f.equals(st) || fPath.startsWith(st.path + "/")) {
11501159
inSelectedFiles = true;
11511160
break;

0 commit comments

Comments
 (0)