add login and board_list #26

Manually merged
norangebit merged 38 commits from feature_integrate_login into develop 2020-01-14 19:53:09 +00:00
11 changed files with 19 additions and 28 deletions
Showing only changes of commit bce45d2605 - Show all commits

View File

@ -33,10 +33,8 @@ android {
dependencies { dependencies {
// standard // standard
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.2.2"
implementation project(':wrapper') implementation project(':wrapper')
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.2.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.core:core-ktx:1.1.0'
@ -81,5 +79,4 @@ dependencies {
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion" androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.androidxArchVersion" androidTestImplementation "androidx.arch.core:core-testing:$rootProject.androidxArchVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion" androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
} }

View File

@ -17,7 +17,6 @@ import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import java.io.IOException import java.io.IOException
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
class BoardDaoTest { class BoardDaoTest {
private lateinit var dao: BoardDao private lateinit var dao: BoardDao
@ -108,8 +107,4 @@ class BoardDaoTest {
assertEquals(0, it.size) assertEquals(0, it.size)
} }
} }
} }

View File

@ -1,7 +1,11 @@
package it.unisannio.ding.ids.wedroid.app.data.dao package it.unisannio.ding.ids.wedroid.app.data.dao
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.room.* import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import it.unisannio.ding.ids.wedroid.app.data.entity.Board import it.unisannio.ding.ids.wedroid.app.data.entity.Board
@Dao @Dao
@ -14,4 +18,4 @@ interface BoardDao {
@Delete @Delete
suspend fun delete(board: Board) suspend fun delete(board: Board)
} }

View File

@ -13,4 +13,3 @@ data class Board(
fun it.unisannio.ding.ids.wedroid.wrapper.entity.Board.convert(): Board { fun it.unisannio.ding.ids.wedroid.wrapper.entity.Board.convert(): Board {
return Board(this.id, this.title) return Board(this.id, this.title)
} }

View File

@ -159,4 +159,3 @@ class BoardRepository(
Log.e("RETROFIT", message) Log.e("RETROFIT", message)
} }
} }

View File

@ -1,6 +1,12 @@
package it.unisannio.ding.ids.wedroid.app.util package it.unisannio.ding.ids.wedroid.app.util
import it.unisannio.ding.ids.wedroid.wrapper.api.* import it.unisannio.ding.ids.wedroid.wrapper.api.BoardService
import it.unisannio.ding.ids.wedroid.wrapper.api.CardCommentService
import it.unisannio.ding.ids.wedroid.wrapper.api.CardService
import it.unisannio.ding.ids.wedroid.wrapper.api.ChecklistService
import it.unisannio.ding.ids.wedroid.wrapper.api.ListService
import it.unisannio.ding.ids.wedroid.wrapper.api.SwimlanesService
import it.unisannio.ding.ids.wedroid.wrapper.api.UserService
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
@ -75,4 +81,3 @@ class ServicesFactory private constructor(
} }
} }
} }

View File

@ -2,7 +2,7 @@ package it.unisannio.ding.ids.wedroid.app.util
import android.content.Context import android.content.Context
class SharedPreferenceHelper(context : Context) : PreferenceReader, PreferenceWriter { class SharedPreferenceHelper(context: Context) : PreferenceReader, PreferenceWriter {
private val sp = context.getSharedPreferences("userinfo", Context.MODE_PRIVATE) private val sp = context.getSharedPreferences("userinfo", Context.MODE_PRIVATE)
override fun getBaseUrl(): String? { override fun getBaseUrl(): String? {
@ -20,8 +20,7 @@ class SharedPreferenceHelper(context : Context) : PreferenceReader, PreferenceWr
override fun setBaseUrl(baseUrl: String?) { override fun setBaseUrl(baseUrl: String?) {
val editor = sp.edit() val editor = sp.edit()
editor.putString("url", baseUrl).apply() editor.putString("url", baseUrl).apply()
}
}
override fun setUserId(userId: String?) { override fun setUserId(userId: String?) {
val editor = sp.edit() val editor = sp.edit()
@ -32,4 +31,4 @@ class SharedPreferenceHelper(context : Context) : PreferenceReader, PreferenceWr
val editor = sp.edit() val editor = sp.edit()
editor.putString("token", token).apply() editor.putString("token", token).apply()
} }
} }

View File

@ -118,7 +118,7 @@ class BoardsListsActivity : AppCompatActivity() {
val isPrivate = data.getBooleanExtra(NewBoardActivity.BOARD_PRIVATE, true) val isPrivate = data.getBooleanExtra(NewBoardActivity.BOARD_PRIVATE, true)
viewModel.insertBoard(title, isPrivate, BoardBackgroundColor.LIMEGREEN) //TODO viewModel.insertBoard(title, isPrivate, BoardBackgroundColor.LIMEGREEN) // TODO
} }
companion object { companion object {
@ -126,4 +126,3 @@ class BoardsListsActivity : AppCompatActivity() {
const val LOGIN_CODE = 19 const val LOGIN_CODE = 19
} }
} }

View File

@ -37,7 +37,6 @@ class LoginActivity : AppCompatActivity() {
return return
} }
val userNameText = username.text.toString() val userNameText = username.text.toString()
val passwordText = password.text.toString() val passwordText = password.text.toString()
@ -47,8 +46,6 @@ class LoginActivity : AppCompatActivity() {
.build() .build()
.create(LoginService::class.java) .create(LoginService::class.java)
service.login(userNameText, passwordText).enqueue(object : Callback<UserPrototype> { service.login(userNameText, passwordText).enqueue(object : Callback<UserPrototype> {
override fun onFailure(call: Call<UserPrototype>, t: Throwable) { override fun onFailure(call: Call<UserPrototype>, t: Throwable) {
Toast.makeText( Toast.makeText(
@ -82,7 +79,6 @@ class LoginActivity : AppCompatActivity() {
setResult(LOGIN_OK) setResult(LOGIN_OK)
finish() finish()
} }
}) })
} }

View File

@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
import it.unisannio.ding.ids.wedroid.app.R import it.unisannio.ding.ids.wedroid.app.R
import it.unisannio.ding.ids.wedroid.app.data.entity.Board import it.unisannio.ding.ids.wedroid.app.data.entity.Board
class BoardsListAdapter internal constructor( class BoardsListAdapter internal constructor(
context: Context context: Context
) : RecyclerView.Adapter<BoardsListAdapter.BoardViewHolder>() { ) : RecyclerView.Adapter<BoardsListAdapter.BoardViewHolder>() {

View File

@ -10,4 +10,3 @@ fun getPrivateFun(name: String, kClass: KClass<*>): KFunction<*>? {
.find { it.name == name } .find { it.name == name }
.also { it?.isAccessible = true } .also { it?.isAccessible = true }
} }