add a menu button for opening files
This commit is contained in:
parent
64d4c30a33
commit
db79756667
|
@ -14,6 +14,7 @@ import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||||
|
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
||||||
import com.simplemobiletools.draw.BuildConfig
|
import com.simplemobiletools.draw.BuildConfig
|
||||||
|
@ -76,6 +77,7 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener {
|
||||||
R.id.menu_save -> trySaveImage()
|
R.id.menu_save -> trySaveImage()
|
||||||
R.id.menu_share -> shareImage()
|
R.id.menu_share -> shareImage()
|
||||||
R.id.clear -> my_canvas.clearCanvas()
|
R.id.clear -> my_canvas.clearCanvas()
|
||||||
|
R.id.open_file -> openFile()
|
||||||
R.id.change_background -> changeBackgroundClicked()
|
R.id.change_background -> changeBackgroundClicked()
|
||||||
R.id.settings -> launchSettings()
|
R.id.settings -> launchSettings()
|
||||||
R.id.about -> launchAbout()
|
R.id.about -> launchAbout()
|
||||||
|
@ -104,6 +106,12 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener {
|
||||||
startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME)
|
startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openFile() {
|
||||||
|
FilePickerDialog(this, curPath) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun changeBackgroundClicked() {
|
private fun changeBackgroundClicked() {
|
||||||
val oldColor = (my_canvas.background as ColorDrawable).color
|
val oldColor = (my_canvas.background as ColorDrawable).color
|
||||||
ColorPickerDialog(this, oldColor) {
|
ColorPickerDialog(this, oldColor) {
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
android:icon="@drawable/ic_share"
|
android:icon="@drawable/ic_share"
|
||||||
android:title="@string/share"
|
android:title="@string/share"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/open_file"
|
||||||
|
android:title="@string/open_file"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/change_background"
|
android:id="@+id/change_background"
|
||||||
android:title="@string/change_background_color"
|
android:title="@string/change_background_color"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Schlichter Zeichenblock</string>
|
<string name="app_name">Schlichter Zeichenblock</string>
|
||||||
<string name="app_launcher_name">Zeichenblock</string>
|
<string name="app_launcher_name">Zeichenblock</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Draw</string>
|
<string name="app_name">Simple Draw</string>
|
||||||
<string name="app_launcher_name">Draw</string>
|
<string name="app_launcher_name">Draw</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Dessin simple</string>
|
<string name="app_name">Dessin simple</string>
|
||||||
<string name="app_launcher_name">Dessiner</string>
|
<string name="app_launcher_name">Dessiner</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Draw</string>
|
<string name="app_name">Simple Draw</string>
|
||||||
<string name="app_launcher_name">Draw</string>
|
<string name="app_launcher_name">Draw</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">シンプル ドロー</string>
|
<string name="app_name">シンプル ドロー</string>
|
||||||
<string name="app_launcher_name">ドロー</string>
|
<string name="app_launcher_name">ドロー</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Draw</string>
|
<string name="app_name">Simple Draw</string>
|
||||||
<string name="app_launcher_name">Desenho</string>
|
<string name="app_launcher_name">Desenho</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Mostrar ferramenta Tamanho do pincel</string>
|
<string name="show_brush_size">Mostrar ferramenta Tamanho do pincel</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Draw</string>
|
<string name="app_name">Simple Draw</string>
|
||||||
<string name="app_launcher_name">Draw</string>
|
<string name="app_launcher_name">Draw</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Draw</string>
|
<string name="app_name">Simple Draw</string>
|
||||||
<string name="app_launcher_name">Draw</string>
|
<string name="app_launcher_name">Draw</string>
|
||||||
|
<string name="open_file">Open file</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="show_brush_size">Show brush size tool</string>
|
<string name="show_brush_size">Show brush size tool</string>
|
||||||
|
|
Loading…
Reference in New Issue