updating commons with some design improvements

This commit is contained in:
tibbi 2022-07-20 11:40:03 +02:00
parent 79d46ba838
commit 96f629d40a
9 changed files with 369 additions and 294 deletions

View File

@ -63,7 +63,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:fbcf12e609'
implementation 'com.github.SimpleMobileTools:Simple-Commons:8ee6c0c17b'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.github.Armen101:AudioRecordView:1.0.4'
implementation 'androidx.documentfile:documentfile:1.0.1'

View File

@ -2,8 +2,6 @@ package com.simplemobiletools.voicerecorder.activities
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.ImageView
import android.widget.TextView
import com.simplemobiletools.commons.extensions.*
@ -24,6 +22,7 @@ class MainActivity : SimpleActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID)
setupOptionsMenu()
if (checkAppSideloading()) {
return
@ -50,8 +49,9 @@ class MainActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
getPagerAdapter()?.onResume()
setupTabColors()
setupToolbar(main_toolbar)
getPagerAdapter()?.onResume()
}
override fun onPause() {
@ -72,19 +72,15 @@ class MainActivity : SimpleActivity() {
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu, menu)
updateMenuItemColors(menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
private fun setupOptionsMenu() {
main_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item)
else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
}
return true
}
private fun tryInitVoiceRecorder() {
@ -142,7 +138,7 @@ class MainActivity : SimpleActivity() {
updateBottomTabItemColors(inactiveView, false)
main_tabs_holder.getTabAt(view_pager.currentItem)?.select()
val bottomBarColor = getBottomTabsBackgroundColor()
val bottomBarColor = getBottomNavigationBackgroundColor()
main_tabs_holder.setBackgroundColor(bottomBarColor)
updateNavigationBarColor(bottomBarColor)
}

View File

@ -6,6 +6,7 @@ import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.helpers.isQPlus
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.voicerecorder.R
@ -23,6 +24,7 @@ class SettingsActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
setupPurchaseThankYou()
setupCustomizeColors()
@ -33,7 +35,7 @@ class SettingsActivity : SimpleActivity() {
setupExtension()
setupBitrate()
setupRecordAfterLaunch()
updateTextColors(settings_scrollview)
updateTextColors(settings_nested_scrollview)
arrayOf(settings_color_customization_label, settings_general_settings_label).forEach {
it.setTextColor(getProperPrimaryColor())

View File

@ -58,6 +58,8 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() {
if (mFeatureLockedDialog != null && isOrWasThankYouInstalled()) {
mFeatureLockedDialog?.dismissDialog()
}
setupToolbar(config_toolbar)
}
private fun initVariables() {

View File

@ -22,13 +22,13 @@ class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Rec
rename_recording_title.setText(recording.title.substringBeforeLast('.'))
}
AlertDialog.Builder(activity)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, R.string.rename) {
showKeyboard(view.rename_recording_title)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
.apply {
activity.setupDialogStuff(view, this, R.string.rename) { alertDialog ->
alertDialog.showKeyboard(view.rename_recording_title)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val newTitle = view.rename_recording_title.value
if (newTitle.isEmpty()) {
activity.toast(R.string.empty_name)
@ -49,7 +49,7 @@ class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Rec
activity.runOnUiThread {
callback()
dismiss()
alertDialog.dismiss()
}
}
}

View File

@ -1,10 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_holder"
android:id="@+id/main_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:menu="@menu/menu"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</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">
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
@ -21,3 +43,4 @@
app:tabRippleColor="@null" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,10 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/settings_scrollview"
android:id="@+id/settings_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/settings_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/settings_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/settings_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/settings_holder"
android:layout_width="match_parent"
@ -211,4 +235,5 @@
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -4,14 +4,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
android:paddingTop="@dimen/medium_margin">
<com.simplemobiletools.commons.views.MyEditText
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_recording_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:layout_marginBottom="@dimen/activity_margin"
android:hint="@string/title">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/rename_recording_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout>

View File

@ -1,5 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/config_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/config_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/config_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/config_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -49,18 +70,12 @@
<Button
android:id="@+id/config_save"
style="@style/MyWidgetConfigSaveStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok"
android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" />
android:text="@string/ok" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>