removing the top toolbar

This commit is contained in:
tibbi 2022-08-12 12:30:40 +02:00
parent 7bface3d99
commit 15c9b29534
5 changed files with 19 additions and 96 deletions

View File

@ -43,5 +43,5 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:6f922ee918'
implementation 'com.github.SimpleMobileTools:Simple-Commons:8b339d6e4b'
}

View File

@ -5,10 +5,12 @@ import android.content.Context
import android.content.Intent
import android.content.pm.LauncherApps
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.Surface
import android.view.WindowManager
import android.widget.FrameLayout
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.commons.views.MyGridLayoutManager
@ -25,28 +27,17 @@ class MainActivity : SimpleActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID)
setupOptionsMenu()
getLaunchers()
}
override fun onResume() {
super.onResume()
setupToolbar(main_toolbar)
updateTextColors(main_coordinator)
launchers_fastscroller.updateColors(getProperPrimaryColor())
(launchers_holder.layoutParams as FrameLayout.LayoutParams).topMargin = statusBarHeight
updateStatusbarColor(Color.TRANSPARENT)
setupNavigationBar()
}
private fun setupOptionsMenu() {
main_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.settings -> launchSettings()
else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
}
}
@SuppressLint("WrongConstant")
private fun getLaunchers() {
val allApps = ArrayList<AppLauncher>()
@ -131,9 +122,4 @@ class MainActivity : SimpleActivity() {
launchers_grid.setPadding(0, 0, resources.getDimension(R.dimen.medium_margin).toInt(), bottomListPadding)
launchers_fastscroller.setPadding(leftListPadding, 0, rightListPadding, 0)
}
private fun launchSettings() {
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}
}

View File

@ -1,74 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_coordinator"
android:id="@+id/launchers_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_app_bar_layout"
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/launchers_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/main_toolbar"
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/launchers_grid"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:menu="@menu/menu_main"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
android:layout_height="match_parent"
android:clipToPadding="false"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/portrait_column_count" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/main_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/launchers_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/no_items_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:alpha="0.8"
android:gravity="center"
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone"
tools:visibility="visible" />
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/launchers_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/launchers_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/portrait_column_count" />
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
</RelativeLayout>

View File

@ -24,7 +24,7 @@
android:layout_below="@+id/launcher_icon"
android:ellipsize="end"
android:gravity="center_horizontal|top"
android:maxLines="2"
android:maxLines="1"
android:textSize="@dimen/smaller_text_size" />
</RelativeLayout>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AppCompatResource">
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector"
android:title="@string/settings"
app:showAsAction="always" />
</menu>