Skip to content

Commit

Permalink
Adding the required pages
Browse files Browse the repository at this point in the history
  • Loading branch information
BasemKhater committed Apr 25, 2024
1 parent 3393528 commit 163fda7
Show file tree
Hide file tree
Showing 8 changed files with 1,393 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.modarb.android.ui.menu.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.CheckBox
import com.modarb.android.R

class AppAppearanceActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_app_appearance)

val imageView = findViewById<View>(R.id.backButton)
imageView.setOnClickListener {
val intent = Intent(this, SettingActivity::class.java)
startActivity(intent)
}


val checkBoxSystemDefault = findViewById<CheckBox>(R.id.checkBoxSystemDefault)
val checkBoxLightTheme = findViewById<CheckBox>(R.id.checkBoxLightTheme)
val checkBoxDarkTheme = findViewById<CheckBox>(R.id.checkBoxDarkTheme)

checkBoxSystemDefault.setOnClickListener {
if (checkBoxSystemDefault.isChecked) {
checkBoxLightTheme.isChecked = false
checkBoxDarkTheme.isChecked = false
checkBoxSystemDefault.setButtonDrawable(R.drawable.theme_checkbox)
} else {
checkBoxSystemDefault.buttonDrawable = null
}
}

checkBoxLightTheme.setOnClickListener {
if (checkBoxLightTheme.isChecked) {
checkBoxSystemDefault.isChecked = false
checkBoxDarkTheme.isChecked = false
checkBoxLightTheme.setButtonDrawable(R.drawable.theme_checkbox)
} else {
checkBoxLightTheme.buttonDrawable = null
}
}

checkBoxDarkTheme.setOnClickListener {
if (checkBoxDarkTheme.isChecked) {
checkBoxSystemDefault.isChecked = false
checkBoxLightTheme.isChecked = false
checkBoxDarkTheme.setButtonDrawable(R.drawable.theme_checkbox)
} else {
checkBoxDarkTheme.buttonDrawable = null
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.modarb.android.ui.menu.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.modarb.android.R
import com.modarb.android.ui.home.HomeActivity

class NotificationActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_notification)

val imageView = findViewById<View>(R.id.backButton)
imageView.setOnClickListener {
val intent = Intent(this, HomeActivity::class.java)
startActivity(intent)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.modarb.android.ui.menu.activities

import android.content.Intent
import android.content.res.ColorStateList
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.appcompat.widget.SwitchCompat
import com.modarb.android.R

class ReminderActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_reminder)

val imageView = findViewById<View>(R.id.backButton)
imageView.setOnClickListener {
val intent = Intent(this, MenuActivity::class.java)
startActivity(intent)
}

val mealsSwitch: SwitchCompat = findViewById(R.id.mealsSwitch)
val workoutSwitch: SwitchCompat = findViewById(R.id.workoutSwitch)
val challengesSwitch: SwitchCompat = findViewById(R.id.challengesSwitch)
val feedPostsSwitch: SwitchCompat = findViewById(R.id.feedPostsSwitch)


mealsSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
mealsSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green))
} else {
mealsSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.gray_75))
}
}

workoutSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
workoutSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green))
} else {
workoutSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.gray_75))
}
}

challengesSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
challengesSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green))
} else {
challengesSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.gray_75))
}
}

feedPostsSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
feedPostsSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green))
} else {
feedPostsSwitch.trackTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.gray_75))
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.modarb.android.ui.menu.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.modarb.android.R

class SettingActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_setting)

val imageView = findViewById<View>(R.id.backButton)
imageView.setOnClickListener {
val intent = Intent(this, MenuActivity::class.java)
startActivity(intent)
}
val cardView = findViewById<View>(R.id.appAppearanceCardView)
cardView.setOnClickListener {
startActivity(Intent(this, AppAppearanceActivity::class.java))
}
}
}
217 changes: 217 additions & 0 deletions app/src/main/res/layout/activity_app_appearance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".ui.menu.activities.NotificationActivity">


<ImageView
android:id="@+id/backButton"
android:layout_width="70dp"
android:layout_height="50dp"
android:layout_marginStart="4dp"
android:layout_marginTop="20dp"
android:scaleType="center"
android:src="@drawable/baseline_arrow_back_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/montserrat"
android:padding="8dp"
android:text="@string/app_appearance"
android:textColor="@color/secondary_200"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.312"
app:layout_constraintStart_toEndOf="@+id/backButton"
app:layout_constraintTop_toTopOf="parent" />

<View
android:id="@+id/lineView"
android:layout_width="380dp"
android:layout_height="2dp"
android:layout_marginTop="4dp"
android:background="@color/grey_400"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="32dp"
android:gravity="start"
android:text="@string/select_theme"
android:textColor="@color/gray_92"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

<androidx.cardview.widget.CardView
android:id="@+id/systemDefaultCardView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:backgroundTint="@color/gray_700"
android:clipToPadding="true"
app:cardCornerRadius="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:gravity="start"
android:text="@string/system_default"
android:textColor="@color/gray_92"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<CheckBox
android:id="@+id/checkBoxSystemDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:button="@drawable/theme_checkbox"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>


<androidx.cardview.widget.CardView
android:id="@+id/lightThemCardView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:backgroundTint="@color/gray_700"
android:clipToPadding="true"
app:cardCornerRadius="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/systemDefaultCardView">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:gravity="start"
android:text="@string/light_theme"
android:textColor="@color/gray_92"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<CheckBox
android:id="@+id/checkBoxLightTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:button="@drawable/theme_checkbox"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textView4"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:id="@+id/darkThemCardView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:backgroundTint="@color/gray_700"
android:clipToPadding="true"
app:cardCornerRadius="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/lightThemCardView">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:gravity="start"
android:text="@string/dark_theme"
android:textColor="@color/gray_92"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<CheckBox
android:id="@+id/checkBoxDarkTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:button="@drawable/theme_checkbox"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textView5"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 163fda7

Please sign in to comment.