Update Sample

change toobar title when recyclerview scroll to new item.
This commit is contained in:
LittleMango
2018-09-03 19:59:51 +08:00
parent c9ff4425e7
commit 1f0a4abfc8
5 changed files with 17 additions and 21 deletions

Binary file not shown.

14
.idea/misc.xml generated
View File

@@ -1,19 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="active-configuration" value="BUNDLED:(bundled):Google Checks" />
<entry key="checkstyle-version" value="8.7" />
<entry key="copy-libs" value="false" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
<component name="NullableNotNullManager"> <component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" /> <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />

View File

@@ -8,8 +8,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 27 targetSdkVersion 27
versionCode 3 versionCode 4
versionName "1.0.2" versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -46,7 +46,7 @@ publish{
userOrg = 'jinliancheng120' userOrg = 'jinliancheng120'
groupId = 'com.littlemango' groupId = 'com.littlemango'
artifactId = 'stacklayoutmanager' artifactId = 'stacklayoutmanager'
publishVersion = '1.0.2' publishVersion = '1.0.3'
desc = 'A RecyclerView.LayoutManager implementation which provides functionality to show a group of stack view.' desc = 'A RecyclerView.LayoutManager implementation which provides functionality to show a group of stack view.'
website = 'https://github.com/LittleMango/StackLayoutManager' website = 'https://github.com/LittleMango/StackLayoutManager'
licences = ['MIT'] licences = ['MIT']

View File

@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.2.50' ext.kotlin_version = '1.2.60'
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.novoda:bintray-release:0.8.1' classpath 'com.novoda:bintray-release:0.8.1'
} }

View File

@@ -68,18 +68,22 @@ public class MainActivity extends AppCompatActivity {
case 2: case 2:
mStackLayoutManager = new StackLayoutManager(ScrollOrientation.LEFT_TO_RIGHT); mStackLayoutManager = new StackLayoutManager(ScrollOrientation.LEFT_TO_RIGHT);
mRecyclerView.setLayoutManager(mStackLayoutManager); mRecyclerView.setLayoutManager(mStackLayoutManager);
getSupportActionBar().setTitle("Picture 0");
break; break;
case 3: case 3:
mStackLayoutManager = new StackLayoutManager(ScrollOrientation.RIGHT_TO_LEFT); mStackLayoutManager = new StackLayoutManager(ScrollOrientation.RIGHT_TO_LEFT);
mRecyclerView.setLayoutManager(mStackLayoutManager); mRecyclerView.setLayoutManager(mStackLayoutManager);
getSupportActionBar().setTitle("Picture 0");
break; break;
case 4: case 4:
mStackLayoutManager = new StackLayoutManager(ScrollOrientation.TOP_TO_BOTTOM); mStackLayoutManager = new StackLayoutManager(ScrollOrientation.TOP_TO_BOTTOM);
mRecyclerView.setLayoutManager(mStackLayoutManager); mRecyclerView.setLayoutManager(mStackLayoutManager);
getSupportActionBar().setTitle("Picture 0");
break; break;
case 5: case 5:
mStackLayoutManager = new StackLayoutManager(ScrollOrientation.BOTTOM_TO_TOP); mStackLayoutManager = new StackLayoutManager(ScrollOrientation.BOTTOM_TO_TOP);
mRecyclerView.setLayoutManager(mStackLayoutManager); mRecyclerView.setLayoutManager(mStackLayoutManager);
getSupportActionBar().setTitle("Picture 0");
break; break;
case 6: case 6:
mStackLayoutManager.setPagerMode(!mStackLayoutManager.getPagerMode()); mStackLayoutManager.setPagerMode(!mStackLayoutManager.getPagerMode());
@@ -112,6 +116,13 @@ public class MainActivity extends AppCompatActivity {
mStackLayoutManager.requestLayout(); mStackLayoutManager.requestLayout();
break; break;
} }
mStackLayoutManager.setItemChangedListener(new StackLayoutManager.ItemChangedListener() {
@Override
public void onItemChanged(int position) {
getSupportActionBar().setTitle("Picture " + position);
}
});
} }
}) })
.show(); .show();
@@ -121,8 +132,7 @@ public class MainActivity extends AppCompatActivity {
mStackLayoutManager.setItemChangedListener(new StackLayoutManager.ItemChangedListener() { mStackLayoutManager.setItemChangedListener(new StackLayoutManager.ItemChangedListener() {
@Override @Override
public void onItemChanged(int position) { public void onItemChanged(int position) {
mToast.setText("first visible item position is " + position); getSupportActionBar().setTitle("Picture " + position);
mToast.show();
} }
}); });
} }