CB-10937 fix stretched icons
This closes # 157
This commit is contained in:
parent
0db344327c
commit
68054819d8
@ -19,7 +19,6 @@
|
||||
package org.apache.cordova.inappbrowser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import org.apache.cordova.inappbrowser.InAppBrowserDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Browser;
|
||||
@ -46,8 +45,9 @@ import android.webkit.HttpAuthHandler;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
@ -564,7 +564,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
actionButtonContainer.setId(Integer.valueOf(1));
|
||||
|
||||
// Back button
|
||||
Button back = new Button(cordova.getActivity());
|
||||
ImageButton back = new ImageButton(cordova.getActivity());
|
||||
RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT);
|
||||
back.setLayoutParams(backLayoutParams);
|
||||
@ -572,15 +572,13 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
back.setId(Integer.valueOf(2));
|
||||
Resources activityRes = cordova.getActivity().getResources();
|
||||
int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable backIcon = activityRes.getDrawable(backResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
back.setBackgroundDrawable(backIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
back.setBackground(backIcon);
|
||||
}
|
||||
Drawable backIcon = activityRes.getDrawable(backResId, cordova.getActivity().getTheme());
|
||||
back.setBackground(null);
|
||||
back.setImageDrawable(backIcon);
|
||||
back.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
|
||||
back.getAdjustViewBounds();
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goBack();
|
||||
@ -588,7 +586,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
});
|
||||
|
||||
// Forward button
|
||||
Button forward = new Button(cordova.getActivity());
|
||||
ImageButton forward = new ImageButton(cordova.getActivity());
|
||||
RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2);
|
||||
forward.setLayoutParams(forwardLayoutParams);
|
||||
@ -596,14 +594,12 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
forward.setId(Integer.valueOf(3));
|
||||
int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable fwdIcon = activityRes.getDrawable(fwdResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
forward.setBackgroundDrawable(fwdIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
forward.setBackground(fwdIcon);
|
||||
}
|
||||
forward.setBackground(null);
|
||||
forward.setImageDrawable(fwdIcon);
|
||||
forward.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
forward.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
|
||||
forward.getAdjustViewBounds();
|
||||
|
||||
forward.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
goForward();
|
||||
@ -634,7 +630,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
});
|
||||
|
||||
// Close/Done button
|
||||
Button close = new Button(cordova.getActivity());
|
||||
ImageButton close = new ImageButton(cordova.getActivity());
|
||||
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
close.setLayoutParams(closeLayoutParams);
|
||||
@ -642,14 +638,12 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
close.setId(Integer.valueOf(5));
|
||||
int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName());
|
||||
Drawable closeIcon = activityRes.getDrawable(closeResId);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
|
||||
{
|
||||
close.setBackgroundDrawable(closeIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
close.setBackground(closeIcon);
|
||||
}
|
||||
close.setBackground(null);
|
||||
close.setImageDrawable(closeIcon);
|
||||
close.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10));
|
||||
close.getAdjustViewBounds();
|
||||
|
||||
close.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
closeDialog();
|
||||
|
Loading…
Reference in New Issue
Block a user