Skip to content

Commit 0436c58

Browse files
codedsuniamareebjamal
authored andcommitted
fix: Margin of snackbar in single media activity (#2902)
1 parent 2786c12 commit 0436c58

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

app/src/main/java/org/fossasia/phimpme/gallery/activities/SingleMediaActivity.java

+18-14
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
820820
SnackBarHandler.showWithBottomMargin(
821821
parentView,
822822
getString(R.string.new_file_created),
823-
(bottomBar.getHeight() * 2) - 22);
823+
parentView.getHeight() - bottomBar.getTop());
824824
}
825825
// adapter.notifyDataSetChanged();
826826
} catch (Exception e) {
827827
Log.e("ERROS - uCrop", imageUri.toString(), e);
828828
}
829829
} else
830830
SnackBarHandler.showWithBottomMargin(
831-
parentView, "errori random", (bottomBar.getHeight() * 2) - 22);
831+
parentView, "errori random", parentView.getHeight() - bottomBar.getTop());
832832
break;
833833
default:
834834
break;
@@ -871,7 +871,7 @@ private void deleteCurrentMedia() {
871871
SnackBarHandler.showWithBottomMargin(
872872
parentView,
873873
getString(R.string.trashbin_move_onefile),
874-
bottomBar.getHeight() + navigationView.getHeight(),
874+
parentView.getHeight() - bottomBar.getTop(),
875875
Snackbar.LENGTH_SHORT);
876876
snackbar.setAction(
877877
R.string.open,
@@ -888,7 +888,7 @@ public void onClick(View view) {
888888
SnackBarHandler.showWithBottomMargin(
889889
parentView,
890890
getApplicationContext().getString(R.string.photo_deleted_msg),
891-
bottomBar.getHeight() + navigationView.getHeight());
891+
parentView.getHeight() - bottomBar.getTop());
892892
snackbar.show();
893893
}
894894
if (!success) {
@@ -1210,7 +1210,7 @@ public void onClick(DialogInterface dialog, int id) {
12101210
SnackBarHandler.showWithBottomMargin(
12111211
parentView,
12121212
getString(R.string.photo_deleted_from_fav_msg),
1213-
(bottomBar.getHeight() * 2) - 22);
1213+
parentView.getHeight() - bottomBar.getTop());
12141214
}
12151215
});
12161216
AlertDialog alertDialog = deleteDialog.create();
@@ -1258,7 +1258,7 @@ public void folderSelected(String path) {
12581258
SnackBarHandler.showWithBottomMargin(
12591259
relativeLayout,
12601260
getString(R.string.copied_successfully) + " to " + path,
1261-
(bottomBar.getHeight() * 2) - 22);
1261+
parentView.getHeight() - bottomBar.getTop());
12621262
}
12631263
}
12641264
});
@@ -1497,7 +1497,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
14971497
SnackBarHandler.showWithBottomMargin(
14981498
parentView,
14991499
getString(R.string.rename_no_change),
1500-
(bottomBar.getHeight() * 2) - 22);
1500+
parentView.getHeight() - bottomBar.getTop());
15011501
renameDialog.dismiss();
15021502
} else {
15031503
int index = file.getPath().lastIndexOf("/");
@@ -1669,7 +1669,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
16691669
SnackBarHandler.showWithBottomMargin(
16701670
parentView,
16711671
getResources().getString(R.string.add_favourite),
1672-
bottomBar.getHeight());
1672+
parentView.getHeight() - bottomBar.getTop());
16731673
snackbar.setAction(
16741674
R.string.openfav,
16751675
new View.OnClickListener() {
@@ -1755,7 +1755,7 @@ public void folderSelected(String path) {
17551755
SnackBarHandler.showWithBottomMargin(
17561756
relativeLayout,
17571757
getString(R.string.photo_moved_successfully) + " to " + path,
1758-
(bottomBar.getHeight() * 2) - 22);
1758+
parentView.getHeight() - bottomBar.getTop());
17591759
}
17601760
});
17611761
bottomSheetDialogFragment.show(
@@ -1769,14 +1769,18 @@ public void folderSelected(String path) {
17691769
AlbumSettings.getSettings(getApplicationContext(), getAlbum());
17701770
albumSettings.changeCoverPath(getApplicationContext(), getAlbum().getMedia(0).getPath());
17711771
SnackBarHandler.showWithBottomMargin(
1772-
parentView, getString(R.string.cover_removed), (bottomBar.getHeight() * 2) - 22);
1772+
parentView,
1773+
getString(R.string.cover_removed),
1774+
parentView.getHeight() - bottomBar.getTop());
17731775
} else {
17741776
AlbumSettings albumSettings =
17751777
AlbumSettings.getSettings(getApplicationContext(), getAlbum());
17761778
albumSettings.changeCoverPath(
17771779
getApplicationContext(), getAlbum().getCurrentMedia().getPath());
17781780
SnackBarHandler.showWithBottomMargin(
1779-
parentView, getString(R.string.change_cover), bottomBar.getHeight());
1781+
parentView,
1782+
getString(R.string.change_cover),
1783+
parentView.getHeight() - bottomBar.getTop());
17801784
MenuItem cover = menu.findItem(R.id.action_cover);
17811785
cover.setTitle("Remove cover image");
17821786
}
@@ -1936,15 +1940,15 @@ public void onClick(View v) {
19361940
SnackBarHandler.showWithBottomMargin(
19371941
parentView,
19381942
getString(R.string.description_saved),
1939-
(bottomBar.getHeight() * 2) - 22);
1943+
(parentView.getHeight() - bottomBar.getTop()));
19401944
} else {
19411945
databaseHelper.update(
19421946
new ImageDescModel(
19431947
pathForDescription, editTextDescription.getText().toString()));
19441948
SnackBarHandler.showWithBottomMargin(
19451949
parentView,
19461950
getString(R.string.description_updated),
1947-
(bottomBar.getHeight() * 2) - 22);
1951+
parentView.getHeight() - bottomBar.getTop());
19481952
}
19491953
}
19501954
});
@@ -1963,7 +1967,7 @@ public void onClick(View v) {
19631967
SnackBarHandler.showWithBottomMargin(
19641968
parentView,
19651969
getString(R.string.description_deleted),
1966-
(bottomBar.getHeight() * 2) - 22);
1970+
(parentView.getHeight() - bottomBar.getTop()));
19671971
}
19681972
}
19691973
});

app/src/main/res/layout/activity_pager.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
layout="@layout/toolbar" />
1717

1818
<RelativeLayout
19+
android:id="@+id/parentRelative"
1920
android:layout_width="match_parent"
2021
android:layout_height="match_parent"
2122
android:fitsSystemWindows="true">
@@ -26,7 +27,7 @@
2627
android:layout_height="match_parent"
2728
android:layout_above="@+id/toolbar_bottom"
2829
android:layout_alignParentBottom="true"
29-
android:layout_alignParentLeft="true"
30+
android:layout_alignParentEnd="true"
3031
android:layout_alignParentStart="true"
3132
android:layout_alignParentTop="true" />
3233

0 commit comments

Comments
 (0)