fix wrong show of sort/list group and FAB in details or text preview

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-07-09 07:43:20 +02:00
parent e3121bf18d
commit be9d4facce
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 12 additions and 3 deletions

View file

@ -1046,6 +1046,8 @@ public class FileDisplayActivity extends FileActivity
}
if (listOfFiles != null) { // should never be null, indeed
setFile(listOfFiles.getCurrentFile());
listOfFiles.setFabVisible(true);
showSortListGroup(true);
}
cleanSecondFragment();
}
@ -2159,6 +2161,7 @@ public class FileDisplayActivity extends FileActivity
*/
public void startTextPreview(OCFile file, boolean showPreview) {
if (showPreview) {
showSortListGroup(false);
Bundle args = new Bundle();
args.putParcelable(EXTRA_FILE, file);
args.putParcelable(EXTRA_ACCOUNT, getAccount());

View file

@ -246,6 +246,10 @@ public abstract class ToolbarActivity extends BaseActivity {
setPreviewImageVisibility(false);
}
public void showSortListGroup(boolean show) {
findViewById(R.id.sort_list_button_group).setVisibility(show ? View.VISIBLE : View.GONE);
}
/**
* Change the bitmap for the toolbar's preview image.
*

View file

@ -171,6 +171,7 @@ public class FileFragment extends Fragment {
*/
void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading);
void showSortListGroup(boolean show);
}
}

View file

@ -28,7 +28,6 @@ import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Build;
@ -125,7 +124,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
@ -996,6 +994,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
} else if (file.isDown() && MimeTypeUtil.isVCard(file)) {
((FileDisplayActivity) mContainerActivity).startContactListFragment(file);
} else if (PreviewTextFileFragment.canBePreviewed(file)) {
setFabVisible(false);
((FileDisplayActivity) mContainerActivity).startTextPreview(file, false);
} else if (file.isDown()) {
if (PreviewMediaFragment.canBePreviewed(file)) {
@ -1114,6 +1113,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
mActiveActionMode.finish();
}
mContainerActivity.showDetails(singleFile);
setFabVisible(false);
mContainerActivity.showSortListGroup(false);
return true;
}
case R.id.action_set_as_wallpaper: {
@ -1752,7 +1753,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
*
* @param visible Desired visibility for the FAB.
*/
void setFabVisible(final boolean visible) {
public void setFabVisible(final boolean visible) {
if (mFabMain == null) {
// is not available in FolderPickerActivity
return;