diff --git a/app/build.gradle b/app/build.gradle index febfe45..d3b8c68 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion "25.0.2" defaultConfig { applicationId "com.mkulesh.mmd" - minSdkVersion 9 + minSdkVersion 16 targetSdkVersion 25 versionCode 4 versionName "1.3" @@ -26,7 +26,7 @@ android { lintOptions { checkReleaseBuilds false abortOnError false - disable "RtlHardcoded", "RtlSymmetry", "RtlEnabled", "ApplySharedPref", "PrivateResource", "SetTextI18n" + disable "RtlHardcoded", "RtlSymmetry", "RtlEnabled", "ApplySharedPref", "PrivateResource", "SetTextI18n", "DefaultLocale" } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 890dd84..157a029 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,8 @@ diff --git a/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java b/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java index f24b809..54915b1 100644 --- a/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java +++ b/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java @@ -98,7 +98,6 @@ public void onOrientationChanged(int orientation) // surface preparation surface = (SurfaceView) rootView.findViewById(R.id.experiment_view); - //surface.setZOrderOnTop(true); surface.getHolder().setFormat(PixelFormat.TRANSPARENT); touchListener = new SurfaceTouchListener(activity, surface); surface.setOnTouchListener(touchListener); diff --git a/app/src/main/java/com/mkulesh/mmd/SurfaceTouchListener.java b/app/src/main/java/com/mkulesh/mmd/SurfaceTouchListener.java index 47cb567..edfbb78 100644 --- a/app/src/main/java/com/mkulesh/mmd/SurfaceTouchListener.java +++ b/app/src/main/java/com/mkulesh/mmd/SurfaceTouchListener.java @@ -25,7 +25,6 @@ import android.graphics.RectF; import android.support.v4.view.MotionEventCompat; -import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.MotionEvent; @@ -59,7 +58,7 @@ private class Pointer int activeId = INVALID_ID; } - private Pointer pointer = new Pointer(); + private final Pointer pointer = new Pointer(); public SurfaceTouchListener(AppCompatActivity activity, SurfaceView surface) { @@ -97,7 +96,7 @@ private boolean onMoveEvent(MotionEvent ev) { final int action = MotionEventCompat.getActionMasked(ev); final int pointerIndex = MotionEventCompat.getActionIndex(ev); - final int pointerCount = MotionEventCompat.getPointerCount(ev); + final int pointerCount = ev.getPointerCount(); if (pointerIndex != 0 || pointerCount != 1) { return true; @@ -106,8 +105,8 @@ private boolean onMoveEvent(MotionEvent ev) switch (action) { case MotionEvent.ACTION_DOWN: - mLastTouchX = MotionEventCompat.getX(ev, pointerIndex); - mLastTouchY = MotionEventCompat.getY(ev, pointerIndex); + mLastTouchX = ev.getX(pointerIndex); + mLastTouchY = ev.getY(pointerIndex); if (pointer.activeId == Pointer.INVALID_ID) { @@ -116,15 +115,15 @@ private boolean onMoveEvent(MotionEvent ev) return true; } } - pointer.activeId = MotionEventCompat.getPointerId(ev, 0); + pointer.activeId = ev.getPointerId(0); break; case MotionEvent.ACTION_MOVE: if (pointer.activeId != Pointer.INVALID_ID) { - final float x = MotionEventCompat.getX(ev, pointerIndex); - final float y = MotionEventCompat.getY(ev, pointerIndex); + final float x = ev.getX(pointerIndex); + final float y = ev.getY(pointerIndex); // Calculate the distance moved final float dx = x - mLastTouchX; diff --git a/app/src/main/java/com/mkulesh/mmd/utils/CompatUtils.java b/app/src/main/java/com/mkulesh/mmd/utils/CompatUtils.java index 8b55da1..f76726e 100644 --- a/app/src/main/java/com/mkulesh/mmd/utils/CompatUtils.java +++ b/app/src/main/java/com/mkulesh/mmd/utils/CompatUtils.java @@ -47,24 +47,6 @@ public static boolean isMarshMallowOrLater() return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; } - /** - * Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource. - * - * This method was deprecated in API level 23. - */ - @SuppressWarnings("deprecation") - public static final void setTextAppearance(Context context, TextView t, int resId) - { - if (isMarshMallowOrLater()) - { - t.setTextAppearance(resId); - } - else - { - t.setTextAppearance(context, resId); - } - } - /** * Returns a color associated with a particular resource ID. * @@ -114,64 +96,10 @@ public static Drawable getDrawable(Context context, int icon) } } - /** - * Procedure sets the background for given view as a drawable with given resource id - */ - @SuppressWarnings("deprecation") - public static void updateBackground(Context c, View v, int resId) - { - Drawable bg = null; - - if (resId >= 0) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - { - bg = c.getResources().getDrawable(resId, c.getTheme()); - } - else - { - bg = c.getResources().getDrawable(resId); - } - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) - { - v.setBackground(bg); - } - else - { - v.setBackgroundDrawable(bg); - } - } - - @SafeVarargs - public static void executeAsyncTask(AsyncTask asyncTask, T... params) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - { - asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); - } - else - { - asyncTask.execute(params); - } - } - - public static boolean isExternalStorageEmulated() - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - { - return Environment.isExternalStorageEmulated(); - } - else - { - return false; - } - } - /** * Procedure creates new dot-separated DecimalFormat */ + @SuppressLint("ObsoleteSdkInt") public static DecimalFormat getDecimalFormat(String format) { DecimalFormat df = new DecimalFormat(format); diff --git a/app/src/main/java/com/mkulesh/mmd/widgets/VerticalSeekBar.java b/app/src/main/java/com/mkulesh/mmd/widgets/VerticalSeekBar.java index 589e80e..93de950 100644 --- a/app/src/main/java/com/mkulesh/mmd/widgets/VerticalSeekBar.java +++ b/app/src/main/java/com/mkulesh/mmd/widgets/VerticalSeekBar.java @@ -41,7 +41,6 @@ public class VerticalSeekBar extends AppCompatSeekBar { private Drawable customThumb; - private boolean mMirrorForRtl = false; public VerticalSeekBar(Context context) { @@ -70,12 +69,7 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) Drawable customThumb = customAttr.getDrawable(R.styleable.VerticalSeekBar_customThumb); setCustomThumb(customThumb); - int[] mirrorForRtlAttr = new int[]{android.R.attr.mirrorForRtl}; - TypedArray attributes = context.obtainStyledAttributes(attrs, mirrorForRtlAttr); - mMirrorForRtl = attributes.getBoolean(0, false); - customAttr.recycle(); - attributes.recycle(); } protected void onSizeChanged(int w, int h, int oldw, int oldh) @@ -147,7 +141,7 @@ private void drawThumb(Canvas canvas) top = 0; bottom = customThumb.getIntrinsicHeight(); } - final int left = (isLayoutRtl() && mMirrorForRtl) ? available - thumbPos : thumbPos; + final int left = thumbPos; final int right = left + thumbWidth; Rect thumbBounds = customThumb.getBounds(); @@ -160,11 +154,6 @@ private void drawThumb(Canvas canvas) } } - private boolean isLayoutRtl() - { - return false; - } - private float getScale() { final int max = getMax(); diff --git a/app/src/main/res/values/consts.xml b/app/src/main/res/values/consts.xml index ae76e8b..8b13301 100644 --- a/app/src/main/res/values/consts.xml +++ b/app/src/main/res/values/consts.xml @@ -6,7 +6,7 @@ @raw/ic_grid_square @raw/ic_grid_diagonal - + 10 10 @@ -77,6 +77,6 @@ 0.1 10.0 0.00 - true + false \ No newline at end of file