Skip to content

Commit 706f125

Browse files
committed
Fix layout issues with title and subtitle orientation
1 parent b260c43 commit 706f125

File tree

6 files changed

+54
-46
lines changed

6 files changed

+54
-46
lines changed

app/src/main/java/com/kemalatli/sample/FirstFragment.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class FirstFragment : Fragment(), View.OnClickListener {
4040
.focusInRectangle(v)
4141
.arrowLocation(ArrowLocation.Right())
4242
.liveIn(lifecycle)
43+
.title("Here is a title")
44+
.subtitle("This is a long description of what we can do with this library. This long text should be handled.")
45+
.okLabel("Ok got it")
46+
.cancelLabel("No forget it!")
4347
.show()
4448
}
4549
}

app/src/main/java/com/kemalatli/sample/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class MainActivity : AppCompatActivity() {
2222
.liveIn(lifecycle)
2323
.focusInCircle(view)
2424
.backColor(ContextCompat.getColor(this, R.color.colorPrimary))
25+
.title("Here is a title")
26+
.subtitle("This is a long description of what we can do with this library. This long text should be handled.")
27+
.okLabel("Ok got it")
28+
.cancelLabel("No forget it!")
2529
.show()
2630
}
2731
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath "com.android.tools.build:gradle:4.0.0-beta01"
9+
classpath 'com.android.tools.build:gradle:4.1.0-alpha09'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sun Apr 19 13:19:46 EET 2020
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-rc-4-all.zip
44
zipStoreBase=GRADLE_USER_HOME
5-
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
5+
zipStorePath=wrapper/dists

library/src/main/java/com/kemalatli/bubbleonboarding/BubbleOnboarding.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BubbleOnboarding internal constructor():LifecycleObserver, View.OnClickLis
3737
private var angle = BubbleDrawable.Builder.DEFAULT_ANGLE
3838
private var arrowHeight = BubbleDrawable.Builder.DEFAULT_ARROW_HEIGHT
3939
private var arrowLocation: ArrowLocation = ArrowLocation.Bottom()
40-
private var bubbleType:BubbleType = BubbleType.SolidColor(Color.YELLOW)
40+
private var bubbleType:BubbleType = BubbleType.SolidColor(Color.RED)
4141
private var bubbleMargin:Int = 20
4242
private var bubbleId:String = "key"
4343

library/src/main/res/layout/view_bubble.xml

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,70 @@
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
android:layout_width="wrap_content"
55
android:layout_height="wrap_content">
6-
<androidx.constraintlayout.widget.ConstraintLayout
6+
<LinearLayout
7+
android:orientation="vertical"
78
android:theme="@style/Theme.MaterialComponents"
89
android:layout_width="wrap_content"
910
android:layout_height="wrap_content"
1011
xmlns:app="http://schemas.android.com/apk/res-auto"
1112
xmlns:tools="http://schemas.android.com/tools">
1213

13-
<TextView
14+
<com.google.android.material.textview.MaterialTextView
1415
android:id="@+id/title"
15-
android:maxWidth="300dp"
16+
android:maxWidth="250dp"
1617
android:layout_marginTop="10dp"
1718
android:layout_marginHorizontal="22dp"
1819
android:textColor="@android:color/black"
1920
android:text="¿Lo has probado y te ha gustado? "
20-
app:layout_constraintTop_toTopOf="parent"
21-
app:layout_constraintStart_toStartOf="parent"
2221
android:layout_width="wrap_content"
2322
android:layout_height="wrap_content">
24-
</TextView>
23+
</com.google.android.material.textview.MaterialTextView>
2524

26-
<TextView
25+
<com.google.android.material.textview.MaterialTextView
2726
android:id="@+id/subtitle"
28-
android:maxWidth="300dp"
27+
android:maxWidth="250dp"
2928
android:layout_marginTop="8dp"
3029
android:layout_marginHorizontal="22dp"
3130
android:textColor="@android:color/black"
3231
android:text="¡Cuenta a otrxs Pickers qué es lo que más te ha gustado de este producto!"
33-
app:layout_constraintTop_toBottomOf="@id/title"
34-
app:layout_constraintStart_toStartOf="parent"
35-
app:layout_constraintEnd_toEndOf="parent"
3632
android:layout_width="wrap_content"
3733
android:layout_height="wrap_content">
38-
</TextView>
34+
</com.google.android.material.textview.MaterialTextView>
35+
36+
<LinearLayout
37+
android:orientation="horizontal"
38+
android:layout_width="match_parent"
39+
android:layout_height="wrap_content">
40+
<com.google.android.material.button.MaterialButton
41+
android:id="@+id/ok"
42+
android:maxWidth="10dp"
43+
android:gravity="start|center_vertical"
44+
style="@style/Widget.MaterialComponents.Button.TextButton"
45+
android:text="Ok"
46+
android:textAllCaps="false"
47+
android:layout_marginStart="22dp"
48+
android:layout_marginTop="10dp"
49+
android:layout_marginBottom="10dp"
50+
android:padding="0dp"
51+
android:layout_width="80dp"
52+
android:layout_height="30dp">
53+
</com.google.android.material.button.MaterialButton>
54+
<com.google.android.material.button.MaterialButton
55+
android:id="@+id/cancel"
56+
android:layout_marginStart="10dp"
57+
android:gravity="start|center_vertical"
58+
style="@style/Widget.MaterialComponents.Button.TextButton"
59+
android:text="Cancel"
60+
android:textAllCaps="false"
61+
android:layout_marginTop="10dp"
62+
android:layout_marginBottom="10dp"
63+
android:padding="0dp"
64+
android:layout_width="wrap_content"
65+
android:layout_height="30dp">
66+
</com.google.android.material.button.MaterialButton>
67+
</LinearLayout>
3968

40-
<com.google.android.material.button.MaterialButton
41-
android:id="@+id/ok"
42-
app:layout_constraintStart_toStartOf="parent"
43-
app:layout_constraintTop_toBottomOf="@id/subtitle"
44-
app:layout_constraintBottom_toBottomOf="parent"
45-
style="@style/Widget.MaterialComponents.Button.TextButton"
46-
android:text="Ok"
47-
android:textAllCaps="false"
48-
android:layout_marginTop="10dp"
49-
android:layout_marginBottom="10dp"
50-
android:padding="0dp"
51-
android:layout_width="wrap_content"
52-
android:layout_height="30dp">
53-
</com.google.android.material.button.MaterialButton>
5469

55-
<com.google.android.material.button.MaterialButton
56-
android:id="@+id/cancel"
57-
app:layout_constraintStart_toEndOf="@id/ok"
58-
app:layout_constraintTop_toBottomOf="@id/subtitle"
59-
app:layout_constraintBottom_toBottomOf="parent"
60-
style="@style/Widget.MaterialComponents.Button.TextButton"
61-
android:text="Cancel"
62-
android:textAllCaps="false"
63-
android:layout_marginTop="10dp"
64-
android:layout_marginBottom="10dp"
65-
android:padding="0dp"
66-
android:layout_width="wrap_content"
67-
android:layout_height="30dp">
68-
</com.google.android.material.button.MaterialButton>
6970

70-
</androidx.constraintlayout.widget.ConstraintLayout>
71+
</LinearLayout>
7172
</FrameLayout>

0 commit comments

Comments
 (0)