Skip to content

Commit 4c43f01

Browse files
committed
adding some main activity redesigns
1 parent 51c8e6b commit 4c43f01

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ android {
6363
}
6464

6565
dependencies {
66-
implementation 'com.github.SimpleMobileTools:Simple-Commons:6323be1fd7'
66+
implementation 'com.github.SimpleMobileTools:Simple-Commons:4caf4d52e8'
6767
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
6868
implementation 'androidx.documentfile:documentfile:1.0.1'
6969

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@ class MainActivity : SimpleActivity() {
8383
private lateinit var searchClearBtn: ImageView
8484

8585
override fun onCreate(savedInstanceState: Bundle?) {
86+
isMaterialActivity = true
8687
super.onCreate(savedInstanceState)
8788
setContentView(R.layout.activity_main)
8889
appLaunched(BuildConfig.APPLICATION_ID)
8990
setupOptionsMenu()
9091
refreshMenuItems()
9192

93+
updateMaterialActivityViews(main_coordinator, main_linear_layout)
94+
9295
searchQueryET = findViewById(R.id.search_query)
9396
searchPrevBtn = findViewById(R.id.search_previous)
9497
searchNextBtn = findViewById(R.id.search_next)
@@ -130,11 +133,13 @@ class MainActivity : SimpleActivity() {
130133

131134
checkShortcuts()
132135

133-
search_wrapper.setBackgroundColor(getProperPrimaryColor())
136+
search_wrapper.setBackgroundColor(getProperStatusBarColor())
134137
val contrastColor = getProperPrimaryColor().getContrastColor()
135138
arrayListOf(searchPrevBtn, searchNextBtn, searchClearBtn).forEach {
136139
it.applyColorFilter(contrastColor)
137140
}
141+
142+
updateTopBarColors(main_toolbar, getProperBackgroundColor())
138143
}
139144

140145
override fun onPause() {
@@ -542,7 +547,8 @@ class MainActivity : SimpleActivity() {
542547

543548
private fun openSearch() {
544549
isSearchActive = true
545-
search_wrapper.beVisible()
550+
search_wrapper.fadeIn()
551+
animateTopBarColors(window.statusBarColor, getProperStatusBarColor(), main_toolbar)
546552
showKeyboard(searchQueryET)
547553

548554
currentNotesView()?.let { noteView ->
@@ -558,7 +564,8 @@ class MainActivity : SimpleActivity() {
558564
private fun closeSearch() {
559565
searchQueryET.text?.clear()
560566
isSearchActive = false
561-
search_wrapper.beGone()
567+
search_wrapper.fadeOut()
568+
animateTopBarColors(window.statusBarColor, getProperBackgroundColor(), main_toolbar)
562569
}
563570

564571
private fun getWantedNoteIndex(wantedNoteId: Long?): Int {

app/src/main/res/layout/activity_main.xml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,20 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8-
<com.google.android.material.appbar.AppBarLayout
9-
android:id="@+id/main_app_bar_layout"
8+
<com.google.android.material.appbar.MaterialToolbar
9+
android:id="@+id/main_toolbar"
1010
android:layout_width="match_parent"
11-
android:layout_height="wrap_content">
12-
13-
<com.google.android.material.appbar.MaterialToolbar
14-
android:id="@+id/main_toolbar"
15-
android:layout_width="match_parent"
16-
android:layout_height="?attr/actionBarSize"
17-
android:background="@color/color_primary"
18-
app:menu="@menu/menu"
19-
app:title="@string/app_launcher_name"
20-
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
21-
22-
</com.google.android.material.appbar.AppBarLayout>
11+
android:layout_height="?attr/actionBarSize"
12+
android:background="@color/color_primary"
13+
app:menu="@menu/menu"
14+
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
2315

2416
<LinearLayout
2517
android:id="@+id/main_linear_layout"
2618
android:layout_width="match_parent"
2719
android:layout_height="match_parent"
28-
android:orientation="vertical"
29-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
20+
android:layout_marginTop="?attr/actionBarSize"
21+
android:orientation="vertical">
3022

3123
<include
3224
android:id="@+id/search_wrapper"

0 commit comments

Comments
 (0)