LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return; | 48 return; |
49 widgetFrameView.setVisibility(View.VISIBLE); | 49 widgetFrameView.setVisibility(View.VISIBLE); |
50 final int rightPaddingDip = android.os.Build.VERSION.SDK_INT < 14 ? 8 : 5; | 50 final int rightPaddingDip = android.os.Build.VERSION.SDK_INT < 14 ? 8 : 5; |
51 final float density = getContext().getResources().getDisplayMetrics().densit
y; | 51 final float density = getContext().getResources().getDisplayMetrics().densit
y; |
52 if (widgetFrameView instanceof LinearLayout) | 52 if (widgetFrameView instanceof LinearLayout) |
53 { | 53 { |
54 ((LinearLayout) widgetFrameView).setOrientation(LinearLayout.HORIZONTAL); | 54 ((LinearLayout) widgetFrameView).setOrientation(LinearLayout.HORIZONTAL); |
55 } | 55 } |
56 widgetFrameView.addView(refreshImage, 0); | 56 widgetFrameView.addView(refreshImage, 0); |
57 refreshImage.setImageResource(R.drawable.ic_menu_refresh); | 57 refreshImage.setImageResource(R.drawable.ic_menu_refresh); |
58 refreshImage.setPadding(refreshImage.getPaddingLeft(), refreshImage.getPaddi
ngTop(), (int) (density * rightPaddingDip), | 58 refreshImage.setPadding(refreshImage.getPaddingLeft(), refreshImage.getPaddi
ngTop(), (int) (density * rightPaddingDip), refreshImage.getPaddingBottom()); |
59 refreshImage.getPaddingBottom()); | |
60 refreshImage.setOnClickListener(new OnClickListener() | 59 refreshImage.setOnClickListener(new OnClickListener() |
61 { | 60 { |
62 @Override | 61 @Override |
63 public void onClick(final View v) | 62 public void onClick(final View v) |
64 { | 63 { |
65 if (refreshClickListener != null) | 64 if (refreshClickListener != null) |
66 { | |
67 refreshClickListener.onClick(refreshImage); | 65 refreshClickListener.onClick(refreshImage); |
68 } | |
69 } | 66 } |
70 }); | 67 }); |
71 } | 68 } |
72 | 69 |
73 public void setOnRefreshClickListener(final OnClickListener l) | 70 public void setOnRefreshClickListener(final OnClickListener l) |
74 { | 71 { |
75 refreshClickListener = l; | 72 refreshClickListener = l; |
76 } | 73 } |
77 } | 74 } |
LEFT | RIGHT |