Skip to content

Commit

Permalink
1.4 sample updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
woxingxiao committed Nov 28, 2019
1 parent afdecf8 commit e8c0987
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HouseBaratheonActivity : AppCompatActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
}

mInterpolatorNameTV.setOnClickListener {
interpolatorNameBtn.setOnClickListener {
PickerFragment().show(supportFragmentManager, PickerFragment::class.java.simpleName)
}
}
Expand All @@ -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) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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.*

Expand All @@ -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)
}
Expand Down
30 changes: 21 additions & 9 deletions app/src/main/res/layout/activity_house_baratheon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<TextView
android:id="@+id/name_tv"
style="@style/TextStyleWithFont"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:text="HOUSE BARATHEON"
app:layout_constraintStart_toEndOf="@+id/sigil_iv"
app:layout_constraintTop_toTopOf="@+id/sigil_iv"/>
Expand All @@ -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"/>

<TextView
android:id="@+id/mInterpolatorNameTV"
android:layout_width="match_parent"
android:id="@+id/hint_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:padding="16dp"
android:text="Interpolator of bounce movement: QUAD_IN"
android:layout_marginBottom="8dp"
android:text="Choose the interpolator of bounce movement:"
android:textColor="@color/colorAccent"
app:layout_constraintBottom_toTopOf="@+id/interpolatorNameBtn"
app:layout_constraintStart_toStartOf="@+id/interpolatorNameBtn"/>

<android.support.design.button.MaterialButton
android:id="@+id/interpolatorNameBtn"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="32dp"
android:text="QUAD_IN"
app:cornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/hint_tv"
app:strokeColor="@color/colorAccent"/>
</android.support.constraint.ConstraintLayout>
</com.xw.repo.widget.BounceScrollView>
</FrameLayout>
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
<TextView
android:id="@+id/mHouseStarkTV"
style="@style/TextStyleWithFont"
android:layout_marginLeft="32dp"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:drawableLeft="@drawable/sigil_of_house_stark"
android:drawableStart="@drawable/sigil_of_house_stark"
android:drawablePadding="16dp"
android:gravity="center"
android:onClick="onClick"
Expand All @@ -68,7 +68,7 @@
android:id="@+id/mHouseTargaryenTV"
style="@style/TextStyleWithFont"
android:layout_marginTop="16dp"
android:drawableLeft="@drawable/sigil_of_house_targaryen"
android:drawableStart="@drawable/sigil_of_house_targaryen"
android:drawablePadding="16dp"
android:gravity="center"
android:onClick="onClick"
Expand All @@ -80,7 +80,7 @@
android:id="@+id/mHouseLannisterTV"
style="@style/TextStyleWithFont"
android:layout_marginTop="16dp"
android:drawableLeft="@drawable/sigil_of_house_lannister"
android:drawableStart="@drawable/sigil_of_house_lannister"
android:drawablePadding="16dp"
android:gravity="center"
android:onClick="onClick"
Expand All @@ -92,7 +92,7 @@
android:id="@+id/mHouseBaratheonTV"
style="@style/TextStyleWithFont"
android:layout_marginTop="16dp"
android:drawableLeft="@drawable/sigil_of_house_baratheon"
android:drawableStart="@drawable/sigil_of_house_baratheon"
android:drawablePadding="16dp"
android:gravity="center"
android:onClick="onClick"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Oct 28 09:09:51 CST 2018
#Sun Nov 24 14:41:06 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

0 comments on commit e8c0987

Please sign in to comment.