From e8c09879ec7937c995d8ee89ef800ddc44af38d0 Mon Sep 17 00:00:00 2001 From: woxingxiao Date: Thu, 28 Nov 2019 22:53:30 +0800 Subject: [PATCH] 1.4 sample updated. --- .../HouseBaratheonActivity.kt | 4 +-- .../HouseLannisterActivity.kt | 2 +- .../bouncescrollviewsample/MainActivity.kt | 20 +++++++------ .../res/layout/activity_house_baratheon.xml | 30 +++++++++++++------ app/src/main/res/layout/activity_main.xml | 10 +++---- app/src/main/res/values/styles.xml | 2 +- build.gradle | 4 +-- gradle/wrapper/gradle-wrapper.properties | 4 +-- 8 files changed, 45 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseBaratheonActivity.kt b/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseBaratheonActivity.kt index 5a260cf..fbf0602 100644 --- a/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseBaratheonActivity.kt +++ b/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseBaratheonActivity.kt @@ -23,7 +23,7 @@ class HouseBaratheonActivity : AppCompatActivity() { supportActionBar!!.setDisplayHomeAsUpEnabled(true) } - mInterpolatorNameTV.setOnClickListener { + interpolatorNameBtn.setOnClickListener { PickerFragment().show(supportFragmentManager, PickerFragment::class.java.simpleName) } } @@ -37,7 +37,7 @@ class HouseBaratheonActivity : AppCompatActivity() { } fun onInterpolatorSelected(ease: Ease) { - mInterpolatorNameTV.text = String.format("Interpolator of bounce movement: %s", ease.name) + interpolatorNameBtn.text = ease.name mBounceScrollView.setBounceInterpolator { input -> EasingProvider.get(ease, input) } } } \ No newline at end of file diff --git a/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseLannisterActivity.kt b/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseLannisterActivity.kt index 93b7af0..661ab5d 100644 --- a/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseLannisterActivity.kt +++ b/app/src/main/java/com/xw/repo/bouncescrollviewsample/HouseLannisterActivity.kt @@ -4,7 +4,7 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.view.MenuItem import com.xw.repo.BubbleSeekBar -import kotlinx.android.synthetic.main.activity_house_stark.* +import kotlinx.android.synthetic.main.activity_house_lannister.* import kotlinx.android.synthetic.main.layout_toolbar.* /** diff --git a/app/src/main/java/com/xw/repo/bouncescrollviewsample/MainActivity.kt b/app/src/main/java/com/xw/repo/bouncescrollviewsample/MainActivity.kt index 56d3df6..e6b52e5 100644 --- a/app/src/main/java/com/xw/repo/bouncescrollviewsample/MainActivity.kt +++ b/app/src/main/java/com/xw/repo/bouncescrollviewsample/MainActivity.kt @@ -1,9 +1,11 @@ package com.xw.repo.bouncescrollviewsample import android.content.Intent +import android.content.res.Resources import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.view.View +import android.view.ViewGroup import android.widget.FrameLayout import kotlinx.android.synthetic.main.activity_main.* @@ -15,22 +17,22 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) - val lp = mToolbar.layoutParams as FrameLayout.LayoutParams - lp.topMargin = Util.getStatusBarHeight() - mToolbar.layoutParams = lp + val statusBarHeight = Util.getStatusBarHeight() + mToolbar.setPadding(0, statusBarHeight, 0, 0) + val lp = mToolbar.layoutParams as ViewGroup.MarginLayoutParams + lp.height = statusBarHeight + (Resources.getSystem().displayMetrics.density * 56).toInt() } fun onClick(v: View) { val intent = Intent() - when { - v.id == R.id.mHouseStarkTV -> + when (v.id) { + R.id.mHouseStarkTV -> intent.setClass(this, HouseStarkActivity::class.java) - v.id == R.id.mHouseTargaryenTV -> + R.id.mHouseTargaryenTV -> intent.setClass(this, HouseTargaryenActivity::class.java) - v.id == R.id.mHouseLannisterTV -> + R.id.mHouseLannisterTV -> intent.setClass(this, HouseLannisterActivity::class.java) - else -> - intent.setClass(this, HouseBaratheonActivity::class.java) + else -> intent.setClass(this, HouseBaratheonActivity::class.java) } startActivity(intent) } diff --git a/app/src/main/res/layout/activity_house_baratheon.xml b/app/src/main/res/layout/activity_house_baratheon.xml index 9b9c782..c73b479 100644 --- a/app/src/main/res/layout/activity_house_baratheon.xml +++ b/app/src/main/res/layout/activity_house_baratheon.xml @@ -35,8 +35,8 @@ @@ -59,22 +59,34 @@ android:text="@string/introduction_of_house_baratheon" android:textColor="@color/colorText" android:textSize="16sp" - app:layout_constraintBottom_toTopOf="@+id/mInterpolatorNameTV" + app:layout_constraintBottom_toTopOf="@+id/hint_tv" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sigil_iv"/> + + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/hint_tv" + app:strokeColor="@color/colorAccent"/> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 73c45cb..d8a5486 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -54,9 +54,9 @@ -