misc code style tweaks

This commit is contained in:
tibbi 2023-01-19 15:36:38 +01:00
parent 5febf58a38
commit 85fc837ad0
7 changed files with 95 additions and 123 deletions

View File

@ -7,6 +7,7 @@
<uses-permission <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" /> android:maxSdkVersion="28" />
<uses-permission <uses-permission
android:name="android.permission.USE_FINGERPRINT" android:name="android.permission.USE_FINGERPRINT"
tools:node="remove" /> tools:node="remove" />

View File

@ -54,8 +54,8 @@ class MainActivity : SimpleActivity(), CanvasListener {
private var defaultPath = "" private var defaultPath = ""
private var defaultFilename = "" private var defaultFilename = ""
private var defaultExtension = PNG private var defaultExtension = PNG
private var intentUri: Uri? = null private var intentUri: Uri? = null
private var uriToLoad: Uri? = null private var uriToLoad: Uri? = null
private var color = 0 private var color = 0
@ -81,7 +81,10 @@ class MainActivity : SimpleActivity(), CanvasListener {
} }
my_canvas.mListener = this my_canvas.mListener = this
stroke_width_bar.setOnSeekBarChangeListener(onStrokeWidthBarChangeListener) stroke_width_bar.onSeekBarChangeListener { progress ->
brushSize = Math.max(progress.toFloat(), 5f)
updateBrushSize()
}
setBackgroundColor(config.canvasBackgroundColor) setBackgroundColor(config.canvasBackgroundColor)
setColor(config.brushColor) setColor(config.brushColor)
@ -676,17 +679,6 @@ class MainActivity : SimpleActivity(), CanvasListener {
} }
} }
private var onStrokeWidthBarChangeListener: SeekBar.OnSeekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
brushSize = Math.max(progress.toFloat(), 5f)
updateBrushSize()
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
}
private fun updateBrushSize() { private fun updateBrushSize() {
my_canvas.setBrushSize(brushSize) my_canvas.setBrushSize(brushSize)
val scale = Math.max(0.03f, brushSize / 100f) val scale = Math.max(0.03f, brushSize / 100f)

View File

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
android:shape="oval"> <solid android:color="@color/color_primary"/>
<stroke android:width="@dimen/preview_dot_stroke_size" android:color="@android:color/white"/>
<solid android:color="@color/color_primary" />
<stroke
android:width="@dimen/preview_dot_stroke_size"
android:color="@android:color/white" />
</shape> </shape>

View File

@ -1,3 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFF" android:pathData="M17.67 3c-0.26 0-0.51 0.1-0.71 0.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c0.4-0.4 0.4-1.03 0.01-1.42l-2.34-2.34C18.17 3.1 17.92 3 17.67 3zM6.92 19L5 17.08l8.339-8.348 1.938 1.938z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M17.67 3c-0.26 0-0.51 0.1-0.71 0.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c0.4-0.4 0.4-1.03 0.01-1.42l-2.34-2.34C18.17 3.1 17.92 3 17.67 3zM6.92 19L5 17.08l8.339-8.348 1.938 1.938z"/>
</vector> </vector>

View File

@ -1,12 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
android:width="24dp" <path android:fillColor="#FFFFFFFF" android:pathData="M15.975 2.95l4.95 4.94c0.78 0.79 0.78 2.05 0 2.84l-9.19 9.19c-1.56 1.56-4.09 1.56-5.66 0l-3.53-3.53c-0.78-0.79-0.78-2.05 0-2.84l10.6-10.6c0.79-0.78 2.05-0.78 2.83 0M3.955 14.97l3.54 3.53c0.78 0.79 2.04 0.79 2.83 0l3.53-3.53-4.95-4.95z"/>
android:height="24dp" <path android:fillColor="#FFFFFFFF" android:pathData="M7.869 20.09c0 0.552 0.446 0.998 0.997 0.997l11.646-0.007c0.552 0 0.997-0.446 0.997-0.997 0-0.552-0.446-0.997-0.998-0.997H8.872c-0.551 0-1.004 0.453-1.003 1.005z"/>
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="m15.9748,2.9503 l4.95,4.94c0.78,0.79 0.78,2.05 0,2.84l-9.19,9.19c-1.56,1.56 -4.09,1.56 -5.66,0l-3.53,-3.53c-0.78,-0.79 -0.78,-2.05 0,-2.84L13.1448,2.9503c0.79,-0.78 2.05,-0.78 2.83,0M3.9548,14.9703l3.54,3.53c0.78,0.79 2.04,0.79 2.83,0l3.53,-3.53 -4.95,-4.95z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="m7.8687,20.0909c0.0003,0.5515 0.4461,0.9968 0.9976,0.9964l11.646,-0.0069c0.5515,-0.0003 0.9968,-0.4461 0.9964,-0.9976 -0.0003,-0.5515 -0.4461,-0.9968 -0.9976,-0.9964L8.8722,19.0862c-0.5515,0.0003 -1.0038,0.4532 -1.0035,1.0047z" />
</vector> </vector>

View File

@ -63,110 +63,103 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/general_settings" /> android:text="@string/general_settings" />
<LinearLayout <RelativeLayout
android:id="@+id/settings_general_settings_holder" android:id="@+id/settings_use_english_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:orientation="vertical">
<RelativeLayout <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_english_holder" android:id="@+id/settings_use_english"
style="@style/SettingsHolderCheckboxStyle" style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:text="@string/use_english_language" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox </RelativeLayout>
android:id="@+id/settings_use_english"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/use_english_language" />
</RelativeLayout> <RelativeLayout
android:id="@+id/settings_language_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language_holder" android:id="@+id/settings_language_label"
style="@style/SettingsHolderTextViewStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/language" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_language_label"
tools:text="English" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_prevent_phone_from_sleeping_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_prevent_phone_from_sleeping"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:text="@string/prevent_phone_from_sleeping" />
<com.simplemobiletools.commons.views.MyTextView </RelativeLayout>
android:id="@+id/settings_language_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/language" />
<com.simplemobiletools.commons.views.MyTextView <RelativeLayout
android:id="@+id/settings_language" android:id="@+id/settings_show_brush_size_holder"
style="@style/SettingsTextValueStyle" style="@style/SettingsHolderCheckboxStyle"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_below="@+id/settings_language_label"
tools:text="English" />
</RelativeLayout> <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_show_brush_size"
<RelativeLayout style="@style/SettingsCheckboxStyle"
android:id="@+id/settings_prevent_phone_from_sleeping_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:text="@string/show_brush_size" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox </RelativeLayout>
android:id="@+id/settings_prevent_phone_from_sleeping"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/prevent_phone_from_sleeping" />
</RelativeLayout> <RelativeLayout
android:id="@+id/settings_allow_zooming_canvas_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_show_brush_size_holder" android:id="@+id/settings_allow_zooming_canvas"
style="@style/SettingsHolderCheckboxStyle" style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:text="@string/allow_zooming_moving_canvas" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox </RelativeLayout>
android:id="@+id/settings_show_brush_size"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_brush_size" />
</RelativeLayout> <RelativeLayout
android:id="@+id/settings_force_portrait_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_allow_zooming_canvas_holder" android:id="@+id/settings_force_portrait"
style="@style/SettingsHolderCheckboxStyle" style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:text="@string/force_portrait_mode" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox </RelativeLayout>
android:id="@+id/settings_allow_zooming_canvas"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/allow_zooming_moving_canvas" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_force_portrait_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_force_portrait"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/force_portrait_mode" />
</RelativeLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -38,11 +38,6 @@
android:icon="@drawable/ic_print_vector" android:icon="@drawable/ic_print_vector"
android:title="@string/print" android:title="@string/print"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item
android:id="@+id/more_apps_from_us"
android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us"
app:showAsAction="always" />
<item <item
android:id="@+id/settings" android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector" android:icon="@drawable/ic_settings_cog_vector"
@ -53,4 +48,9 @@
android:icon="@drawable/ic_info_vector" android:icon="@drawable/ic_info_vector"
android:title="@string/about" android:title="@string/about"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item
android:id="@+id/more_apps_from_us"
android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us"
app:showAsAction="ifRoom" />
</menu> </menu>