Skip to content

Commit

Permalink
Material You
Browse files Browse the repository at this point in the history
  • Loading branch information
AChep committed Nov 15, 2021
1 parent 5826352 commit 16fc6fd
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 590 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,11 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(), View.OnClickListener

private lateinit var adapter: DependencyAdapter

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View = super.onCreateView(inflater, container, savedInstanceState)
.let {
wrapInStatusBarView(it)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setOnApplyWindowInsetsListener { insets ->
viewBinding.scrollView.updatePadding(
bottom = insets.systemWindowInsetBottom,
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)
viewBinding.navUpBtnContainer.updatePadding(
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)

view.findViewById<View>(R.id.statusBarBg).apply {
layoutParams.height = insets.systemWindowInsetTop
requestLayout()
}

insets.consumeSystemWindowInsets()
viewBinding.topAppBar.setNavigationOnClickListener {
findNavController().navigateUp()
}

viewBinding.navUpBtn.setOnClickListener(this)
viewBinding.appGithubBtn.setOnClickListener(this)
viewBinding.linkedInBtn.setOnClickListener(this)
viewBinding.instagramBtn.setOnClickListener(this)
Expand Down Expand Up @@ -99,11 +73,10 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(), View.OnClickListener

override fun onClick(view: View) {
when (view.id) {
R.id.navUpBtn -> findNavController().navigateUp()
R.id.appGithubBtn -> aboutViewModel.openGitHub()
R.id.appShareBtn -> {
val subject = getString(R.string.app_name)
val text = "Literary Clock represents time in a form of literature qoutes. " +
val text = "Literary Clock represents time in a form of literature quotes. " +
"Check it out: https://play.google.com/store/apps/details?id=com.artemchep.literaryclock"
val i = Intent(Intent.ACTION_SEND).apply {
type = "description/plain"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,11 @@ class DonateFragment : BaseFragment<FragmentDonateBinding>(), View.OnClickListen

private val itemAdapter by lazy { ItemAdapter<SkuItem>() }

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View = super.onCreateView(inflater, container, savedInstanceState)
.let {
wrapInStatusBarView(it)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setOnApplyWindowInsetsListener { insets ->
viewBinding.scrollView.updatePadding(
bottom = insets.systemWindowInsetBottom,
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)
viewBinding.navUpBtnContainer.updatePadding(
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)

view.findViewById<View>(R.id.statusBarBg).apply {
layoutParams.height = insets.systemWindowInsetTop
requestLayout()
}

insets.consumeSystemWindowInsets()
viewBinding.topAppBar.setNavigationOnClickListener {
findNavController().navigateUp()
}

viewBinding.navUpBtn.setOnClickListener(this)

viewBinding.recyclerView.layoutManager = LinearLayoutManager(context)
viewBinding.recyclerView.adapter = FastAdapter.with(itemAdapter).apply {
onClickListener = object : ClickListener<SkuItem> {
Expand Down Expand Up @@ -135,9 +108,6 @@ class DonateFragment : BaseFragment<FragmentDonateBinding>(), View.OnClickListen
}

override fun onClick(view: View) {
when (view.id) {
R.id.navUpBtn -> findNavController().navigateUp()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,11 @@ class DonateQuoteFragment : BaseFragment<FragmentDonateQuoteBinding>(), View.OnC
/** The format of a digital clock used system-wide */
private val timeFormat by lazy { createTimeFormat(requireContext()) }

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View = super.onCreateView(inflater, container, savedInstanceState)
.let {
wrapInStatusBarView(it)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setOnApplyWindowInsetsListener { insets ->
viewBinding.scrollView.updatePadding(
bottom = insets.systemWindowInsetBottom,
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)
viewBinding.navUpBtnContainer.updatePadding(
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)

view.findViewById<View>(R.id.statusBarBg).apply {
layoutParams.height = insets.systemWindowInsetTop
requestLayout()
}

insets.consumeSystemWindowInsets()
viewBinding.topAppBar.setNavigationOnClickListener {
findNavController().navigateUp()
}

viewBinding.navUpBtn.setOnClickListener(this)
viewBinding.btn.setOnClickListener(this)
viewBinding.timeTextView.setOnClickListener(this)

Expand Down Expand Up @@ -148,7 +122,6 @@ class DonateQuoteFragment : BaseFragment<FragmentDonateQuoteBinding>(), View.OnC

override fun onClick(view: View) {
when (view.id) {
R.id.navUpBtn -> navigateUp()
R.id.btn -> donateQuoteViewModel.send()
R.id.timeTextView -> donateQuoteViewModel.editTime()
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,11 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(),
override val viewBindingFactory: (LayoutInflater, ViewGroup?, Boolean) -> FragmentSettingsBinding
get() = FragmentSettingsBinding::inflate

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View = super.onCreateView(inflater, container, savedInstanceState)
.let {
wrapInStatusBarView(it)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setOnApplyWindowInsetsListener { insets ->
viewBinding.scrollView.updatePadding(
bottom = insets.systemWindowInsetBottom,
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)
viewBinding.navUpBtnContainer.updatePadding(
right = insets.systemWindowInsetRight,
left = insets.systemWindowInsetLeft
)

view.findViewById<View>(R.id.statusBarBg).apply {
layoutParams.height = insets.systemWindowInsetTop
requestLayout()
}

insets.consumeSystemWindowInsets()
viewBinding.topAppBar.setNavigationOnClickListener {
findNavController().navigateUp()
}

viewBinding.themeSpinner.apply {
val themes = arrayOf(
getString(R.string.settings_theme_auto) to Cfg.APP_THEME_AUTO,
Expand Down Expand Up @@ -97,7 +72,6 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(),
}
}

viewBinding.navUpBtn.setOnClickListener(this)
setupWidgetUpdaterPreference()
setupWidgetColorPreference()
}
Expand Down Expand Up @@ -177,7 +151,6 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(),
override fun onClick(view: View) {
when (view.id) {
R.id.altWidgetUpdaterTextView -> viewBinding.altWidgetUpdaterSwitch.toggle()
R.id.navUpBtn -> findNavController().navigateUp()
}
}

Expand Down

0 comments on commit 16fc6fd

Please sign in to comment.