Skip to content

Commit

Permalink
PetFinder Sample: Add domain models
Browse files Browse the repository at this point in the history
  • Loading branch information
RotBolt committed Oct 11, 2023
1 parent 8e3ccb3 commit adba8b1
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.squareup.sample.petfinder.ui.theme.WorkflowTheme
import com.squareup.sample.petfinder.theme.WorkflowTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.squareup.sample.petfinder.domain

data class Address (
val address1: Any? = null,
val address2: Any? = null,
val city: String,
val state: String,
val postcode: String,
val country: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.squareup.sample.petfinder.domain

data class Adoption (
val policy: String? = null,
val url: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.squareup.sample.petfinder.domain

data class Animal (
val id: Long,
val organizationId: String,
val url: String,
val type: String,
val species: String,
val breeds: Breeds,
val colors: Colors,
val age: String,
val gender: String,
val size: String,
val coat: String,
val name: String,
val description: String,
val photos: List<Photo>,
val videos: List<Video>,
val status: String,
val attributes: Attributes,
val environment: Environment,
val tags: List<String>,
val contact: Contact,
val publishedAt: String,
val distance: Double,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.squareup.sample.petfinder.domain

data class Attributes (
val spayedNeutered: Boolean,
val houseTrained: Boolean,
val declawed: Boolean,
val specialNeeds: Boolean,
val shotsCurrent: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.squareup.sample.petfinder.domain

data class Breeds (
val primary: String,
val secondary: Any? = null,
val mixed: Boolean,
val unknown: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.squareup.sample.petfinder.domain

data class Colors (
val primary: String,
val secondary: Any? = null,
val tertiary: Any? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.squareup.sample.petfinder.domain

data class Contact (
val email: String,
val phone: String,
val address: Address
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.squareup.sample.petfinder.domain

data class Environment (
val children: Boolean,
val dogs: Boolean,
val cats: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.squareup.sample.petfinder.domain

data class Hours (
val monday: String? = null,
val tuesday: String? = null,
val wednesday: String? = null,
val thursday: String? = null,
val friday: String? = null,
val saturday: String? = null,
val sunday: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.squareup.sample.petfinder.domain

data class Organization (
val id: String,
val name: String,
val email: String,
val phone: String,
val address: Address,
val hours: Hours,
val url: String,
val website: String? = null,
val missionStatement: Any? = null,
val adoption: Adoption,
val socialMedia: SocialMedia,
val photos: List<Photo>,
val distance: Double,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.squareup.sample.petfinder.domain

data class Photo (
val small: String,
val medium: String,
val large: String,
val full: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.squareup.sample.petfinder.domain

data class SocialMedia (
val facebook: String? = null,
val twitter: String? = null,
val youtube: String? = null,
val instagram: String? = null,
val pinterest: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.squareup.sample.petfinder.domain

data class Video (
val embed: String
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.squareup.sample.petfinder.ui.theme
package com.squareup.sample.petfinder.theme

import androidx.compose.ui.graphics.Color

Expand All @@ -8,4 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.squareup.sample.petfinder.ui.theme
package com.squareup.sample.petfinder.theme

import android.app.Activity
import android.os.Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.squareup.sample.petfinder.ui.theme
package com.squareup.sample.petfinder.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -31,4 +31,4 @@ val Typography = Typography(
letterSpacing = 0.5.sp
)
*/
)
)
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ include(
":samples:hello-workflow",
":samples:hello-workflow-fragment",
":samples:nested-overlays",
":samples:petfinder",
":samples:stub-visibility",
":samples:tictactoe:app",
":samples:tictactoe:common",
Expand Down

0 comments on commit adba8b1

Please sign in to comment.