Merge commit 'refs/pull/42/head' of github.com:SimpleMobileTools/Simple-Draw
This commit is contained in:
commit
22bc275da1
3 changed files with 33 additions and 21 deletions
|
@ -19,8 +19,8 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.simplemobiletools.draw.Config;
|
import com.simplemobiletools.draw.Config;
|
||||||
|
@ -52,7 +52,7 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
||||||
@BindView(R.id.stroke_width_bar) SeekBar mStrokeWidthBar;
|
@BindView(R.id.stroke_width_bar) SeekBar mStrokeWidthBar;
|
||||||
|
|
||||||
private String curFileName;
|
private String curFileName;
|
||||||
private int curExtensionIndex;
|
private int curExtensionId;
|
||||||
|
|
||||||
private int color;
|
private int color;
|
||||||
private float strokeWidth;
|
private float strokeWidth;
|
||||||
|
@ -167,8 +167,10 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
||||||
final EditText fileNameET = (EditText) saveFileView.findViewById(R.id.file_name);
|
final EditText fileNameET = (EditText) saveFileView.findViewById(R.id.file_name);
|
||||||
fileNameET.setText(curFileName);
|
fileNameET.setText(curFileName);
|
||||||
|
|
||||||
final Spinner fileExtensionS = (Spinner) saveFileView.findViewById(R.id.file_extension);
|
final RadioGroup fileExtensionRG = (RadioGroup) saveFileView.findViewById(R.id.extension_radio_group);
|
||||||
fileExtensionS.setSelection(curExtensionIndex);
|
if (curExtensionId != 0) {
|
||||||
|
fileExtensionRG.check(curExtensionId);
|
||||||
|
}
|
||||||
builder.setView(saveFileView);
|
builder.setView(saveFileView);
|
||||||
|
|
||||||
builder.setPositiveButton(R.string.ok, null);
|
builder.setPositiveButton(R.string.ok, null);
|
||||||
|
@ -180,11 +182,17 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final String fileName = fileNameET.getText().toString().trim();
|
final String fileName = fileNameET.getText().toString().trim();
|
||||||
final String extension = (String) fileExtensionS.getSelectedItem();
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
|
final String extension;
|
||||||
|
switch (fileExtensionRG.getCheckedRadioButtonId()) {
|
||||||
|
default:
|
||||||
|
case R.id.extension_radio_png: extension = ".png"; break;
|
||||||
|
case R.id.extension_radio_svg: extension = ".svg"; break;
|
||||||
|
}
|
||||||
|
|
||||||
if (saveFile(fileName, extension)) {
|
if (saveFile(fileName, extension)) {
|
||||||
curFileName = fileName;
|
curFileName = fileName;
|
||||||
curExtensionIndex = fileExtensionS.getSelectedItemPosition();
|
curExtensionId = fileExtensionRG.getCheckedRadioButtonId();
|
||||||
|
|
||||||
Utils.showToast(getApplicationContext(), R.string.saving_ok);
|
Utils.showToast(getApplicationContext(), R.string.saving_ok);
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
|
|
|
@ -17,18 +17,26 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/file_name_label"
|
android:layout_below="@+id/file_name_label"
|
||||||
android:layout_marginBottom="@dimen/activity_margin"
|
android:layout_marginBottom="@dimen/activity_margin"
|
||||||
android:layout_toLeftOf="@+id/file_extension"
|
|
||||||
android:singleLine="true"/>
|
android:singleLine="true"/>
|
||||||
|
|
||||||
<Spinner
|
<RadioGroup
|
||||||
android:id="@+id/file_extension"
|
android:id="@+id/extension_radio_group"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/file_name"
|
android:layout_below="@+id/file_name"
|
||||||
android:layout_alignParentRight="true"
|
android:checkedButton="@+id/extension_radio_png">
|
||||||
android:layout_alignTop="@+id/file_name"
|
|
||||||
android:layout_below="@+id/file_name_label"
|
<RadioButton
|
||||||
android:gravity="center_vertical"
|
android:id="@+id/extension_radio_png"
|
||||||
android:entries="@array/save_formats"/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=".png"/>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/extension_radio_svg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=".svg"/>
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
<string name="no_permissions">Could not save the file without accessing the external storage</string>
|
<string name="no_permissions">Could not save the file without accessing the external storage</string>
|
||||||
<string name="ok">OK</string>
|
<string name="ok">OK</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string-array name="save_formats" translatable="false">
|
|
||||||
<item>.png</item>
|
|
||||||
<item>.svg</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
|
Loading…
Reference in a new issue