Skip to content

Commit

Permalink
Image Full Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
imchathura committed Oct 31, 2017
1 parent e6582cf commit 2d1b218
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 67 deletions.
10 changes: 0 additions & 10 deletions .idea/libraries/AndroidImagePopup_1_0_7.xml

This file was deleted.

6 changes: 3 additions & 3 deletions .idea/libraries/animated_vector_drawable_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/appcompat_v7_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/espresso_core_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/espresso_idling_resource_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/exposed_instrumentation_api_publish_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .idea/libraries/hamcrest_library_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/rules_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/runner_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/support_annotations_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_compat_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_core_ui_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_core_utils_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_fragment_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_media_compat_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/support_v4_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/libraries/support_vector_drawable_25_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions app/src/main/java/com/fexcon/imgpopup/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
Log.e("Width",""+Resources.getSystem().getDisplayMetrics().widthPixels);
final ImagePopup imagePopup = new ImagePopup(this);
imagePopup.setBackgroundColor(Color.BLACK);
// imagePopup.setWindowHeight(Resources.getSystem().getDisplayMetrics().heightPixels);
// imagePopup.setWindowWidth(Resources.getSystem().getDisplayMetrics().widthPixels);
imagePopup.setFullScreen(true);
imagePopup.setHideCloseIcon(true);
imagePopup.setImageOnClickClose(true);

Expand All @@ -34,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {

Picasso.with(this).load(photoUrl).into(imageView);
// to use it when the same photo are in the image
// imagePopup.initiatePopup(imageView.getDrawable());
// imagePopup.initiatePopup(imageView.getDrawable());

// to download the image from url if you want different resolution or different image
imagePopup.initiatePopupWithPicasso(photoUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ImagePopup extends ImageView {
private int windowWidth = 0;
private boolean imageOnClickClose;
private boolean hideCloseIcon;
private boolean fullScreen;

private int backgroundColor = Color.parseColor("#FFFFFF");

Expand Down Expand Up @@ -96,6 +97,14 @@ public void setHideCloseIcon(boolean hideCloseIcon) {
this.hideCloseIcon = hideCloseIcon;
}

public boolean isFullScreen() {
return fullScreen;
}

public void setFullScreen(boolean fullScreen) {
this.fullScreen = fullScreen;
}

public void initiatePopup(Drawable drawable) {

try {
Expand Down Expand Up @@ -189,7 +198,6 @@ public void initiatePopupWithPicasso(File imageFile) {
public void initiatePopupWithGlide(String imageUrl) {

try {
// Log.e("Image", "initiatePopupWithGlide");

LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);

Expand Down Expand Up @@ -223,13 +231,16 @@ public void viewPopup() {
int width = metrics.widthPixels;
int height = metrics.heightPixels;

if (windowHeight != 0 || windowWidth != 0) {
width = windowWidth;
height = windowHeight;
if(isFullScreen()) {
popupWindow = new PopupWindow(layout, (width), (height), true);
}else{

popupWindow = new PopupWindow(layout, (int) (width * .8), (int) (height * .6), true);
}else {
if (windowHeight != 0 || windowWidth != 0) {
width = windowWidth;
height = windowHeight;
popupWindow = new PopupWindow(layout, (width), (height), true);
} else {
popupWindow = new PopupWindow(layout, (int) (width * .8), (int) (height * .6), true);
}
}


Expand Down

0 comments on commit 2d1b218

Please sign in to comment.