Skip to content

Commit

Permalink
Merge branch 'feature/jetpack-compose_20240413' into feature/splash-api
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoongcho committed Jun 18, 2024
2 parents 3291ded + ac15bdb commit 2407b62
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
Expand All @@ -50,7 +49,6 @@ import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.viewmodel.compose.viewModel
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
Expand Down Expand Up @@ -110,7 +108,6 @@ import me.blog.korn123.easydiary.models.ActionLog
import me.blog.korn123.easydiary.models.Diary
import me.blog.korn123.easydiary.services.BaseNotificationService
import me.blog.korn123.easydiary.services.NotificationService
import me.blog.korn123.easydiary.ui.components.CardContainer
import me.blog.korn123.easydiary.ui.components.CategoryTitleCard
import me.blog.korn123.easydiary.ui.components.ScrollableCard
import me.blog.korn123.easydiary.ui.components.SimpleCard
Expand Down Expand Up @@ -181,7 +178,7 @@ open class BaseDevActivity : EasyDiaryActivity() {
super.onCreate(savedInstanceState)
mBinding = ActivityBaseDevBinding.inflate(layoutInflater)
setContentView(mBinding.root)
setSupportActionBar(mBinding.toolbar)
setSupportActionBar(mBinding.partialAppbarLayout.toolbar)
supportActionBar?.run {
title = "Easy-Diary Dev Mode"
setDisplayHomeAsUpEnabled(true)
Expand Down Expand Up @@ -609,7 +606,7 @@ open class BaseDevActivity : EasyDiaryActivity() {
CategoryTitleCard(title = "Custom Launcher")
FlowRow(
maxItemsInEachRow = maxItemsInEachRow,
modifier = Modifier.padding(6.dp, 3.dp)
modifier = Modifier
) {
SimpleCard(
"EasyDiary Launcher",
Expand Down Expand Up @@ -790,7 +787,7 @@ open class BaseDevActivity : EasyDiaryActivity() {
AppTheme {
val configuration = LocalConfiguration.current
val maxItemsInEachRow = if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) 2 else 3
CardContainer {
Column {
val settingCardModifier = Modifier
.fillMaxWidth()
.weight(1f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.blog.korn123.easydiary.activities
import android.content.Intent
import android.hardware.SensorManager
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import com.simplemobiletools.commons.models.Release
import com.squareup.seismic.ShakeDetector
Expand All @@ -21,9 +22,6 @@ import java.util.Calendar

open class EasyDiaryActivity : BaseSimpleActivity(), ShakeDetector.Listener {
var mCustomLineSpacing = true
private val mRootView: ViewGroup? by lazy {
findViewById(R.id.main_holder)
}


/***************************************************************************************************
Expand All @@ -48,7 +46,7 @@ open class EasyDiaryActivity : BaseSimpleActivity(), ShakeDetector.Listener {
startMainActivityWithClearTask()
} else {
resumeLock()
mRootView?.let {
getMainViewGroup()?.let {
initTextSize(it)
updateTextColors(it)
updateAppViews(it)
Expand Down Expand Up @@ -78,7 +76,7 @@ open class EasyDiaryActivity : BaseSimpleActivity(), ShakeDetector.Listener {
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
}

override fun getMainViewGroup(): ViewGroup? = mRootView
override fun getMainViewGroup(): ViewGroup? = if (findViewById<View>(R.id.main_holder) != null) findViewById(R.id.main_holder) else findViewById(R.id.compose_view)

override fun hearShake() {
TransitionHelper.startActivityWithTransition(
Expand Down
36 changes: 9 additions & 27 deletions app/src/main/res/layout/activity_base_dev.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,17 @@
android:layout_height="match_parent"
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include
android:id="@+id/partial_appbar_layout"
layout="@layout/partial_appbar_layout" />

<LinearLayout
android:id="@+id/main_holder"
style="@style/LinearLayoutVertical"
<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/partial_appbar_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar">

<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
android:layout_weight="1" />

<include
android:id="@+id/partial_settings_progress"
Expand All @@ -43,6 +25,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar" />
app:layout_constraintTop_toBottomOf="@+id/partial_appbar_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

19 changes: 19 additions & 0 deletions app/src/main/res/layout/partial_appbar_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>


0 comments on commit 2407b62

Please sign in to comment.