Skip to content

Commit

Permalink
added flow example.
Browse files Browse the repository at this point in the history
  • Loading branch information
riggaroo committed Jan 26, 2020
1 parent b59f73b commit e27e860
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.github.bumptech.glide:glide:4.10.0'
kapt 'com.github.bumptech.glide:compiler:4.10.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'

implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<activity android:name=".ImageFilterViewActivity"/>
<activity android:name=".ConstraintLayoutStatesExampleActivity"/>
<activity android:name=".BottomNavAnimationActivity"/>
<activity android:name=".FlowActivity"/>
<activity android:name=".RecyclerViewSwipeMotionActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package za.co.riggaroo.constraintlayoutdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class FlowActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_flow)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class OptionsActivity : AppCompatActivity() {
buttonSwipeRecyclerView.setOnClickListener {
startActivity(Intent(this, RecyclerViewSwipeMotionActivity::class.java))
}

buttonFlow.setOnClickListener {
startActivity(Intent(this, FlowActivity::class.java))
}
}
}

86 changes: 86 additions & 0 deletions app/src/main/res/layout/activity_flow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textViewHeading"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="Flow Layout"
android:textAppearance="@style/TextAppearance.AppCompat.Display2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.chip.Chip
android:id="@+id/chip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Design"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="28dp" />

<com.google.android.material.chip.Chip
android:id="@+id/chip2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Data"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="118dp" />

<com.google.android.material.chip.Chip
android:id="@+id/chip3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Engineering"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="190dp" />

<com.google.android.material.chip.Chip
android:id="@+id/chip4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Marketing"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="298dp" />

<com.google.android.material.chip.Chip
android:id="@+id/chip5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Finance"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="25dp" />

<com.google.android.material.chip.Chip
android:id="@+id/chip6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="108dp" />

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flowLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:constraint_referenced_ids="chip,chip2,chip3,chip4,chip5,chip6"
app:flow_firstHorizontalStyle="packed"
app:flow_horizontalAlign="end"
app:flow_lastHorizontalStyle="packed"
app:flow_wrapMode="aligned"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewHeading" />


</androidx.constraintlayout.widget.ConstraintLayout>
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,16 @@
app:layout_constraintTop_toBottomOf="@+id/buttonClStates"
android:text="MOTION SWIPE RECYCLERVIEW"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonFlow"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/buttonSwipeRecyclerView"
android:text="FLOW LAYOUT"/>

</androidx.constraintlayout.widget.ConstraintLayout>
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 @@
#Tue Sep 24 11:38:15 SAST 2019
#Sat Oct 26 16:05:43 SAST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip

0 comments on commit e27e860

Please sign in to comment.