Remove force null check

This commit is contained in:
h4h13 2019-10-09 18:22:02 +05:30
parent 12f6f0a505
commit 8d8149839a
7 changed files with 48 additions and 34 deletions

View file

@ -117,7 +117,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
companion object { companion object {
@JvmField @JvmField
val TAG = ArtistsFragment::class.java.simpleName val TAG: String = ArtistsFragment::class.java.simpleName
fun newInstance(): ArtistsFragment { fun newInstance(): ArtistsFragment {

View file

@ -80,7 +80,7 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
companion object { companion object {
@JvmField @JvmField
val TAG = GenresFragment::class.java.simpleName val TAG: String = GenresFragment::class.java.simpleName
fun newInstance(): GenresFragment { fun newInstance(): GenresFragment {
return GenresFragment() return GenresFragment()

View file

@ -60,11 +60,11 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
} }
override fun showEmptyView() { override fun showEmptyView() {
adapter!!.swapDataSet(ArrayList()) adapter?.swapDataSet(ArrayList())
} }
override fun playlists(playlists: ArrayList<Playlist>) { override fun playlists(playlists: ArrayList<Playlist>) {
adapter!!.swapDataSet(playlists) adapter?.swapDataSet(playlists)
} }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
@ -77,7 +77,7 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
companion object { companion object {
@JvmField @JvmField
val TAG = PlaylistsFragment::class.java.simpleName val TAG: String = PlaylistsFragment::class.java.simpleName
fun newInstance(): PlaylistsFragment { fun newInstance(): PlaylistsFragment {
val args = Bundle() val args = Bundle()

View file

@ -83,12 +83,12 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
} }
public override fun setUsePalette(usePalette: Boolean) { public override fun setUsePalette(usePalette: Boolean) {
adapter!!.usePalette(usePalette) adapter?.usePalette(usePalette)
} }
override fun setGridSize(gridSize: Int) { override fun setGridSize(gridSize: Int) {
layoutManager!!.spanCount = gridSize layoutManager?.spanCount = gridSize
adapter!!.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} }
override fun onResume() { override fun onResume() {
@ -104,7 +104,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
} }
override fun showEmptyView() { override fun showEmptyView() {
adapter!!.swapDataSet(ArrayList()) adapter?.swapDataSet(ArrayList())
} }
override fun loadSortOrder(): String { override fun loadSortOrder(): String {

View file

@ -60,6 +60,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
if (sections.isEmpty()) { if (sections.isEmpty()) {
showEmptyView() showEmptyView()
shortcuts.visibility = View.GONE
} else { } else {
emptyContainer.hide() emptyContainer.hide()
} }

View file

@ -196,4 +196,11 @@
tools:text="Hemanth savarala" /> tools:text="Hemanth savarala" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Group
android:id="@+id/shortcuts"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="history,lastAdded,topPlayed,actionShuffle" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -20,7 +20,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/contentContainer" android:id="@+id/contentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
@ -28,34 +28,40 @@
<include layout="@layout/abs_playlists" /> <include layout="@layout/abs_playlists" />
<androidx.recyclerview.widget.RecyclerView <FrameLayout
android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:nestedScrollingEnabled="false" />
<LinearLayout <androidx.recyclerview.widget.RecyclerView
android:id="@+id/emptyContainer" android:id="@+id/recyclerView"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:nestedScrollingEnabled="false"
android:gravity="center_horizontal" tools:visibility="gone" />
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<code.name.monkey.retromusic.views.IconImageView <LinearLayout
android:layout_width="96dp" android:id="@+id/emptyContainer"
android:layout_height="96dp"
app:srcCompat="@drawable/ic_play_arrow_white_64dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/emptyText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/start_play_music" android:gravity="center_horizontal"
android:textAppearance="@style/TextViewNormal" android:orientation="vertical"
android:textColor="?colorOnBackground" /> android:visibility="gone"
</LinearLayout> tools:visibility="visible">
<code.name.monkey.retromusic.views.IconImageView
android:layout_width="96dp"
android:layout_height="96dp"
app:srcCompat="@drawable/ic_play_arrow_white_64dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/emptyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/start_play_music"
android:textAppearance="@style/TextViewNormal"
android:textColor="?colorOnBackground" />
</LinearLayout>
</FrameLayout>
</LinearLayout> </LinearLayout>