This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| id 'com.android.application' | |
| id 'kotlin-android' | |
| } | |
| android { | |
| compileSdkVersion 30 | |
| buildToolsVersion "30.0.2" | |
| defaultConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| Text("Hello world by compose") | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hacomeister.jetpackcompose | |
| import androidx.appcompat.app.AppCompatActivity | |
| import android.os.Bundle | |
| import androidx.compose.foundation.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.platform.setContent | |
| import androidx.ui.tooling.preview.Preview | |
| class MainActivity : AppCompatActivity() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| Greeting(name = "Responsible") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CloudDbRepository { | |
| private var mCloudDb: AGConnectCloudDB | |
| var mCloudDbZone: CloudDBZone? = null | |
| init { | |
| mCloudDb = AGConnectCloudDB.getInstance() | |
| } | |
| companion object { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseFoodRepository(val mCloudDbZone: CloudDBZone) : IRepository { | |
| //baseFoodList is a live data object. | |
| val baseFoodList = MutableLiveData<MutableList<BaseFood>>() | |
| //getAll method is getting all BaseFood data from cloud db without any filtering. | |
| override fun getAll() { | |
| //In here, we mention that we want to get BaseFood ObjectType information. | |
| val query = CloudDBZoneQuery.where(BaseFood::class.java) | |
| val queryTask: CloudDBZoneTask<CloudDBZoneSnapshot<BaseFood>> = mCloudDbZone.executeQuery( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivityViewModel : ViewModel() { | |
| var cloudDbRepository: CloudDbRepository = CloudDbRepository() | |
| private var ingredientRepository : IngredientRepository | |
| private var baseFoodRepository : BaseFoodRepository | |
| val ingredientList : MutableLiveData<MutableList<Ingredient>> | |
| val baseFoodList : MutableLiveData<MutableList<BaseFood>> | |
| init { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:orientation="vertical"> | |
| <TextView | |
| android:id="@+id/item_name" | |
| android:layout_width="wrap_content" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseFoodAdapter( | |
| var baseFoods: MutableList<BaseFood>, | |
| var clickListener: OnBaseFoodClickListener | |
| ) : RecyclerView.Adapter<BaseFoodAdapter.BaseFoodViewHolder>() { | |
| fun updateBaseFoods(newBaseFoods: List<BaseFood>) { | |
| baseFoods.clear() | |
| baseFoods.addAll(newBaseFoods) | |
| notifyDataSetChanged() | |
| } |
OlderNewer