Skip to content

Commit aa41b53

Browse files
authored
Merge pull request SimpleMobileTools#680 from Aga-C/fix-opening-shortcut
Fixed showing note picker on opening from shortcut (SimpleMobileTools#679)
2 parents 7bfd0de + 48eb068 commit aa41b53

File tree

1 file changed

+6
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/activities

1 file changed

+6
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,22 @@ class MainActivity : SimpleActivity() {
9898
searchNextBtn = findViewById(com.simplemobiletools.commons.R.id.search_next)
9999
searchClearBtn = findViewById(com.simplemobiletools.commons.R.id.search_clear)
100100

101-
initViewPager(intent.getLongExtra(OPEN_NOTE_ID, -1L))
101+
val noteToOpen = intent.getLongExtra(OPEN_NOTE_ID, -1L)
102+
initViewPager(noteToOpen)
102103
binding.pagerTabStrip.drawFullUnderline = false
103104
val textSize = getPercentageFontSize()
104105
binding.pagerTabStrip.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
105106
binding.pagerTabStrip.layoutParams.height =
106107
(textSize + resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin) * 2).toInt()
107108
(binding.pagerTabStrip.layoutParams as ViewPager.LayoutParams).isDecor = true
109+
110+
val hasNoIntent = intent.action.isNullOrEmpty() && noteToOpen == -1L
111+
108112
checkWhatsNewDialog()
109113
checkIntents(intent)
110114

111115
storeStateVariables()
112-
if (config.showNotePicker && savedInstanceState == null) {
116+
if (config.showNotePicker && savedInstanceState == null && hasNoIntent) {
113117
displayOpenNoteDialog()
114118
}
115119

0 commit comments

Comments
 (0)