Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/HelpfulCheckBoxPreference.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Created April 11, 2014, 1:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/android/HelpfulCheckBoxPreference.java
diff --git a/src/org/adblockplus/android/HelpfulCheckBoxPreference.java b/src/org/adblockplus/android/HelpfulCheckBoxPreference.java
index 32bf02023f0806cc9894889c2009c4c98e1baaad..e4343ba5f45c9d1fb0305e9bce6ff7aca4dd6c59 100644
--- a/src/org/adblockplus/android/HelpfulCheckBoxPreference.java
+++ b/src/org/adblockplus/android/HelpfulCheckBoxPreference.java
@@ -35,55 +35,57 @@ public class HelpfulCheckBoxPreference extends CheckBoxPreference
private OnClickListener helpClickListener;
private String url;
- public HelpfulCheckBoxPreference(Context context, AttributeSet attrs)
+ public HelpfulCheckBoxPreference(final Context context, final AttributeSet attrs)
{
super(context, attrs);
}
@Override
- protected void onBindView(View view)
+ protected void onBindView(final View view)
{
super.onBindView(view);
- final ImageView helpImage = new ImageView(getContext());
- final ViewGroup widgetFrameView = ((ViewGroup) view.findViewById(android.R.id.widget_frame));
+ final ImageView helpImage = new ImageView(this.getContext());
+ final ViewGroup widgetFrameView = ((ViewGroup)view.findViewById(android.R.id.widget_frame));
if (widgetFrameView == null)
+ {
return;
+ }
widgetFrameView.setVisibility(View.VISIBLE);
final int rightPaddingDip = android.os.Build.VERSION.SDK_INT < 14 ? 8 : 5;
- final float mDensity = getContext().getResources().getDisplayMetrics().density;
+ final float mDensity = this.getContext().getResources().getDisplayMetrics().density;
if (widgetFrameView instanceof LinearLayout)
{
- ((LinearLayout) widgetFrameView).setOrientation(LinearLayout.HORIZONTAL);
+ ((LinearLayout)widgetFrameView).setOrientation(LinearLayout.HORIZONTAL);
}
widgetFrameView.addView(helpImage, 0);
helpImage.setImageResource(R.drawable.ic_menu_help);
- helpImage.setPadding(helpImage.getPaddingLeft(), helpImage.getPaddingTop(), (int) (mDensity * rightPaddingDip), helpImage.getPaddingBottom());
+ helpImage.setPadding(helpImage.getPaddingLeft(), helpImage.getPaddingTop(), (int)(mDensity * rightPaddingDip), helpImage.getPaddingBottom());
helpImage.setOnClickListener(new OnClickListener()
{
@Override
- public void onClick(View v)
+ public void onClick(final View v)
{
- if (helpClickListener != null)
+ if (HelpfulCheckBoxPreference.this.helpClickListener != null)
{
- helpClickListener.onClick(helpImage);
+ HelpfulCheckBoxPreference.this.helpClickListener.onClick(helpImage);
}
- else if (url != null)
+ else if (HelpfulCheckBoxPreference.this.url != null)
{
- Uri uri = Uri.parse(url);
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ final Uri uri = Uri.parse(HelpfulCheckBoxPreference.this.url);
+ final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
HelpfulCheckBoxPreference.this.getContext().startActivity(intent);
}
}
});
}
- public void setOnHelpClickListener(OnClickListener l)
+ public void setOnHelpClickListener(final OnClickListener l)
{
- helpClickListener = l;
+ this.helpClickListener = l;
}
- public void setHelpUrl(String url)
+ public void setHelpUrl(final String url)
{
this.url = url;
}

Powered by Google App Engine
This is Rietveld