Skip to content

Commit f48f498

Browse files
committed
code fixes
Signed-off-by: Surinder Kumar <[email protected]>
1 parent b0f5368 commit f48f498

File tree

3 files changed

+38
-65
lines changed

3 files changed

+38
-65
lines changed

app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadWorker.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,6 @@ class FileUploadWorker(
206206
notificationManager.dismissNotification()
207207
}
208208

209-
private fun setWorkerState(user: User?) {
210-
WorkerStateObserver.send(WorkerState.FileUploadStarted(user))
211-
}
212-
213209
private fun setIdleWorkerState() {
214210
WorkerStateObserver.send(WorkerState.FileUploadCompleted(currentUploadFileOperation?.file))
215211
}
@@ -269,7 +265,6 @@ class FileUploadWorker(
269265
return@withContext Result.failure()
270266
}
271267

272-
setWorkerState(user)
273268
val operation = createUploadFileOperation(upload, user)
274269
currentUploadFileOperation = operation
275270

app/src/main/java/com/owncloud/android/ui/activity/AlbumsPickerActivity.kt

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ class AlbumsPickerActivity :
9191
captionText = resources.getText(R.string.media_picker_toolbar_title).toString()
9292
}
9393

94-
folderPickerBinding.folderPickerBtnCopy.visibility = View.GONE
95-
folderPickerBinding.folderPickerBtnMove.visibility = View.GONE
96-
folderPickerBinding.folderPickerBtnChoose.visibility = View.GONE
97-
folderPickerBinding.folderPickerBtnCancel.visibility = View.GONE
98-
folderPickerBinding.chooseButtonSpacer.visibility = View.GONE
99-
folderPickerBinding.moveOrCopyButtonSpacer.visibility = View.GONE
94+
folderPickerBinding.run {
95+
folderPickerBtnCopy.visibility = View.GONE
96+
folderPickerBtnMove.visibility = View.GONE
97+
folderPickerBtnChoose.visibility = View.GONE
98+
folderPickerBtnCancel.visibility = View.GONE
99+
chooseButtonSpacer.visibility = View.GONE
100+
moveOrCopyButtonSpacer.visibility = View.GONE
101+
}
100102
}
101103

102104
private fun createFragments() {
@@ -114,18 +116,22 @@ class AlbumsPickerActivity :
114116
}
115117

116118
private fun createGalleryFragment() {
117-
val photoFragment = GalleryFragment()
118-
val bundle = Bundle()
119-
bundle.putParcelable(
120-
OCFileListFragment.SEARCH_EVENT,
121-
SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH)
122-
)
123-
bundle.putBoolean(EXTRA_FROM_ALBUM, true)
124-
photoFragment.arguments = bundle
125-
126-
val transaction = supportFragmentManager.beginTransaction()
127-
transaction.add(R.id.fragment_container, photoFragment, TAG_LIST_OF_FOLDERS)
128-
transaction.commit()
119+
val bundle = Bundle().apply {
120+
putParcelable(
121+
OCFileListFragment.SEARCH_EVENT,
122+
SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH)
123+
)
124+
putBoolean(EXTRA_FROM_ALBUM, true)
125+
}
126+
127+
val fragment = GalleryFragment().apply {
128+
arguments = bundle
129+
}
130+
131+
supportFragmentManager.beginTransaction().run {
132+
add(R.id.fragment_container, fragment, TAG_LIST_OF_FOLDERS)
133+
commit()
134+
}
129135
}
130136

131137
private val listOfFilesFragment: AlbumsFragment?
@@ -173,21 +179,13 @@ class AlbumsPickerActivity :
173179
}
174180
}
175181

176-
override fun showDetails(file: OCFile?) {
177-
// not used at the moment
178-
}
182+
override fun showDetails(file: OCFile?) = Unit
179183

180-
override fun showDetails(file: OCFile?, activeTab: Int) {
181-
// not used at the moment
182-
}
184+
override fun showDetails(file: OCFile?, activeTab: Int) = Unit
183185

184-
override fun onBrowsedDownTo(folder: OCFile?) {
185-
// not used at the moment
186-
}
186+
override fun onBrowsedDownTo(folder: OCFile?) = Unit
187187

188-
override fun onTransferStateChanged(file: OCFile?, downloading: Boolean, uploading: Boolean) {
189-
// not used at the moment
190-
}
188+
override fun onTransferStateChanged(file: OCFile?, downloading: Boolean, uploading: Boolean) = Unit
191189

192190
companion object {
193191
private val EXTRA_ACTION = AlbumsPickerActivity::class.java.canonicalName?.plus(".EXTRA_ACTION")
@@ -209,13 +207,9 @@ class AlbumsPickerActivity :
209207
}
210208
}
211209

212-
override fun onRefresh(enforced: Boolean) {
213-
// do nothing
214-
}
210+
override fun onRefresh(enforced: Boolean) = Unit
215211

216-
override fun onRefresh() {
217-
// do nothing
218-
}
212+
override fun onRefresh() = Unit
219213

220214
override fun onOptionsItemSelected(item: MenuItem): Boolean {
221215
when (item.itemId) {

app/src/main/java/com/owncloud/android/ui/fragment/albums/AlbumItemsFragment.kt

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -519,21 +519,13 @@ class AlbumItemsFragment :
519519

520520
override fun getColumnsCount(): Int = columnSize
521521

522-
override fun onShareIconClick(file: OCFile?) {
523-
// nothing to do here
524-
}
522+
override fun onShareIconClick(file: OCFile?) = Unit
525523

526-
override fun showShareDetailView(file: OCFile?) {
527-
// nothing to do here
528-
}
524+
override fun showShareDetailView(file: OCFile?) = Unit
529525

530-
override fun showActivityDetailView(file: OCFile?) {
531-
// nothing to do here
532-
}
526+
override fun showActivityDetailView(file: OCFile?) = Unit
533527

534-
override fun onOverflowIconClicked(file: OCFile?, view: View?) {
535-
// nothing to do here
536-
}
528+
override fun onOverflowIconClicked(file: OCFile?, view: View?) = Unit
537529

538530
override fun onItemClicked(file: OCFile) {
539531
if (adapter?.isMultiSelect() == true) {
@@ -591,9 +583,7 @@ class AlbumItemsFragment :
591583

592584
override fun isLoading(): Boolean = false
593585

594-
override fun onHeaderClicked() {
595-
// nothing to do here
596-
}
586+
override fun onHeaderClicked() = Unit
597587

598588
fun onAlbumRenamed(newAlbumName: String) {
599589
albumName = newAlbumName
@@ -930,13 +920,9 @@ class AlbumItemsFragment :
930920
*/
931921
private val mSelectionWhenActionModeClosedByDrawer: MutableSet<OCFile> = HashSet()
932922

933-
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
934-
// nothing to do
935-
}
923+
override fun onDrawerSlide(drawerView: View, slideOffset: Float) = Unit
936924

937-
override fun onDrawerOpened(drawerView: View) {
938-
// nothing to do
939-
}
925+
override fun onDrawerOpened(drawerView: View) = Unit
940926

941927
/**
942928
* When the navigation drawer is closed, action mode is recovered in the same state as was when the drawer was
@@ -978,9 +964,7 @@ class AlbumItemsFragment :
978964
/**
979965
* Update action mode bar when an item is selected / unselected in the list
980966
*/
981-
override fun onItemCheckedStateChanged(mode: ActionMode, position: Int, id: Long, checked: Boolean) {
982-
// nothing to do here
983-
}
967+
override fun onItemCheckedStateChanged(mode: ActionMode, position: Int, id: Long, checked: Boolean) = Unit
984968

985969
/**
986970
* Load menu and customize UI when action mode is started.

0 commit comments

Comments
 (0)