Skip to content

Commit

Permalink
Move FlexLayoutManager into serparate module
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueMatthew committed Jan 22, 2022
1 parent eb76a43 commit 27dfeaa
Show file tree
Hide file tree
Showing 64 changed files with 870 additions and 232 deletions.
19 changes: 6 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ android {
keyPassword KEY_PASSWORD
}
}
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "org.wakin.flexlayoutmanager"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++14"
}
}
}
buildTypes {
release {
Expand All @@ -40,18 +35,16 @@ android {
jniDebuggable = true
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
ndkVersion '23.1.7779620'
buildToolsVersion '30.0.3'

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(path: ':flexlayout')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wakin.flexlayout">
package="org.wakin.flexlayoutsample">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand All @@ -14,7 +14,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="org.wakin.flexlayout.app.MainActivity">
<activity android:name="org.wakin.flexlayoutsample.app.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -23,4 +23,4 @@
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.wakin.flexlayout.app;
package org.wakin.flexlayoutsample.app;


import android.content.pm.ActivityInfo;
Expand All @@ -17,12 +17,12 @@
import android.view.View;
import android.view.ViewGroup;

import org.wakin.flexlayout.R;
import org.wakin.flexlayout.layoutmanager.graphics.Insets;
import org.wakin.flexlayout.layoutmanager.LayoutCallback;
import org.wakin.flexlayout.layoutmanager.FlexLayoutManager;
import org.wakin.flexlayout.layoutmanager.impl.SectionPosition;
import org.wakin.flexlayout.layoutmanager.graphics.Size;
import org.wakin.flexlayoutsample.R;
import org.wakin.flexlayout.graphics.Insets;
import org.wakin.flexlayout.LayoutCallback;
import org.wakin.flexlayout.FlexLayoutManager;
import org.wakin.flexlayout.impl.SectionPosition;
import org.wakin.flexlayout.graphics.Size;

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

for (SectionPosition sp : mDataSource.getStickyItems()) {
layoutManager.addStickyItem(sp.section, sp.item);
}

layoutManager.setStackedStickyItems(true);
// layoutManager.setLayoutCallback(this);

mRecyclerView.setLayoutManager(layoutManager);
}

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

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

FlexLayoutManager layoutManager = (FlexLayoutManager) mRecyclerView.getLayoutManager();
for (SectionPosition sp : mDataSource.getStickyItems()) {
layoutManager.addStickyItem(sp.section, sp.item);
}

layoutManager.setStackedStickyItems(true);

mAdapter.notifyDataSetChanged();

final Handler handler = new Handler();
Expand Down
Loading

0 comments on commit 27dfeaa

Please sign in to comment.