Skip to content

Commit

Permalink
Fix action bar icon
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Sep 4, 2024
1 parent 96916a5 commit 3a7c201
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,17 @@ public void onDrawerOpened(View drawerView) {
mDrawerLayout.addDrawerListener(mDrawerToggle);
mDrawerToggle.setDrawerIndicatorEnabled(true);
mDrawerToggle.setDrawerSlideAnimationEnabled(true);
setActionBarLeadingIcon(R.drawable.ic_arrow_back);
}

public void setActionBarLeadingIcon(int id) {
Drawable backArrow = ResourcesCompat.getDrawable(getResources(),
R.drawable.ic_arrow_back,
id,
null);

viewThemeUtils.platform.tintToolbarArrowDrawable(this, mDrawerToggle, backArrow);
if (backArrow != null) {
viewThemeUtils.platform.tintToolbarArrowDrawable(this, mDrawerToggle, backArrow);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1020,18 +1020,25 @@ public void onBackPressed() {
final Fragment leftFragment = getLeftFragment();
if (leftFragment instanceof OCFileListFragment listOfFiles) {
OCFile currentDir = getCurrentDir();
OCFile parentDir = fileDataStorageManager.getFileById(currentDir.getParentId());

if (isRoot(currentDir)) {
finish();
} else if (parentDir != null && parentDir.isRoot()) {
openDrawer();
} else {
browseUp(listOfFiles);
return;
}

OCFile secondParentDir = fileDataStorageManager.getNthParent(currentDir, 2);
if (secondParentDir != null && secondParentDir.isRoot()) {
filterCurrentDirectory();
browseUp(listOfFiles);

if (menuItemId == R.id.nav_favorites || menuItemId == R.id.nav_shared) {
OCFile parentDir = fileDataStorageManager.getFileById(currentDir.getParentId());
if (parentDir != null && parentDir.isRoot()) {
openDrawer();
} else {
browseUp(listOfFiles);

OCFile secondParentDir = fileDataStorageManager.getNthParent(currentDir, 2);
if (secondParentDir != null && secondParentDir.isRoot()) {
filterCurrentDirectory();
setActionBarLeadingIcon(R.drawable.ic_menu);
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,10 @@ private void fileOnItemClick(OCFile file) {
@Override
@OptIn(markerClass = UnstableApi.class)
public void onItemClicked(OCFile file) {
if (mContainerActivity != null && mContainerActivity instanceof FileActivity fileActivity) {
fileActivity.setActionBarLeadingIcon(R.drawable.ic_arrow_back);
}

if (getCommonAdapter() != null && getCommonAdapter().isMultiSelect()) {
toggleItemToCheckedList(file);
} else {
Expand Down

0 comments on commit 3a7c201

Please sign in to comment.