mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Merge branch '566-raise-api-level' into 'master'
Stop supporting Gingerbread Closes #566 See merge request !278
This commit is contained in:
@@ -76,9 +76,8 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
Intent i = new Intent(this, ExitActivity.class);
|
||||
i.addFlags(FLAG_ACTIVITY_NEW_TASK
|
||||
| FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
|
||||
| FLAG_ACTIVITY_NO_ANIMATION);
|
||||
if (Build.VERSION.SDK_INT >= 11)
|
||||
i.addFlags(FLAG_ACTIVITY_CLEAR_TASK);
|
||||
| FLAG_ACTIVITY_NO_ANIMATION
|
||||
| FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ package org.briarproject.android.forum;
|
||||
import android.animation.Animator;
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
@@ -519,14 +517,12 @@ public class ForumActivity extends BriarActivity implements
|
||||
List<Integer> indexList =
|
||||
getSubTreeIndexes(visiblePos, forumEntry.getLevel());
|
||||
if (!indexList.isEmpty()) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
// stop animating children
|
||||
for (int index : indexList) {
|
||||
ValueAnimator anim =
|
||||
animatingEntries.get(forumEntries.get(index));
|
||||
if (anim != null && anim.isRunning()) {
|
||||
anim.cancel();
|
||||
}
|
||||
// stop animating children
|
||||
for (int index : indexList) {
|
||||
ValueAnimator anim =
|
||||
animatingEntries.get(forumEntries.get(index));
|
||||
if (anim != null && anim.isRunning()) {
|
||||
anim.cancel();
|
||||
}
|
||||
}
|
||||
if (indexList.size() == 1) {
|
||||
@@ -560,7 +556,6 @@ public class ForumActivity extends BriarActivity implements
|
||||
return null;
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void animateFadeOut(final ForumViewHolder ui,
|
||||
final ForumEntry addedEntry) {
|
||||
ui.setIsRecyclable(false);
|
||||
@@ -686,9 +681,7 @@ public class ForumActivity extends BriarActivity implements
|
||||
ui.cell.setBackgroundColor(ContextCompat
|
||||
.getColor(ForumActivity.this,
|
||||
R.color.forum_cell_highlight));
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
animateFadeOut(ui, addedEntry);
|
||||
}
|
||||
animateFadeOut(ui, addedEntry);
|
||||
addedEntry = null;
|
||||
} else {
|
||||
ui.cell.setBackgroundColor(ContextCompat
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package org.briarproject.android.introduction;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
import org.briarproject.android.contact.ContactListAdapter;
|
||||
@@ -47,6 +42,7 @@ public class ContactChooserAdapter extends ContactListAdapter {
|
||||
* Set the identity from whose perspective the contact shall be chosen.
|
||||
* Contacts that belong to a different author will be shown grayed out,
|
||||
* but are still clickable.
|
||||
*
|
||||
* @param authorId The ID of the local Author
|
||||
*/
|
||||
public void setLocalAuthor(AuthorId authorId) {
|
||||
@@ -55,21 +51,12 @@ public class ContactChooserAdapter extends ContactListAdapter {
|
||||
}
|
||||
|
||||
private void grayOutItem(final ContactHolder ui) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
float alpha = 0.25f;
|
||||
ui.bulb.setAlpha(alpha);
|
||||
ui.avatar.setAlpha(alpha);
|
||||
ui.name.setAlpha(alpha);
|
||||
ui.date.setAlpha(alpha);
|
||||
ui.identity.setAlpha(alpha);
|
||||
} else {
|
||||
ColorFilter colorFilter = new PorterDuffColorFilter(Color.GRAY,
|
||||
PorterDuff.Mode.MULTIPLY);
|
||||
ui.bulb.setColorFilter(colorFilter);
|
||||
ui.avatar.setColorFilter(colorFilter);
|
||||
ui.name.setEnabled(false);
|
||||
ui.date.setEnabled(false);
|
||||
}
|
||||
float alpha = 0.25f;
|
||||
ui.bulb.setAlpha(alpha);
|
||||
ui.avatar.setAlpha(alpha);
|
||||
ui.name.setAlpha(alpha);
|
||||
ui.date.setAlpha(alpha);
|
||||
ui.identity.setAlpha(alpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@@ -101,11 +100,9 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
|
||||
SharedPreferences prefs = sharedPreferencesFactory.create();
|
||||
excludedFields = new HashSet<>();
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
for (String name : prefs.getStringSet(PREF_EXCLUDED_FIELDS,
|
||||
new HashSet<String>())) {
|
||||
excludedFields.add(ReportField.valueOf(name));
|
||||
}
|
||||
for (String name : prefs.getStringSet(PREF_EXCLUDED_FIELDS,
|
||||
new HashSet<String>())) {
|
||||
excludedFields.add(ReportField.valueOf(name));
|
||||
}
|
||||
|
||||
Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
|
||||
@@ -367,16 +364,14 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
protected void onPostExecute(Boolean success) {
|
||||
final SharedPreferences prefs =
|
||||
sharedPreferencesFactory.create();
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
final SharedPreferences.Editor prefEditor =
|
||||
prefs.edit();
|
||||
Set<String> fields = new HashSet<>();
|
||||
for (ReportField field : excludedFields) {
|
||||
fields.add(field.name());
|
||||
}
|
||||
prefEditor.putStringSet(PREF_EXCLUDED_FIELDS, fields);
|
||||
prefEditor.apply();
|
||||
final SharedPreferences.Editor prefEditor =
|
||||
prefs.edit();
|
||||
Set<String> fields = new HashSet<>();
|
||||
for (ReportField field : excludedFields) {
|
||||
fields.add(field.name());
|
||||
}
|
||||
prefEditor.putStringSet(PREF_EXCLUDED_FIELDS, fields);
|
||||
prefEditor.apply();
|
||||
|
||||
if (success) {
|
||||
// Retrieve user's comment and email address, if any
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package org.briarproject.android.sharing;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -27,25 +21,10 @@ import static android.view.View.VISIBLE;
|
||||
class ContactSelectorAdapter
|
||||
extends BaseContactListAdapter<ContactSelectorAdapter.SelectableContactHolder> {
|
||||
|
||||
private final ColorFilter grayColorFilter;
|
||||
|
||||
ContactSelectorAdapter(Context context,
|
||||
OnItemClickListener listener) {
|
||||
|
||||
super(context, listener);
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
grayColorFilter = null;
|
||||
} else {
|
||||
// Overlay the background colour at 75% opacity
|
||||
int bg = ContextCompat.getColor(context, R.color.window_background);
|
||||
int alpha = (int) (255 * 0.75f);
|
||||
int red = Color.red(bg);
|
||||
int green = Color.green(bg);
|
||||
int blue = Color.blue(bg);
|
||||
bg = Color.argb(alpha, red, green, blue);
|
||||
grayColorFilter = new PorterDuffColorFilter(bg,
|
||||
PorterDuff.Mode.SRC_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,14 +93,9 @@ class ContactSelectorAdapter
|
||||
}
|
||||
|
||||
private void grayOutItem(SelectableContactHolder ui, boolean gray) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
float alpha = gray ? 0.25f : 1f;
|
||||
ui.avatar.setAlpha(alpha);
|
||||
ui.name.setAlpha(alpha);
|
||||
ui.checkBox.setAlpha(alpha);
|
||||
} else {
|
||||
if (gray) ui.avatar.setColorFilter(grayColorFilter);
|
||||
else ui.avatar.clearColorFilter();
|
||||
}
|
||||
float alpha = gray ? 0.25f : 1f;
|
||||
ui.avatar.setAlpha(alpha);
|
||||
ui.name.setAlpha(alpha);
|
||||
ui.checkBox.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package org.briarproject.android.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.Adapter;
|
||||
import android.util.AttributeSet;
|
||||
@@ -71,7 +69,7 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
showProgressBar();
|
||||
|
||||
// scroll down when opening keyboard
|
||||
if (isScrollingToEnd && Build.VERSION.SDK_INT >= 11) {
|
||||
if (isScrollingToEnd) {
|
||||
addLayoutChangeListener();
|
||||
}
|
||||
|
||||
@@ -90,7 +88,6 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
};
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void addLayoutChangeListener() {
|
||||
recyclerView.addOnLayoutChangeListener(
|
||||
new OnLayoutChangeListener() {
|
||||
|
||||
@@ -25,7 +25,6 @@ import static android.hardware.Camera.Parameters.FOCUS_MODE_EDOF;
|
||||
import static android.hardware.Camera.Parameters.FOCUS_MODE_FIXED;
|
||||
import static android.hardware.Camera.Parameters.FOCUS_MODE_MACRO;
|
||||
import static android.hardware.Camera.Parameters.SCENE_MODE_BARCODE;
|
||||
import static android.view.SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
@@ -59,8 +58,6 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
super.onAttachedToWindow();
|
||||
setKeepScreenOn(true);
|
||||
SurfaceHolder holder = getHolder();
|
||||
if (Build.VERSION.SDK_INT < 11)
|
||||
holder.setType(SURFACE_TYPE_PUSH_BUFFERS);
|
||||
holder.addCallback(this);
|
||||
}
|
||||
|
||||
@@ -164,8 +161,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
LOG.info("Setting scene mode to barcode");
|
||||
params.setSceneMode(SCENE_MODE_BARCODE);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14 &&
|
||||
focusModes.contains(FOCUS_MODE_CONTINUOUS_PICTURE)) {
|
||||
if (focusModes.contains(FOCUS_MODE_CONTINUOUS_PICTURE)) {
|
||||
LOG.info("Setting focus mode to continuous picture");
|
||||
params.setFocusMode(FOCUS_MODE_CONTINUOUS_PICTURE);
|
||||
} else if (focusModes.contains(FOCUS_MODE_CONTINUOUS_VIDEO)) {
|
||||
@@ -212,12 +208,6 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
+ ", stretch " + stretch + ", pixels " + pixels
|
||||
+ ", score " + score);
|
||||
}
|
||||
// Large preview sizes can crash older devices
|
||||
int maxDimension = Math.max(width, height);
|
||||
if (Build.VERSION.SDK_INT < 14 && maxDimension > screenMax) {
|
||||
LOG.info("Too large for screen");
|
||||
continue;
|
||||
}
|
||||
if (bestSize == null || score > bestScore) {
|
||||
bestSize = size;
|
||||
bestScore = score;
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.briarproject.android.util;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
@@ -12,25 +10,7 @@ import static android.view.View.VISIBLE;
|
||||
|
||||
public class CustomAnimations {
|
||||
|
||||
public static void animateHeight(ViewGroup viewGroup, boolean isExtending,
|
||||
int duration) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
animateHeightPostGingerbread(viewGroup, isExtending, duration);
|
||||
} else {
|
||||
animateHeightGingerbread(viewGroup, isExtending);
|
||||
}
|
||||
}
|
||||
|
||||
private static void animateHeightGingerbread(ViewGroup viewGroup,
|
||||
boolean isExtending) {
|
||||
// No animations for Gingerbread
|
||||
if (isExtending) viewGroup.setVisibility(VISIBLE);
|
||||
else viewGroup.setVisibility(GONE);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private static void animateHeightPostGingerbread(final ViewGroup viewGroup,
|
||||
public static void animateHeight(final ViewGroup viewGroup,
|
||||
final boolean isExtending, int duration) {
|
||||
ValueAnimator anim;
|
||||
if (isExtending) {
|
||||
@@ -74,4 +54,5 @@ public class CustomAnimations {
|
||||
anim.setDuration(duration);
|
||||
anim.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user