Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: platform_tools/android/app/src/com/skia/SkiaSampleActivity.java

Issue 1136753003: Add android_launch_app script to allow command line options to be passed to the sampleApp when star… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 package com.skia; 8 package com.skia;
9 9
10 import android.app.ActionBar; 10 import android.app.ActionBar;
11 import android.app.Activity; 11 import android.app.Activity;
12 import android.app.DownloadManager; 12 import android.app.DownloadManager;
13 import android.content.Intent;
13 import android.content.Context; 14 import android.content.Context;
14 import android.os.Build; 15 import android.os.Build;
15 import android.os.Bundle; 16 import android.os.Bundle;
16 import android.os.Handler; 17 import android.os.Handler;
17 import android.os.Message; 18 import android.os.Message;
18 import android.view.KeyEvent; 19 import android.view.KeyEvent;
19 import android.view.Menu; 20 import android.view.Menu;
20 import android.view.MenuItem; 21 import android.view.MenuItem;
21 import android.view.ViewGroup; 22 import android.view.ViewGroup;
22 import android.widget.ArrayAdapter; 23 import android.widget.ArrayAdapter;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 59 }
59 } 60 }
60 61
61 private void createSampleView(boolean useOpenGLAPI, int msaaSampleCount) { 62 private void createSampleView(boolean useOpenGLAPI, int msaaSampleCount) {
62 if (mSampleView != null) { 63 if (mSampleView != null) {
63 ViewGroup viewGroup = (ViewGroup) mSampleView.getParent(); 64 ViewGroup viewGroup = (ViewGroup) mSampleView.getParent();
64 viewGroup.removeView(mSampleView); 65 viewGroup.removeView(mSampleView);
65 mSampleView.terminate(); 66 mSampleView.terminate();
66 } 67 }
67 68
68 mSampleView = new SkiaSampleView(this, useOpenGLAPI, msaaSampleCount); 69 // intent get intent extras if triggered from the command line
70 Intent intent = this.getIntent();
71 String flags = intent.getStringExtra("cmdLineFlags");
72
73 if (flags == null || flags.isEmpty()) {
74 flags = "--pictureDir /data/local/tmp/skia_skp ";
75 flags += "--resourcePath /data/local/tmp/skia_resources ";
76 }
77
78 mSampleView = new SkiaSampleView(this, flags, useOpenGLAPI, msaaSampleCo unt);
69 LinearLayout holder = (LinearLayout) findViewById(R.id.holder); 79 LinearLayout holder = (LinearLayout) findViewById(R.id.holder);
70 holder.addView(mSampleView, new LinearLayout.LayoutParams( 80 holder.addView(mSampleView, new LinearLayout.LayoutParams(
71 ViewGroup.LayoutParams.MATCH_PARENT, 81 ViewGroup.LayoutParams.MATCH_PARENT,
72 ViewGroup.LayoutParams.MATCH_PARENT)); 82 ViewGroup.LayoutParams.MATCH_PARENT));
73 } 83 }
74 84
75 private void setupActionBar() { 85 private void setupActionBar() {
76 ActionBar.OnNavigationListener navigationCallback = new ActionBar.OnNavi gationListener() { 86 ActionBar.OnNavigationListener navigationCallback = new ActionBar.OnNavi gationListener() {
77 @Override 87 @Override
78 public boolean onNavigationItemSelected(int position, long itemId) { 88 public boolean onNavigationItemSelected(int position, long itemId) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 mSampleView.getMSAASampleCount() == requestedSampleCount && 270 mSampleView.getMSAASampleCount() == requestedSampleCount &&
261 mSampleView.getUsesOpenGLAPI() == requestedOpenGLAPI) { 271 mSampleView.getUsesOpenGLAPI() == requestedOpenGLAPI) {
262 return true; 272 return true;
263 } 273 }
264 274
265 createSampleView(requestedOpenGLAPI, requestedSampleCount); 275 createSampleView(requestedOpenGLAPI, requestedSampleCount);
266 276
267 return true; 277 return true;
268 } 278 }
269 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698