Skip to content

Commit 6781c38

Browse files
author
Iain Connor
committed
Updating to new support lib
1 parent f7daf42 commit 6781c38

File tree

6 files changed

+18
-51
lines changed

6 files changed

+18
-51
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
5+
buildToolsVersion "23.0.3"
66

77
defaultConfig {
88
applicationId "com.tippingcanoe.dewey.app"
@@ -21,6 +21,6 @@ android {
2121

2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:23.1.1'
24+
compile 'com.android.support:appcompat-v7:23.2.1'
2525
compile project(':library')
2626
}

app/src/main/java/com/tippingcanoe/dewey/app/DemoAdapter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.tippingcanoe.dewey.app;
22

3-
import android.graphics.Color;
43
import android.support.v7.widget.RecyclerView;
5-
import android.util.TypedValue;
6-
import android.view.Gravity;
74
import android.view.LayoutInflater;
85
import android.view.View;
96
import android.view.ViewGroup;
@@ -40,7 +37,7 @@ public void onBindViewHolder ( DeweyViewHolder holder, int position ) {
4037

4138
@Override
4239
public int getItemCount () {
43-
return 2;//return sentances.size();
40+
return 10000;
4441
}
4542

4643
protected List<String> getRandomSentances () {

app/src/main/res/layout/dewey_cell.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
android:id="@+id/dewey_cell_label"
44
xmlns:android="http://schemas.android.com/apk/res/android"
55
android:layout_width="40dp"
6-
android:layout_height="wrap_content"
6+
android:layout_height="40dp"
77
android:gravity="center"
88
android:padding="10dp"
99
android:ellipsize="end"/>

library/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
5+
buildToolsVersion "23.0.3"
66

77
defaultConfig {
88
minSdkVersion 10
@@ -21,6 +21,6 @@ android {
2121
dependencies {
2222
compile fileTree(dir: 'libs', include: ['*.jar'])
2323

24-
compile 'com.android.support:appcompat-v7:23.1.1'
25-
compile 'com.android.support:recyclerview-v7:23.1.1'
24+
compile 'com.android.support:appcompat-v7:23.2.1'
25+
compile 'com.android.support:recyclerview-v7:23.2.1'
2626
}

library/library.iml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
1313
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
1414
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
15-
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
16-
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
1715
<afterSyncTasks>
1816
<task>generateDebugSources</task>
19-
<task>generateDebugTestSources</task>
2017
</afterSyncTasks>
2118
<option name="ALLOW_USER_CONFIGURATION" value="false" />
2219
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@@ -65,22 +62,15 @@
6562
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
6663
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6764
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
65+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
6866
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
6967
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
7068
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
71-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
7269
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
73-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
7570
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
76-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
77-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
78-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
7971
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
8072
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
8173
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
82-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
83-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
8474
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
8575
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
8676
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
@@ -89,9 +79,11 @@
8979
</content>
9080
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9181
<orderEntry type="sourceFolder" forTests="false" />
92-
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
93-
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
94-
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
95-
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
82+
<orderEntry type="library" exported="" name="recyclerview-v7-23.2.1" level="project" />
83+
<orderEntry type="library" exported="" name="support-v4-23.2.1" level="project" />
84+
<orderEntry type="library" exported="" name="support-annotations-23.2.1" level="project" />
85+
<orderEntry type="library" exported="" name="animated-vector-drawable-23.2.1" level="project" />
86+
<orderEntry type="library" exported="" name="support-vector-drawable-23.2.1" level="project" />
87+
<orderEntry type="library" exported="" name="appcompat-v7-23.2.1" level="project" />
9688
</component>
9789
</module>

library/src/main/java/com/tippingcanoe/dewey/DeweyLayoutManager.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,11 @@ public DeweyLayoutManager(Context context, AttributeSet attrs, int defStyleAttr,
3838

3939
@Override
4040
public void onMeasure ( RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec ) {
41-
if ( View.MeasureSpec.getMode(heightSpec) != View.MeasureSpec.EXACTLY ) {
42-
int height = measureFirstChildHeight(recycler);
43-
heightSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);
44-
}
45-
4641
super.onMeasure(recycler, state, widthSpec, heightSpec);
4742

4843
updateUniformCellWidth();
4944
}
5045

51-
protected int measureFirstChildHeight(RecyclerView.Recycler recycler) {
52-
View view = getItemCount() == 0 ? null : recycler.getViewForPosition(0);
53-
54-
if (view != null) {
55-
RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) view.getLayoutParams();
56-
57-
int childHeightSpec = ViewGroup.getChildMeasureSpec(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), getPaddingTop() + getPaddingBottom(), p.height);
58-
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), childHeightSpec);
59-
60-
int height = view.getMeasuredHeight() + p.bottomMargin + p.topMargin;
61-
62-
detachView(view);
63-
64-
return height;
65-
}
66-
67-
return 0;
68-
}
69-
7046
@Override
7147
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
7248
return updateLayoutParamsForUniformWidthIfNeeded(super.generateDefaultLayoutParams());
@@ -151,15 +127,17 @@ public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State
151127

152128
class DurationSmoothScroller extends LinearSmoothScroller {
153129
private static final int TARGET_SEEK_SCROLL_DISTANCE_PX = 10000;
130+
private final float MILLISECONDS_PER_PX;
154131
private final float distanceInPixels;
155132
private final float duration;
156133

157134
public DurationSmoothScroller(Context context, int distanceInPixels, int duration) {
158135
super(context);
159136
this.distanceInPixels = distanceInPixels;
160-
float millisecondsPerPx = calculateSpeedPerPixel(context.getResources().getDisplayMetrics());
137+
duration = 1000;
138+
MILLISECONDS_PER_PX = calculateSpeedPerPixel(context.getResources().getDisplayMetrics());
161139
this.duration = distanceInPixels < TARGET_SEEK_SCROLL_DISTANCE_PX ?
162-
(int) (Math.abs(distanceInPixels) * millisecondsPerPx) : duration;
140+
(int) (Math.abs(distanceInPixels) * MILLISECONDS_PER_PX) : duration;
163141
}
164142

165143
@Override

0 commit comments

Comments
 (0)