회원가입, 로그인 페이지 추가
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
import retrofit2.Retrofit
|
||||
|
||||
class ApiBuilder {
|
||||
fun <T> build(retrofit: Retrofit, service: Class<T>): T {
|
||||
return retrofit.create(service)
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ApiResponse<T>(
|
||||
@SerializedName("success") val success: Boolean,
|
||||
@SerializedName("data") val data: T? = null,
|
||||
@SerializedName("message") val message: String? = null,
|
||||
@SerializedName("errorProperty") val errorProperty: String? = null
|
||||
)
|
@@ -1,4 +1,12 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
object Constants {
|
||||
const val PREF_TOKEN = "pref_token"
|
||||
const val PREF_EMAIL = "pref_email"
|
||||
const val PREF_USER_ID = "pref_user_id"
|
||||
const val PREF_NICKNAME = "pref_nickname"
|
||||
const val PREF_PROFILE_IMAGE = "pref_profile_image"
|
||||
|
||||
const val EXTRA_DATA = "extra_data"
|
||||
const val EXTRA_TERMS = "extra_terms"
|
||||
}
|
||||
|
@@ -0,0 +1,49 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
import android.app.Activity
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.AnimationDrawable
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import kr.co.vividnext.sodalive.databinding.DialogLoadingBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
|
||||
class LoadingDialog(
|
||||
activity: Activity,
|
||||
layoutInflater: LayoutInflater
|
||||
) {
|
||||
private val alertDialog: AlertDialog
|
||||
private val dialogView = DialogLoadingBinding.inflate(layoutInflater)
|
||||
private val animationDrawable: AnimationDrawable
|
||||
|
||||
init {
|
||||
val dialogBuilder = AlertDialog.Builder(activity)
|
||||
dialogBuilder.setView(dialogView.root)
|
||||
|
||||
animationDrawable = dialogView.tvLoading.compoundDrawables[1] as AnimationDrawable
|
||||
|
||||
alertDialog = dialogBuilder.create()
|
||||
alertDialog.setCancelable(false)
|
||||
alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
}
|
||||
|
||||
fun show(width: Int, message: String = "") {
|
||||
alertDialog.show()
|
||||
animationDrawable.start()
|
||||
dialogView.tvLoading.text = message
|
||||
|
||||
val lp = WindowManager.LayoutParams()
|
||||
lp.copyFrom(alertDialog.window?.attributes)
|
||||
lp.width = width - (26.7f.dpToPx()).toInt()
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
|
||||
alertDialog.window?.attributes = lp
|
||||
}
|
||||
|
||||
fun dismiss() {
|
||||
animationDrawable.stop()
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
@@ -43,4 +43,34 @@ object SharedPreferenceManager {
|
||||
else -> throw UnsupportedOperationException("Error")
|
||||
}
|
||||
}
|
||||
|
||||
var token: String
|
||||
get() = sharedPreferences[Constants.PREF_TOKEN, ""]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_TOKEN] = value
|
||||
}
|
||||
|
||||
var userId: Long
|
||||
get() = sharedPreferences[Constants.PREF_USER_ID, 0]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_USER_ID] = value
|
||||
}
|
||||
|
||||
var nickname: String
|
||||
get() = sharedPreferences[Constants.PREF_NICKNAME, ""]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_NICKNAME] = value
|
||||
}
|
||||
|
||||
var email: String
|
||||
get() = sharedPreferences[Constants.PREF_EMAIL, ""]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_EMAIL] = value
|
||||
}
|
||||
|
||||
var profileImage: String
|
||||
get() = sharedPreferences[Constants.PREF_PROFILE_IMAGE, ""]
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_PROFILE_IMAGE] = value
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user