Skip to content

Commit

Permalink
Merge pull request #152 from kaczmarkiewiczp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
patrykcoding authored Jun 28, 2018
2 parents a45feab + 32c0b31 commit 355621d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ public class FileExplorerFragment extends Fragment implements FileExplorerRecy
private boolean isInMoveMode;
private SpeedDialView fab;
private MenuItem menuSelectAll;
private MenuItem menuGoTo;
private MenuItem menuLink;
private MenuItem menuHttpServe;
private MenuItem menuEmptyTrash;
private Boolean isDarkTheme;
private Boolean isSearchMode;
private String searchString;
Expand Down Expand Up @@ -490,10 +494,11 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.file_explorer_folder_menu, menu);
menuSelectAll = menu.findItem(R.id.action_select_all);
menuGoTo = menu.findItem(R.id.action_go_to);
menuLink = menu.findItem(R.id.action_link);
menuHttpServe = menu.findItem(R.id.action_http_serve);
menuEmptyTrash = menu.findItem(R.id.action_empty_trash);

if (isInMoveMode) {
menuSelectAll.setVisible(false);
}
if (!remote.hasTrashCan()) {
menu.findItem(R.id.action_empty_trash).setVisible(false);
}
Expand All @@ -504,6 +509,32 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.findItem(R.id.action_go_to).setVisible(false);
}
menu.findItem(R.id.action_wrap_filenames).setChecked(true);

if (isInMoveMode || recyclerViewAdapter.isInSelectMode()) {
setOptionsMenuVisibility(false);
}
}

private void setOptionsMenuVisibility(boolean setVisible) {
if (menuSelectAll == null || menuGoTo == null || menuLink == null || menuHttpServe == null || menuEmptyTrash == null) {
return;
}

menuHttpServe.setVisible(setVisible);
if (!setVisible && isInMoveMode) {
menuSelectAll.setVisible(false);
} else {
menuSelectAll.setVisible(true);
}
if (!remote.isCrypt()) {
menuLink.setVisible(setVisible);
}
if (remote.hasTrashCan()) {
menuEmptyTrash.setVisible(setVisible);
}
if (remote.isRemoteType(RemoteItem.SFTP)) {
menuGoTo.setVisible(setVisible);
}
}

@Override
Expand Down Expand Up @@ -778,7 +809,7 @@ private void cancelMoveClicked() {
hideMoveBar();
fab.show();
fab.setVisibility(View.VISIBLE);
menuSelectAll.setVisible(true);
setOptionsMenuVisibility(true);
recyclerViewAdapter.refreshData();

if (moveStartPath != null && !moveStartPath.equals(directoryObject.getCurrentPath())) {
Expand Down Expand Up @@ -808,7 +839,7 @@ private void moveLocationSelected() {
hideMoveBar();
fab.show();
fab.setVisibility(View.VISIBLE);
menuSelectAll.setVisible(true);
setOptionsMenuVisibility(true);
recyclerViewAdapter.setMoveMode(false);
recyclerViewAdapter.refreshData();
isInMoveMode = false;
Expand Down Expand Up @@ -990,6 +1021,9 @@ public boolean onBackButtonPressed() {
} else if (pathStack.isEmpty()) {
return false;
}
if (!isInMoveMode && !recyclerViewAdapter.isInSelectMode()) {
fab.show();
}
if (fetchDirectoryTask != null) {
fetchDirectoryTask.cancel(true);
}
Expand Down Expand Up @@ -1043,6 +1077,9 @@ public void onDirectoryClicked(FileItem fileItem, int position) {
breadcrumbView.addCrumb(fileItem.getName(), fileItem.getPath());
swipeRefreshLayout.setRefreshing(true);
pathStack.push(directoryObject.getCurrentPath());
if (!isInMoveMode && !recyclerViewAdapter.isInSelectMode()) {
fab.show();
}

if (isSearchMode) {
searchClicked();
Expand Down Expand Up @@ -1083,6 +1120,7 @@ private void handleFilesSelected() {
showBottomBar();
fab.hide();
fab.setVisibility(View.INVISIBLE);
setOptionsMenuVisibility(false);
if (numOfSelected > 1) {
((FragmentActivity) context).findViewById(R.id.file_rename).setAlpha(.5f);
((FragmentActivity) context).findViewById(R.id.file_rename).setClickable(false);
Expand All @@ -1100,6 +1138,7 @@ public void onFileDeselected() {
hideBottomBar();
fab.show();
fab.setVisibility(View.VISIBLE);
setOptionsMenuVisibility(true);
}
}

Expand Down Expand Up @@ -1172,6 +1211,9 @@ public void onBreadCrumbClicked(String path) {
if (isSearchMode) {
searchClicked();
}
if (!isInMoveMode && !recyclerViewAdapter.isInSelectMode()) {
fab.show();
}
if (directoryObject.getCurrentPath().equals(path)) {
return;
}
Expand Down Expand Up @@ -1298,7 +1340,7 @@ private void moveFiles(List<FileItem> moveItems) {
isInMoveMode = true;
((FragmentActivity) context).setTitle(getString(R.string.select_destination));
((FragmentActivity) context).findViewById(R.id.move_bar).setVisibility(View.VISIBLE);
menuSelectAll.setVisible(false);
setOptionsMenuVisibility(false);
fab.hide();
fab.setVisibility(View.INVISIBLE);
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/dialog_file_properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
android:text="@string/filename"/>
<TextView
Expand All @@ -26,7 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:textColor="?attr/textColorPrimary"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
android:text="@string/modified_time"/>
<TextView
Expand All @@ -41,7 +41,7 @@
android:id="@+id/file_size_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textColor="?attr/colorAccent"
android:paddingTop="16dp"
android:textStyle="bold"
android:text="@string/size"/>
Expand Down Expand Up @@ -71,7 +71,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
android:text="@string/md5"/>
<TextView
Expand All @@ -90,7 +90,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textColor="?attr/colorAccent"
android:paddingTop="16dp"
android:textStyle="bold"
android:text="@string/sha1"/>
Expand Down

0 comments on commit 355621d

Please sign in to comment.