Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various color and margin/padding issues #106

Merged
merged 1 commit into from
Mar 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import app.opass.ccip.R
import app.opass.ccip.extension.updateMargin
import com.google.android.material.dialog.MaterialAlertDialogBuilder

class LanguagePreferenceFragment : DialogFragment() {
Expand Down Expand Up @@ -140,6 +141,14 @@ class LanguagePreferenceAdapter(
holder.localName.text = item.localName
holder.translatedName.text = item.translatedName

if (position == 0) {
holder.optionItem.updateMargin(top = 36)
}

if (position == items.size - 1) {
holder.optionItem.updateMargin(bottom = 36)
}

if (!isSelected) {
holder.selectedIcon.setImageDrawable(null)
} else {
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/app/opass/ccip/ui/wifi/WiFiNetworkAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package app.opass.ccip.ui.wifi
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.isGone
import androidx.core.view.marginTop
import androidx.recyclerview.widget.RecyclerView
import app.opass.ccip.R
import app.opass.ccip.extension.updateMargin
import app.opass.ccip.model.WifiNetworkInfo

class WifiNetworkAdapter(
Expand Down Expand Up @@ -38,10 +41,19 @@ class WifiNetworkAdapter(

holder.password.text = item.password
holder.password.isGone = false

if (position == 0) {
holder.networkItem.updateMargin(top = 36)
}

if (position == items.size - 1) {
holder.networkItem.updateMargin(bottom = 36)
}
}
}

class WifiNetworkViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val networkItem: LinearLayout = view.findViewById(R.id.network_item)
val name: TextView = view.findViewById(R.id.network_name)
val password: TextView = view.findViewById(R.id.network_password)
}
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/room_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<solid android:color="@color/backgroundColorAccent" />
</shape>
</item>
</selector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/tag_round_corner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="?attr/colorAccent" />
<solid android:color="@color/colorAccentDark" />

<corners android:radius="16dp" />
</shape>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_session_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_star_border_white_48dp"
app:backgroundTint="@color/colorPrimary"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end" />

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_schedule_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="@string/filter"
android:tint="?attr/colorOnSecondary"
app:backgroundTint="@color/colorPrimary"
android:tint="?attr/colorOnPrimary"
android:visibility="invisible"
app:srcCompat="@drawable/ic_baseline_filter_list_24" />

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/include_auth_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<Button
android:id="@+id/not_this_event"
style="@style/Widget.MaterialComponents.Button.TextButton"
style="@style/TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="?attr/colorSecondary">
android:background="@color/backgroundColorAccent">

<ImageView
android:id="@+id/event_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="10dp"
card_view:srcCompat="?attr/colorSecondary" />
card_view:srcCompat="@color/backgroundColorAccent" />
</RelativeLayout>

<TextView
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/layout/item_option_language.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:orientation="horizontal"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="24dp"
android:paddingEnd="24dp">

<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:orientation="vertical">
<TextView
android:id="@+id/option_local_name"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_session.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="8dp"
android:maxLines="1"
android:padding="2dp"
android:text="New Text"
android:text="TR412-1"
app:layout_constraintBottom_toTopOf="@id/tagsBarrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/item_wifi_network.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?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:id="@+id/network_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:orientation="vertical"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="8dp"
android:paddingBottom="16dp">
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="24dp"
android:paddingEnd="24dp">

<TextView
android:id="@+id/network_name"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<resources>
<color name="colorPrimary">#3C2354</color>
<color name="colorPrimaryDark">#1D162B</color>
<color name="colorAccent">#765987</color>
<color name="colorAccent">#b4a0c0</color>
<color name="colorAccentDark">#694f78</color>
<color name="colorDietMeat">#FFA000</color>
<color name="colorDietVegetarian">#298A08</color>
<color name="colorWhite">#FFFFFF</color>
Expand All @@ -11,5 +12,6 @@
<color name="textColorPrimary">@android:color/white</color>
<color name="textColorSecondary">@color/colorAccent</color>
<color name="backgroundColorPrimary">@color/background_material_dark</color>
<color name="backgroundColorAccent">@color/colorAccentDark</color>
<color name="secondaryContainer">#4A4458</color>
</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<resources>
<color name="colorPrimary">#3C2354</color>
<color name="colorPrimaryDark">#1D162B</color>
<color name="colorAccent">#765987</color>
<color name="colorAccent">#b4a0c0</color>
<color name="colorAccentDark">#694f78</color>
<color name="colorDietMeat">#FFA000</color>
<color name="colorDietVegetarian">#298A08</color>
<color name="colorWhite">#FFFFFF</color>
Expand All @@ -11,5 +12,6 @@
<color name="textColorPrimary">@android:color/black</color>
<color name="textColorSecondary">@color/colorPrimary</color>
<color name="backgroundColorPrimary">@color/background_material_light</color>
<color name="backgroundColorAccent">@color/colorPrimary</color>
<color name="secondaryContainer">#E8DEF8</color>
</resources>
23 changes: 23 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,32 @@
<item name="android:textColorSecondary">@color/textColorSecondary</item>
<item name="android:colorBackground">@color/backgroundColorPrimary</item>
<item name="android:navigationBarColor">@color/navigationBarColor</item>
<item name="materialAlertDialogTheme">@style/AlertDialogTheme</item>
<item name="textAppearanceButton">@style/ButtonTextAppearance</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

<style name="AlertDialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="buttonBarNeutralButtonStyle">@style/NeutralButtonStyle</item>
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
</style>

<style name="NeutralButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/textColorSecondary</item>
</style>

<style name="NegativeButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/textColorSecondary</item>
</style>

<style name="PositiveButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/textColorSecondary</item>
</style>

<style name="Widget.CardContent" parent="android:Widget">
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
Expand Down Expand Up @@ -55,4 +74,8 @@
<style name="ButtonTextAppearance" parent="TextAppearance.MaterialComponents.Button">
<item name="android:letterSpacing">0</item>
</style>

<style name="TextButton" parent="Widget.MaterialComponents.Button.TextButton">
<item name="android:textColor">@color/textColorSecondary</item>
</style>
</resources>