OSDN Git Service

am 0136501f: am 03684b9d: am 4bf2ce27: SDK: Enforce GDK_NATIVE_WINDOWS=true for linux...
authorRaphael <raphael@google.com>
Tue, 3 Nov 2009 20:35:39 +0000 (12:35 -0800)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 3 Nov 2009 20:35:39 +0000 (12:35 -0800)
Merge commit '0136501f88c2e5181d9bf60c5d71fdc4696361c0' into eclair-mr2-plus-aosp

* commit '0136501f88c2e5181d9bf60c5d71fdc4696361c0':
  SDK: Enforce GDK_NATIVE_WINDOWS=true for linux scripts

samples/ApiDemos/res/layout/alert_dialog.xml
samples/ApiDemos/res/values/strings.xml
samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
tools/traceview/etc/traceview

index ddd5cb6..741be33 100644 (file)
@@ -41,6 +41,9 @@
         <Button android:id="@+id/checkbox_button"
             android:layout_width="fill_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_multi_choice"/>
+        <Button android:id="@+id/checkbox_button2"
+            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:text="@string/alert_dialog_multi_choice_cursor"/>
         <Button android:id="@+id/text_entry_button"
             android:layout_width="fill_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_text_entry"/>
index 2800bff..28267a5 100644 (file)
     <string name="alert_dialog_select_button">List dialog</string>
     <string name="alert_dialog_single_choice">Single choice list</string>
     <string name="alert_dialog_multi_choice">Repeat alarm</string>
+    <string name="alert_dialog_multi_choice_cursor">Send Call to VoiceMail</string>
     <string name="alert_dialog_progress_button">Progress dialog</string>
     <string name="alert_dialog_text_entry">Text Entry dialog</string>
     <string name="alert_dialog_username">Name:</string>
index fabdfc1..0ef79b3 100644 (file)
@@ -28,6 +28,9 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
+import android.widget.Toast;
+import android.database.Cursor;
+import android.provider.Contacts;
 
 import com.example.android.apis.R;
 
@@ -60,6 +63,7 @@ public class AlertDialogSamples extends Activity {
     private static final int DIALOG_SINGLE_CHOICE = 5;
     private static final int DIALOG_MULTIPLE_CHOICE = 6;
     private static final int DIALOG_TEXT_ENTRY = 7;
+    private static final int DIALOG_MULTIPLE_CHOICE_CURSOR = 8;
 
     private static final int MAX_PROGRESS = 100;
     
@@ -193,6 +197,28 @@ public class AlertDialogSamples extends Activity {
                     }
                 })
                .create();
+            case DIALOG_MULTIPLE_CHOICE_CURSOR:
+                String[] projection = new String[] {
+                        Contacts.People._ID,
+                        Contacts.People.NAME,
+                        Contacts.People.SEND_TO_VOICEMAIL
+                };
+                Cursor cursor = managedQuery(Contacts.People.CONTENT_URI, projection, null, null, null);
+                return new AlertDialog.Builder(AlertDialogSamples.this)
+                    .setIcon(R.drawable.ic_popup_reminder)
+                    .setTitle(R.string.alert_dialog_multi_choice_cursor)
+                    .setMultiChoiceItems(cursor,
+                            Contacts.People.SEND_TO_VOICEMAIL,
+                            Contacts.People.NAME,
+                            new DialogInterface.OnMultiChoiceClickListener() {
+                                public void onClick(DialogInterface dialog, int whichButton,
+                                        boolean isChecked) {
+                                    Toast.makeText(AlertDialogSamples.this,
+                                            "Readonly Demo Only - Data will not be updated",
+                                            Toast.LENGTH_SHORT).show();
+                                }
+                            })
+                   .create();
         case DIALOG_TEXT_ENTRY:
             // This example shows how to add a custom layout to an AlertDialog
             LayoutInflater factory = LayoutInflater.from(this);
@@ -281,6 +307,14 @@ public class AlertDialogSamples extends Activity {
             }
         });
         
+        /* Display a list of checkboxes, backed by a cursor */
+        Button checkBox2 = (Button) findViewById(R.id.checkbox_button2);
+        checkBox2.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                showDialog(DIALOG_MULTIPLE_CHOICE_CURSOR);
+            }
+        });
+
         /* Display a text entry dialog */
         Button textEntry = (Button) findViewById(R.id.text_entry_button);
         textEntry.setOnClickListener(new OnClickListener() {
index 065cd0f..7035791 100755 (executable)
@@ -68,7 +68,7 @@ if [ `uname` = "Linux" ]; then
 fi
 
 while expr "x$1" : 'x-J' >/dev/null; do
-    opt=`expr "$1" : '-J\(.*\)'`
+    opt=`expr "x$1" : 'x-J\(.*\)'`
     javaOpts="${javaOpts} -${opt}"
     shift
 done