Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
8884a00
Deps: Add arch core related missing transitively used dependencies
ParaskP7 Dec 8, 2022
0c504ad
Deps: Update androidx arch core to 2.1.0
ParaskP7 Dec 8, 2022
2d93639
Deps: Add lifecycle transitively used dependencies on image editor
ParaskP7 Dec 8, 2022
482f47b
Deps: Add lifecycle transitively used dependencies on editor
ParaskP7 Dec 8, 2022
3cc47ab
Deps: Add lifecycle transitively used dependencies on wordpress
ParaskP7 Dec 8, 2022
0ead5d3
Deps: Update androidx lifecycle to 2.5.1
ParaskP7 Dec 8, 2022
ce51f00
Merge pull request #17642 from wordpress-mobile/deps/update-androidx-…
irfano Dec 9, 2022
00b6e37
Merge branch 'deps/main-batch-androidx-core' of github.com:wordpress-…
ParaskP7 Dec 20, 2022
2acf618
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Dec 20, 2022
ac86ad4
Merge branch 'deps/main-batch-androidx-core' of github.com:wordpress-…
ParaskP7 Dec 20, 2022
a0537cb
Test: Fix conversation notifications view model test
ParaskP7 Dec 21, 2022
fec2420
Test: Fix reader discover view model test
ParaskP7 Dec 21, 2022
37c5275
Deps: Add androidx core transitively used dependencies on editor
ParaskP7 Dec 21, 2022
2b372ff
Deps: Update androidx core to 1.8.0
ParaskP7 Dec 21, 2022
e4f6589
Fix: Fall back to default locale context extensions current locale
ParaskP7 Dec 21, 2022
b4572a6
Fix: Update accessibility delegate compat override functions
ParaskP7 Dec 21, 2022
87610f8
Merge pull request #17643 from wordpress-mobile/deps/update-androidx-…
ParaskP7 Dec 23, 2022
4f6107d
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Dec 23, 2022
5c425d6
Merge branch 'deps/main-batch-androidx-core' of github.com:wordpress-…
ParaskP7 Dec 23, 2022
10bb29e
Merge branch 'deps/main-batch-androidx-core' of github.com:wordpress-…
ParaskP7 Dec 23, 2022
0cf7c0b
Deps: Add fragment transitively used dependencies on image editor
ParaskP7 Dec 22, 2022
0914722
Deps: Add fragment transitively used dependencies on editor
ParaskP7 Dec 22, 2022
6622ca0
Deps: Update androidx fragment to 1.5.5
ParaskP7 Dec 22, 2022
ca54cd5
Merge pull request #17691 from wordpress-mobile/deps/update-androidx-…
irfano Dec 23, 2022
ed27a93
Build: Disable all warnings as errors kotlin compile options flag
ParaskP7 Dec 22, 2022
9aa97e3
Deps: Add androidx activity dependency (1.5.1)
ParaskP7 Dec 22, 2022
9fcfe74
Refactor: Remove redundant sam constructor from crop fragment
ParaskP7 Dec 22, 2022
a06ceed
Analysis: Resolve options menu deprecated warnings on crop fragment
ParaskP7 Dec 22, 2022
ad30662
Analysis: Match menu provider implementation signatures on crop fragment
ParaskP7 Dec 22, 2022
67c6f0e
Refactor: Replace if with when on menu time selected for crop fragment
ParaskP7 Dec 22, 2022
c2cde23
Refactor: Optimize view pager 2 imports on preview image
ParaskP7 Dec 22, 2022
c5e7129
Refactor: Move lambda argument out of parenthesis on preview image
ParaskP7 Dec 22, 2022
3bb80e6
Analysis: Resolve options menu deprecated warnings on preview image
ParaskP7 Dec 22, 2022
3d06435
Analysis: Match menu provider implementation signatures on preview image
ParaskP7 Dec 22, 2022
cf36d82
Refactor: Replace if with when on menu time selected for preview image
ParaskP7 Dec 22, 2022
f5cfc9d
Refactor: Move lambda argument out of parenthesis on unified comments
ParaskP7 Dec 22, 2022
8bc2879
Analysis: Resolve options menu deprecated warnings on unified comments
ParaskP7 Dec 22, 2022
818f5a0
Analysis: Match menu provider implementation signatures on uni. comments
ParaskP7 Dec 22, 2022
24e2c82
Refactor: Refactor when on menu time selected for unified comments
ParaskP7 Dec 22, 2022
adf875c
Analysis: Resolve empty function block warnings for scan history
ParaskP7 Dec 22, 2022
ec6621e
Refactor: Move lambda argument out of parenthesis on scan history
ParaskP7 Dec 22, 2022
12972ca
Analysis: Resolve options menu deprecated warnings on scan history
ParaskP7 Dec 22, 2022
c6e864f
Analysis: Match menu provider implementation signatures on scan history
ParaskP7 Dec 22, 2022
e2fe148
Refactor: Replace if with when on menu time selected for scan history
ParaskP7 Dec 22, 2022
5d6d893
Refactor: Remove redundant sam constructor from media picker
ParaskP7 Dec 23, 2022
ba3dcfe
Analysis: Resolve options menu deprecated warnings on media picker
ParaskP7 Dec 23, 2022
a770cf3
Analysis: Match menu provider implementation signatures on media picker
ParaskP7 Dec 23, 2022
cd769fd
Refactor: Refactor when on menu time selected for media picker
ParaskP7 Dec 23, 2022
6da9e62
Analysis: Resolve magic number warnings for page parent
ParaskP7 Dec 23, 2022
1efeb01
Refactor: Remove redundant sam constructor from page parent
ParaskP7 Dec 23, 2022
23d3921
Analysis: Resolve options menu deprecated warnings on page parent
ParaskP7 Dec 23, 2022
650a75c
Analysis: Match menu provider implementation signatures on page parent
ParaskP7 Dec 23, 2022
3b06322
Refactor: Move create menu close to menu item selected on page parent
ParaskP7 Dec 23, 2022
d36c551
Refactor: Replace if with when on menu time selected for page parent
ParaskP7 Dec 23, 2022
5227f14
Analysis: Remove unnecessary non null annotation from reader fragment
ParaskP7 Dec 23, 2022
29323fc
Analysis: Resolve options menu deprecated warnings on reader fragment
ParaskP7 Dec 23, 2022
70e13fd
Analysis: Match menu provider impl. signatures on reader fragment
ParaskP7 Dec 23, 2022
95c85ef
Refactor: Refactor when on menu time selected for reader fragment
ParaskP7 Dec 23, 2022
daff2a6
Refactor: Remove redundant qualifier name for reader post detail
ParaskP7 Dec 23, 2022
d19ade9
Refactor: Optimize analytics tracker imports on reader post detail
ParaskP7 Dec 23, 2022
a1f5a3e
Analysis: Suppress redundant nullable return type on reader post detail
ParaskP7 Dec 23, 2022
037187d
Refactor: Move lambda argument out of parenthesis on reader post detail
ParaskP7 Dec 23, 2022
67e1545
Analysis: Move return count warnings from baseline and close to source
ParaskP7 Dec 23, 2022
d6b93bf
Analysis: Move large class warning from baseline and close to source
ParaskP7 Dec 23, 2022
cc3a1a8
Analysis: Move magic number warning from baseline and close to source
ParaskP7 Dec 23, 2022
979d525
Analysis: Move complex condition warning from baseline and close to src
ParaskP7 Dec 23, 2022
feef56d
Analysis: Remove unnecessary complex method warning
ParaskP7 Dec 23, 2022
7e016fe
Analysis: Resolve empty function block warnings for reader post detail
ParaskP7 Dec 23, 2022
6fb0b5a
Analysis: Resolve options menu deprecated warnings on reader post detail
ParaskP7 Dec 23, 2022
ddd84ae
Analysis: Match menu provider impl. signatures on reader post detail
ParaskP7 Dec 23, 2022
4af1d09
Refactor: Refactor when on menu time selected for reader post detail
ParaskP7 Dec 23, 2022
1fc5b46
Analysis: Resolve options menu deprecated warnings on site creation
ParaskP7 Dec 23, 2022
919a781
Analysis: Match menu provider impl. signatures on site creation
ParaskP7 Dec 23, 2022
5015048
Refactor: Replace if with when on menu time selected for site creation
ParaskP7 Dec 23, 2022
41c2580
Analysis: Move magic number warning from baseline and close to source
ParaskP7 Dec 23, 2022
cc8ad8b
Analysis: Resolve empty function block warnings for stats fragment
ParaskP7 Dec 23, 2022
a4bc981
Refactor: Move lambda argument out of parenthesis on stats fragment
ParaskP7 Dec 23, 2022
ac545e3
Analysis: Resolve options menu deprecated warnings on stats fragment
ParaskP7 Dec 23, 2022
422e955
Analysis: Suppress options menu deprecated warnings on stats list
ParaskP7 Dec 23, 2022
fa98dc6
Refactor: Remove redundant sam constructor from insights mgmt
ParaskP7 Dec 23, 2022
c50b8e5
Analysis: Resolve options menu deprecated warnings on insights mgmt
ParaskP7 Dec 23, 2022
44c0cb6
Analysis: Match menu provider implementation signatures on insights mgmt
ParaskP7 Dec 23, 2022
a99b1b5
Refactor: Move create menu close to menu item selected on insights mgmt
ParaskP7 Dec 23, 2022
adbbf39
Refactor: Refactor when on menu time selected for insights mgmt
ParaskP7 Dec 23, 2022
dfcfe10
Analysis: Resolve options menu deprecated warnings on insights details
ParaskP7 Dec 23, 2022
42ea804
Refactor: Remove redundant sam constructor from stats detail
ParaskP7 Dec 23, 2022
fa7229c
Analysis: Resolve options menu deprecated warnings on stats detail
ParaskP7 Dec 23, 2022
d8994c3
Build: Enable all warnings as errors kotlin compile options flag
ParaskP7 Dec 23, 2022
78a8d7f
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jan 11, 2023
190301a
Merge branch 'deps/main-batch-androidx-core' of github.com:wordpress-…
ParaskP7 Jan 11, 2023
35c0edd
Merge pull request #17696 from wordpress-mobile/deps/update-androidx-…
ParaskP7 Jan 12, 2023
ba73281
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jan 12, 2023
cc45dd1
Deps: Add appcompat transitively used dependencies on wordpress
ParaskP7 Jan 11, 2023
01db274
Deps: Update androidx appcompat to 1.4.2
ParaskP7 Jan 11, 2023
87fff61
Merge pull request #17743 from wordpress-mobile/deps/update-androidx-…
ovitrif Jan 13, 2023
de15d46
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jan 13, 2023
181781a
Fix: Make suggestion tokenizer nullable to fix inflate exception
ParaskP7 Jan 13, 2023
8c5e041
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jan 23, 2023
4f0326d
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jan 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,21 @@ dependencies {
debugImplementation "com.facebook.stetho:stetho:$stethoVersion"
debugImplementation "com.facebook.stetho:stetho-okhttp3:$stethoVersion"

implementation "androidx.arch.core:core-common:$androidxArchCoreVersion"
implementation "androidx.arch.core:core-runtime:$androidxArchCoreVersion"
implementation "com.google.code.gson:gson:$googleGsonVersion"
implementation "androidx.core:core:$androidxCoreVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation "androidx.lifecycle:lifecycle-common:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-runtime:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$androidxLifecycleVersion"
implementation "androidx.activity:activity:$androidxActivityVersion"
implementation "androidx.activity:activity-ktx:$androidxActivityVersion"
implementation "androidx.fragment:fragment:$androidxFragmentVersion"
implementation "androidx.fragment:fragment-ktx:$androidxFragmentVersion"
implementation "androidx.media:media:$androidxMediaVersion"
implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion"
implementation "androidx.appcompat:appcompat-resources:$androidxAppcompatVersion"
implementation "androidx.cardview:cardview:$androidxCardviewVersion"
implementation "androidx.recyclerview:recyclerview:$androidxRecyclerviewVersion"
implementation "com.google.android.material:material:$googleMaterialVersion"
Expand All @@ -384,7 +391,10 @@ dependencies {
implementation "androidx.work:work-runtime-ktx:$androidxWorkVersion"
implementation "androidx.work:work-gcm:$androidxWorkVersion" // GCMNetworkManager on api <= 22
implementation "androidx.constraintlayout:constraintlayout:$androidxConstraintlayoutVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-core:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-process:$androidxLifecycleVersion"
implementation "com.android.volley:volley:$androidVolleyVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.MenuItem
import android.view.View
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
Expand Down Expand Up @@ -36,7 +37,7 @@ import org.wordpress.android.util.SnackbarSequencer
import org.wordpress.android.viewmodel.observeEvent
import javax.inject.Inject

class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_fragment) {
class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_fragment), MenuProvider {
@Inject
lateinit var viewModelFactory: ViewModelProvider.Factory

Expand All @@ -58,6 +59,7 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
requireActivity().addMenuProvider(this, viewLifecycleOwner)

val site = requireArguments().getSerializable(WordPress.SITE) as SiteModel
val commentIdentifier = requireNotNull(
Expand All @@ -73,8 +75,6 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
}

private fun UnifiedCommentsEditFragmentBinding.setupToolbar() {
setHasOptionsMenu(true)

val activity = (requireActivity() as AppCompatActivity)
activity.setSupportActionBar(toolbarMain)
activity.supportActionBar?.let {
Expand Down Expand Up @@ -102,7 +102,7 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
site: SiteModel,
commentIdentifier: CommentIdentifier
) {
viewModel.uiActionEvent.observeEvent(viewLifecycleOwner, {
viewModel.uiActionEvent.observeEvent(viewLifecycleOwner) {
when (it) {
CLOSE -> {
requireActivity().finish()
Expand All @@ -117,13 +117,13 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
EditCancelDialogFragment.newInstance().show(childFragmentManager, EDIT_CANCEL_DIALOG_TAG)
}
}
})
}

viewModel.onSnackbarMessage.observeEvent(viewLifecycleOwner, { messageHolder ->
viewModel.onSnackbarMessage.observeEvent(viewLifecycleOwner) { messageHolder ->
showSnackbar(messageHolder)
})
}

viewModel.uiState.observe(viewLifecycleOwner, { uiState ->
viewModel.uiState.observe(viewLifecycleOwner) { uiState ->
if (uiState.showProgress) {
loadingView.visibility = View.VISIBLE
scrollView.visibility = View.GONE
Expand Down Expand Up @@ -161,7 +161,7 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
commentEditEmailAddress.isEnabled = enableEditEmail
userName.isEnabled = enableEditName
}
})
}

viewModel.start(site, commentIdentifier)
}
Expand Down Expand Up @@ -203,29 +203,27 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
}
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.edit_comment_menu, menu)
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.edit_comment_menu, menu)

menu.findItem(R.id.action_item)?.let { actionMenu ->
actionMenu.setOnMenuItemClickListener {
viewModel.onActionMenuClicked()
true
}

viewModel.uiState.observe(viewLifecycleOwner, { uiState ->
viewModel.uiState.observe(viewLifecycleOwner) { uiState ->
actionMenu.isEnabled = uiState.canSaveChanges
})
}
}
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
viewModel.onBackPressed()
}
override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
android.R.id.home -> {
viewModel.onBackPressed()
true
}
return true
else -> true
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.wordpress.android.ui.jetpack.scan.history

import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -29,7 +32,7 @@ import org.wordpress.android.util.LocaleManagerWrapper
import javax.inject.Inject

@AndroidEntryPoint
class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), ScrollableViewInitializedListener {
class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), MenuProvider, ScrollableViewInitializedListener {
@Inject
lateinit var uiHelpers: UiHelpers

Expand All @@ -43,9 +46,11 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable

private val onTabSelectedListener = object : OnTabSelectedListener {
override fun onTabReselected(tab: Tab) {
// Do nothing
}

override fun onTabUnselected(tab: Tab) {
// Do nothing
}

override fun onTabSelected(tab: Tab) {
Expand All @@ -55,6 +60,7 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
requireActivity().addMenuProvider(this, viewLifecycleOwner)
binding = ScanHistoryFragmentBinding.bind(view).apply {
initViewModel(getSite(savedInstanceState))
initToolbar()
Expand All @@ -72,7 +78,7 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable
}

private fun ScanHistoryFragmentBinding.setupObservers() {
viewModel.uiState.observe(viewLifecycleOwner, { uiState ->
viewModel.uiState.observe(viewLifecycleOwner) { uiState ->
uiHelpers.updateVisibility(tabLayout, uiState.contentVisible)
uiHelpers.updateVisibility(viewPager, uiState.contentVisible)
uiHelpers.updateVisibility(fullscreenErrorWithRetry.errorLayout, uiState.errorVisible)
Expand All @@ -82,7 +88,7 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable
}
is ErrorUiState -> fullscreenErrorWithRetry.updateErrorLayout(uiState)
}
})
}
}

private fun FullscreenErrorWithRetryBinding.updateErrorLayout(uiState: ErrorUiState) {
Expand All @@ -105,7 +111,6 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable
}

private fun ScanHistoryFragmentBinding.initToolbar() {
setHasOptionsMenu(true)
val activity = (requireActivity() as AppCompatActivity)
toolbarMain.title = getString(R.string.scan_history)
activity.setSupportActionBar(toolbarMain)
Expand All @@ -128,12 +133,16 @@ class ScanHistoryFragment : Fragment(R.layout.scan_history_fragment), Scrollable
super.onSaveInstanceState(outState)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
// Do nothing
}

override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
android.R.id.home -> {
requireActivity().onBackPressed()
return true
true
}
return super.onOptionsItemSelected(item)
else -> false
}

private class ScanHistoryTabAdapter(
Expand Down
Loading