Skip to content

Commit

Permalink
!! Diagnose Build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
david-allison committed Aug 3, 2024
1 parent 40cc358 commit 84e5c09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
# Do not run the scheduled jobs on forks
if: (github.event_name == 'schedule' && github.repository == 'ankidroid/Anki-Android') || (github.event_name != 'schedule')
needs: matrix_prep
timeout-minutes: 35
timeout-minutes: 15
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
strategy:
Expand Down
17 changes: 15 additions & 2 deletions AnkiDroid/src/main/java/com/ichi2/anki/dialogs/tags/TagsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,25 @@ class TagsDialog : AnalyticsDialogFragment {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
resizeWhenSoftInputShown(requireActivity().window)

Timber.w("16404: 1-1")
resizeWhenSoftInputShown(requireActivity().window)
Timber.w("16404: 1-2")
val tagsFile = requireNotNull(
BundleCompat.getParcelable(requireArguments(), ARG_TAGS_FILE, TagsFile::class.java)
) {
"$ARG_TAGS_FILE is required"
}

Timber.w("16404: 1-3")
val data = tagsFile.getData()
Timber.w("16404: 1-4")
type = data.type
tags = TagsList(
allTags = data.allTags,
checkedTags = data.checkedTags,
uncheckedTags = data.uncheckedTags
)
Timber.w("16404: 1-5")
isCancelable = true
}

Expand All @@ -166,10 +170,12 @@ class TagsDialog : AnalyticsDialogFragment {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@SuppressLint("InflateParams")
val tagsDialogView = LayoutInflater.from(activity).inflate(R.layout.tags_dialog, null, false)
Timber.w("16404: 2-6")
tagsListRecyclerView = tagsDialogView.findViewById(R.id.tags_dialog_tags_list)
val tagsListRecyclerView: RecyclerView? = tagsListRecyclerView
tagsListRecyclerView?.requestFocus()
val tagsListLayout: RecyclerView.LayoutManager = LinearLayoutManager(activity)
Timber.w("16404: 2-7")
tagsListRecyclerView?.layoutManager = tagsListLayout
tagsArrayAdapter = TagsArrayAdapter(tags!!, resources)
tagsListRecyclerView?.adapter = tagsArrayAdapter
Expand All @@ -178,12 +184,14 @@ class TagsDialog : AnalyticsDialogFragment {
if (tags!!.isEmpty) {
noTagsTextView?.visibility = View.VISIBLE
}
Timber.w("16404: 2-8")
val optionsGroup = tagsDialogView.findViewById<RadioGroup>(R.id.tags_dialog_options_radiogroup)
for (i in 0 until optionsGroup.childCount) {
optionsGroup.getChildAt(i).id = i
}
optionsGroup.check(0)
selectedOption = radioButtonIdToCardState(optionsGroup.checkedRadioButtonId)
Timber.w("16404: 2-9")
optionsGroup.setOnCheckedChangeListener { _: RadioGroup?, checkedId: Int -> selectedOption = radioButtonIdToCardState(checkedId) }
if (type == DialogType.EDIT_TAGS) {
dialogTitle = resources.getString(R.string.card_details_tags)
Expand All @@ -198,6 +206,7 @@ class TagsDialog : AnalyticsDialogFragment {
positiveText = getString(R.string.select)
tagsArrayAdapter!!.tagLongClickListener = View.OnLongClickListener { false }
}
Timber.w("16404: 2-10")
adjustToolbar(tagsDialogView)
dialog = AlertDialog.Builder(requireActivity())
.positiveButton(text = positiveText!!) {
Expand All @@ -210,14 +219,18 @@ class TagsDialog : AnalyticsDialogFragment {
.negativeButton(R.string.dialog_cancel)
.customView(view = tagsDialogView)
.create()
Timber.w("16404: 2-11")
val dialog: AlertDialog? = dialog
resizeWhenSoftInputShown(dialog?.window!!)
Timber.w("16404: 2-12")
return dialog
}

override fun onResume() {
super.onResume()
Timber.w("16404: 3-1")
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
Timber.w("16404: 3-2")
}

private fun radioButtonIdToCardState(id: Int) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,24 @@ class TagsDialogTest : RobolectricTest() {

@Test
fun test_AddNewTag_newHierarchicalTag_willUniformHierarchicalTag() {
Timber.w("16404: 1")
val type = TagsDialog.DialogType.EDIT_TAGS
val allTags = listOf("common")
val checkedTags = listOf("common")
val args = TagsDialog(ParametersUtils.whatever())
.withTestArguments(type, checkedTags, allTags)
.arguments
val mockListener = Mockito.mock(TagsDialogListener::class.java)
Timber.w("16404: 2")
val factory = TagsDialogFactory(mockListener)
Timber.w("16404: 3")
val scenario = FragmentScenario.launch(TagsDialog::class.java, args, R.style.Theme_Light, factory)
Timber.w("16404: 4")
scenario.moveToState(Lifecycle.State.STARTED)
Timber.w("16404: 5")
scenario.onFragment { f: TagsDialog ->
val dialog = f.dialog as AlertDialog?
assertThat(dialog, IsNull.notNullValue())

val recycler: RecyclerView = dialog!!.findViewById(R.id.tags_dialog_tags_list)!!
val tag = "common::::careless"
f.addTag(tag)
Expand Down

0 comments on commit 84e5c09

Please sign in to comment.