@@ -91,6 +91,8 @@ public void setHideCloseIcon(boolean hideCloseIcon) {
91
91
}
92
92
93
93
public void initiatePopup (Drawable drawable ){
94
+
95
+
94
96
try {
95
97
LayoutInflater inflater = (LayoutInflater )context .getSystemService (context .LAYOUT_INFLATER_SERVICE );
96
98
@@ -100,32 +102,30 @@ public void initiatePopup(Drawable drawable){
100
102
101
103
ImageView imageView = (ImageView )layout .findViewById (R .id .imageView );
102
104
imageView .setImageDrawable (drawable );
105
+
106
+
107
+
103
108
Log .e ("Image" ,"Height--> " +imageView .getDrawable ().getMinimumHeight ());
104
109
Log .e ("Image" ,"Width--> " +imageView .getDrawable ().getMinimumWidth ());
105
110
106
- /** Height & Width Adjustments according to the Image size and Device Screen size **/
111
+
112
+
113
+
114
+
115
+ // /** Height & Width Adjustments according to the Image size and Device Screen size **/
107
116
DisplayMetrics metrics = new DisplayMetrics ();
108
117
((Activity ) getContext ()).getWindowManager ().getDefaultDisplay ().getMetrics (metrics );
109
118
Log .e ("Phone Height" ,"-->" +metrics .heightPixels );
110
119
Log .e ("Phone Width" ,"-->" +metrics .widthPixels );
111
120
112
- if (windowWidth == 0 || windowHeight == 0 ) {
113
- windowHeight = imageView .getDrawable ().getMinimumHeight ();
114
- windowWidth = imageView .getDrawable ().getMinimumWidth ();
115
- if (metrics .heightPixels < imageView .getDrawable ().getMinimumHeight () && metrics .widthPixels < imageView .getDrawable ().getMinimumWidth ()) {
116
- /** Landscape Image **/
117
- if (windowHeight < windowWidth ) {
118
- windowHeight = metrics .heightPixels - 1310 ;
119
- windowWidth = metrics .widthPixels - 250 ;
120
- } else {
121
- windowHeight = metrics .heightPixels - 460 ;
122
- windowWidth = metrics .widthPixels - 200 ;
123
- }
121
+ int width = metrics .widthPixels ;
122
+ int height = metrics .heightPixels ;
124
123
125
- }
126
- }
124
+ // ((Activity) getContext()).getWindow().setLayout((int)(width*.8),(int)(height*.6));
125
+ //
126
+
127
+ popupWindow = new PopupWindow (layout , (int )(width *.8 ),(int )(height *.6 ), true );
127
128
128
- popupWindow = new PopupWindow (layout , windowWidth , windowHeight , true );
129
129
popupWindow .showAtLocation (layout , Gravity .CENTER , 0 ,0 );
130
130
131
131
ImageView closeIcon = (ImageView )layout .findViewById (R .id .closeBtn );
@@ -152,11 +152,11 @@ public void onClick(View view) {
152
152
}
153
153
154
154
/** Background dim part **/
155
- WindowManager windowManager = (WindowManager ) context .getSystemService (Context .WINDOW_SERVICE );
156
- WindowManager .LayoutParams layoutParams = (WindowManager .LayoutParams ) layout .getLayoutParams ();
157
- layoutParams .flags = WindowManager .LayoutParams .FLAG_DIM_BEHIND ;
158
- layoutParams .dimAmount = 0.3f ;
159
- windowManager .updateViewLayout (layout , layoutParams );
155
+ // WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
156
+ // WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) layout.getLayoutParams();
157
+ // layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
158
+ // layoutParams.dimAmount = 0.3f;
159
+ // windowManager.updateViewLayout(layout, layoutParams);
160
160
161
161
}catch (Exception e ){
162
162
e .printStackTrace ();
0 commit comments