Skip to content

Commit

Permalink
fix: Margin of snackbar in single media activity (#2902)
Browse files Browse the repository at this point in the history
  • Loading branch information
codedsun authored and iamareebjamal committed Nov 1, 2019
1 parent 2786c12 commit 0436c58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.new_file_created),
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
}
// adapter.notifyDataSetChanged();
} catch (Exception e) {
Log.e("ERROS - uCrop", imageUri.toString(), e);
}
} else
SnackBarHandler.showWithBottomMargin(
parentView, "errori random", (bottomBar.getHeight() * 2) - 22);
parentView, "errori random", parentView.getHeight() - bottomBar.getTop());
break;
default:
break;
Expand Down Expand Up @@ -871,7 +871,7 @@ private void deleteCurrentMedia() {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.trashbin_move_onefile),
bottomBar.getHeight() + navigationView.getHeight(),
parentView.getHeight() - bottomBar.getTop(),
Snackbar.LENGTH_SHORT);
snackbar.setAction(
R.string.open,
Expand All @@ -888,7 +888,7 @@ public void onClick(View view) {
SnackBarHandler.showWithBottomMargin(
parentView,
getApplicationContext().getString(R.string.photo_deleted_msg),
bottomBar.getHeight() + navigationView.getHeight());
parentView.getHeight() - bottomBar.getTop());
snackbar.show();
}
if (!success) {
Expand Down Expand Up @@ -1210,7 +1210,7 @@ public void onClick(DialogInterface dialog, int id) {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.photo_deleted_from_fav_msg),
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
}
});
AlertDialog alertDialog = deleteDialog.create();
Expand Down Expand Up @@ -1258,7 +1258,7 @@ public void folderSelected(String path) {
SnackBarHandler.showWithBottomMargin(
relativeLayout,
getString(R.string.copied_successfully) + " to " + path,
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
}
}
});
Expand Down Expand Up @@ -1497,7 +1497,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.rename_no_change),
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
renameDialog.dismiss();
} else {
int index = file.getPath().lastIndexOf("/");
Expand Down Expand Up @@ -1669,7 +1669,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
SnackBarHandler.showWithBottomMargin(
parentView,
getResources().getString(R.string.add_favourite),
bottomBar.getHeight());
parentView.getHeight() - bottomBar.getTop());
snackbar.setAction(
R.string.openfav,
new View.OnClickListener() {
Expand Down Expand Up @@ -1755,7 +1755,7 @@ public void folderSelected(String path) {
SnackBarHandler.showWithBottomMargin(
relativeLayout,
getString(R.string.photo_moved_successfully) + " to " + path,
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
}
});
bottomSheetDialogFragment.show(
Expand All @@ -1769,14 +1769,18 @@ public void folderSelected(String path) {
AlbumSettings.getSettings(getApplicationContext(), getAlbum());
albumSettings.changeCoverPath(getApplicationContext(), getAlbum().getMedia(0).getPath());
SnackBarHandler.showWithBottomMargin(
parentView, getString(R.string.cover_removed), (bottomBar.getHeight() * 2) - 22);
parentView,
getString(R.string.cover_removed),
parentView.getHeight() - bottomBar.getTop());
} else {
AlbumSettings albumSettings =
AlbumSettings.getSettings(getApplicationContext(), getAlbum());
albumSettings.changeCoverPath(
getApplicationContext(), getAlbum().getCurrentMedia().getPath());
SnackBarHandler.showWithBottomMargin(
parentView, getString(R.string.change_cover), bottomBar.getHeight());
parentView,
getString(R.string.change_cover),
parentView.getHeight() - bottomBar.getTop());
MenuItem cover = menu.findItem(R.id.action_cover);
cover.setTitle("Remove cover image");
}
Expand Down Expand Up @@ -1936,15 +1940,15 @@ public void onClick(View v) {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.description_saved),
(bottomBar.getHeight() * 2) - 22);
(parentView.getHeight() - bottomBar.getTop()));
} else {
databaseHelper.update(
new ImageDescModel(
pathForDescription, editTextDescription.getText().toString()));
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.description_updated),
(bottomBar.getHeight() * 2) - 22);
parentView.getHeight() - bottomBar.getTop());
}
}
});
Expand All @@ -1963,7 +1967,7 @@ public void onClick(View v) {
SnackBarHandler.showWithBottomMargin(
parentView,
getString(R.string.description_deleted),
(bottomBar.getHeight() * 2) - 22);
(parentView.getHeight() - bottomBar.getTop()));
}
}
});
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_pager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
layout="@layout/toolbar" />

<RelativeLayout
android:id="@+id/parentRelative"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
Expand All @@ -26,7 +27,7 @@
android:layout_height="match_parent"
android:layout_above="@+id/toolbar_bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />

Expand Down

0 comments on commit 0436c58

Please sign in to comment.