Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoongcho committed Nov 4, 2023
1 parent 2d6a7c4 commit ef86881
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ class DiaryCalendarItemAdapter(
false -> context.applyMarkDownPolicy(this, "${diaryDto.contents}", false, arrayListOf(), true)
}

maxLines = when (context.config.enableContentsSummary) {
true -> {
context.config.summaryMaxLines
// ellipsize = TextUtils.TruncateAt.valueOf("END")
}
if (layoutResourceId != R.layout.item_diary_dashboard_calendar) {
maxLines = when (context.config.enableContentsSummary) {
true -> {
context.config.summaryMaxLines
// ellipsize = TextUtils.TruncateAt.valueOf("END")
}

false -> {
Integer.MAX_VALUE
// ellipsize = null
false -> {
Integer.MAX_VALUE
// ellipsize = null
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
Expand All @@ -29,12 +30,12 @@ import me.blog.korn123.easydiary.activities.DiaryReadingActivity
import me.blog.korn123.easydiary.activities.SymbolFilterPickerActivity
import me.blog.korn123.easydiary.adapters.DailySymbolAdapter
import me.blog.korn123.easydiary.adapters.DiaryCalendarItemAdapter
import me.blog.korn123.easydiary.databinding.DialogDashboardCalendarItemBinding
import me.blog.korn123.easydiary.databinding.DialogOptionItemBinding
import me.blog.korn123.easydiary.databinding.FragmentDailySymbolBinding
import me.blog.korn123.easydiary.databinding.PartialDailySymbolBinding
import me.blog.korn123.easydiary.enums.DialogMode
import me.blog.korn123.easydiary.extensions.config
import me.blog.korn123.easydiary.extensions.makeToast
import me.blog.korn123.easydiary.extensions.updateAlertDialogWithIcon
import me.blog.korn123.easydiary.extensions.updateDashboardInnerCard
import me.blog.korn123.easydiary.helper.AAF_TEST
Expand All @@ -45,6 +46,7 @@ import me.blog.korn123.easydiary.helper.TransitionHelper
import java.text.SimpleDateFormat
import java.util.*


class DailySymbolFragment : Fragment() {

/***************************************************************************************************
Expand Down Expand Up @@ -94,7 +96,7 @@ class DailySymbolFragment : Fragment() {
val builder = AlertDialog.Builder(requireActivity()).apply {
setPositiveButton(getString(android.R.string.ok)) { _, _ -> }
}
val dialogOptionItemBinding = DialogOptionItemBinding.inflate(layoutInflater)
val dialogOptionItemBinding = DialogDashboardCalendarItemBinding.inflate(layoutInflater)
val calendarItemAdapter = DiaryCalendarItemAdapter(requireContext(), R.layout.item_diary_dashboard_calendar, selectedItems)
dialogOptionItemBinding.run {
listView.adapter = calendarItemAdapter
Expand All @@ -105,13 +107,17 @@ class DailySymbolFragment : Fragment() {
putExtra(DIARY_SEQUENCE, selectedItems[position].sequence)
}
)
dialog?.dismiss()
// dialog?.dismiss()
}
}
Handler(Looper.getMainLooper()).postDelayed({
dialog = builder.create().apply {
requireActivity().updateAlertDialogWithIcon(DialogMode.DEFAULT, this, null, dialogOptionItemBinding.root)
}
val layoutParams = WindowManager.LayoutParams()
layoutParams.copyFrom(dialog?.window?.attributes)
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
dialog?.window?.attributes = layoutParams
}, 100)
}
}
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/dialog_dashboard_calendar_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ListView
android:clipToPadding="false"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:id="@+id/listView"
android:divider="@null"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
2 changes: 0 additions & 2 deletions app/src/main/res/layout/item_diary_dashboard_calendar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

<com.simplemobiletools.commons.views.MyTextView
android:textColor="@color/default_text_color"
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit ef86881

Please sign in to comment.