Raised API level to 15. Deleted all unnecessary guards and resources.

This commit is contained in:
Christine Emrich 2015-11-17 10:38:52 +01:00
parent 2756785079
commit 30df722528
18 changed files with 55 additions and 191 deletions

View file

@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import android.util.SparseArray;
@ -331,23 +330,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
}
});
}
//On API LEVEL < 11 we can't use the rotate method.. so we have to set different bitmaps.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
if(group.id_database != ALL_STARRED_ITEMS.getValue()) {
if (rotation == 90) {
viewHolder.imgView.setImageResource(R.drawable.ic_action_expand_less);
} else {
viewHolder.imgView.setImageResource(R.drawable.ic_action_expand_more);
}
}
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
viewHolder.imgView.setRotation(rotation);
}
viewHolder.imgView.setRotation(rotation);
return convertView;
}

View file

@ -22,11 +22,9 @@
package de.luhmer.owncloudnewsreader;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
@ -198,13 +196,8 @@ public class NewsDetailFragment extends Fragment {
* @param htmlPage
* @param webView
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void SetSoftwareRenderModeForWebView(String htmlPage, WebView webView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
return;
}
if(htmlPage.contains(".gif")) {
if (htmlPage.contains(".gif")) {
webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
Log.v("NewsDetailFragment", "Using LAYER_TYPE_SOFTWARE");
} else {

View file

@ -1,6 +1,5 @@
package de.luhmer.owncloudnewsreader;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
@ -11,7 +10,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.DialogFragment;
@ -96,14 +94,12 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
//Build the menu
switch(mDialogType) {
case IMAGE:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
mMenuItems.put(getString(R.string.action_img_download), new MenuAction() {
@Override
public void execute() {
downloadImage(mImageUrl);
}
});
}
mMenuItems.put(getString(R.string.action_img_download), new MenuAction() {
@Override
public void execute() {
downloadImage(mImageUrl);
}
});
mMenuItems.put(getString(R.string.action_img_open), new MenuAction() {
@Override
public void execute() {
@ -116,14 +112,12 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
shareImage();
}
});
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
mMenuItems.put(getString(R.string.action_img_copylink), new MenuAction() {
@Override
public void execute() {
copyToCipboard(mDialogTitle, mImageUrl.toString());
}
});
}
mMenuItems.put(getString(R.string.action_img_copylink), new MenuAction() {
@Override
public void execute() {
copyToCipboard(mDialogTitle, mImageUrl.toString());
}
});
break;
case URL:
mMenuItems.put(getString(R.string.action_link_open), new MenuAction() {
@ -143,14 +137,12 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
shareLink();
}
});
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
mMenuItems.put(getString(R.string.action_link_copy), new MenuAction() {
@Override
public void execute() {
copyToCipboard(mDialogTitle, mDialogText);
}
});
}
mMenuItems.put(getString(R.string.action_link_copy), new MenuAction() {
@Override
public void execute() {
copyToCipboard(mDialogTitle, mDialogText);
}
});
break;
}
@ -211,7 +203,6 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void copyToCipboard(String label, String text) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Activity.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(label, text);
@ -246,7 +237,6 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
getDialog().dismiss();
}
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void downloadImage(URL url) {
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.toast_img_download_wait), Toast.LENGTH_SHORT).show();
@ -258,9 +248,7 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
request.setTitle("Downloading image");
request.setDescription(filename);
request.setVisibleInDownloadsUi(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
}
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
downloadID = downloadManager.enqueue(request);
getDialog().hide();
} else {
@ -281,7 +269,6 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
if(downloadCompleteReceiver != null) return;
downloadCompleteReceiver = new BroadcastReceiver() {
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onReceive(Context context, Intent intent) {
long refID = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);

View file

@ -38,7 +38,6 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -243,16 +242,14 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
private void showTapLogoToSyncShowcaseView() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
NewsReaderListFragment nlf = getSlidingListFragment();
new MaterialShowcaseView.Builder(NewsReaderListActivity.this)
.setTarget(nlf.headerLogo)
.setDismissText("GOT IT")
.setContentText("Tap this logo to sync with ownCloud")
.setDelay(300) // optional but starting animations immediately in onCreate can make them choppy
.singleUse("LOGO_SYNC") // provide a unique ID used to ensure it is only shown once
.show();
}
NewsReaderListFragment nlf = getSlidingListFragment();
new MaterialShowcaseView.Builder(NewsReaderListActivity.this)
.setTarget(nlf.headerLogo)
.setDismissText("GOT IT")
.setContentText("Tap this logo to sync with ownCloud")
.setDelay(300) // optional but starting animations immediately in onCreate can make them choppy
.singleUse("LOGO_SYNC") // provide a unique ID used to ensure it is only shown once
.show();
}
View.OnClickListener mSnackbarListener = new View.OnClickListener()
@ -499,17 +496,15 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
*/
private boolean syncFinishedHandler() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(300); // half second between each showcase view
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, "SWIPE_LEFT_RIGHT_AND_PTR");
sequence.setConfig(config);
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Pull-to-Refresh to sync with ownCloud", "GOT IT");
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Swipe Left/Right to mark article as read", "GOT IT");
sequence.start();
}
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(300); // half second between each showcase view
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, "SWIPE_LEFT_RIGHT_AND_PTR");
sequence.setConfig(config);
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Pull-to-Refresh to sync with ownCloud", "GOT IT");
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Swipe Left/Right to mark article as read", "GOT IT");
sequence.start();
NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
newsReaderListFragment.ReloadAdapter();

View file

@ -479,14 +479,10 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
view.startAnimation(animator);
} else {
int absoluteYPosition = appHeight - view.getHeight() - (int) getResources().getDimension(R.dimen.activity_vertical_margin) - (int) dipToPx(yPosition);
//int animationpos = 500;
float xPosition = rlVideoPodcastSurfaceWrapper.getVideoXPosition();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {//TODO podcast video is only working for newer android versions
view.animate().x(xPosition).y(absoluteYPosition).setDuration(animationTime);
}
//scaleX(scaleFactor).scaleY(scaleFactor)
//TODO podcast video is only working for newer android versions
view.animate().x(xPosition).y(absoluteYPosition).setDuration(animationTime);
}

View file

@ -126,11 +126,7 @@ public class SettingsActivity extends PreferenceActivity {
super.onCreate(savedInstanceState);
/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
//getActionBar().setDisplayHomeAsUpEnabled(true);
}*/
//getActionBar().setDisplayHomeAsUpEnabled(true);
AppBarLayout appBarLayout;
@ -177,12 +173,7 @@ public class SettingsActivity extends PreferenceActivity {
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
addPreferencesFromResource(R.xml.pref_general);
} else {
addPreferencesFromResource(R.xml.pref_general_legacy);
}
addPreferencesFromResource(R.xml.pref_general);
PreferenceCategory header = new PreferenceCategory(this);
header.setTitle(R.string.pref_header_display);
@ -198,11 +189,7 @@ public class SettingsActivity extends PreferenceActivity {
header = new PreferenceCategory(this);
header.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(header);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
addPreferencesFromResource(R.xml.pref_notification);
} else {
addPreferencesFromResource(R.xml.pref_notification_legacy);
}
addPreferencesFromResource(R.xml.pref_notification);
/*
header = new PreferenceCategory(this);

View file

@ -4,7 +4,6 @@ import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
@ -154,11 +153,7 @@ public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickL
textViewSummary.setTypeface(Typeface.DEFAULT_BOLD);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
((View) textViewSummary.getParent()).setAlpha(alpha);
}
//itemView.invalidate();
//textViewSummary.invalidate();
((View) textViewSummary.getParent()).setAlpha(alpha);
}
}

View file

@ -1,7 +1,6 @@
package de.luhmer.owncloudnewsreader.helper;
import android.os.AsyncTask;
import android.os.Build;
/**
* Created by David on 20.07.2015.
@ -9,10 +8,7 @@ import android.os.Build;
public class AsyncTaskHelper {
@SafeVarargs
public static <Params,Progress,Result> void StartAsyncTask(AsyncTask<Params,Progress,Result> asyncTask, Params... params) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
else
asyncTask.execute(params);
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
}
}

View file

@ -158,8 +158,7 @@ public class HttpJsonRequest {
//http://stackoverflow.com/questions/859111/how-do-i-accept-a-self-signed-certificate-with-a-java-httpsurlconnection
//http://developer.android.com/training/articles/security-ssl.html
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
// CookieHandler.setDefault(new CookieManager());
// CookieHandler.setDefault(new CookieManager());
Response response = client.newCall(request).execute();

View file

@ -23,12 +23,10 @@ package de.luhmer.owncloudnewsreader.reader.owncloud;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import com.squareup.okhttp.HttpUrl;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
@ -85,27 +83,7 @@ public class OwnCloud_Reader {
@SafeVarargs
private final <Params> void Start_AsyncTask(final AsyncTask_Reader asyncTask, final Params... params) {
if (apiFuture == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
apiFuture = ((ExecutorService) AsyncTask.THREAD_POOL_EXECUTOR).submit(apiCallable);
} else { //Workaround for older Android Devices with no ExecutorService support
final CountDownLatch countDownLatch = new CountDownLatch(1);
new Thread() {
public void run() {
try {
apiFuture = new CompatFuture<>(apiCallable.call());
} catch (Exception ex) {
ex.printStackTrace();
}
countDownLatch.countDown();
}
}.start();
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
apiFuture = ((ExecutorService) AsyncTask.THREAD_POOL_EXECUTOR).submit(apiCallable);
}
asyncTask.setAPIFuture(apiFuture);

View file

@ -1,9 +1,7 @@
package de.luhmer.owncloudnewsreader.view;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
@ -76,10 +74,9 @@ public class AnimatingProgressBar extends ProgressBar {
return super.getSecondaryProgress() / RESOLUTION;
}
@TargetApi(11)
@Override
public synchronized void setProgress(int progress) {
if (!animate || android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
if (!animate) {
super.setProgress(progress);
return;
}
@ -102,10 +99,9 @@ public class AnimatingProgressBar extends ProgressBar {
animator.start();
}
@TargetApi(11)
@Override
public synchronized void setSecondaryProgress(int secondaryProgress) {
if (!animate || android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
if (!animate) {
super.setSecondaryProgress(secondaryProgress);
return;
}
@ -128,18 +124,15 @@ public class AnimatingProgressBar extends ProgressBar {
animatorSecondary.start();
}
@TargetApi(11)
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (animator != null) {
animator.cancel();
}
if (animatorSecondary != null) {
animatorSecondary.cancel();
}
if (animator != null) {
animator.cancel();
}
if (animatorSecondary != null) {
animatorSecondary.cancel();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

View file

@ -1,32 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="cb_AutoSyncOnStart"
android:title="@string/pref_title_AutoSyncOnStart" />
<CheckBoxPreference
android:key="cb_ShowOnlyUnread"
android:title="@string/pref_title_ShowOnlyUnread" />
<CheckBoxPreference
android:key="cb_NavigateWithVolumeButtons"
android:title="@string/pref_title_NavigateWithVolumeButtons" />
<CheckBoxPreference
android:key="cb_MarkAsReadWhileScrolling"
android:title="@string/pref_title_MarkAsReadWhileScrolling" />
<CheckBoxPreference
android:key="cb_openInBrowserDirectly"
android:title="@string/pref_title_OpenInBrowserDirectly" />
<ListPreference
android:defaultValue="1"
android:entries="@array/pref_general_sort_order"
android:entryValues="@array/pref_general_sort_order_values_not_translated"
android:key="sp_sort_order"
android:title="@string/pref_title_general_sort_order" />
</PreferenceScreen>

View file

@ -1,8 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:defaultValue="1"
android:key="cb_showNotificationNewArticles"
android:title="@string/pref_title_notification_new_articles_available" />
</PreferenceScreen>

View file

@ -17,7 +17,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
ANDROID_BUILD_MIN_SDK_VERSION=8
ANDROID_BUILD_MIN_SDK_VERSION=15
ANDROID_BUILD_TARGET_SDK_VERSION=23
ANDROID_BUILD_TOOLS_VERSION=23.0.1
ANDROID_BUILD_SDK_VERSION=23