Skip to content

Commit 12babfc

Browse files
authored
Merge pull request #101 from pravinyo/my_books_screen
Book details improved, feature added for listen, read and downloaded tracks details
2 parents 0420d00 + b61c3d5 commit 12babfc

File tree

34 files changed

+334
-84
lines changed

34 files changed

+334
-84
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ dependencies {
7474
implementation(project(path: ModuleDependency.FEATURE_PLAYER_FULL_SCREEN))
7575
implementation(project(path: ModuleDependency.FEATURE_SETTINGS))
7676
implementation(project(path: ModuleDependency.FEATURE_LISTEN_LATER_UI))
77+
implementation(project(path: ModuleDependency.FEATURE_MY_BOOKS_UI))
7778
implementation(project(path: ModuleDependency.SERVICES))
7879

7980
implementation(LibraryDependency.KOIN_X_VIEWMODEL)

app/src/main/java/com/allsoftdroid/audiobook/di/AppModule.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.allsoftdroid.audiobook.feature_downloader.domain.IDownloaderCore
77
import com.allsoftdroid.audiobook.presentation.viewModel.MainActivityViewModel
88
import com.allsoftdroid.audiobook.services.audio.AudioManager
99
import com.allsoftdroid.common.base.usecase.UseCaseHandler
10+
import com.allsoftdroid.common.base.utils.LocalFilesForBook
1011
import com.allsoftdroid.feature.book_details.data.repository.BookDetailsSharedPreferencesRepositoryImpl
1112
import com.allsoftdroid.feature.book_details.domain.repository.BookDetailsSharedPreferenceRepository
1213
import org.koin.androidx.viewmodel.dsl.viewModel
@@ -81,5 +82,9 @@ object AppModule {
8182
single<BookDetailsSharedPreferenceRepository> {
8283
BookDetailsSharedPreferencesRepositoryImpl.create(context = get())
8384
}
85+
86+
single {
87+
LocalFilesForBook(app = get())
88+
}
8489
}
8590
}

buildSrc/src/main/java/com/allsoftdroid/buildsrc/ModuleDependency.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ object ModuleDependency {
1717
const val FEATURE_PLAYER_FULL_SCREEN = ":feature_playerfullscreen"
1818
const val FEATURE_SETTINGS = ":feature_settings"
1919
const val FEATURE_LISTEN_LATER_UI = ":feature_listen_later_ui"
20+
const val FEATURE_MY_BOOKS_UI = ":feature_mybooks"
2021

2122
const val LIBRARY_COMMON = ":common"
2223

common/src/main/java/com/allsoftdroid/common/base/store/downloader/DownloadEvent.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,10 @@ data class PullAndUpdateStatus(
5959
override val chapterIndex: Int=-1,
6060
val downloadId:Long) : DownloadEvent()
6161

62-
data class DownloadNothing(override val bookId: String="",override val chapterIndex: Int=-1) : DownloadEvent()
62+
data class DownloadNothing(override val bookId: String="",override val chapterIndex: Int=-1) : DownloadEvent()
63+
64+
data class MultiDownload(
65+
override val bookId:String="",
66+
override val chapterIndex: Int =-1,
67+
val downloads:List<Download>
68+
) : DownloadEvent()
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.allsoftdroid.audiobook.services.audio.utils
1+
package com.allsoftdroid.common.base.utils
22

33
import android.app.Application
44
import android.net.Uri
@@ -13,7 +13,6 @@ import java.util.*
1313

1414
class LocalFilesForBook(private val app:Application) {
1515

16-
@VisibleForTesting
1716
fun getDownloadedFilesList(bookId:String):List<String>?{
1817
val directory = Environment.getExternalStoragePublicDirectory(ArchiveUtils.getDownloadsRootFolder(context = app))
1918

common/src/main/res/navigation/nav_graph.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
android:id="@+id/action_AudioBookListFragment_to_ListenLaterFragment"
2525
app:destination="@id/ListenLaterFragment" />
2626

27+
<action
28+
android:id="@+id/action_AudioBookListFragment_to_MyBooksFragment"
29+
app:destination="@id/MyBooksFragment" />
30+
2731
</fragment>
2832

2933
<fragment
@@ -32,6 +36,12 @@
3236
android:label="SettingsFragment">
3337
</fragment>
3438

39+
<fragment
40+
android:id="@+id/MyBooksFragment"
41+
android:name="com.allsoftdroid.audiobook.feature_mybooks.MyBooksFragment"
42+
android:label="MyBooksFragment">
43+
</fragment>
44+
3545
<fragment
3646
android:id="@+id/ListenLaterFragment"
3747
android:name="com.allsoftdroid.audiobook.feature_listen_later_ui.presentation.ListenLaterFragment"

feature_book/src/main/java/com/allsoftdroid/feature_book/presentation/AudioBookListFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ class AudioBookListFragment : BaseUIFragment(){
8484
this.findNavController()
8585
.navigate(R.id.action_AudioBookListFragment_to_ListenLaterFragment)
8686
}
87+
88+
R.id.nav_item_my_book -> {
89+
this.findNavController()
90+
.navigate(R.id.action_AudioBookListFragment_to_MyBooksFragment)
91+
}
8792
}
8893

8994
return@setNavigationItemSelectedListener false

feature_book/src/main/res/layout/fragment_audiobook_list.xml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
3131
<LinearLayout
3232
android:id="@+id/toolbar_side_1"
3333
android:orientation="horizontal"
34+
android:layout_marginStart="@dimen/margin_normal"
35+
android:layout_marginEnd="@dimen/margin_normal"
3436
app:toolbarItemVisibility="@{audioBookListViewModel.displaySearch}"
3537
android:layout_width="match_parent"
3638
android:layout_height="match_parent">
3739
<ImageView
3840
android:id="@+id/toolbar_nav_hamburger"
39-
android:layout_width="wrap_content"
40-
android:layout_height="wrap_content"
41+
android:layout_width="@dimen/control_icon_size"
42+
android:layout_height="@dimen/control_icon_size"
4143
android:clickable="true"
4244
android:focusable="true"
43-
android:layout_marginStart="16dp"
4445
android:layout_gravity="center_vertical"
4546
android:src="@drawable/ic_toolbar_menu_hamburger"
4647
android:contentDescription="@string/toolbar_nav_hamburger" />
@@ -57,11 +58,10 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
5758

5859
<ImageView
5960
android:id="@+id/toolbar_book_search"
60-
android:layout_width="wrap_content"
61-
android:layout_height="wrap_content"
61+
android:layout_width="@dimen/control_icon_size"
62+
android:layout_height="@dimen/control_icon_size"
6263
android:clickable="true"
6364
android:focusable="true"
64-
android:layout_marginEnd="16dp"
6565
android:layout_gravity="center_vertical"
6666
android:src="@drawable/book_search_outline"
6767
android:contentDescription="@string/audiobook_search" />
@@ -72,12 +72,13 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
7272
android:id="@+id/toolbar_side_2"
7373
app:toolbarItemVisibility="@{audioBookListViewModel.displaySearch}"
7474
android:orientation="horizontal"
75+
android:layout_marginStart="@dimen/margin_normal"
76+
android:layout_marginEnd="@dimen/margin_normal"
7577
android:layout_width="match_parent"
7678
android:layout_height="match_parent">
7779
<ImageView
78-
android:layout_width="wrap_content"
79-
android:layout_height="wrap_content"
80-
android:layout_marginStart="8dp"
80+
android:layout_width="@dimen/control_icon_size"
81+
android:layout_height="@dimen/control_icon_size"
8182
android:layout_gravity="center_vertical"
8283
android:src="@drawable/ic_search_web"
8384
android:contentDescription="@string/web_search_icon" />
@@ -97,9 +98,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
9798

9899
<ImageView
99100
android:id="@+id/iv_search"
100-
android:layout_width="wrap_content"
101-
android:layout_height="wrap_content"
102-
android:layout_marginEnd="16dp"
101+
android:layout_width="@dimen/control_icon_size"
102+
android:layout_height="@dimen/control_icon_size"
103103
android:src="@drawable/ic_arrow_chevron_right"
104104
android:layout_gravity="center_vertical"
105105
app:searchOrClose="@{audioBookListViewModel.searchOrClose}"
@@ -109,9 +109,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
109109

110110
<ImageView
111111
android:id="@+id/iv_search_cancel"
112-
android:layout_width="wrap_content"
113-
android:layout_height="wrap_content"
114-
android:layout_marginEnd="16dp"
112+
android:layout_width="@dimen/control_icon_size"
113+
android:layout_height="@dimen/control_icon_size"
115114
android:src="@drawable/close"
116115
app:searchOrClose="@{audioBookListViewModel.searchOrClose}"
117116
android:layout_gravity="center_vertical"
@@ -126,7 +125,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.
126125
android:layout_width="0dp"
127126
android:layout_height="0dp"
128127
android:clipToPadding="false"
129-
android:padding="6dp"
130128
app:layout_constraintBottom_toBottomOf="parent"
131129
app:layout_constraintEnd_toEndOf="parent"
132130
app:layout_constraintStart_toStartOf="parent"

feature_book/src/main/res/layout/nav_header_main.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:id="@+id/nav_header"
44
android:layout_width="match_parent"
5-
android:layout_height="160dp"
5+
android:layout_height="@dimen/nav_header_height"
66
android:background="@color/colorPrimaryDark"
77
android:clickable="true"
88
android:focusable="true"
99
android:gravity="bottom"
1010
android:orientation="vertical"
11-
android:padding="16dp"
11+
android:padding="@dimen/nav_padding_normal"
1212
android:theme="@style/ThemeOverlay.AppCompat.Dark">
1313

1414
<ImageView
1515
android:id="@+id/nav_header_imageView"
16-
android:layout_width="64dp"
17-
android:layout_height="64dp"
16+
android:layout_width="@dimen/nav_image_size"
17+
android:layout_height="@dimen/nav_image_size"
1818
android:src="@drawable/ic_jellyfish"
1919
android:contentDescription="@string/profile_picture" />
2020

2121
<TextView
2222
android:id="@+id/nav_header_textView"
2323
android:layout_width="match_parent"
2424
android:layout_height="wrap_content"
25-
android:paddingTop="16dp"
25+
android:paddingTop="@dimen/nav_padding_normal"
2626
android:text="@string/guest_user"
2727
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
2828
</LinearLayout>

0 commit comments

Comments
 (0)