diff --git a/Clover/app/build.gradle b/Clover/app/build.gradle index 84236b33..9a4b0da6 100644 --- a/Clover/app/build.gradle +++ b/Clover/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 19 + compileSdkVersion 21 buildToolsVersion "21.1.1" defaultConfig { minSdkVersion 14 - targetSdkVersion 19 + targetSdkVersion 21 versionName "v1.2.2" versionCode 40 diff --git a/Clover/app/proguard.cfg b/Clover/app/proguard.cfg index 4faf19ff..7f3763cc 100644 --- a/Clover/app/proguard.cfg +++ b/Clover/app/proguard.cfg @@ -132,8 +132,3 @@ } -keep public class pl.droidsonroids.gif.GifIOException{*;} - -# Remove these when targetSdkVersion >= 21 --dontwarn pl.droidsonroids.gif.GifImageButton --dontwarn pl.droidsonroids.gif.GifImageView --dontwarn pl.droidsonroids.gif.GifTextView diff --git a/Clover/app/src/main/java/org/floens/chan/ui/activity/ChanActivity.java b/Clover/app/src/main/java/org/floens/chan/ui/activity/ChanActivity.java index 695ed96a..1ea61488 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/activity/ChanActivity.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/activity/ChanActivity.java @@ -649,9 +649,6 @@ public class ChanActivity extends BaseActivity implements AdapterView.OnItemSele } private class BoardSpinnerAdapter extends BaseAdapter { - private static final int VIEW_TYPE_ITEM = 0; - private static final int VIEW_TYPE_ADD = 1; - private Context context; private Spinner spinner; private List boards; @@ -699,16 +696,6 @@ public class ChanActivity extends BaseActivity implements AdapterView.OnItemSele return boards.size() + 1; } - @Override - public int getViewTypeCount() { - return 2; - } - - @Override - public int getItemViewType(int position) { - return position == getCount() - 1 ? VIEW_TYPE_ADD : VIEW_TYPE_ITEM; - } - @Override public long getItemId(final int position) { return position; @@ -716,42 +703,24 @@ public class ChanActivity extends BaseActivity implements AdapterView.OnItemSele @Override public String getItem(final int position) { - switch (getItemViewType(position)) { - case VIEW_TYPE_ITEM: - return boards.get(position).key; - case VIEW_TYPE_ADD: - return context.getString(R.string.board_select_add); - default: - return ""; + if (position == getCount() - 1) { + return context.getString(R.string.board_select_add); + } else { + return boards.get(position).key; } } @Override public View getView(final int position, View convertView, final ViewGroup parent) { - switch (getItemViewType(position)) { - case VIEW_TYPE_ITEM: { - if (convertView == null || (Integer) convertView.getTag() != VIEW_TYPE_ITEM) { - convertView = LayoutInflater.from(context).inflate(R.layout.board_select_spinner, null); - convertView.setTag(VIEW_TYPE_ITEM); - } - - TextView textView = (TextView) convertView; - textView.setText(getItem(position)); - return textView; - } - case VIEW_TYPE_ADD: { - if (convertView == null || (Integer) convertView.getTag() != VIEW_TYPE_ADD) { - convertView = LayoutInflater.from(context).inflate(R.layout.board_select_add, null); - convertView.setTag(VIEW_TYPE_ADD); - } - - TextView textView = (TextView) convertView; - textView.setText(getItem(position)); - return textView; - } + if (position == getCount() - 1) { + TextView textView = (TextView) LayoutInflater.from(context).inflate(R.layout.board_select_add, null); + textView.setText(getItem(position)); + return textView; + } else { + TextView textView = (TextView) LayoutInflater.from(context).inflate(R.layout.board_select_spinner, null); + textView.setText(getItem(position)); + return textView; } - - return null; } } }