From 61232ef02c14929d39f8173b509b8a9f9a233534 Mon Sep 17 00:00:00 2001
From: Bananeweizen
* <?xml version="1.0" encoding="utf-8"?> * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" * android:orientation="vertical" - * android:layout_width="fill_parent" + * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:paddingLeft="8dp" * android:paddingRight="8dp"> - * + * * <ListView android:id="@id/android:list" - * android:layout_width="fill_parent" + * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#00FF00" * android:layout_weight="1" * android:drawSelectorOnTop="false"/> - * + * * <TextView android:id="@id/android:empty" - * android:layout_width="fill_parent" + * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#FF0000" * android:text="No data"/> * </LinearLayout> *- * + * *
* Row Layout *
@@ -96,27 +98,27 @@ import android.widget.ListView; * source for the resource two_line_list_item, which displays two data * fields,one above the other, for each list row. * - * + * ** <?xml version="1.0" encoding="utf-8"?> * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" * android:layout_width="fill_parent" * android:layout_height="wrap_content" * android:orientation="vertical"> - * + * * <TextView android:id="@+id/text1" * android:textSize="16sp" * android:textStyle="bold" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> - * + * * <TextView android:id="@+id/text2" * android:textSize="16sp" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> * </LinearLayout> *- * + * *
* You must identify the data bound to each TextView object in this layout. The * syntax for this is discussed in the next section. @@ -137,40 +139,40 @@ import android.widget.ListView; * Contacts provider for all contacts, then binding the Name and Company fields * to a two line row layout in the activity's ListView. *
- * + * *
* public class MyListAdapter extends FragmentListActivity {
- *
+ *
* @Override
* protected void onCreate(Bundle savedInstanceState){
* super.onCreate(savedInstanceState);
- *
+ *
* // We'll define a custom screen layout here (the one shown above), but
* // typically, you could just use the standard FragmentListActivity layout.
* setContentView(R.layout.custom_list_activity_view);
- *
+ *
* // Query for all people contacts using the {@link android.provider.Contacts.People} convenience class.
* // Put a managed wrapper around the retrieved cursor so we don't have to worry about
* // requerying or closing it as the activity changes state.
* mCursor = this.getContentResolver().query(People.CONTENT_URI, null, null, null, null);
* startManagingCursor(mCursor);
- *
- * // Now create a new list adapter bound to the cursor.
+ *
+ * // Now create a new list adapter bound to the cursor.
* // SimpleListAdapter is designed for binding to a Cursor.
* ListAdapter adapter = new SimpleCursorAdapter(
* this, // Context.
- * android.R.layout.two_line_list_item, // Specify the row template to use (here, two columns bound to the two retrieved cursor
+ * android.R.layout.two_line_list_item, // Specify the row template to use (here, two columns bound to the two retrieved cursor
* rows).
* mCursor, // Pass in the cursor to bind to.
* new String[] {People.NAME, People.COMPANY}, // Array of cursor columns to bind to.
* new int[] {android.R.id.text1, android.R.id.text2}); // Parallel array of which template objects to bind to those columns.
- *
+ *
* // Bind to our new adapter.
* setListAdapter(adapter);
* }
* }
*
- *
+ *
* @see #setListAdapter
* @see android.widget.ListView
*/
@@ -186,38 +188,38 @@ public class FragmentListActivity extends FragmentActivity {
*/
protected ListView mList;
- private Handler mHandler = new Handler();
+ private final Handler mHandler = new Handler();
private boolean mFinishedStart = false;
- private Runnable mRequestFocus = new Runnable() {
+ private final Runnable mRequestFocus = new Runnable() {
@Override
public void run() {
mList.focusableViewAvailable(mList);
}
};
-
+
/**
* This method will be called when an item in the list is selected.
* Subclasses should override. Subclasses can call
* getListView().getItemAtPosition(position) if they need to access the
* data associated with the selected item.
- *
+ *
* @param l The ListView where the click happened
* @param v The view that was clicked within the ListView
* @param position The position of the view in the list
* @param id The row id of the item that was clicked
*/
- protected void onListItemClick(ListView l, View v, int position, long id) {
+ protected void onListItemClick(final ListView l, final View v, final int position, final long id) {
}
-
+
/**
* Ensures the list view has been created before Activity restores all
* of the view states.
- *
+ *
*@see Activity#onRestoreInstanceState(Bundle)
*/
@Override
- protected void onRestoreInstanceState(@NonNull Bundle state) {
+ protected void onRestoreInstanceState(@NonNull final Bundle state) {
ensureList();
super.onRestoreInstanceState(state);
}
@@ -225,13 +227,13 @@ public class FragmentListActivity extends FragmentActivity {
/**
* Updates the screen state (current list and other views) when the
* content changes.
- *
+ *
* @see Activity#onContentChanged()
*/
@Override
public void onContentChanged() {
super.onContentChanged();
- View emptyView = findViewById(android.R.id.empty);
+ final View emptyView = findViewById(android.R.id.empty);
mList = (ListView)findViewById(android.R.id.list);
if (mList == null) {
throw new RuntimeException(
@@ -252,7 +254,7 @@ public class FragmentListActivity extends FragmentActivity {
/**
* Provide the cursor for the list view.
*/
- public void setListAdapter(ListAdapter adapter) {
+ public void setListAdapter(final ListAdapter adapter) {
synchronized (this) {
ensureList();
mAdapter = adapter;
@@ -263,10 +265,10 @@ public class FragmentListActivity extends FragmentActivity {
/**
* Set the currently selected list item to the specified
* position with the adapter's data
- *
+ *
* @param position
*/
- public void setSelection(int position) {
+ public void setSelection(final int position) {
mList.setSelection(position);
}
@@ -291,7 +293,7 @@ public class FragmentListActivity extends FragmentActivity {
ensureList();
return mList;
}
-
+
/**
* Get the ListAdapter associated with this activity's ListView.
*/
@@ -299,17 +301,18 @@ public class FragmentListActivity extends FragmentActivity {
return mAdapter;
}
+ @SuppressLint("InlinedApi")
private void ensureList() {
if (mList != null) {
return;
}
setContentView(android.R.layout.list_content);
-
+
}
- private AdapterView.OnItemClickListener mOnClickListener = new AdapterView.OnItemClickListener() {
+ private final AdapterView.OnItemClickListener mOnClickListener = new AdapterView.OnItemClickListener() {
@Override
- public void onItemClick(AdapterView> parent, View v, int position, long id)
+ public void onItemClick(final AdapterView> parent, final View v, final int position, final long id)
{
onListItemClick((ListView)parent, v, position, id);
}
diff --git a/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java b/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java
index 0f922c5..49181a2 100644
--- a/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java
+++ b/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java
@@ -21,6 +21,7 @@ import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -67,12 +68,12 @@ public class TitlePageIndicator extends View implements PageIndicator {
public final int value;
- IndicatorStyle(int value) {
+ IndicatorStyle(final int value) {
this.value = value;
}
- public static IndicatorStyle fromValue(int value) {
- for (IndicatorStyle style : IndicatorStyle.values()) {
+ public static IndicatorStyle fromValue(final int value) {
+ for (final IndicatorStyle style : IndicatorStyle.values()) {
if (style.value == value) {
return style;
}
@@ -91,12 +92,12 @@ public class TitlePageIndicator extends View implements PageIndicator {
private boolean mBoldText;
private int mColorText;
private int mColorSelected;
- private Path mPath = new Path();
+ private final Path mPath = new Path();
private final Paint mPaintFooterLine;
private IndicatorStyle mFooterIndicatorStyle;
private final Paint mPaintFooterIndicator;
private float mFooterIndicatorHeight;
- private float mFooterIndicatorUnderlinePadding;
+ private final float mFooterIndicatorUnderlinePadding;
private float mFooterPadding;
private float mTitlePadding;
private float mTopPadding;
@@ -106,21 +107,21 @@ public class TitlePageIndicator extends View implements PageIndicator {
private static final int INVALID_POINTER = -1;
- private int mTouchSlop;
+ private final int mTouchSlop;
private float mLastMotionX = -1;
private int mActivePointerId = INVALID_POINTER;
private boolean mIsDragging;
- public TitlePageIndicator(Context context) {
+ public TitlePageIndicator(final Context context) {
this(context, null);
}
- public TitlePageIndicator(Context context, AttributeSet attrs) {
+ public TitlePageIndicator(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.vpiTitlePageIndicatorStyle);
}
- public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
+ public TitlePageIndicator(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
//Load defaults from resources
@@ -140,7 +141,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);
//Retrieve styles attributes
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, R.style.Widget_TitlePageIndicator);
+ final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, R.style.Widget_TitlePageIndicator);
//Retrieve the colors to be used for this view and apply them.
mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight, defaultFooterLineHeight);
@@ -179,7 +180,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mPaintFooterLine.getColor();
}
- public void setFooterColor(int footerColor) {
+ public void setFooterColor(final int footerColor) {
mPaintFooterLine.setColor(footerColor);
mPaintFooterIndicator.setColor(footerColor);
invalidate();
@@ -189,7 +190,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mFooterLineHeight;
}
- public void setFooterLineHeight(float footerLineHeight) {
+ public void setFooterLineHeight(final float footerLineHeight) {
mFooterLineHeight = footerLineHeight;
mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
invalidate();
@@ -199,7 +200,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mFooterIndicatorHeight;
}
- public void setFooterIndicatorHeight(float footerTriangleHeight) {
+ public void setFooterIndicatorHeight(final float footerTriangleHeight) {
mFooterIndicatorHeight = footerTriangleHeight;
invalidate();
}
@@ -208,7 +209,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mFooterPadding;
}
- public void setFooterIndicatorPadding(float footerIndicatorPadding) {
+ public void setFooterIndicatorPadding(final float footerIndicatorPadding) {
mFooterPadding = footerIndicatorPadding;
invalidate();
}
@@ -217,7 +218,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mFooterIndicatorStyle;
}
- public void setFooterIndicatorStyle(IndicatorStyle indicatorStyle) {
+ public void setFooterIndicatorStyle(final IndicatorStyle indicatorStyle) {
mFooterIndicatorStyle = indicatorStyle;
invalidate();
}
@@ -226,7 +227,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mColorSelected;
}
- public void setSelectedColor(int selectedColor) {
+ public void setSelectedColor(final int selectedColor) {
mColorSelected = selectedColor;
invalidate();
}
@@ -235,7 +236,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mBoldText;
}
- public void setSelectedBold(boolean selectedBold) {
+ public void setSelectedBold(final boolean selectedBold) {
mBoldText = selectedBold;
invalidate();
}
@@ -244,7 +245,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mColorText;
}
- public void setTextColor(int textColor) {
+ public void setTextColor(final int textColor) {
mPaintText.setColor(textColor);
mColorText = textColor;
invalidate();
@@ -254,7 +255,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return mPaintText.getTextSize();
}
- public void setTextSize(float textSize) {
+ public void setTextSize(final float textSize) {
mPaintText.setTextSize(textSize);
invalidate();
}
@@ -263,7 +264,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return this.mTitlePadding;
}
- public void setTitlePadding(float titlePadding) {
+ public void setTitlePadding(final float titlePadding) {
mTitlePadding = titlePadding;
invalidate();
}
@@ -272,7 +273,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return this.mTopPadding;
}
- public void setTopPadding(float topPadding) {
+ public void setTopPadding(final float topPadding) {
mTopPadding = topPadding;
invalidate();
}
@@ -281,7 +282,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
return this.mClipPadding;
}
- public void setClipPadding(float clipPadding) {
+ public void setClipPadding(final float clipPadding) {
mClipPadding = clipPadding;
invalidate();
}
@@ -292,7 +293,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
* @see android.view.View#onDraw(android.graphics.Canvas)
*/
@Override
- protected void onDraw(Canvas canvas) {
+ protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (mViewPager == null) {
@@ -304,7 +305,7 @@ public class TitlePageIndicator extends View implements PageIndicator {
}
//Calculate views bounds
- ArrayList