Skip to content

Commit

Permalink
[MERGE] : #60 -> main
Browse files Browse the repository at this point in the history
[ADD/#60] 테스트용 코드 추가
  • Loading branch information
blueme0 authored Jun 13, 2024
2 parents 68d144e + ffc07d8 commit c76a743
Show file tree
Hide file tree
Showing 36 changed files with 113 additions and 48 deletions.
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ class ResultSubmitActivity

val arr = ArrayList<ReviewAnswer>()
resultViewModel.problemRange.value.forEach { (i, strings) ->
Timber.tag("chaeda-check").d("i: $i, strings: ${strings.toList()}")
Timber.tag("chaeda-check").d("assignmentResult: ${resultViewModel.assignmentResult.value[i]}")
val list = mutableListOf<ResultAnswer>()
strings.forEach {
list.add(ResultAnswer(resultViewModel.assignmentResult.value[i]?.containsKey(it)!!, it))
if (resultViewModel.assignmentResult.value.containsKey(i))
list.add(ResultAnswer(resultViewModel.assignmentResult.value[i]?.containsKey(it)!!, it))
else
list.add(ResultAnswer(false, it))
}
arr.add(ReviewAnswer(i, list))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class AddProblemPhotoActivity
if (tsubject != null) initForResultReview()
chapters = subject!!.chapters
chapter = chapters!![0]
viewModel.updateChapter(chapter!!)

initListener()
initAddBtn()
Expand All @@ -97,9 +98,14 @@ class AddProblemPhotoActivity

with(binding) {
val now = LocalDateTime.now()
etDate.setText(now.format(DateTimeFormatter.ofPattern("yyyy.MM.dd")))
etDate.setText(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
etTextbook.setText(name)
etIndex.setText(index)
with(viewModel) {
updateDateString(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
updateTextbookName(name!!)
updateProblemNum(index!!)
}
}
}

Expand Down Expand Up @@ -311,7 +317,7 @@ class AddProblemPhotoActivity

private fun initListener() {
with(binding) {
ivBack.setOnSingleClickListener {
llBack.setOnSingleClickListener {
finish()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class AddProblemViewModel @Inject constructor(
}

companion object {
private const val DATE_REGEX = "^(\\d{4}).(\\d{2}).(\\d{2})\$"
private const val DATE_REGEX = "^(\\d{4})-(\\d{2})-(\\d{2})\$"
const val IMAGE_TYPE_HOMEWORK_THUMBNAIL = "HOMEWORK_THUMBNAIL"
const val IMAGE_TYPE_REVIEW_NOTE_PROBLEM = "REVIEW_NOTE_PROBLEM"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class ProblemBoxActivity
initView()
initListener()
}


binding.llBack.setOnSingleClickListener { finish() }
observe()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ class ReviewFolderActivity

private fun initListener() {
with(binding) {
llBack.setOnSingleClickListener {
finish()
}

if (id != -1L) {
tvFab.text = "오답 폴더 수정하기"
etTitle.text.insert(0, title)
etContent.text.insert(0, description)
tvDownload.visibility = View.VISIBLE
empty.visibility = View.GONE
tvDelete.visibility = View.VISIBLE

tvDownload.setOnSingleClickListener {
viewModel.postMakeReviewPdf(id)
Expand All @@ -70,7 +76,9 @@ class ReviewFolderActivity
}
} else {
tvFab.text = "오답 폴더 만들기"
tvDownload.visibility = View.INVISIBLE
tvDownload.visibility = View.GONE
tvDelete.visibility = View.INVISIBLE
empty.visibility = View.VISIBLE

fab.setOnSingleClickListener {
viewModel.postNewFolder()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PdfListAdapter (private val itemClick: (ReviewPdf) -> (Unit))

fun onBind(item: ReviewPdf) {
binding.tvTitle.text = item.title
binding.tvContent.text = item.createdDateTime
binding.tvContent.text = item.createdDateTime.split("T")[0]
binding.ivThumbnail.setImageResource(R.drawable.ic_empty_thumbnail)

binding.root.setOnSingleClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import com.chaeda.base.util.extension.setOnSingleClickListener
import com.chaeda.chaeda.R
import com.chaeda.chaeda.databinding.ActivityReviewPdfListBinding
import com.chaeda.chaeda.presentation.review.add.ReviewState
import com.chaeda.domain.entity.ReviewPdf
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import timber.log.Timber
import java.io.File
import java.net.URL

Expand Down Expand Up @@ -67,8 +69,11 @@ class ReviewPdfListActivity

private fun initListener() {
with(binding) {
tvTitle.setOnSingleClickListener {
llBack.setOnSingleClickListener {
finish()
}

tvTitle.setOnSingleClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(arrayOf(Manifest.permission.POST_NOTIFICATIONS), 1)
Expand All @@ -88,7 +93,8 @@ class ReviewPdfListActivity

private fun initView() {
pdfAdapter = PdfListAdapter {
viewModel.getReviewPdf(it.id)
// viewModel.getReviewPdf(it.id)
urlDownloading(TEST_DOWNLOAD_PDF)
}

binding.rvPdf.adapter = pdfAdapter
Expand All @@ -102,9 +108,11 @@ class ReviewPdfListActivity
when (state) {
is ReviewState.GetReviewPdfListSuccess -> {
pdfAdapter.setItems(state.list)
pdfAdapter.setItems(listOf(ReviewPdf(1L, "review", "2024-06-12")))
}
is ReviewState.GetReviewPdfSuccess -> {
urlDownloading(state.url)
// urlDownloading(state.url)
urlDownloading(TEST_DOWNLOAD_PDF)
}
else -> { }
}
Expand Down Expand Up @@ -133,6 +141,7 @@ class ReviewPdfListActivity
val columnReason: Int = cursor.getColumnIndex(DownloadManager.COLUMN_REASON)
val status: Int = cursor.getInt(columnIndex)
cursor.close()
Timber.tag("chaeda-download").d("columnReason : $columnReason")
when (status) {
DownloadManager.STATUS_SUCCESSFUL -> Toast.makeText(
this@ReviewPdfListActivity,
Expand All @@ -157,16 +166,19 @@ class ReviewPdfListActivity
}

private fun urlDownloading(url: String) {
Timber.tag("chaeda-download").d("urlDownloading: $url")
if (mDownloadManager == null) {
mDownloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
}
val outputFile = File(outputFilePath + getFileName(url))
// val outputFile = File(outputFilePath + getFileName(url))
val outputFile = File(outputFilePath + "review.pdf")
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs()
}
val uri = Uri.parse(url)
val request = DownloadManager.Request(uri)
request.setTitle(getFileName(url))
// request.setTitle(getFileName(url))
request.setTitle("review.pdf")
request.setDestinationUri(Uri.fromFile(outputFile))
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
request.setAllowedOverMetered(true)
Expand All @@ -191,6 +203,8 @@ class ReviewPdfListActivity

companion object {
fun getIntent(context: Context) = Intent(context, ReviewPdfListActivity::class.java)
private const val TEST_DOWNLOAD_PDF = "https://s3-fullaccel.s3.ap-northeast-2.amazonaws.com/s3test.pdf?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEFkaDmFwLW5vcnRoZWFzdC0yIkcwRQIgQeJMXDrTVUmXe8zZe8FYa9%2BczXT4Cl0t3ExgrrP9Q0kCIQC%2FLaQmcKxHthqjv%2F2ZNFTs1CtH9aZNAZbefGfbO2kAYCrxAgjS%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDc2NzM5NzkyNjYyNyIM9f%2FAyWxfC027oKpOKsUCgk6D0JnmC%2Fbx048z%2B7ZKXwc63q7Ee72jpzxCn4thqMX0dnPL2Dp3T46VJyHHhxwpXZs4WDfCztgD9YxRPXEAp6aVGGH%2FsO76lVT6igvjBdzr1aZ531njYubJZR4ISVXa%2ByoFT4WE%2FkhxbP14M88GvVZRHjMtGO03oJ4ur3ZaeLB04f4qMoisLcaEGKTjXfnmp9F8audPE%2FXXmJJwdwNTGDQHKcIREUK%2BMTgMSQFXyen%2FsXBq1NTBJfNw6v97sW6u1MoMJh%2BuVhMSMLx0bb7w%2BXOyMvXscu4850zEpMM8uRogZl%2B2e4ATbFqWx98TGK%2FP9Cvvv9NO0HBpmIadMdlYf9k2%2BfYwuvnWjX3xZhvZ6x7%2FDAMkYJ56Elay2StfRaXHXlzLVuy2%2FEALzlomgIhlreZ8c%2FrZmCzqWZY2OPgo2b0RblFQ7DDsjNGyBjqzAtE4E968FGp%2B4oip%2FrQKNFqQoubt%2FXx2ub9sigWWAnK6yUAnZL1S25BNNFYTuuOJ0g5LOz2s0RNdAQHYrnh29HtRjhadq6TJF022eYc8yUKb9a80WXdLfrGl%2FT8kl4b9HaNESLYUcQ6dMdufDN9ka%2Fg5Nx22G6vBm540bS3P3fmWBLvvDHWCUwY%2F%2BPRrEZgHYP7Kw80y3Js69tZGYJzJdo%2FSRQuoiq3RX7yCXbfxJbVWbQOXRRnC%2FO6X4sJuhTL6KQLUhkNcBBaSRjyZlyEM95gmAyPxqDjtvCe1R3CfBv%2B2BIfspcuv4QterAX3oD09n0nrT8%2BEzzoy7xrY0SUY1U6%2Fwf2CpxQIbWbndYNOh5e6dVZzb5t%2FOP0SG7cS8rgVX%2FdcnTGIXQVb80x5uBXwkn5cXIs%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240527T094435Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7200&X-Amz-Credential=ASIA3FLD3C3RXLOIJY7W%2F20240527%2Fap-northeast-2%2Fs3%2Faws4_request&X-Amz-Signature=35adc1687804d93e07dbf18aa6c4df4601d3f0ec15ca675283cdc2f5d35b490a"
// private const val TEST_DOWNLOAD_PDF = "https://drive.google.com/file/d/1wHbsqcfI9E9NRMuLgh4DYYcDHaba3xqN/view?usp=drive_link"
// private const val TEST_DOWNLOAD_PDF = "https://bigfile.mail.naver.com/download?fid=PqR0W6k9WzU9KAujK3ejFAMlKxEjKogZFAgrKxUmKAg/KxvjKxbZKAblFoKla3e4KoMZKrMqKzumK4UmMouXp6MdF6pSK6JCF6UrpzMdM2=="
private const val TEST_DOWNLOAD_PDF = "https://bigfile.mail.naver.com/download?fid=P9R0W6k9WzU9aAujK3ejaxu9FAbjKogZFAgrKxUmKxUwKAujKxbZKAblFoKla3YrKogqKxU/KA3Sp6tmFrKrFrElK4ulax3CFo2lFxK9pt=="
}
}
Binary file modified app/src/main/res/drawable/ic_homework_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_add_problem_photo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
android:layout_marginStart="46dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/nanumsquare_regular"
android:text="틀린 날짜 입력"
android:text="틀린 날짜 입력 (ex. 2024-01-01)"
android:textColor="#828282"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -98,7 +98,7 @@
android:background="@drawable/shape_rect8_fill_brown"
android:textAlignment="center"
android:gravity="center"
android:text="문제 사진 불러오기"
android:text="문제 사진 촬영하기"
app:layout_constraintTop_toBottomOf="@id/et_date"
android:layout_marginTop="33dp"
android:fontFamily="@font/nanumsquare_bold"
Expand Down
24 changes: 16 additions & 8 deletions app/src/main/res/layout/activity_problem_box.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:layout_height="65dp"
android:background="@color/appbar_background"
app:layout_constraintTop_toTopOf="parent"
/>
tools:layout_editor_absoluteX="0dp" />

<LinearLayout
android:id="@+id/ll_back"
Expand All @@ -41,23 +41,31 @@
android:src="@drawable/ic_arrow_left"
/>

<View
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="이전 화면으로"
android:fontFamily="@font/nanumsquare_regular"
android:textColor="#000000"
android:textSize="16sp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
/>
</LinearLayout>

<TextView
android:id="@+id/tv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="삭제하기"
android:fontFamily="@font/nanumsquare_regular"
android:textColor="#000000"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="@id/ll_back"
app:layout_constraintBottom_toBottomOf="@id/ll_back"
app:layout_constraintEnd_toEndOf="parent"
android:paddingHorizontal="25dp"
/>

<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
Expand Down
33 changes: 28 additions & 5 deletions app/src/main/res/layout/activity_review_folder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
</LinearLayout>

<TextView
android:id="@+id/tv_download"
android:id="@+id/tv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="pdf 만들기"
android:text="삭제하기"
android:fontFamily="@font/nanumsquare_regular"
android:textColor="#000000"
android:textSize="16sp"
Expand Down Expand Up @@ -130,21 +130,44 @@
app:layout_constraintTop_toBottomOf="@id/tv_content" />

<TextView
android:id="@+id/tv_photo"
android:id="@+id/tv_download"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginHorizontal="46dp"
android:background="@drawable/shape_rect8_fill_brown"
android:textAlignment="center"
android:gravity="center"
android:text="문제 보관함에서 문제 선택하기"
android:text="pdf 만들기"
app:layout_constraintTop_toBottomOf="@id/et_content"
android:layout_marginTop="33dp"
android:fontFamily="@font/nanumsquare_bold"
android:textSize="16sp"
android:textColor="@color/white"
/>

<View
android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="23dp"
app:layout_constraintTop_toBottomOf="@id/tv_download"
/>

<TextView
android:id="@+id/tv_photo"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginHorizontal="46dp"
android:background="@drawable/shape_rect8_fill_brown"
android:textAlignment="center"
android:gravity="center"
android:text="문제 보관함에서 문제 선택하기"
app:layout_constraintTop_toBottomOf="@id/empty"
android:layout_marginTop="10dp"
android:fontFamily="@font/nanumsquare_bold"
android:textSize="16sp"
android:textColor="@color/white"
/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_problems"
android:layout_width="match_parent"
Expand All @@ -161,7 +184,7 @@

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_width="133dp"
android:layout_width="153dp"
android:layout_height="47dp"
android:layout_gravity="end|bottom"
android:layout_marginBottom="32dp"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
6 changes: 0 additions & 6 deletions app/src/main/res/mipmap-anydpi/ic_launcher.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/main/res/mipmap-anydpi/ic_launcher_round.xml

This file was deleted.

Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Binary file not shown.
4 changes: 4 additions & 0 deletions app/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">Chaeda</string>
<string name="app_name">채다</string>
<string name="statistics_main_introduce">채다 서비스에서 제공하는\n통계 정보들은 아래와 같습니다.</string>
<string name="statistics_count_title">풀이한 문항 수 비교</string>
<string name="statistics_count_subtitle">특정 날짜, 주차, 월을 기준으로\n사용자가 풀이한 문제 수를 그래프로 비교합니다.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class RemoteStatisticsDataSource @Inject constructor(
suspend fun getWrongCountByChapter(
chapter: String
): List<ConceptDetail> {
return statisticsService.getWrongCountByChapter(chapter)
val list = mutableListOf<ConceptDetail>()
statisticsService.getWrongCountByChapter(chapter).forEach {
list.add(it.toConceptDetail())
}
return list
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ interface StatisticsService {
@GET("/statistics/statistics/accumulated/{chapter}/list")
suspend fun getWrongCountByChapter(
@Path("chapter") chapter: String
): List<ConceptDetail>
): List<ConceptStatisticsDTO>
}

0 comments on commit c76a743

Please sign in to comment.