Skip to content

Commit

Permalink
updated ego fragment ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kadersuutlu committed Sep 6, 2024
1 parent e6b7e44 commit 4f61c93
Show file tree
Hide file tree
Showing 5 changed files with 236 additions and 65 deletions.
5 changes: 3 additions & 2 deletions app/src/main/res/drawable/switch_background.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F5F5F5"/> <!-- Arka Plan Rengi -->
<corners android:radius="8dp"/> <!-- Kenar Köşe Yuvarlama -->
<solid android:color="#F5F5F5"/>
<corners android:radius="8dp"/>
<size android:width="100dp" android:height="20dp"/>
<padding android:left="8dp" android:right="8dp" android:top="4dp" android:bottom="4dp"/>
</shape>
284 changes: 221 additions & 63 deletions app/src/main/res/layout/fragment_ego.xml
Original file line number Diff line number Diff line change
@@ -1,80 +1,238 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@android:color/white"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">

<Switch
android:id="@+id/switch_ego"
android:layout_width="wrap_content"
<androidx.cardview.widget.CardView
android:id="@+id/cardViewEgo"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/switch_background"
android:checked="true"
android:padding="10dp"
android:text="Ego"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_ego_icon" />

<Switch
android:id="@+id/switch_anger"
android:layout_width="wrap_content"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ego"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_ego"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:thumb="@drawable/ic_ego_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewAnger"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/switch_background"
android:enabled="false"
android:padding="10dp"
android:text="Anger"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_angry_icon" />

<Switch
android:id="@+id/switch_disgust"
android:layout_width="wrap_content"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardViewEgo">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Anger"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_anger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:thumb="@drawable/ic_angry_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewDisgust"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/switch_background"
android:enabled="false"
android:padding="10dp"
android:text="Disgust"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_disgust_icon" />

<Switch
android:id="@+id/switch_fear"
android:layout_width="wrap_content"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardViewAnger">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Disgust"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_disgust"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:thumb="@drawable/ic_disgust_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewFear"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/switch_background"
android:enabled="false"
android:padding="10dp"
android:text="Fear"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_fear_icon" />

<Switch
android:id="@+id/switch_joy"
android:layout_width="wrap_content"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardViewDisgust">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fear"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_fear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:thumb="@drawable/ic_fear_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewJoy"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/switch_background"
android:enabled="false"
android:padding="10dp"
android:text="Joy"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_joy_icon" />

<Switch
android:id="@+id/switch_sadness"
android:layout_width="wrap_content"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardViewFear">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Joy"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_joy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:thumb="@drawable/ic_joy_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewSadness"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/switch_background"
android:enabled="false"
android:padding="10dp"
android:text="Sadness"
android:textColor="@android:color/black"
android:thumb="@drawable/ic_sad_icon" />

</LinearLayout>
android:layout_marginBottom="16dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardViewJoy">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sadness"
android:textColor="@android:color/black" />

<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Switch
android:id="@+id/switch_sadness"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:thumb="@drawable/ic_sad_icon"
android:track="@drawable/switch_background" />
</LinearLayout>
</androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="smallMargin">5dp</dimen>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
<string name="joy">Joy</string>
<string name="sadness">Sadness</string>
<string name="max">"Max 4 switch added to bottomnavigationbar "</string>


</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
</style>

<style name="Theme.KekodChallenge1" parent="Base.Theme.KekodChallenge1" />

<style name="CardViewStyle" parent="TextAppearance.AppCompat">
<item name="android:layout_margin">@dimen/smallMargin</item>
<item name="cardCornerRadius">@dimen/smallMargin</item>
</style>

</resources>

0 comments on commit 4f61c93

Please sign in to comment.