Skip to content

Commit

Permalink
minSdkVersion is dropped to 14
Browse files Browse the repository at this point in the history
  • Loading branch information
volsahin committed Oct 28, 2017
1 parent 3f54be9 commit 3449c91
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 38 deletions.
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.volcaniccoder.volxfastscrollsample"
minSdkVersion 16
targetSdkVersion 26
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -24,9 +24,9 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.android.support:support-annotations:27.0.0'
testCompile 'junit:junit:4.12'
compile project(path: ':volxfastscroll')
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Apr 09 02:22:14 EEST 2017
#Sat Oct 28 19:31:40 EET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
26 changes: 11 additions & 15 deletions volxfastscroll/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion 27
buildToolsVersion '26.0.2'

defaultConfig {
minSdkVersion 16
targetSdkVersion 26
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
Expand All @@ -21,14 +19,12 @@ android {
}
}

ext.supportLibraryVersion = '27.0.0'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-annotations:25.3.1'
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:support-annotations:$supportLibraryVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
Expand Down Expand Up @@ -55,7 +56,8 @@ public class Volx implements Runnable {
private List<VolxCharModel> charList = new ArrayList<>();
private int lastPos = -1;
private int blinkCount = 0;
private boolean isTouched = true;
private boolean isUserScrolled = true;
private boolean isUserTouchedRightBar = false;
private boolean isInactive = false;
private int itemHeight;
private List<Integer> positionList = new ArrayList<>();
Expand Down Expand Up @@ -121,7 +123,7 @@ private void execute() {

if (!charArr.contains(c)) {
charArr.add(c);
charList.add(new VolxCharModel(c, false));
charList.add(new VolxCharModel(c));
positionList.add(counter);
}

Expand Down Expand Up @@ -153,8 +155,8 @@ public void onGlobalLayout() {
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);

if (newState == SCROLL_STATE_DRAGGING && !isTouched) {
isTouched = true;
if (newState == SCROLL_STATE_DRAGGING && !isUserScrolled) {
isUserScrolled = true;
rightIndicatorLayout.setVisibility(View.VISIBLE);
removeViewsWithDelay();
}
Expand Down Expand Up @@ -191,6 +193,8 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
public boolean onTouch(View v, MotionEvent event) {
int y = (int) event.getY();

isUserTouchedRightBar = true;

if (rightIndicatorLayout.getVisibility() == View.GONE)
setViewsVisibility(true);

Expand Down Expand Up @@ -242,7 +246,8 @@ private void setViewsVisibility(boolean isShow) {
if (delayMillis == NEVER_CLOSE)
return;
rightIndicatorLayout.setVisibility(View.GONE);
isTouched = false;
isUserScrolled = false;
isUserTouchedRightBar = false;
return;
}

Expand Down Expand Up @@ -293,19 +298,24 @@ private void initViews() {
rightIndicatorLayout.addView(mRecyclerView, listParams);

// Adding animate layout change to parent layout
LayoutTransition lt = new LayoutTransition();
lt.disableTransitionType(LayoutTransition.APPEARING);
parentLayout.setLayoutTransition(lt);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
LayoutTransition lt = new LayoutTransition();
lt.disableTransitionType(LayoutTransition.APPEARING);
parentLayout.setLayoutTransition(lt);
}

}

@Override
public void run() {
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
if (isUserTouchedRightBar) return;
if (rightIndicatorLayout.getVisibility() == VISIBLE) {
setViewsVisibility(false);
}
mRecyclerView.removeCallbacks(this);
}
});
}
Expand All @@ -317,7 +327,10 @@ public void notifyValueDataChanged() {
}

private void onScreenCreated(int height, ViewTreeObserver.OnGlobalLayoutListener listener) {
parentLayout.getViewTreeObserver().removeOnGlobalLayoutListener(listener);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
parentLayout.getViewTreeObserver().removeGlobalOnLayoutListener(listener);
else
parentLayout.getViewTreeObserver().removeOnGlobalLayoutListener(listener);

rightBarParams.height = (int) (height * barHeightRatio);
itemHeight = (int) (height * barHeightRatio - utils.dpToPx(16)) / (charList.size());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.volcaniccoder.volxfastscroll;

public class VolxAdapterFeatures {
class VolxAdapterFeatures {

private int paramsHeight;
private float scale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ public class VolxCharModel {
private boolean isBlink;
private boolean isGone;

public VolxCharModel(Character character, boolean isBlink) {
public VolxCharModel(Character character) {
this.character = character;
this.isBlink = isBlink;
}

public Character getCharacter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.view.View;
import android.view.ViewGroup;

public class VolxUtils {
class VolxUtils {

private Context mContext;

Expand Down

0 comments on commit 3449c91

Please sign in to comment.