diff --git a/.idea/libraries/Gradle__effects_android_23.xml b/.idea/libraries/Gradle__effects_android_23.xml
deleted file mode 100644
index 8497777..0000000
--- a/.idea/libraries/Gradle__effects_android_23.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__maps_android_23.xml b/.idea/libraries/Gradle__maps_android_23.xml
deleted file mode 100644
index 278d884..0000000
--- a/.idea/libraries/Gradle__maps_android_23.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__usb_android_23.xml b/.idea/libraries/Gradle__usb_android_23.xml
deleted file mode 100644
index 4832e05..0000000
--- a/.idea/libraries/Gradle__usb_android_23.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index ba7052b..635999d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/build.gradle b/build.gradle
index 47cf56f..934182e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,9 +9,20 @@ buildscript {
}
}
+
allprojects {
repositories {
jcenter()
google()
}
}
+
+// This block encapsulates custom properties and makes them available to all
+// modules in the project.
+ext {
+ // The following are only a few examples of the types of properties you can define.
+ compileSdkVersion = 28
+ // You can also create properties to specify versions for dependencies.
+ // Having consistent versions between modules can avoid conflicts with behavior.
+ supportLibVersion = "28.0.0"
+}
diff --git a/library/build.gradle b/library/build.gradle
index c03c04e..745e93d 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,15 +1,16 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 'Google Inc.:Google APIs:23'
+ compileSdkVersion 28
defaultConfig {
- minSdkVersion 14
+ minSdkVersion 16
+ targetSdkVersion 28
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
diff --git a/library/library.iml b/library/library.iml
index b9f5dc6..2384fc4 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -99,6 +99,7 @@
+
@@ -109,10 +110,7 @@
-
+
-
-
-
\ No newline at end of file
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 9dd1d15..bf1c5e6 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -4,5 +4,4 @@
android:versionCode="1"
android:versionName="1.0">
-
diff --git a/library/src/main/java/net/simonvt/numberpicker/NumberPicker.java b/library/src/main/java/net/simonvt/numberpicker/NumberPicker.java
index 0e7ad3b..4324584 100644
--- a/library/src/main/java/net/simonvt/numberpicker/NumberPicker.java
+++ b/library/src/main/java/net/simonvt/numberpicker/NumberPicker.java
@@ -301,7 +301,7 @@ public static final Formatter getTwoDigitFormatter() {
/**
* Cache for the string representation of selector indices.
*/
- private final SparseArray mSelectorIndexToStringCache = new SparseArray();
+ private final SparseArray mSelectorIndexToStringCache = new SparseArray<>();
/**
* The selector indices whose value are show by the selector.
@@ -369,11 +369,6 @@ public static final Formatter getTwoDigitFormatter() {
*/
private float mLastDownEventY;
- /**
- * The time of the last down event.
- */
- private long mLastDownEventTime;
-
/**
* The Y position of the last down or move event.
*/
@@ -503,7 +498,7 @@ public interface OnScrollListener {
/**
* The view is not scrolling.
*/
- public static int SCROLL_STATE_IDLE = 0;
+ int SCROLL_STATE_IDLE = 0;
/**
* The user is scrolling using touch, and his finger is still on the screen.
@@ -661,7 +656,7 @@ public boolean onLongClick(View v) {
// increment button
if (!mHasSelectorWheel) {
- mIncrementButton = (ImageButton) findViewById(R.id.np__increment);
+ mIncrementButton = findViewById(R.id.np__increment);
mIncrementButton.setOnClickListener(onClickListener);
mIncrementButton.setOnLongClickListener(onLongClickListener);
} else {
@@ -670,7 +665,7 @@ public boolean onLongClick(View v) {
// decrement button
if (!mHasSelectorWheel) {
- mDecrementButton = (ImageButton) findViewById(R.id.np__decrement);
+ mDecrementButton = findViewById(R.id.np__decrement);
mDecrementButton.setOnClickListener(onClickListener);
mDecrementButton.setOnLongClickListener(onLongClickListener);
} else {
@@ -678,7 +673,7 @@ public boolean onLongClick(View v) {
}
// input text
- mInputText = (EditText) findViewById(R.id.np__numberpicker_input);
+ mInputText = findViewById(R.id.np__numberpicker_input);
mInputText.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
@@ -815,7 +810,11 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
removeAllCallbacks();
mInputText.setVisibility(View.INVISIBLE);
mLastDownOrMoveEventY = mLastDownEventY = event.getY();
- mLastDownEventTime = event.getEventTime();
+ /*
+ The time of the last down event.
+ */ /**
+ * The time of the last down event.
+ */long mLastDownEventTime = event.getEventTime();
mIngonreMoveEvents = false;
mShowSoftInputOnTap = false;
// Handle pressed state before any state change.
@@ -1233,8 +1232,8 @@ private void tryComputeMaxWidth() {
maxTextWidth = (int) (numberOfDigits * maxDigitWidth);
} else {
final int valueCount = mDisplayedValues.length;
- for (int i = 0; i < valueCount; i++) {
- final float textWidth = mSelectorWheelPaint.measureText(mDisplayedValues[i]);
+ for (String mDisplayedValue : mDisplayedValues) {
+ final float textWidth = mSelectorWheelPaint.measureText(mDisplayedValue);
if (textWidth > maxTextWidth) {
maxTextWidth = (int) textWidth;
}
@@ -1752,9 +1751,7 @@ private int getWrappedSelectorIndex(int selectorIndex) {
* will be displayed in the selector.
*/
private void incrementSelectorIndices(int[] selectorIndices) {
- for (int i = 0; i < selectorIndices.length - 1; i++) {
- selectorIndices[i] = selectorIndices[i + 1];
- }
+ System.arraycopy(selectorIndices, 1, selectorIndices, 0, selectorIndices.length - 1);
int nextScrollSelectorIndex = selectorIndices[selectorIndices.length - 2] + 1;
if (mWrapSelectorWheel && nextScrollSelectorIndex > mMaxValue) {
nextScrollSelectorIndex = mMinValue;
@@ -1768,9 +1765,7 @@ private void incrementSelectorIndices(int[] selectorIndices) {
* will be displayed in the selector.
*/
private void decrementSelectorIndices(int[] selectorIndices) {
- for (int i = selectorIndices.length - 1; i > 0; i--) {
- selectorIndices[i] = selectorIndices[i - 1];
- }
+ System.arraycopy(selectorIndices, 0, selectorIndices, 1, selectorIndices.length - 1);
int nextScrollSelectorIndex = selectorIndices[1] - 1;
if (mWrapSelectorWheel && nextScrollSelectorIndex < mMinValue) {
nextScrollSelectorIndex = mMaxValue;
@@ -1813,7 +1808,7 @@ private void validateInputTextView(View v) {
updateInputTextView();
} else {
// Check the new value and ensure it's in range
- int current = getSelectedPos(str.toString());
+ int current = getSelectedPos(str);
setValueInternal(current, true);
}
}
@@ -2490,7 +2485,7 @@ private void findAccessibilityNodeInfosByTextInChild(String searchedLowerCase,
case VIRTUAL_VIEW_ID_DECREMENT: {
String text = getVirtualDecrementButtonText();
if (!TextUtils.isEmpty(text)
- && text.toString().toLowerCase().contains(searchedLowerCase)) {
+ && text.toLowerCase().contains(searchedLowerCase)) {
outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT));
}
} return;
@@ -2511,10 +2506,10 @@ private void findAccessibilityNodeInfosByTextInChild(String searchedLowerCase,
case VIRTUAL_VIEW_ID_INCREMENT: {
String text = getVirtualIncrementButtonText();
if (!TextUtils.isEmpty(text)
- && text.toString().toLowerCase().contains(searchedLowerCase)) {
+ && text.toLowerCase().contains(searchedLowerCase)) {
outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT));
}
- } return;
+ }
}
}
diff --git a/library/src/main/java/net/simonvt/numberpicker/Scroller.java b/library/src/main/java/net/simonvt/numberpicker/Scroller.java
index b99ac81..b5fbb0d 100644
--- a/library/src/main/java/net/simonvt/numberpicker/Scroller.java
+++ b/library/src/main/java/net/simonvt/numberpicker/Scroller.java
@@ -30,7 +30,7 @@
* automatically moved to its final stage and computeScrollOffset()
* will always return false to indicate that scrolling is over.
*/
-public class Scroller {
+class Scroller {
private int mMode;
private int mStartX;
@@ -61,7 +61,6 @@ public class Scroller {
private static final int FLING_MODE = 1;
private static float DECELERATION_RATE = (float) (Math.log(0.75) / Math.log(0.9));
- private static float ALPHA = 800; // pixels / seconds
private static float START_TENSION = 0.4f; // Tension at start: (0.4 * total T, 1.0 * Distance)
private static float END_TENSION = 1.0f - START_TENSION;
private static final int NB_SAMPLES = 100;
@@ -389,6 +388,8 @@ public void fling(int startX, int startY, int velocityX, int velocityY,
float velocity = (float) Math.sqrt(velocityX * velocityX + velocityY * velocityY);
mVelocity = velocity;
+ // pixels / seconds
+ float ALPHA = 800;
final double l = Math.log(START_TENSION * velocity / ALPHA);
mDuration = (int) (1000.0 * Math.exp(l / (DECELERATION_RATE - 1.0)));
mStartTime = AnimationUtils.currentAnimationTimeMillis();
diff --git a/mobilinkdTNC/build.gradle b/mobilinkdTNC/build.gradle
index 55f3aa9..8426d60 100644
--- a/mobilinkdTNC/build.gradle
+++ b/mobilinkdTNC/build.gradle
@@ -6,19 +6,26 @@ android {
defaultConfig {
applicationId "com.mobilinkd.tncconfig"
- minSdkVersion 14
+ minSdkVersion 16
+ targetSdkVersion 28
+
+ // Defines the version number of your app.
+ versionCode 16
+
+ // Defines a user-friendly version name for your app.
+ versionName "1.2.2"
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
- compile project(':library')
- compile 'com.android.support:appcompat-v7:28.0.0'
- compile 'com.android.support:gridlayout-v7:28.0.0'
+ implementation project(':library')
+ implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
+ implementation "com.android.support:gridlayout-v7:${rootProject.ext.supportLibVersion}"
}
diff --git a/mobilinkdTNC/mobilinkdTNC.iml b/mobilinkdTNC/mobilinkdTNC.iml
index 1a4d895..294f2fd 100644
--- a/mobilinkdTNC/mobilinkdTNC.iml
+++ b/mobilinkdTNC/mobilinkdTNC.iml
@@ -87,37 +87,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
diff --git a/mobilinkdTNC/src/main/AndroidManifest.xml b/mobilinkdTNC/src/main/AndroidManifest.xml
index 6d40adb..3226bf7 100644
--- a/mobilinkdTNC/src/main/AndroidManifest.xml
+++ b/mobilinkdTNC/src/main/AndroidManifest.xml
@@ -1,9 +1,7 @@
+ package="com.mobilinkd.tncconfig">