Layout update to main fragment

This commit is contained in:
2020-04-19 14:09:29 +01:00
parent 96c0b944c1
commit 2a711248af
10 changed files with 64 additions and 19 deletions

View File

@@ -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"
}

View File

@@ -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" />

View 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))
}
}

View File

@@ -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) }
}
}

View File

@@ -1,4 +0,0 @@
package com.example.h_mal.candyspace.data.room
interface RoomDatabase {
}

View File

@@ -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() {

View File

@@ -0,0 +1,7 @@
package com.example.h_mal.candyspace.ui.main
interface CompletionListener {
fun onStarted()
fun onSuccess()
fun onFailure()
}

View File

@@ -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(
private val repository: Repository
) : ViewModel() {
var searchString: String? = null
fun submit(view: View){
class MainViewModel : ViewModel() {
// TODO: Implement the ViewModel
}
}

View File

@@ -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" />

View File

@@ -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>