Skip to content

Commit 3d60124

Browse files
authored
Merge pull request #11 from skydoves/fix/measure_height
Fix/measure height
2 parents 14e16ae + b36b3f4 commit 3d60124

File tree

13 files changed

+72
-86
lines changed

13 files changed

+72
-86
lines changed

app/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ android {
1616

1717
dependencies {
1818
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
19-
implementation "androidx.appcompat:appcompat:$versions.androidxAppcompat"
20-
implementation "androidx.cardview:cardview:$versions.cardView"
19+
implementation "com.google.android.material:material:$versions.googleMaterial"
2120
implementation "com.github.skydoves:baserecyclerviewadapter:$versions.baseAdapter"
22-
implementation "androidx.recyclerview:recyclerview:$versions.recyclerView"
2321
implementation project(":expandablelayout")
2422
}
2523

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:supportsRtl="true"
1212
android:theme="@style/AppTheme"
13-
tools:ignore="GoogleAppIndexingWarning">
13+
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
1414
<activity android:name=".CustomActivity" />
1515
<activity android:name=".MainActivity">
1616
<intent-filter>

app/src/main/java/com/skydoves/expandablelayoutdemo/MainActivity.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ package com.skydoves.expandablelayoutdemo
1919
import android.os.Bundle
2020
import android.widget.Toast
2121
import androidx.appcompat.app.AppCompatActivity
22-
import kotlinx.android.synthetic.main.activity_main.*
23-
import kotlinx.android.synthetic.main.layout_second.view.*
22+
import kotlinx.android.synthetic.main.activity_main.expandable
23+
import kotlinx.android.synthetic.main.activity_main.expandable1
24+
import kotlinx.android.synthetic.main.activity_main.expandable2
25+
import kotlinx.android.synthetic.main.layout_second.view.button0
26+
import kotlinx.android.synthetic.main.layout_second.view.button1
27+
import kotlinx.android.synthetic.main.layout_second.view.button2
28+
import kotlinx.android.synthetic.main.layout_second.view.button3
2429

2530
class MainActivity : AppCompatActivity() {
2631

@@ -58,7 +63,7 @@ class MainActivity : AppCompatActivity() {
5863
if (expandable1.isExpanded) {
5964
expandable1.collapse()
6065
} else {
61-
expandable1.expand(370)
66+
expandable1.expand()
6267
}
6368
}
6469
expandable1.secondLayout.setOnClickListener { toast("clicked the second layout") }

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:id="@+id/parentLayout"
45
android:layout_width="match_parent"
56
android:layout_height="match_parent"
67
android:background="@color/background"

app/src/main/res/layout/item_row.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
android:layout_height="wrap_content"
66
android:background="@color/background800"
77
android:foreground="?attr/selectableItemBackground"
8-
android:orientation="vertical">
8+
android:orientation="vertical"
9+
tools:ignore="UnusedAttribute">
910

1011
<TextView
1112
android:id="@+id/row_title"
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
android:id="@+id/layout_cover"
45
android:layout_width="match_parent"
56
android:layout_height="wrap_content"
67
android:background="@color/skyBlue"
78
android:foreground="?attr/selectableItemBackground"
8-
android:padding="16dp">
9+
android:gravity="center"
10+
android:padding="16dp"
11+
tools:ignore="UnusedAttribute">
912

1013
<TextView
1114
android:layout_width="wrap_content"
1215
android:layout_height="wrap_content"
13-
android:layout_centerInParent="true"
14-
android:layout_gravity="center_vertical"
16+
android:layout_gravity="center"
1517
android:text="This is the ExpandableLayout"
1618
android:textColor="@color/white_87" />
17-
</RelativeLayout>
19+
</LinearLayout>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
android:layout_width="match_parent"
45
android:layout_height="wrap_content"
56
android:background="@color/background800"
67
android:foreground="?attr/selectableItemBackground"
78
android:orientation="vertical"
8-
android:padding="10dp">
9+
android:padding="10dp"
10+
tools:ignore="UnusedAttribute">
911

1012
<TextView
1113
android:id="@+id/textView"
1214
android:layout_width="match_parent"
13-
android:layout_height="120dp"
14-
android:text="All men have stars, but they are not the same things for different people. For some, who are travelers, the stars are guides. For others they are no more than little lights in the sky. For others, who are scholars, they are problems... But all these stars are silent. You-You alone will have stars as no one else has them."
15+
android:layout_height="wrap_content"
16+
android:text="@string/text_stars"
1517
android:textColor="@android:color/white" />
1618
</LinearLayout>

app/src/main/res/layout/layout_second2.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:layout_width="match_parent"
55
android:layout_height="wrap_content"
6+
android:background="@color/background800"
67
android:orientation="vertical">
78

89
<androidx.cardview.widget.CardView
@@ -15,9 +16,9 @@
1516

1617
<TextView
1718
android:layout_width="wrap_content"
18-
android:layout_height="match_parent"
19+
android:layout_height="wrap_content"
1920
android:padding="10dp"
20-
android:text="Travelocity has some of the best prices on vacation packages guaranteed. Book your flight and hotel together to save money today!"
21+
android:text="@string/text_travel"
2122
android:textColor="@color/white_93" />
2223
</androidx.cardview.widget.CardView>
23-
</RelativeLayout>
24+
</LinearLayout>

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<resources>
2-
<string name="app_name">ExpandableLayoutDemo</string>
2+
<string name="app_name">ExpandableLayoutDemo</string>
3+
<string name="text_travel">Travelocity has some of the best prices on vacation packages guaranteed. Book your flight and hotel together to save money today!</string>
4+
<string name="text_stars">All men have stars, but they are not the same things for different people. For some, who are travelers, the stars are guides. For others they are no more than little lights in the sky. For others, who are scholars, they are problems... But all these stars are silent. You-You alone will have stars as no one else has them.</string>
35
</resources>

dependencies.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ ext.versions = [
55
versionName : '1.0.4',
66

77
gradleBuildTool : '3.5.3',
8-
spotlessGradle : '3.26.1',
8+
spotlessGradle : '3.28.0',
99
dokkaGradle : '0.9.17',
1010
bintrayRelease : '0.9.1',
1111

12-
kotlin : '1.3.61',
12+
kotlin : '1.3.70',
1313
androidxAppcompat : '1.1.0',
1414

1515
// for demo
16-
cardView : '1.0.0',
17-
recyclerView : '1.1.0',
16+
googleMaterial : '1.2.0-alpha05',
1817
baseAdapter : '0.1.3'
1918
]

0 commit comments

Comments
 (0)