Skip to content

Commit

Permalink
Merge pull request #1339 from dashpay/feature-voting-improvements
Browse files Browse the repository at this point in the history
feat(dashpay): improve voting features
  • Loading branch information
HashEngineering authored Jan 14, 2025
2 parents 447e319 + 80c8cd0 commit 45d9743
Show file tree
Hide file tree
Showing 36 changed files with 1,186 additions and 676 deletions.
82 changes: 0 additions & 82 deletions common/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -961,87 +961,6 @@
<item name="android:theme">@style/PrimaryButtonTheme.Large.LightBlue</item>
</style>

<style name="VoteButtonTheme">
<item name="cornerRadius">7dp</item>
<item name="titleTextColor">@color/white</item>
<item name="backgroundColor">@color/content_primary</item>
<item name="strokeColor">@color/content_primary</item>
<item name="rippleColor">@color/ripple_light</item>
<item name="disabledBackgroundColor">@color/disabled_button_bg</item>
</style>

<style name="VoteButton" parent="Widget.AppCompat.Button.Borderless">
<item name="fontFamily">@font/inter_semibold</item>
<item name="android:textColor">@color/button_text</item>
<item name="android:background">@drawable/rounded_ripple_background</item>
<item name="android:theme">@style/VoteButtonTheme</item>
<item name="android:textSize">12sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:minHeight">40dp</item>
</style>

<style name="Button.Vote" parent="Widget.AppCompat.Button.Borderless">
<item name="fontFamily">@font/inter_semibold</item>
<item name="android:textColor">@color/button_text</item>
<item name="android:background">@drawable/rounded_ripple_background</item>
<item name="android:theme">@style/VoteButtonTheme</item>
<item name="android:textSize">12sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:minHeight">40dp</item>
</style>

<style name="VoteButton.LightBlue">
<item name="backgroundColor">@color/dash_blue_0.05</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_blue</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.LightBlue">
<item name="android:theme">@style/VoteButton.LightBlue</item>
</style>

<style name="VoteButton.LightRed">
<item name="backgroundColor">@color/red_0.05</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/red</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.LightRed">
<item name="android:theme">@style/VoteButton.LightRed</item>
</style>

<style name="VoteButton.Blue">
<item name="backgroundColor">@color/dash_blue</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_white</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.Blue">
<item name="android:theme">@style/VoteButton.Blue</item>
</style>

<style name="VoteButton.Red">
<item name="backgroundColor">@color/red</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_white</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.Red">
<item name="android:theme">@style/VoteButton.Red</item>
</style>

<style name="Button.Primary.Small">
<item name="android:textSize">13sp</item>
<item name="android:minHeight">30dp</item>
Expand All @@ -1064,7 +983,6 @@
<item name="android:theme">@style/PrimaryButtonTheme.Small.Round</item>
</style>


<style name="Button.Primary.ExtraSmall">
<item name="android:theme">@style/PrimaryButtonTheme.ExtraSmall</item>
<item name="android:textSize">11sp</item>
Expand Down
9 changes: 9 additions & 0 deletions wallet/res/drawable/ic_blue_bolt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="10dp"
android:height="16dp"
android:viewportWidth="10"
android:viewportHeight="16">
<path
android:pathData="M0.5,8.81C0.5,8.666 0.562,8.52 0.685,8.371L6.753,0.915C6.872,0.771 6.999,0.681 7.135,0.647C7.275,0.613 7.4,0.626 7.51,0.686C7.621,0.745 7.697,0.841 7.74,0.972C7.786,1.1 7.774,1.254 7.701,1.437L5.734,6.696H9.491C9.639,6.696 9.76,6.743 9.854,6.836C9.951,6.926 10,7.04 10,7.18C10,7.329 9.941,7.477 9.822,7.626L3.754,15.076C3.635,15.224 3.505,15.316 3.365,15.349C3.229,15.384 3.106,15.371 2.996,15.311C2.886,15.252 2.807,15.156 2.76,15.025C2.718,14.893 2.731,14.736 2.799,14.554L4.772,9.294H1.009C0.865,9.294 0.744,9.25 0.646,9.16C0.549,9.067 0.5,8.95 0.5,8.81Z"
android:fillColor="#008DE4"/>
</vector>
25 changes: 25 additions & 0 deletions wallet/res/drawable/ic_thumb_down_red.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright 2024 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<path
android:pathData="M14.123,0.744H3.823C2.813,0.744 1.953,1.434 1.733,2.454L0.763,8.554C0.663,9.164 0.843,9.784 1.243,10.254C1.643,10.724 2.233,10.994 2.853,10.994H6.103V12.464C6.083,13.184 6.293,13.874 6.713,14.464C7.063,14.964 7.623,15.254 8.223,15.254C8.273,15.254 8.313,15.254 8.363,15.254C9.013,15.204 9.583,14.824 9.883,14.244L11.913,10.214C11.974,10.084 12.113,10.004 12.253,10.004H14.144C15.314,10.004 16.264,9.054 16.264,7.884V2.864C16.264,1.694 15.314,0.744 14.144,0.744H14.123ZM10.774,9.644L8.743,13.674C8.603,13.944 8.353,13.994 8.253,14.004C8.143,14.004 7.893,14.004 7.723,13.754C7.463,13.374 7.323,12.934 7.333,12.474L7.353,10.374C7.353,10.204 7.293,10.044 7.173,9.924C7.053,9.804 6.893,9.734 6.733,9.734H2.853C2.593,9.734 2.363,9.624 2.193,9.434C2.033,9.244 1.953,8.984 1.993,8.734L2.953,2.674C3.043,2.274 3.403,1.984 3.813,1.984H11.253V9.074C11.054,9.224 10.884,9.404 10.774,9.634V9.644ZM14.983,7.874C14.983,8.354 14.594,8.744 14.113,8.744H12.503V1.994H14.113C14.594,1.994 14.983,2.384 14.983,2.864V7.884V7.874Z"
android:fillColor="#EA3943"/>
</vector>
25 changes: 25 additions & 0 deletions wallet/res/drawable/ic_thumb_down_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright 2024 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<path
android:pathData="M14.123,0.744H3.823C2.813,0.744 1.953,1.434 1.733,2.454L0.763,8.554C0.663,9.164 0.843,9.784 1.243,10.254C1.643,10.724 2.233,10.994 2.853,10.994H6.103V12.464C6.083,13.184 6.293,13.874 6.713,14.464C7.063,14.964 7.623,15.254 8.223,15.254C8.273,15.254 8.313,15.254 8.363,15.254C9.013,15.204 9.583,14.824 9.883,14.244L11.913,10.214C11.974,10.084 12.113,10.004 12.253,10.004H14.144C15.314,10.004 16.264,9.054 16.264,7.884V2.864C16.264,1.694 15.314,0.744 14.144,0.744H14.123ZM10.774,9.644L8.743,13.674C8.603,13.944 8.353,13.994 8.253,14.004C8.143,14.004 7.893,14.004 7.723,13.754C7.463,13.374 7.323,12.934 7.333,12.474L7.353,10.374C7.353,10.204 7.293,10.044 7.173,9.924C7.053,9.804 6.893,9.734 6.733,9.734H2.853C2.593,9.734 2.363,9.624 2.193,9.434C2.033,9.244 1.953,8.984 1.993,8.734L2.953,2.674C3.043,2.274 3.403,1.984 3.813,1.984H11.253V9.074C11.054,9.224 10.884,9.404 10.774,9.634V9.644ZM14.983,7.874C14.983,8.354 14.594,8.744 14.113,8.744H12.503V1.994H14.113C14.594,1.994 14.983,2.384 14.983,2.864V7.884V7.874Z"
android:fillColor="#ffffff"/>
</vector>
25 changes: 25 additions & 0 deletions wallet/res/drawable/ic_thumb_up_blue.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright 2024 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<path
android:pathData="M2.877,15.256H13.177C14.186,15.256 15.047,14.566 15.267,13.546L16.236,7.446C16.337,6.836 16.156,6.216 15.757,5.746C15.356,5.276 14.767,5.006 14.146,5.006H10.896V3.536C10.917,2.816 10.707,2.126 10.286,1.536C9.937,1.036 9.377,0.746 8.777,0.746C8.727,0.746 8.687,0.746 8.637,0.746C7.987,0.796 7.417,1.176 7.117,1.756L5.087,5.786C5.027,5.916 4.887,5.996 4.747,5.996H2.857C1.687,5.996 0.737,6.946 0.737,8.116V13.136C0.737,14.306 1.687,15.256 2.857,15.256H2.877ZM6.227,6.356L8.257,2.326C8.397,2.056 8.647,2.006 8.747,1.996C8.857,1.996 9.107,1.996 9.277,2.246C9.537,2.626 9.677,3.066 9.667,3.526L9.647,5.626C9.647,5.796 9.707,5.956 9.827,6.076C9.947,6.196 10.106,6.266 10.267,6.266H14.146C14.406,6.266 14.637,6.376 14.807,6.566C14.967,6.756 15.047,7.016 15.007,7.266L14.047,13.326C13.957,13.726 13.597,14.016 13.186,14.016H5.747V6.926C5.947,6.776 6.117,6.596 6.227,6.366V6.356ZM2.017,8.126C2.017,7.646 2.407,7.256 2.887,7.256H4.497V14.006H2.887C2.407,14.006 2.017,13.616 2.017,13.136V8.116V8.126Z"
android:fillColor="#008DE4"/>
</vector>
25 changes: 25 additions & 0 deletions wallet/res/drawable/ic_thumb_up_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright 2024 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<path
android:pathData="M2.877,15.256H13.177C14.186,15.256 15.047,14.566 15.267,13.546L16.236,7.446C16.337,6.836 16.156,6.216 15.757,5.746C15.356,5.276 14.767,5.006 14.146,5.006H10.896V3.536C10.917,2.816 10.707,2.126 10.286,1.536C9.937,1.036 9.377,0.746 8.777,0.746C8.727,0.746 8.687,0.746 8.637,0.746C7.987,0.796 7.417,1.176 7.117,1.756L5.087,5.786C5.027,5.916 4.887,5.996 4.747,5.996H2.857C1.687,5.996 0.737,6.946 0.737,8.116V13.136C0.737,14.306 1.687,15.256 2.857,15.256H2.877ZM6.227,6.356L8.257,2.326C8.397,2.056 8.647,2.006 8.747,1.996C8.857,1.996 9.107,1.996 9.277,2.246C9.537,2.626 9.677,3.066 9.667,3.526L9.647,5.626C9.647,5.796 9.707,5.956 9.827,6.076C9.947,6.196 10.106,6.266 10.267,6.266H14.146C14.406,6.266 14.637,6.376 14.807,6.566C14.967,6.756 15.047,7.016 15.007,7.266L14.047,13.326C13.957,13.726 13.597,14.016 13.186,14.016H5.747V6.926C5.947,6.776 6.117,6.596 6.227,6.366V6.356ZM2.017,8.126C2.017,7.646 2.407,7.256 2.887,7.256H4.497V14.006H2.887C2.407,14.006 2.017,13.616 2.017,13.136V8.116V8.126Z"
android:fillColor="#ffffff"/>
</vector>
102 changes: 102 additions & 0 deletions wallet/res/layout/dialog_one_vote_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2023 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<View
android:id="@+id/drag_indicator"
android:layout_width="35dp"
android:layout_height="4dp"
android:layout_gravity="center"
android:layout_marginVertical="7dp"
android:background="@drawable/rounded_background"
android:theme="@style/DragIndicatorBackground"
tools:background="@color/light_gray" />

<TextView
style="@style/Headline5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:gravity="center_horizontal"
android:textAlignment="gravity"
android:layout_marginHorizontal="20dp"
android:text="@string/one_vote_left_title" />

<TextView
android:id="@+id/subtitle"
style="@style/Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textAlignment="gravity"
android:layout_marginHorizontal="20dp"
android:text="@string/quick_vote_subtitle" />

<TextView
android:id="@+id/show_usernames"
style="@style/Caption.Medium.Blue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textAlignment="gravity"
android:layout_marginHorizontal="20dp"
android:text="@string/one_vote_left_show_usernames" />

<TextView
android:id="@+id/username_list"
style="@style/Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textAlignment="gravity"
android:layout_marginHorizontal="20dp"
android:visibility="invisible"
tools:visibility="visible"
tools:text="@string/one_vote_left_username_examples" />


<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="15dp">

<Button
android:id="@+id/dismiss_btn"
style="@style/Button.Primary.Large.Grey"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:text="@string/cancel" />

<Button
android:id="@+id/ok_button"
style="@style/Button.Primary.Large.Blue"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="15dp"
android:layout_weight="1"
android:text="@string/button_ok" />
</LinearLayout>
</LinearLayout>
28 changes: 28 additions & 0 deletions wallet/res/layout/dialog_username_request_filters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,40 @@
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@id/header">



<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="vertical"
android:paddingHorizontal="15dp">
<TextView
android:id="@+id/group_by_label"
style="@style/Caption.Medium.Tertiary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:text="@string/group_by" />

<androidx.cardview.widget.CardView
android:id="@+id/group_by_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:cardBackgroundColor="@color/background_secondary"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/group_by_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="2"
tools:listitem="@layout/radiobutton_row" />
</androidx.cardview.widget.CardView>

<TextView
android:id="@+id/sort_by_label"
Expand Down
8 changes: 6 additions & 2 deletions wallet/res/layout/fragment_more.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@
<Button
android:id="@+id/join_dashpay_btn"
style="@style/Button.Primary.Blue"
android:layout_width="110dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="14dp"
android:layout_marginHorizontal="100dp"
android:maxLines="1"
android:ellipsize="end"
android:minWidth="110dp"
android:text="@string/join"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down Expand Up @@ -237,7 +241,7 @@
style="@style/MenuRowSubTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/requested_voting_duration" />
tools:text="Results on 10/12/2024" />
</LinearLayout>

<LinearLayout
Expand Down
Loading

0 comments on commit 45d9743

Please sign in to comment.