Skip to content

Commit b20debe

Browse files
committed
code fixes
Signed-off-by: Surinder Kumar <surinder.kumar@t-systems.com>
1 parent 4137454 commit b20debe

2 files changed

Lines changed: 38 additions & 60 deletions

File tree

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
@@ -525,21 +525,13 @@ class AlbumItemsFragment :
525525

526526
override fun getColumnsCount(): Int = columnSize
527527

528-
override fun onShareIconClick(file: OCFile?) {
529-
// nothing to do here
530-
}
528+
override fun onShareIconClick(file: OCFile?) = Unit
531529

532-
override fun showShareDetailView(file: OCFile?) {
533-
// nothing to do here
534-
}
530+
override fun showShareDetailView(file: OCFile?) = Unit
535531

536-
override fun showActivityDetailView(file: OCFile?) {
537-
// nothing to do here
538-
}
532+
override fun showActivityDetailView(file: OCFile?) = Unit
539533

540-
override fun onOverflowIconClicked(file: OCFile?, view: View?) {
541-
// nothing to do here
542-
}
534+
override fun onOverflowIconClicked(file: OCFile?, view: View?) = Unit
543535

544536
override fun onItemClicked(file: OCFile) {
545537
if (adapter?.isMultiSelect() == true) {
@@ -597,9 +589,7 @@ class AlbumItemsFragment :
597589

598590
override fun isLoading(): Boolean = false
599591

600-
override fun onHeaderClicked() {
601-
// nothing to do here
602-
}
592+
override fun onHeaderClicked() = Unit
603593

604594
fun onAlbumRenamed(newAlbumName: String) {
605595
albumName = newAlbumName
@@ -936,13 +926,9 @@ class AlbumItemsFragment :
936926
*/
937927
private val mSelectionWhenActionModeClosedByDrawer: MutableSet<OCFile> = HashSet()
938928

939-
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
940-
// nothing to do
941-
}
929+
override fun onDrawerSlide(drawerView: View, slideOffset: Float) = Unit
942930

943-
override fun onDrawerOpened(drawerView: View) {
944-
// nothing to do
945-
}
931+
override fun onDrawerOpened(drawerView: View) = Unit
946932

947933
/**
948934
* When the navigation drawer is closed, action mode is recovered in the same state as was when the drawer was
@@ -984,9 +970,7 @@ class AlbumItemsFragment :
984970
/**
985971
* Update action mode bar when an item is selected / unselected in the list
986972
*/
987-
override fun onItemCheckedStateChanged(mode: ActionMode, position: Int, id: Long, checked: Boolean) {
988-
// nothing to do here
989-
}
973+
override fun onItemCheckedStateChanged(mode: ActionMode, position: Int, id: Long, checked: Boolean) = Unit
990974

991975
/**
992976
* Load menu and customize UI when action mode is started.

0 commit comments

Comments
 (0)