Skip to content

Commit

Permalink
last update
Browse files Browse the repository at this point in the history
  • Loading branch information
gaguriee committed Mar 31, 2023
1 parent 3aef89d commit 38deb37
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 36 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ class RegisterActivity2 : AppCompatActivity() {
return;
}

Toast.makeText(
this,
"주소 : ${data?.getStringExtra("address").toString()}",
Toast.LENGTH_SHORT
)
.show()
userInfo.addressLati = data?.getDoubleExtra("latitude", 0.0)
userInfo.addressLongi = data?.getDoubleExtra("longitude", 0.0)
binding.homeEdittext.text = data?.getStringExtra("address").toString()
Expand Down Expand Up @@ -180,6 +174,8 @@ class RegisterActivity2 : AppCompatActivity() {
val AuthorizationHeader = "Bearer " + App.prefs.accessToken
Log.d("AuthorizationHeader :", AuthorizationHeader.toString())
Log.d("userInfo :", userInfo.toString())
userInfo.isConnect = true

val callApi = smsAuthApi.register(authorizationHeader = AuthorizationHeader, checkRegisterRequest = userInfo)
callApi.enqueue(object : Callback<registerResponse> {
override fun onResponse(call: Call<registerResponse>, response: Response<registerResponse>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class AdminReportActivity : AppCompatActivity(){
binding = ActivityAdminReportBinding.inflate(layoutInflater)
setContentView(binding.root)
report = intent.getParcelableExtra<Report>("report")!!
val name = intent.getStringExtra("name")
binding.nameText.text = name + " 님의"


Log.d("report!!!", report.toString())

val repository = RetrofitRepository()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import com.kgg.android.seenear.AdminActivity.adminmain.AdminMainActivity
import com.kgg.android.seenear.UserActivity.usermodify.ModifyUserInfoActivity
import com.kgg.android.seenear.UserActivity.usermodify.medicine.medicineInquiry.MedicineInquiryActivity
import com.kgg.android.seenear.network.data.*
import java.text.SimpleDateFormat
import java.util.*


class AdminDetailActivity : AppCompatActivity() {
Expand Down Expand Up @@ -56,10 +58,25 @@ class AdminDetailActivity : AppCompatActivity() {
viewModel = ViewModelProvider(this,viewModelFactory).get(AdminDetailViewModel::class.java)



viewModel.userInfo.observe(this, Observer {
Log.d("userInfo",it.toString())

binding.profileNameDetail.text = it.name
binding.profileBirthDetail.text = it.birth

val sdf = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val date = sdf.parse(it.birth)

val dob = Calendar.getInstance()
dob.time = date

val today = Calendar.getInstance()
var age = today.get(Calendar.YEAR) - dob.get(Calendar.YEAR)
if (today.get(Calendar.DAY_OF_YEAR) < dob.get(Calendar.DAY_OF_YEAR)) {
age--
}

binding.profileBirthDetail.text = ""+ age.toString() +""
binding.profileAddressDetail.text = it.addressDetail
elderly_id = it.id!!
name = it.name!!
Expand Down Expand Up @@ -155,6 +172,7 @@ class AdminDetailActivity : AppCompatActivity() {
itemView.setOnClickListener {
val intent = Intent(this@AdminDetailActivity, AdminReportActivity::class.java)
intent.putExtra("report", item)
intent.putExtra("name",binding.profileNameDetail.text )
startActivity(intent)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import com.kgg.android.seenear.data.userInfo
import com.kgg.android.seenear.databinding.ActivityAdminMainBinding
import com.kgg.android.seenear.network.RetrofitRepository
import com.kgg.android.seenear.network.data.registerResponse
import java.text.SimpleDateFormat
import java.util.*

class AdminMainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -160,7 +162,21 @@ class AdminMainActivity : AppCompatActivity() {

fun bind(item: registerResponse) {
profile_name.text = item.name
profile_birth.text = item.birth


val sdf = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val date = sdf.parse(item.birth)

val dob = Calendar.getInstance()
dob.time = date

val today = Calendar.getInstance()
var age = today.get(Calendar.YEAR) - dob.get(Calendar.YEAR)
if (today.get(Calendar.DAY_OF_YEAR) < dob.get(Calendar.DAY_OF_YEAR)) {
age--
}
profile_birth.text = ""+ age.toString() +""

profile_address.text = item.addressDetail

itemView.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ class UserChatActivity : AppCompatActivity() {
lateinit var userList: List<registerResponse>

private lateinit var speechRecognizer: SpeechRecognizer
lateinit var idList : List<Int>


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityUserChatBinding.inflate(layoutInflater)
setContentView(binding.root)

val time = System.currentTimeMillis()
val dateFormat = SimpleDateFormat(("yyyy년 MM월 dd일 E요일"), Locale("ko", "KR"))
val timeFormat = SimpleDateFormat(("HH:mm"), Locale("ko", "KR"))
Expand All @@ -85,6 +86,7 @@ class UserChatActivity : AppCompatActivity() {
val repository = RetrofitRepository()
val viewModelFactory = UserChatViewModelFactory(repository)

bool = true
viewModel = ViewModelProvider(this,viewModelFactory).get(UserChatViewModel::class.java)


Expand All @@ -104,7 +106,6 @@ class UserChatActivity : AppCompatActivity() {
initRecycler()
if (it.size>0)
binding.recyclerView.scrollToPosition(datas.size - 1) // 가장 마지막 항목으로 스크롤
binding.recyclerView.smoothScrollToPosition(datas.size - 1)

})

Expand All @@ -124,9 +125,11 @@ class UserChatActivity : AppCompatActivity() {
// 권한 체크 코드
if (Build.VERSION.SDK_INT >= 23)
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.INTERNET, Manifest.permission.RECORD_AUDIO), 1)
chatAdapter.notifyDataSetChanged()

startSTT()



}
binding.chatSendBtn.setOnClickListener {
if (binding.chatContent.text.length>0){
Expand Down Expand Up @@ -216,6 +219,7 @@ class UserChatActivity : AppCompatActivity() {

companion object{
var textSize = 14f
var bool = true
}


Expand Down Expand Up @@ -245,20 +249,24 @@ class UserChatActivity : AppCompatActivity() {
private val loading_bar: LottieAnimationView = itemView.findViewById(R.id.loading_bar)
private val chat_date: ConstraintLayout = itemView.findViewById(R.id.chat_date)
private val chat_date_text: TextView = itemView.findViewById(R.id.chat_date_text)
private val radioGroup: RadioGroup = itemView.findViewById(R.id.radioGroup)
private val radioGroup: RadioGroup = itemView.findViewById(R.id.radioGroup)
private val positiveButton: RadioButton = itemView.findViewById(R.id.positiveButton)
private val negativeButton: RadioButton = itemView.findViewById(R.id.negativeButton)

fun bind(item: chat) {


// status "네" 누르기

positiveButton.setOnClickListener {
val statusCheckRequest = statusCheckRequest(item.type, true, item.id)
viewModel.statusCheck( statusCheckRequest )
radioGroup.visibility = View.GONE
bool = false
Toast.makeText(this@UserChatActivity, "좋아요!", Toast.LENGTH_SHORT).show()
// val currentRead = Read(item.id)
// CoroutineScope(Dispatchers.IO).launch {
// db.readDao().insertRead(currentRead)
// }

}

Expand All @@ -268,8 +276,12 @@ class UserChatActivity : AppCompatActivity() {
val statusCheckRequest = statusCheckRequest(item.type, false, item.id)
viewModel.statusCheck( statusCheckRequest )
radioGroup.visibility = View.GONE
bool = false
Toast.makeText(this@UserChatActivity, "뭔가 문제가 있으신가요?", Toast.LENGTH_SHORT).show()

// val currentRead = Read(item.id)
// CoroutineScope(Dispatchers.IO).launch {
// db.readDao().insertRead(currentRead)
// }
}

my_message_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize)
Expand All @@ -284,25 +296,28 @@ class UserChatActivity : AppCompatActivity() {
}

Log.d("datas in bind", item.toString())


if (item.userSend== true){
partner_message.visibility = View.GONE
my_message.visibility = View.VISIBLE
my_message_text.text = item.content
}
else{
if (position == datas.size -1 && (
item.type.equals("meal1")||
item.type.equals("meal2")||
item.type.equals("meal3")||
item.type.equals("medicine1")||
item.type.equals("medicine2")||
item.type.equals("medicine3")||
item.type.equals("health")||
item.type.equals("physicalActivity")||
item.type.equals("feel")||
item.type.equals("toilet")

)){
item.type.equals("meal1")||
item.type.equals("meal2")||
item.type.equals("meal3")||
item.type.equals("medicine1")||
item.type.equals("medicine2")||
item.type.equals("medicine3")||
item.type.equals("health")||
item.type.equals("physicalActivity")||
item.type.equals("feel")||
item.type.equals("toilet")

)
&& bool){
radioGroup.visibility = View.VISIBLE
}
else
Expand Down Expand Up @@ -344,6 +359,9 @@ class UserChatActivity : AppCompatActivity() {
startListening(speechRecognizerIntent)
}

if (datas.size>0)
binding.recyclerView.smoothScrollToPosition(datas.size - 1)

}
/***
* SpeechToText 기능 세팅
Expand All @@ -356,6 +374,10 @@ class UserChatActivity : AppCompatActivity() {
binding.STTButton.visibility = View.GONE
binding.chatContent.isFocusable = false
binding.chatContent.isFocusableInTouchMode = false

initRecycler()
if (datas.size>0)
binding.recyclerView.smoothScrollToPosition(datas.size - 1)
}

override fun onRmsChanged(rmsdB: Float) {}
Expand All @@ -372,7 +394,8 @@ class UserChatActivity : AppCompatActivity() {
Toast.makeText(this@UserChatActivity, "음성인식을 종료합니다", Toast.LENGTH_SHORT).show()
binding.loadingBar.visibility = View.GONE
binding.STTButton.visibility = View.VISIBLE
binding.recyclerView.smoothScrollToPosition(datas.size - 1)
if (datas.size>0)
binding.recyclerView.smoothScrollToPosition(datas.size - 1)
binding.chatContent.isFocusable = true
binding.chatContent.isFocusableInTouchMode = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class chat(
var content : String? = null,
var createdAt : String? = null,
var userSend : Boolean = true,
var type : String? = null
var type : String? = null,
)

data class chatResponse(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_admin_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:text="챗봇 정보 수정"
android:text="약 복용 정보"
android:textStyle="bold" />
</LinearLayout>

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_admin_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:background="#F5F5F5">

<TextView
android:id="@+id/textView8"
android:id="@+id/nameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
Expand All @@ -29,8 +29,8 @@
android:textColor="#10542F"
android:textSize="18dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
app:layout_constraintStart_toStartOf="@+id/nameText"
app:layout_constraintTop_toBottomOf="@+id/nameText" />

<LinearLayout
android:id="@+id/linearLayout5"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginEnd="48dp"
android:text="로그아웃"
android:textColor="@color/theme_green3"
android:textSize="12dp"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/bottom_sheet_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@
android:id="@+id/userInfo_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="32dp"
android:background="#00FFFFFF"
android:inputType="textMultiLine"
android:lineSpacingExtra="8sp"
android:maxLength="100"
android:padding="8dp"
android:singleLine="false"
android:textSize="14dp"
app:layout_constraintBottom_toTopOf="@+id/userCheckBtn"
app:layout_constraintStart_toStartOf="@+id/textView36"
app:layout_constraintTop_toBottomOf="@+id/textView36" />

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/chat_recycler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
android:paddingTop="8dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp"
android:autoLink="web"
android:text="아침식사는 하셨나요?"
android:textSize="12dp" />

Expand Down Expand Up @@ -182,6 +183,8 @@
android:paddingEnd="12dp"
android:paddingBottom="8dp"
android:text="내 메시지"
android:autoLink="web"

android:textSize="12dp"
android:visibility="visible" />

Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ dependencyResolutionManagement {
}
rootProject.name = "seeNear"
include ':app'
include ':chatlibrary'

0 comments on commit 38deb37

Please sign in to comment.