Skip to content

Commit

Permalink
-ui changes for rounded button
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-dimagi committed Nov 14, 2024
1 parent 151f68d commit 7b2a260
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 27 deletions.
13 changes: 8 additions & 5 deletions app/res/layout/blue_outlined_button.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"

<org.commcare.activities.components.RoundedButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/blue_outlined_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/blue"
android:visibility="gone"
style="@style/CommCare.Button.Default"
android:background="@drawable/blue_outlined_view"
android:focusable="true"
android:padding="10dp"
tools:viewBindingIgnore="true"/>
tools:viewBindingIgnore="true"
app:roundButtonBorderVisible="true"
app:roundButtonBorderColor="@color/button_primary"
app:roundButtonTextColor="@color/blue"/>
38 changes: 24 additions & 14 deletions app/res/layout/choice_dialog_three_panel.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:viewBindingIgnore="true">
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:viewBindingIgnore="true">

<include
android:id="@+id/choice_dialog_title"
Expand All @@ -24,40 +25,49 @@
android:layout_marginEnd="@dimen/standard_spacer_large"
android:layout_marginStart="@dimen/standard_spacer_large">

<Button
<org.commcare.activities.components.RoundedButton
android:id="@+id/choice_dialog_panel_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawablePadding="5dp"
android:layout_marginRight="@dimen/standard_spacer"
android:paddingTop="15dp"
android:layout_marginEnd="@dimen/standard_spacer" />
android:layout_marginEnd="@dimen/standard_spacer"
app:roundButtonBorderVisible="true"
app:roundButtonBorderColor="@color/cc_brand_color"
app:roundButtonTextColor="@color/cc_brand_color"
app:roundButtonBackgroundColor="@color/transparent"/>

<Button
<org.commcare.activities.components.RoundedButton
android:id="@+id/choice_dialog_panel_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawablePadding="5dp"
android:layout_marginLeft="@dimen/standard_spacer"
android:layout_marginRight="@dimen/standard_spacer"
android:paddingTop="15dp"
android:layout_marginStart="@dimen/standard_spacer"
android:layout_marginEnd="@dimen/standard_spacer" />
android:layout_marginEnd="@dimen/standard_spacer"
app:roundButtonBorderVisible="true"
app:roundButtonBorderColor="@color/cc_brand_color"
app:roundButtonTextColor="@color/cc_brand_color"
app:roundButtonBackgroundColor="@color/transparent"/>

<Button
<org.commcare.activities.components.RoundedButton
android:id="@+id/choice_dialog_panel_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawablePadding="5dp"
android:layout_marginLeft="@dimen/standard_spacer"
android:paddingTop="15dp"
android:layout_marginStart="@dimen/standard_spacer" />
app:roundButtonBorderVisible="true"
app:roundButtonBorderColor="@color/cc_brand_color"
app:roundButtonTextColor="@color/cc_brand_color"
android:layout_marginStart="@dimen/standard_spacer"
app:roundButtonBackgroundColor="@color/transparent"/>

</LinearLayout>

Expand Down
13 changes: 9 additions & 4 deletions app/res/layout/progress_dialog_cancel_button.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
<org.commcare.activities.components.RoundedButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="@dimen/min_button_height"
android:layout_below="@+id/main_content_holder"
Expand All @@ -9,10 +10,14 @@
android:layout_marginEnd="@dimen/standard_spacer_large"
android:layout_marginRight="@dimen/standard_spacer_large"
android:layout_marginBottom="@dimen/standard_spacer"
android:background="@android:color/transparent"
android:padding="@dimen/standard_spacer"
android:textAllCaps="true"
app:roundButtonTextColor="@color/cc_brand_color"
app:roundButtonBorderVisible="true"
app:roundButtonBorderColor="@color/cc_brand_color"
style="@style/CommCare.Button.Default"
android:text="STOP"
android:textSize="@dimen/font_size_dp_medium"
app:roundButtonTextSize="12sp"
app:roundButtonBackgroundColor="@color/transparent"
android:visibility="gone"
tools:viewBindingIgnore="true"/>
tools:viewBindingIgnore="true" />
6 changes: 3 additions & 3 deletions app/src/org/commcare/activities/components/RoundedButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public class RoundedButton extends androidx.appcompat.widget.AppCompatButton {

private static final int DEFAULT_BUTTON_HEIGHT = 100;
private static final int DEFAULT_RADIUS = 30;
private static final int DEFAULT_BACKGROUND_COLOR = Color.WHITE;
private static final int DEFAULT_TEXT_COLOR = Color.BLACK;
private static final int DEFAULT_BACKGROUND_COLOR = Color.parseColor("#004EBC");
private static final int DEFAULT_TEXT_COLOR = Color.WHITE;
private static final int DEFAULT_ICON_TINT_COLOR = Color.WHITE;
private static final int DEFAULT_PADDING = 24;
private static final boolean DEFAULT_ICON_LEFT_ALIGN = false;
private static final int DEFAULT_FONT_RES_ID = R.font.roboto_regular;
private static final boolean DEFAULT_BORDER_VISIBLE = false;
private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
private static final int DEFAULT_BORDER_COLOR = Color.parseColor("#004EBC");
private static final int DEFAULT_BORDER_RADIUS = DEFAULT_RADIUS;
private static final int DEFAULT_BORDER_WIDTH = 1;
private static final int DEFAULT_TEXT_SIZE = 7;
Expand Down
4 changes: 3 additions & 1 deletion app/src/org/commcare/views/widgets/IntentWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.widget.Toast;

import org.commcare.activities.components.FormEntryConstants;
import org.commcare.activities.components.RoundedButton;
import org.commcare.android.javarosa.IntentCallout;
import org.commcare.logic.PendingCalloutInterface;
import org.commcare.utils.CompoundIntentList;
Expand Down Expand Up @@ -93,7 +94,7 @@ protected IntentWidget(Context context, FormEntryPrompt prompt, Intent in, Inten
} else {
mStringAnswer = new TextView(getContext());
}
launchIntentButton = new AppCompatButton(getContext());
launchIntentButton = new RoundedButton(getContext());
setupTextView();
setupButton();
}
Expand Down Expand Up @@ -124,6 +125,7 @@ private void setupButton() {
getButtonLabel(),
!mPrompt.isReadOnly());


// launch barcode capture intent on click
launchIntentButton.setOnClickListener(v -> performCallout());
addView(launchIntentButton);
Expand Down

0 comments on commit 7b2a260

Please sign in to comment.