Skip to content

Commit 5a37852

Browse files
Got the info buttons showing the relevant tooltips
Got the info buttons showing the relevant tooltips
1 parent 8fc360a commit 5a37852

File tree

4 files changed

+73
-42
lines changed

4 files changed

+73
-42
lines changed

Branch-SDK/src/main/java/io/branch/referral/validators/LinkingValidatorDialog.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private enum ROUTING_TYPE { CANONICAL_URL, DEEPLINK_PATH, CUSTOM }
2828
private TextView linkingValidatorText;
2929
private EditText linkingValidatorEditText;
3030
private LinearLayout customKVPField;
31+
private LinearLayout linkingValidatorRowsLayout;
3132
private int step = 1;
3233
private String routingKey = "";
3334
private String routingValue = "";
@@ -39,6 +40,9 @@ private enum ROUTING_TYPE { CANONICAL_URL, DEEPLINK_PATH, CUSTOM }
3940
private String webOnlyBranchLink; //Web-only Branch link
4041
private String missingDeeplinkDataBranchLink; //Branch link with empty deep link data (to test graceful handling when data is missing)
4142
private LinkingValidatorDialogRowItem row1;
43+
private LinkingValidatorDialogRowItem row2;
44+
private LinkingValidatorDialogRowItem row3;
45+
private LinkingValidatorDialogRowItem row4;
4246

4347
public LinkingValidatorDialog(final Context context) {
4448
super(context);
@@ -69,11 +73,18 @@ public LinkingValidatorDialog(final Context context) {
6973
linkingValidatorText = findViewById(R.id.linkingValidatorText);
7074
linkingValidatorEditText = findViewById(R.id.linkingValidatorEditText);
7175
customKVPField = findViewById(R.id.customKVPField);
76+
linkingValidatorRowsLayout = findViewById(R.id.linkingValidatorRows);
7277

7378
linkingValidatorEditText.setVisibility(View.GONE);
7479
customKVPField.setVisibility(View.GONE);
80+
linkingValidatorRowsLayout.setVisibility(View.GONE);
7581

7682
routingType = ROUTING_TYPE.CANONICAL_URL;
83+
84+
row1 = findViewById(R.id.linkingValidatorRow1);
85+
row2 = findViewById(R.id.linkingValidatorRow2);
86+
row3 = findViewById(R.id.linkingValidatorRow3);
87+
row4 = findViewById(R.id.linkingValidatorRow4);
7788
}
7889

7990
@Override
@@ -123,9 +134,15 @@ void LoadStep2Screen() {
123134
}
124135

125136
void GenerateBranchLinks() {
137+
linkingValidatorEditText.setVisibility(View.GONE);
138+
linkingValidatorText.setVisibility(View.GONE);
126139
ctaButton.setText(LinkingValidatorConstants.step3ButtonText);
127-
row1 = findViewById(R.id.linkingValidatorRow1);
128-
row1.SetTitleText(LinkingValidatorConstants.linkingValidatorRow1Title);
140+
linkingValidatorRowsLayout.setVisibility(View.VISIBLE);
141+
142+
row1.InitializeRow(LinkingValidatorConstants.linkingValidatorRow1Title, LinkingValidatorConstants.infoButton1Copy);
143+
row2.InitializeRow(LinkingValidatorConstants.linkingValidatorRow2Title, LinkingValidatorConstants.infoButton2Copy);
144+
row3.InitializeRow(LinkingValidatorConstants.linkingValidatorRow3Title, LinkingValidatorConstants.infoButton3Copy);
145+
row4.InitializeRow(LinkingValidatorConstants.linkingValidatorRow4Title, LinkingValidatorConstants.infoButton4Copy);
129146

130147
customKeyEditText = findViewById(R.id.keyEditText);
131148
customValueEditText = findViewById(R.id.valueEditText);
@@ -140,6 +157,7 @@ void GenerateBranchLinks() {
140157
uriFallbackBranchLink = GenerateBranchLink("uriFallbackBranchLink", "$uri_redirect_mode", "2", routingKey, routingValue);
141158
webOnlyBranchLink = GenerateBranchLink("webOnlyBranchLink", "$web_only", "true", routingKey, routingValue);
142159
missingDeeplinkDataBranchLink = GenerateBranchLink("missingDataBranchLink", routingKey, "");
160+
143161
}
144162

145163
String GenerateBranchLink(String identifierForBUO, String... params) {
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
11
package io.branch.referral.validators;
22

3+
import android.app.AlertDialog;
34
import android.content.Context;
45
import android.util.AttributeSet;
56
import android.view.LayoutInflater;
67
import android.view.View;
8+
import android.widget.Button;
79
import android.widget.LinearLayout;
810
import android.widget.TextView;
911

1012
import io.branch.referral.R;
1113

1214
public class LinkingValidatorDialogRowItem extends LinearLayout {
1315

16+
Context context;
1417
TextView titleText;
18+
Button infoButton;
19+
String infoText;
1520

1621
public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs) {
1722
super(context, attrs);
18-
View view = LayoutInflater.from(getContext()).inflate(R.layout.linking_validator_dialog_row_item, null);
19-
this.addView(view);
20-
titleText = view.findViewById(R.id.linkingValidatorRowTitleText);
23+
this.context = context;
2124
}
2225

2326
public LinkingValidatorDialogRowItem(Context context, AttributeSet attrs, int defStyle) {
2427
super(context, attrs, defStyle);
28+
this.context = context;
2529
}
2630

27-
public void SetTitleText(String title) {
31+
public void InitializeRow(String title, String infoText) {
32+
View view = LayoutInflater.from(getContext()).inflate(R.layout.linking_validator_dialog_row_item, null);
33+
this.addView(view);
34+
titleText = view.findViewById(R.id.linkingValidatorRowTitleText);
35+
infoButton = view.findViewById(R.id.linkingValidatorRowInfoButton);
2836
titleText.setText(title);
37+
this.infoText = infoText;
38+
infoButton.setOnClickListener(view1 -> {
39+
AlertDialog.Builder builder = new AlertDialog.Builder(context);
40+
builder.setMessage(infoText).setTitle(titleText.getText());
41+
AlertDialog dialog = builder.create();
42+
dialog.show();
43+
});
2944
}
3045
}

Branch-SDK/src/main/res/layout/dialog_linking_validator.xml

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
android:layout_width="409dp"
1212
android:layout_height="100dp"
1313
android:orientation="horizontal"
14-
android:visibility="gone"
1514
app:layout_constraintEnd_toEndOf="parent"
1615
app:layout_constraintStart_toStartOf="parent"
17-
app:layout_constraintTop_toTopOf="parent"
18-
tools:visibility="visible">
16+
app:layout_constraintTop_toTopOf="parent">
1917

2018
<Space
2119
android:layout_width="0dp"
@@ -49,11 +47,12 @@
4947
android:id="@+id/linkingValidatorDropdownMenu"
5048
android:layout_width="351dp"
5149
android:layout_height="50dp"
52-
android:visibility="visible"
50+
android:visibility="invisible"
5351
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
5452
app:layout_constraintEnd_toEndOf="parent"
5553
app:layout_constraintStart_toStartOf="parent"
56-
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorText" />
54+
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorText"
55+
tools:visibility="invisible" />
5756

5857
<TextView
5958
android:id="@+id/linkingValidatorText"
@@ -63,7 +62,7 @@
6362
android:gravity="center"
6463
android:text="What key do you use for deep link routing?"
6564
android:textSize="20sp"
66-
android:visibility="visible"
65+
android:visibility="invisible"
6766
app:layout_constraintEnd_toEndOf="parent"
6867
app:layout_constraintStart_toStartOf="parent"
6968
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader" />
@@ -75,7 +74,7 @@
7574
android:ems="10"
7675
android:hint="Enter a value"
7776
android:inputType="text"
78-
android:visibility="visible"
77+
android:visibility="invisible"
7978
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
8079
app:layout_constraintEnd_toEndOf="parent"
8180
app:layout_constraintStart_toStartOf="parent"
@@ -141,16 +140,17 @@
141140
</LinearLayout>
142141

143142
<LinearLayout
143+
android:id="@+id/linkingValidatorRows"
144144
android:layout_width="0dp"
145145
android:layout_height="wrap_content"
146146
android:layout_marginStart="20dp"
147147
android:layout_marginEnd="20dp"
148148
android:orientation="vertical"
149+
android:visibility="visible"
149150
app:layout_constraintBottom_toTopOf="@+id/linkingValidatorButton"
150151
app:layout_constraintEnd_toEndOf="parent"
151152
app:layout_constraintStart_toStartOf="parent"
152-
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader"
153-
android:visibility="gone">
153+
app:layout_constraintTop_toBottomOf="@+id/linkingValidatorHeader">
154154

155155
<TextView
156156
android:id="@+id/textView"
@@ -161,51 +161,50 @@
161161

162162
<Space
163163
android:layout_width="0dp"
164-
android:layout_height="30dp"
165-
android:layout_weight="0.5" />
164+
android:layout_height="30dp" />
166165

167-
<include
166+
<io.branch.referral.validators.LinkingValidatorDialogRowItem
168167
android:id="@+id/linkingValidatorRow1"
169-
layout="@layout/linking_validator_dialog_row_item" />
168+
android:layout_width="match_parent"
169+
android:layout_height="50dp" />
170170

171171
<Space
172172
android:layout_width="0dp"
173-
android:layout_height="10dp"
174-
android:layout_weight="0.5" />
173+
android:layout_height="10dp" />
175174

176-
<include
175+
<io.branch.referral.validators.LinkingValidatorDialogRowItem
177176
android:id="@+id/linkingValidatorRow2"
178-
layout="@layout/linking_validator_dialog_row_item" />
177+
android:layout_width="match_parent"
178+
android:layout_height="50dp" />
179179

180180
<Space
181181
android:layout_width="0dp"
182-
android:layout_height="10dp"
183-
android:layout_weight="0.5" />
182+
android:layout_height="10dp" />
184183

185-
<include
184+
<io.branch.referral.validators.LinkingValidatorDialogRowItem
186185
android:id="@+id/linkingValidatorRow3"
187-
layout="@layout/linking_validator_dialog_row_item" />
186+
android:layout_width="match_parent"
187+
android:layout_height="50dp" />
188188

189189
<Space
190190
android:layout_width="0dp"
191-
android:layout_height="10dp"
192-
android:layout_weight="0.5" />
191+
android:layout_height="10dp" />
193192

194-
<include
193+
<io.branch.referral.validators.LinkingValidatorDialogRowItem
195194
android:id="@+id/linkingValidatorRow4"
196-
layout="@layout/linking_validator_dialog_row_item" />
195+
android:layout_width="match_parent"
196+
android:layout_height="50dp" />
197197

198198
<Space
199199
android:layout_width="0dp"
200-
android:layout_height="30dp"
201-
android:layout_weight="0.5" />
200+
android:layout_height="30dp" />
202201

203202
<TextView
204203
android:id="@+id/textView6"
205204
android:layout_width="match_parent"
206205
android:layout_height="30dp"
207-
android:text="Additional use cases to test:"
208-
android:textSize="20sp" />
206+
android:textSize="20sp"
207+
android:text="Additional use cases to test:" />
209208

210209
<Space
211210
android:layout_width="0dp"
@@ -214,8 +213,7 @@
214213

215214
<Space
216215
android:layout_width="0dp"
217-
android:layout_height="10dp"
218-
android:layout_weight="0.5" />
216+
android:layout_height="10dp" />
219217

220218
<LinearLayout
221219
android:layout_width="match_parent"

Branch-SDK/src/main/res/layout/linking_validator_dialog_row_item.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@
1515
android:layout_height="wrap_content"
1616
android:layout_weight="0.4"
1717
android:text="Title"
18-
android:textSize="16sp" />
18+
android:textSize="14sp" />
1919

2020
<Button
2121
android:id="@+id/linkingValidatorRowInfoButton"
2222
android:layout_width="0dp"
2323
android:layout_height="match_parent"
2424
android:layout_weight="0.15"
2525
android:text="Info"
26-
android:textSize="10sp" />
26+
android:textSize="9sp" />
2727

2828
<Button
2929
android:id="@+id/linkingValidatorRowCopyButton"
3030
android:layout_width="0dp"
3131
android:layout_height="match_parent"
3232
android:layout_weight="0.15"
3333
android:text="Copy"
34-
android:textSize="10sp" />
34+
android:textSize="9sp" />
3535

3636
<Button
3737
android:id="@+id/linkingValidatorRowShareButton"
3838
android:layout_width="0dp"
3939
android:layout_height="match_parent"
4040
android:layout_weight="0.15"
4141
android:text="Share"
42-
android:textSize="10sp" />
42+
android:textSize="9sp" />
4343

4444
<Button
4545
android:id="@+id/linkingValidatorRowDebugButton"
4646
android:layout_width="0dp"
4747
android:layout_height="match_parent"
4848
android:layout_weight="0.15"
4949
android:text="Debug"
50-
android:textSize="10sp" />
50+
android:textSize="9sp" />
5151

5252
</LinearLayout>
5353

0 commit comments

Comments
 (0)