From patchwork Wed Jul 18 16:17:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 10127 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CEFBE24024 for ; Wed, 18 Jul 2012 16:17:17 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 61D71A182C7 for ; Wed, 18 Jul 2012 16:17:17 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1887674ggn.11 for ; Wed, 18 Jul 2012 09:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=DMmQI4R6g3DlbKl02DGDSMdX99t0oy3SE3ifnh5uk/c=; b=dySvtA1pnTZiFtPBA5V500+gEyXYCg3Wuwxt6dubKqw3bg6frk/PH23X9XBNVaXMo+ YLgMKAl4CVum7oPzLvAGQLvfQz9NXg3fsYQRUCiQ37lJSrNjU/3O/9Uye4mt1a3yucnK b9zZC0u0ufMlK0FO+9zl1V3R/4K110lMx4sqBkxiOh8BrsUFh07CaLQ9VcQC9lu/OC3v JsBZkSfwJGvYzCnxeM1u0qhIgiqgefw4SJ6FIbVhHeH/KlIQKnPLCUITfVKlyOCECVe+ ifY7+ZFXLB5lYDkTY+loM9ZxZY09rluF0T45ZZf9Gan5myI37O80WVs26IRNrFeWpGk/ 2hTw== Received: by 10.50.57.167 with SMTP id j7mr2584803igq.53.1342628236404; Wed, 18 Jul 2012 09:17:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.153.7 with SMTP id i7csp1223ibw; Wed, 18 Jul 2012 09:17:15 -0700 (PDT) Received: by 10.180.88.229 with SMTP id bj5mr7764597wib.19.1342628234284; Wed, 18 Jul 2012 09:17:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fj1si38937721wib.21.2012.07.18.09.17.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 09:17:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1SrWw5-0000Cp-IS for ; Wed, 18 Jul 2012 16:17:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 6BA81E00A6 for ; Wed, 18 Jul 2012 16:17:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 234 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 234: Android: Display a list of acceptable values instead of a text entry for options that have such a... Message-Id: <20120718161713.20229.80978.launchpad@ackee.canonical.com> Date: Wed, 18 Jul 2012 16:17:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15637"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 5b6eb793efc8f310ac693e88b33deee65334476d X-Gm-Message-State: ALoCoQk6+Jcypng0GmidcdEOSURc+zzymNiI/x061hcPUB3joU6NQC19fmYs9D49SP9LwZqRoxgt Merge authors: Alexandros Frantzis (afrantzis) Related merge proposals: https://code.launchpad.net/~linaro-graphics-wg/glmark2/android-gui-options-finite-value-set/+merge/115499 proposed by: Alexandros Frantzis (afrantzis) review: Approve - Jesse Barker (jesse-barker) ------------------------------------------------------------ revno: 234 [merge] committer: Alexandros Frantzis branch nick: trunk timestamp: Wed 2012-07-18 19:06:30 +0300 message: Android: Display a list of acceptable values instead of a text entry for options that have such a list. modified: android/src/org/linaro/glmark2/EditorActivity.java android/src/org/linaro/glmark2/SceneInfo.java src/android.cpp --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'android/src/org/linaro/glmark2/EditorActivity.java' --- android/src/org/linaro/glmark2/EditorActivity.java 2012-07-10 09:44:06 +0000 +++ android/src/org/linaro/glmark2/EditorActivity.java 2012-07-18 09:46:21 +0000 @@ -56,7 +56,8 @@ public class EditorActivity extends Activity { public static final int DIALOG_SCENE_NAME_ID = 0; - public static final int DIALOG_SCENE_OPTION_ID = 1; + public static final int DIALOG_SCENE_OPTION_TEXT_ID = 1; + public static final int DIALOG_SCENE_OPTION_LIST_ID = 2; public static final int ITEM_POSITION_SCENE_NAME_HEADER = 0; public static final int ITEM_POSITION_SCENE_NAME = 1; @@ -117,10 +118,16 @@ Bundle bundle = new Bundle(); bundle.putInt("item-pos", position); /* Show the right dialog, depending on the clicked list position */ - if (position == ITEM_POSITION_SCENE_NAME) + if (position == ITEM_POSITION_SCENE_NAME) { showDialog(DIALOG_SCENE_NAME_ID, bundle); - else if (position >= ITEM_POSITION_SCENE_OPTION) - showDialog(DIALOG_SCENE_OPTION_ID, bundle); + } + else if (position >= ITEM_POSITION_SCENE_OPTION) { + String[] values = adapter.getItem(position).option.acceptableValues; + if (values.length == 0) + showDialog(DIALOG_SCENE_OPTION_TEXT_ID, bundle); + else + showDialog(DIALOG_SCENE_OPTION_LIST_ID, bundle); + } } }); @@ -161,7 +168,7 @@ } break; - case DIALOG_SCENE_OPTION_ID: + case DIALOG_SCENE_OPTION_TEXT_ID: { AlertDialog.Builder builder = new AlertDialog.Builder(this); final EditorItem item = adapter.getItem(itemPos); @@ -176,7 +183,7 @@ event.getAction() == KeyEvent.ACTION_UP)) { item.value = v.getText().toString(); - dismissDialog(DIALOG_SCENE_OPTION_ID); + dismissDialog(DIALOG_SCENE_OPTION_TEXT_ID); } return true; } @@ -192,6 +199,24 @@ } break; + case DIALOG_SCENE_OPTION_LIST_ID: + { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + final EditorItem item = adapter.getItem(itemPos); + builder.setTitle(item.option.name + ": " + item.option.description); + + builder.setItems(item.option.acceptableValues, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int index) { + item.value = item.option.acceptableValues[index]; + adapter.notifyDataSetChanged(); + dismissDialog(DIALOG_SCENE_OPTION_LIST_ID); + } + }); + + dialog = builder.create(); + } + break; + default: dialog = null; break; @@ -350,7 +375,7 @@ private ArrayList getSceneInfoList() { ArrayList l = new ArrayList(); SceneInfo customSceneInfo = new SceneInfo("__custom__"); - customSceneInfo.addOption("__custom__", "Custom benchmark string", ""); + customSceneInfo.addOption("__custom__", "Custom benchmark string", "", new String[0]); for (Parcelable p: getIntent().getParcelableArrayExtra("scene-info")) l.add((SceneInfo)p); === modified file 'android/src/org/linaro/glmark2/SceneInfo.java' --- android/src/org/linaro/glmark2/SceneInfo.java 2012-07-05 15:05:49 +0000 +++ android/src/org/linaro/glmark2/SceneInfo.java 2012-07-18 09:45:59 +0000 @@ -30,6 +30,7 @@ String name; String description; String defaultValue; + String[] acceptableValues; } public SceneInfo(String name) { @@ -37,11 +38,14 @@ this.options = new ArrayList