From 1742a7532f537265ac39eed0caca96ce46666d80 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 24 May 2012 13:27:25 -0700 Subject: [PATCH] Start differentiating bewteen picture attachments and sdcard attachments --- astrid/res/values/strings-premium.xml | 2 ++ .../astrid/activity/TaskEditFragment.java | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/astrid/res/values/strings-premium.xml b/astrid/res/values/strings-premium.xml index 0aba2a908..1fa905279 100644 --- a/astrid/res/values/strings-premium.xml +++ b/astrid/res/values/strings-premium.xml @@ -20,5 +20,7 @@ Up Choose a file Permissions error! Please make sure you have not blocked Astrid from accessing the SD card. + Attach a picture + Attach a file from your SD card Error copying file for attachment diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index 75321435d..02c4a0e78 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -52,6 +52,7 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewParent; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; @@ -999,8 +1000,29 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { } private void startAttachFile() { - Intent attachFile = new Intent(getActivity(), FileExplore.class); - startActivityForResult(attachFile, REQUEST_CODE_ATTACH_FILE); + ArrayList options = new ArrayList(); + options.add(getString(R.string.file_add_picture)); + options.add(getString(R.string.file_add_sdcard)); + + ArrayAdapter adapter = new ArrayAdapter(getActivity(), + android.R.layout.simple_spinner_dropdown_item, options.toArray(new String[options.size()])); + + DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface d, int which) { + if(which == 0) { + System.err.println("Attach a picture"); + } else if (which == 1) { + Intent attachFile = new Intent(getActivity(), FileExplore.class); + startActivityForResult(attachFile, REQUEST_CODE_ATTACH_FILE); + } + } + }; + + // show a menu of available options + new AlertDialog.Builder(getActivity()) + .setAdapter(adapter, listener) + .show().setOwnerActivity(getActivity()); } private void startRecordingAudio() {