Skip to content

Commit 39ebb2f

Browse files
committed
Renamed buttonDef to buttonProps for Android to stay consistent with iOS.
1 parent c23d24d commit 39ebb2f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/android/ThemeableBrowser.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -789,23 +789,23 @@ public void onPageFinished(String url, boolean canGoBack, boolean canGoForward)
789789

790790
if (features.customButtons != null) {
791791
for (int i = 0; i < features.customButtons.length; i++) {
792-
final BrowserButton buttonDef = features.customButtons[i];
792+
final BrowserButton buttonProps = features.customButtons[i];
793793
final int index = i;
794794
Button button = createButton(
795-
buttonDef,
795+
buttonProps,
796796
String.format("custom button at %d", i),
797797
new View.OnClickListener() {
798798
@Override
799799
public void onClick(View view) {
800800
if (inAppWebView != null) {
801-
emitButtonEvent(buttonDef,
801+
emitButtonEvent(buttonProps,
802802
inAppWebView.getUrl(), index);
803803
}
804804
}
805805
}
806806
);
807807

808-
if (ALIGN_RIGHT.equals(buttonDef.align)) {
808+
if (ALIGN_RIGHT.equals(buttonProps.align)) {
809809
rightButtonContainer.addView(button);
810810
rightContainerWidth
811811
+= button.getLayoutParams().width;
@@ -1005,47 +1005,47 @@ private Drawable getImage(String name, String altPath, double altDensity) throws
10051005
return result;
10061006
}
10071007

1008-
private void setButtonImages(View view, BrowserButton buttonDef, int disabledAlpha) {
1008+
private void setButtonImages(View view, BrowserButton buttonProps, int disabledAlpha) {
10091009
Drawable normalDrawable = null;
10101010
Drawable disabledDrawable = null;
10111011
Drawable pressedDrawable = null;
10121012

10131013
CharSequence description = view.getContentDescription();
10141014

1015-
if (buttonDef.image != null || buttonDef.wwwImage != null) {
1015+
if (buttonProps.image != null || buttonProps.wwwImage != null) {
10161016
try {
1017-
normalDrawable = getImage(buttonDef.image, buttonDef.wwwImage,
1018-
buttonDef.wwwImageDensity);
1017+
normalDrawable = getImage(buttonProps.image, buttonProps.wwwImage,
1018+
buttonProps.wwwImageDensity);
10191019
ViewGroup.LayoutParams params = view.getLayoutParams();
10201020
params.width = normalDrawable.getIntrinsicWidth();
10211021
params.height = normalDrawable.getIntrinsicHeight();
10221022
} catch (Resources.NotFoundException e) {
10231023
emitError(ERR_LOADFAIL,
10241024
String.format("Image for %s, %s, failed to load",
1025-
description, buttonDef.image));
1025+
description, buttonProps.image));
10261026
} catch (IOException ioe) {
10271027
emitError(ERR_LOADFAIL,
10281028
String.format("Image for %s, %s, failed to load",
1029-
description, buttonDef.wwwImage));
1029+
description, buttonProps.wwwImage));
10301030
}
10311031
} else {
10321032
emitWarning(WRN_UNDEFINED,
10331033
String.format("Image for %s is not defined. Button will not be shown",
10341034
description));
10351035
}
10361036

1037-
if (buttonDef.imagePressed != null || buttonDef.wwwImagePressed != null) {
1037+
if (buttonProps.imagePressed != null || buttonProps.wwwImagePressed != null) {
10381038
try {
1039-
pressedDrawable = getImage(buttonDef.imagePressed, buttonDef.wwwImagePressed,
1040-
buttonDef.wwwImageDensity);
1039+
pressedDrawable = getImage(buttonProps.imagePressed, buttonProps.wwwImagePressed,
1040+
buttonProps.wwwImageDensity);
10411041
} catch (Resources.NotFoundException e) {
10421042
emitError(ERR_LOADFAIL,
10431043
String.format("Pressed image for %s, %s, failed to load",
1044-
description, buttonDef.imagePressed));
1044+
description, buttonProps.imagePressed));
10451045
} catch (IOException e) {
10461046
emitError(ERR_LOADFAIL,
10471047
String.format("Pressed image for %s, %s, failed to load",
1048-
description, buttonDef.wwwImagePressed));
1048+
description, buttonProps.wwwImagePressed));
10491049
}
10501050
} else {
10511051
emitWarning(WRN_UNDEFINED,
@@ -1107,15 +1107,15 @@ private void setBackground(View view, Drawable drawable) {
11071107
}
11081108
}
11091109

1110-
private Button createButton(BrowserButton buttonDef, String description,
1110+
private Button createButton(BrowserButton buttonProps, String description,
11111111
View.OnClickListener listener) {
11121112
Button result = null;
1113-
if (buttonDef != null) {
1113+
if (buttonProps != null) {
11141114
result = new Button(cordova.getActivity());
11151115
result.setContentDescription(description);
11161116
result.setLayoutParams(new LinearLayout.LayoutParams(
11171117
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
1118-
setButtonImages(result, buttonDef, DISABLED_ALPHA);
1118+
setButtonImages(result, buttonProps, DISABLED_ALPHA);
11191119
if (listener != null) {
11201120
result.setOnClickListener(listener);
11211121
}

0 commit comments

Comments
 (0)