changed title of voiceprompt and placement of microphone-button in taskedit, handle the case a device doesnt have market installed and would crash with ActivityNotFoundException

pull/14/head
Arne Jans 14 years ago
parent e9bcec1444
commit b55a819f85

@ -88,26 +88,31 @@
android:layout_height="wrap_content"
android:text="@string/TEA_note_label"
style="@style/TextAppearance.GEN_EditLabel" />
<!-- Voice Add Note Button -->
<ImageButton android:id="@+id/voiceAddNoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
android:src="@drawable/ic_btn_speak_now"
android:scaleType="fitCenter"/>
<EditText
android:id="@+id/notes"
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="vertical"
android:gravity="top"
android:hint="@string/TEA_notes_hint"
android:autoText="true"
android:capitalize="sentences"
android:singleLine="false" />
android:layout_height="wrap_content">
<!-- Voice Add Note Button -->
<ImageButton android:id="@+id/voiceAddNoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_btn_speak_now"
android:scaleType="fitCenter"
android:visibility="gone"/>
<EditText
android:id="@+id/notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="100"
android:scrollbars="vertical"
android:gravity="top"
android:hint="@string/TEA_notes_hint"
android:autoText="true"
android:capitalize="sentences"
android:singleLine="false" />
</LinearLayout>
<!-- buttons -->
<LinearLayout
android:orientation="horizontal"

@ -91,8 +91,8 @@
<string name="TLA_quick_add_hint">Add to this list...</string>
<!-- Voice Add Prompt Text -->
<string name="TLA_voice_add_prompt">Speak to create a task</string>
<string name="TLA_voice_edit_prompt">Speak to add a tasktitle</string>
<string name="TLA_voice_add_prompt">Speak to add a task</string>
<string name="TLA_voice_edit_prompt">Speak to add to tasktitle</string>
<!-- ====================================================== TaskAdapter == -->
@ -344,6 +344,8 @@
<string name="EPr_voiceInputInstall_dlg">Voice-input is not installed.\nDo you want to go to the market and install it?</string>
<!-- Preference: Task List recognition-service is not available for this system -->
<string name="EPr_voiceInputUnavailable_dlg">Unfortunately voice-input is not available for your system.\nIf possible, please update your system to 2.1 or later.</string>
<!-- Preference: Market is not available for this system -->
<string name="EPr_marketUnavailable_dlg">Unfortunately the market is not available for your system.\nIf possible, try downloading voicesearch from another source.</string>
<!-- Preference: Task List Show Voice-button if recognition-service is available -->
<string name="EPr_voiceInputEnabled_title">Enable voice-input</string>
<!-- Preference: Task List Voice-button directly creates tasks -->

@ -11,6 +11,7 @@ import java.util.Map.Entry;
import org.weloveastrid.rmilk.MilkPreferences;
import org.weloveastrid.rmilk.MilkUtilities;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
@ -200,7 +201,7 @@ public class EditPreferences extends TodorooPreferences {
@Override
public void updatePreferences(final Preference preference, Object value) {
Resources r = getResources();
final Resources r = getResources();
if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
if (value != null && !(Boolean)value)
preference.setSummary(R.string.EPr_showNotes_desc_disabled);
@ -222,11 +223,25 @@ public class EditPreferences extends TodorooPreferences {
@Override
public void onClick(DialogInterface dialog,
int which) {
dialog.dismiss();
// User wants to install voicesearch, take him to the market
Intent marketIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://search?q=pname:" + //$NON-NLS-1$
"com.google.android.voicesearch.x"));
startActivity(marketIntent);
try {
startActivity(marketIntent);
} catch (ActivityNotFoundException ane) {
DialogUtilities.okDialog(EditPreferences.this,
r.getString(R.string.EPr_marketUnavailable_dlg),
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
((CheckBoxPreference)preference).setChecked(false);
dialog.dismiss();
}
});
}
}
},
new OnClickListener() {
@ -248,7 +263,6 @@ public class EditPreferences extends TodorooPreferences {
dialog.dismiss();
}
});
}
}
} else if (r.getString(R.string.p_voiceRemindersEnabled).equals(preference.getKey())) {

Loading…
Cancel
Save