diff --git a/app/src/main/java/code/name/monkey/retromusic/dagger/module/HomeModule.kt b/app/src/main/java/code/name/monkey/retromusic/dagger/module/HomeModule.kt index 6b8d8f6f..51b6eadd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dagger/module/HomeModule.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dagger/module/HomeModule.kt @@ -18,7 +18,6 @@ import code.name.monkey.retromusic.mvp.presenter.HomePresenter import code.name.monkey.retromusic.mvp.presenter.HomePresenter.HomePresenterImpl import dagger.Module import dagger.Provides -import javax.inject.Singleton /** * Created by hemanths on 2019-09-04. @@ -27,7 +26,6 @@ import javax.inject.Singleton class HomeModule { @Provides - @Singleton fun providesHomePresenter(presenter: HomePresenterImpl): HomePresenter { return presenter } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt index 2471794f..354a073e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt @@ -18,6 +18,7 @@ import android.app.Dialog import android.os.Bundle import android.view.LayoutInflater import android.view.View +import android.view.ViewGroup import androidx.fragment.app.DialogFragment import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.MainActivity @@ -78,6 +79,15 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener { return materialDialog } + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + dialog?.window?.let { + (requireActivity() as MainActivity).setLightNavigationBar(true) + } + + return super.onCreateView(inflater, container, savedInstanceState) + + } + companion object { private const val WHICH_ONE = "which_one" diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java index 52126d70..7fe77211 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java @@ -1,5 +1,6 @@ package code.name.monkey.retromusic.fragments.mainactivity.folders; +import android.app.ActivityOptions; import android.app.Dialog; import android.content.Context; import android.media.MediaScannerConnection; @@ -26,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.afollestad.materialcab.MaterialCab; import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.card.MaterialCardView; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView; @@ -62,6 +64,7 @@ import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListene import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader; import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.util.FileUtil; +import code.name.monkey.retromusic.util.NavigationUtil; import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.RetroColorUtil; import code.name.monkey.retromusic.util.ViewUtil; @@ -84,6 +87,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements private View coordinatorLayout, container, empty; + private MaterialCardView toolbarContainer; + private Toolbar toolbar; private BreadCrumbLayout breadCrumbs; @@ -238,6 +243,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor))); appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext()))); + toolbar.setOnClickListener(v -> { + ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer, getString(R.string.transition_toolbar)); + NavigationUtil.goToSearch(getMainActivity(), options); + }); } private void setUpBreadCrumbs() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt index 800e626c..0a4302df 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/home/BannerHomeFragment.kt @@ -43,17 +43,21 @@ import kotlinx.android.synthetic.main.home_content.* import java.io.File import java.util.* import javax.inject.Inject -import kotlin.collections.ArrayList class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeView { + private lateinit var homeAdapter: HomeAdapter + + @Inject + lateinit var homePresenter: HomePresenter + + private var disposable: CompositeDisposable = CompositeDisposable() + private lateinit var toolbar: Toolbar override fun sections(sections: ArrayList) { val finalList = sections.sortedWith(compareBy { it.priority }) homeAdapter.swapData(finalList) - recyclerView.apply { - layoutManager = LinearLayoutManager(mainActivity) - adapter = homeAdapter - } + + if (sections.isEmpty()) { showEmptyView() } else { @@ -61,11 +65,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba } } - @Inject - lateinit var homePresenter: HomePresenter - - private var disposable: CompositeDisposable = CompositeDisposable() - private lateinit var toolbar: Toolbar override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home, viewGroup, false) @@ -102,7 +101,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) App.musicComponent.inject(this) - } @@ -136,8 +134,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba contentContainer.setBackgroundColor(ThemeStore.primaryColor(requireContext())) setupToolbar() - homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics) - checkPadding() userImage.setOnClickListener { @@ -145,8 +141,16 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba } titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext())) titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName) + homePresenter.attachView(this) homePresenter.loadSections() + + homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics) + + recyclerView.apply { + layoutManager = LinearLayoutManager(mainActivity) + adapter = homeAdapter + } } private fun checkPadding() { @@ -210,7 +214,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba checkPadding() } - private lateinit var homeAdapter: HomeAdapter override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt index 9457b36a..c72f308b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt @@ -45,7 +45,7 @@ interface HomePresenter : Presenter { private val repository: Repository ) : PresenterImpl(), HomePresenter { - val hashSet: HashSet = HashSet() + private val hashSet: HashSet = HashSet() override fun loadSections() { loadRecentArtists() diff --git a/app/src/main/res/drawable/ic_home_selected_white_24dp.xml b/app/src/main/res/drawable/ic_home_selected_white_24dp.xml index 37beaa0c..6f6136f0 100644 --- a/app/src/main/res/drawable/ic_home_selected_white_24dp.xml +++ b/app/src/main/res/drawable/ic_home_selected_white_24dp.xml @@ -6,5 +6,5 @@ android:viewportHeight="24"> + android:pathData="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_home_white_24dp.xml b/app/src/main/res/drawable/ic_home_white_24dp.xml index b78bab9d..76f069b7 100644 --- a/app/src/main/res/drawable/ic_home_white_24dp.xml +++ b/app/src/main/res/drawable/ic_home_white_24dp.xml @@ -6,5 +6,5 @@ android:viewportHeight="24"> + android:pathData="M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_folder.xml b/app/src/main/res/layout/fragment_folder.xml index 35334c3a..f6a85e18 100644 --- a/app/src/main/res/layout/fragment_folder.xml +++ b/app/src/main/res/layout/fragment_folder.xml @@ -34,12 +34,15 @@ android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="@dimen/toolbar_margin_horizontal" + android:layout_marginTop="@dimen/toolbar_margin_vertical" + android:layout_marginEnd="@dimen/toolbar_margin_horizontal" + android:layout_marginBottom="@dimen/toolbar_margin_vertical" + app:cardBackgroundColor="?colorSurface" app:cardCornerRadius="8dp" app:cardElevation="0dp" app:cardUseCompatPadding="true" - app:layout_scrollFlags="scroll|enterAlways" + app:layout_collapseMode="pin" app:strokeColor="?dividerColor" app:strokeWidth="1dp"> @@ -49,8 +52,13 @@ diff --git a/app/src/main/res/layout/item_list_quick_actions.xml b/app/src/main/res/layout/item_list_quick_actions.xml index 025659f2..afb280ec 100644 --- a/app/src/main/res/layout/item_list_quick_actions.xml +++ b/app/src/main/res/layout/item_list_quick_actions.xml @@ -25,8 +25,8 @@ android:id="@+id/playAction" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/button_margin_horizontal" - android:layout_marginEnd="@dimen/button_margin_horizontal" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" android:layout_weight="1" android:paddingTop="@dimen/button_padding_vertical" android:paddingBottom="@dimen/button_padding_vertical" @@ -42,8 +42,8 @@ android:id="@+id/shuffleAction" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/button_margin_horizontal" - android:layout_marginEnd="@dimen/button_margin_horizontal" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" android:layout_weight="1" android:paddingTop="@dimen/button_padding_vertical" android:paddingBottom="@dimen/button_padding_vertical" diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index fe764660..0b14d9a0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -170,7 +170,8 @@ - diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt index a865414b..0669aaac 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ATH.kt @@ -6,15 +6,13 @@ import android.app.ActivityManager import android.content.Context import android.os.Build import android.view.View - +import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR import androidx.annotation.ColorInt import androidx.appcompat.widget.Toolbar import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper -import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - /** * @author Karim Abou Zeid (kabouzeid) */