add a menu button for opening files

This commit is contained in:
tibbi 2017-04-09 09:46:44 +02:00
parent 64d4c30a33
commit db79756667
10 changed files with 20 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
import com.simplemobiletools.draw.BuildConfig
@ -76,6 +77,7 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener {
R.id.menu_save -> trySaveImage()
R.id.menu_share -> shareImage()
R.id.clear -> my_canvas.clearCanvas()
R.id.open_file -> openFile()
R.id.change_background -> changeBackgroundClicked()
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
@ -104,6 +106,12 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME)
}
private fun openFile() {
FilePickerDialog(this, curPath) {
}
}
private fun changeBackgroundClicked() {
val oldColor = (my_canvas.background as ColorDrawable).color
ColorPickerDialog(this, oldColor) {

View File

@ -16,6 +16,10 @@
android:icon="@drawable/ic_share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/open_file"
android:title="@string/open_file"
app:showAsAction="never"/>
<item
android:id="@+id/change_background"
android:title="@string/change_background_color"

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Schlichter Zeichenblock</string>
<string name="app_launcher_name">Zeichenblock</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Simple Draw</string>
<string name="app_launcher_name">Draw</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Dessin simple</string>
<string name="app_launcher_name">Dessiner</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Simple Draw</string>
<string name="app_launcher_name">Draw</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">シンプル ドロー</string>
<string name="app_launcher_name">ドロー</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Simple Draw</string>
<string name="app_launcher_name">Desenho</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Mostrar ferramenta Tamanho do pincel</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Simple Draw</string>
<string name="app_launcher_name">Draw</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Simple Draw</string>
<string name="app_launcher_name">Draw</string>
<string name="open_file">Open file</string>
<!-- Settings -->
<string name="show_brush_size">Show brush size tool</string>