Skip to content

Commit 27dfeaa

Browse files
committed
Move FlexLayoutManager into serparate module
1 parent eb76a43 commit 27dfeaa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+870
-232
lines changed

app/build.gradle

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@ android {
1515
keyPassword KEY_PASSWORD
1616
}
1717
}
18-
compileSdkVersion 28
18+
compileSdkVersion 30
1919
defaultConfig {
2020
applicationId "org.wakin.flexlayoutmanager"
2121
minSdkVersion 19
22-
targetSdkVersion 28
22+
targetSdkVersion 30
2323
versionCode 1
2424
versionName "1.0"
2525
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
26-
externalNativeBuild {
27-
cmake {
28-
cppFlags "-std=c++14"
29-
}
30-
}
3126
}
3227
buildTypes {
3328
release {
@@ -40,18 +35,16 @@ android {
4035
jniDebuggable = true
4136
}
4237
}
43-
externalNativeBuild {
44-
cmake {
45-
path "src/main/cpp/CMakeLists.txt"
46-
version "3.10.2"
47-
}
48-
}
38+
ndkVersion '23.1.7779620'
39+
buildToolsVersion '30.0.3'
40+
4941
}
5042

5143
dependencies {
5244
implementation fileTree(dir: 'libs', include: ['*.jar'])
5345
implementation 'androidx.appcompat:appcompat:1.0.2'
5446
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
47+
implementation project(path: ':flexlayout')
5548
testImplementation 'junit:junit:4.12'
5649
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
5750
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.wakin.flexlayout">
3+
package="org.wakin.flexlayoutsample">
44

55
<uses-permission android:name="android.permission.INTERNET" />
66
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
@@ -14,7 +14,7 @@
1414
android:roundIcon="@mipmap/ic_launcher_round"
1515
android:supportsRtl="true"
1616
android:theme="@style/AppTheme">
17-
<activity android:name="org.wakin.flexlayout.app.MainActivity">
17+
<activity android:name="org.wakin.flexlayoutsample.app.MainActivity">
1818
<intent-filter>
1919
<action android:name="android.intent.action.MAIN" />
2020

@@ -23,4 +23,4 @@
2323
</activity>
2424
</application>
2525

26-
</manifest>
26+
</manifest>

app/src/main/java/org/wakin/flexlayout/app/MainActivity.java renamed to app/src/main/java/org/wakin/flexlayoutsample/app/MainActivity.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.wakin.flexlayout.app;
1+
package org.wakin.flexlayoutsample.app;
22

33

44
import android.content.pm.ActivityInfo;
@@ -17,12 +17,12 @@
1717
import android.view.View;
1818
import android.view.ViewGroup;
1919

20-
import org.wakin.flexlayout.R;
21-
import org.wakin.flexlayout.layoutmanager.graphics.Insets;
22-
import org.wakin.flexlayout.layoutmanager.LayoutCallback;
23-
import org.wakin.flexlayout.layoutmanager.FlexLayoutManager;
24-
import org.wakin.flexlayout.layoutmanager.impl.SectionPosition;
25-
import org.wakin.flexlayout.layoutmanager.graphics.Size;
20+
import org.wakin.flexlayoutsample.R;
21+
import org.wakin.flexlayout.graphics.Insets;
22+
import org.wakin.flexlayout.LayoutCallback;
23+
import org.wakin.flexlayout.FlexLayoutManager;
24+
import org.wakin.flexlayout.impl.SectionPosition;
25+
import org.wakin.flexlayout.graphics.Size;
2626

2727
import java.util.List;
2828
import java.util.HashMap;
@@ -324,13 +324,6 @@ private void setFlexLayoutManager() {
324324
mRecyclerView.setBackgroundColor(Color.LTGRAY);
325325
FlexLayoutManager layoutManager = new FlexLayoutManager(this, MainActivityDataSource.ORIENTATION, false, this);
326326

327-
for (SectionPosition sp : mDataSource.getStickyItems()) {
328-
layoutManager.addStickyItem(sp.section, sp.item);
329-
}
330-
331-
layoutManager.setStackedStickyItems(true);
332-
// layoutManager.setLayoutCallback(this);
333-
334327
mRecyclerView.setLayoutManager(layoutManager);
335328
}
336329

@@ -346,6 +339,13 @@ protected void initDataSource(Rect frame) {
346339

347340
mDataSource = new MainActivityDataSource(mRecyclerView.getContext(), width, height);
348341

342+
FlexLayoutManager layoutManager = (FlexLayoutManager) mRecyclerView.getLayoutManager();
343+
for (SectionPosition sp : mDataSource.getStickyItems()) {
344+
layoutManager.addStickyItem(sp.section, sp.item);
345+
}
346+
347+
layoutManager.setStackedStickyItems(true);
348+
349349
mAdapter.notifyDataSetChanged();
350350

351351
final Handler handler = new Handler();

0 commit comments

Comments
 (0)