-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
148 additions
and
65 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,21 +43,27 @@ class JoinCreate : Fragment(){ | |
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
val binding = FragmentJoinCreateBinding.inflate(inflater, container, false) | ||
|
||
// EditText binding | ||
val input_name = binding.inputName | ||
val input_id = binding.newId | ||
val new_password = binding.inputNewpassword | ||
val check_password = binding.checkPassword | ||
|
||
// 버튼 view 바인딩 | ||
val binding = FragmentJoinCreateBinding.inflate(inflater, container, false) | ||
binding.nextCreate.setOnClickListener{ | ||
//회원 등록 | ||
registerUser(input_name.text.toString(), input_id.text.toString(), new_password.text.toString()) | ||
|
||
// 화면 이동 | ||
(activity as JoinActivity).replaceFragment(JoinShare()) | ||
} | ||
|
||
binding.nextCreate.isEnabled = false | ||
binding.nextCreate.setBackgroundColor(Color.parseColor("#d3d3d3")); | ||
|
||
// EditText binding | ||
val input_name = binding.inputName | ||
val input_id = binding.newId | ||
val new_password = binding.inputNewpassword | ||
val check_password = binding.checkPassword | ||
|
||
|
||
// 핸들러 적용 | ||
var textWatcher = object : TextWatcher { | ||
|
@@ -87,30 +93,27 @@ class JoinCreate : Fragment(){ | |
|
||
|
||
|
||
/* 회원가입 */ | ||
Log.d("mobileApp", "회원가입 버튼을 누름") | ||
|
||
|
||
return binding.root | ||
} | ||
|
||
private fun registerUser(userName: String, email: String, password: String){ | ||
val call: Call<RegisterRes> = MyApplication.networkServiceAuth.register( | ||
RegisterReq("test5","[email protected]", "55555555") | ||
RegisterReq(userName,email, password) | ||
) | ||
|
||
call?.enqueue(object : Callback<RegisterRes>{ | ||
override fun onResponse(call: Call<RegisterRes>, response: Response<RegisterRes>) { | ||
if(response.isSuccessful){ | ||
Log.d("mobileApp", "$response") | ||
Log.d("mobileApp", "$response ${response.body()}") | ||
} | ||
} | ||
|
||
override fun onFailure(call: Call<RegisterRes>, t: Throwable) { | ||
Log.d("mobileApp", "onFailure $t") | ||
} | ||
}) | ||
|
||
|
||
|
||
|
||
|
||
return binding.root | ||
} | ||
|
||
companion object { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
29 changes: 29 additions & 0 deletions
29
SHAPEUP2022/app/src/main/java/com/example/shape_up_2022/SaveSharedPreference.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.example.shape_up_2022 | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.preference.PreferenceManager | ||
|
||
class SaveSharedPreference { | ||
companion object{ | ||
fun getSharedPreferences(ctx: Context): SharedPreferences? { | ||
return PreferenceManager.getDefaultSharedPreferences(ctx) | ||
} | ||
|
||
fun setUserEmail(ctx: Context, email: String) { | ||
val editor = getSharedPreferences(ctx)!!.edit() | ||
editor.putString("username", email) | ||
editor.commit() | ||
} | ||
|
||
fun getUserEmail(ctx: Context?): String? { | ||
return getSharedPreferences(ctx!!)!!.getString("username", "") | ||
} | ||
|
||
fun clearUserEmail(ctx: Context?) { | ||
val editor = getSharedPreferences(ctx!!)!!.edit() | ||
editor.clear() | ||
editor.commit() | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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