mirror of
https://github.com/hmalik144/Candy_Space_tech_test.git
synced 2025-12-10 03:05:27 +00:00
Layout update to main fragment
This commit is contained in:
@@ -47,23 +47,24 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
|
||||
|
||||
// ViewModel and LiveData
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
|
||||
|
||||
//New Material Design
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha10'
|
||||
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
||||
|
||||
//Kodein Dependency Injection
|
||||
implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1"
|
||||
implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1"
|
||||
|
||||
//Android Room
|
||||
implementation "androidx.room:room-runtime:2.2.0-rc01"
|
||||
implementation "androidx.room:room-ktx:2.2.0-rc01"
|
||||
kapt "androidx.room:room-compiler:2.2.0-rc01"
|
||||
implementation "androidx.room:room-runtime:2.2.5"
|
||||
implementation "androidx.room:room-ktx:2.2.5"
|
||||
kapt "androidx.room:room-compiler:2.2.5"
|
||||
|
||||
implementation 'com.xwray:groupie:2.3.0'
|
||||
implementation 'com.xwray:groupie-kotlin-android-extensions:2.3.0'
|
||||
implementation 'com.xwray:groupie-databinding:2.3.0'
|
||||
|
||||
implementation "androidx.preference:preference-ktx:1.1.0"
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<activity android:name=".ui.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
14
app/src/main/java/com/example/h_mal/candyspace/AppClass.kt
Normal file
14
app/src/main/java/com/example/h_mal/candyspace/AppClass.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.example.h_mal.candyspace
|
||||
|
||||
import android.app.Application
|
||||
import org.kodein.di.Kodein
|
||||
import org.kodein.di.KodeinAware
|
||||
import org.kodein.di.android.x.androidXModule
|
||||
|
||||
class AppClass : Application(), KodeinAware{
|
||||
override val kodein = Kodein.lazy {
|
||||
import(androidXModule(this@AppClass))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ class Repository(
|
||||
private val api: ApiClass
|
||||
): ResponseUnwrap() {
|
||||
|
||||
suspend fun sdasda(username: String): User {
|
||||
suspend fun getUsers(username: String): User {
|
||||
return apiRequest { api.getUsersFromApi(username) }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.example.h_mal.candyspace.data.room
|
||||
|
||||
interface RoomDatabase {
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.example.h_mal.candyspace
|
||||
package com.example.h_mal.candyspace.ui
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.example.h_mal.candyspace.R
|
||||
import com.example.h_mal.candyspace.ui.main.MainFragment
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.h_mal.candyspace.ui.main
|
||||
|
||||
interface CompletionListener {
|
||||
fun onStarted()
|
||||
fun onSuccess()
|
||||
fun onFailure()
|
||||
}
|
||||
@@ -1,7 +1,16 @@
|
||||
package com.example.h_mal.candyspace.ui.main
|
||||
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.example.h_mal.candyspace.data.repositories.Repository
|
||||
|
||||
class MainViewModel : ViewModel() {
|
||||
// TODO: Implement the ViewModel
|
||||
class MainViewModel(
|
||||
private val repository: Repository
|
||||
) : ViewModel() {
|
||||
|
||||
var searchString: String? = null
|
||||
|
||||
fun submit(view: View){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity" />
|
||||
tools:context=".ui.MainActivity" />
|
||||
|
||||
@@ -7,13 +7,30 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.main.MainFragment">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/search_bar"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_margin="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/container">
|
||||
<EditText
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/search_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="Submit"/>
|
||||
</LinearLayout>
|
||||
|
||||
<view class="androidx.appcompat.app.AlertController$RecycleListView"
|
||||
android:id="@+id/recycler_view"
|
||||
@@ -22,7 +39,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintTop_toBottomOf="@id/container"
|
||||
tools:listitem="@android:layout/simple_list_item_2">
|
||||
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user