Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.google.android.test.activity; |
| 18 | |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 19 | import java.util.ArrayList; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 20 | import java.util.List; |
| 21 | |
| 22 | import android.app.Activity; |
| 23 | import android.app.ActivityManager; |
Dianne Hackborn | 8a59b7f | 2012-01-09 12:05:26 -0800 | [diff] [blame] | 24 | import android.app.AlertDialog; |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 25 | import android.content.ActivityNotFoundException; |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 26 | import android.content.BroadcastReceiver; |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 27 | import android.content.ComponentName; |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 28 | import android.content.ContentProviderClient; |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 29 | import android.content.Intent; |
| 30 | import android.content.ServiceConnection; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 31 | import android.os.Bundle; |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 32 | import android.os.IBinder; |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 33 | import android.os.RemoteException; |
Dianne Hackborn | 79af1dd | 2012-08-16 16:42:52 -0700 | [diff] [blame] | 34 | import android.os.UserHandle; |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 35 | import android.os.UserManager; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 36 | import android.graphics.Bitmap; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 37 | import android.widget.ImageView; |
| 38 | import android.widget.LinearLayout; |
| 39 | import android.widget.TextView; |
| 40 | import android.widget.ScrollView; |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 41 | import android.widget.Toast; |
Dianne Hackborn | 8a59b7f | 2012-01-09 12:05:26 -0800 | [diff] [blame] | 42 | import android.view.Menu; |
| 43 | import android.view.MenuItem; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 44 | import android.view.View; |
| 45 | import android.content.Context; |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 46 | import android.content.pm.UserInfo; |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 47 | import android.content.res.Configuration; |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 48 | import android.util.Log; |
| 49 | |
| 50 | public class ActivityTestMain extends Activity { |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 51 | static final String TAG = "ActivityTest"; |
| 52 | |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 53 | static final String KEY_CONFIGURATION = "configuration"; |
| 54 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 55 | ActivityManager mAm; |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 56 | Configuration mOverrideConfig; |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 57 | int mSecondUser; |
| 58 | |
| 59 | ArrayList<ServiceConnection> mConnections = new ArrayList<ServiceConnection>(); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 60 | |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 61 | class BroadcastResultReceiver extends BroadcastReceiver { |
| 62 | @Override |
| 63 | public void onReceive(Context context, Intent intent) { |
| 64 | Bundle res = getResultExtras(true); |
| 65 | int user = res.getInt("user", -1); |
| 66 | Toast.makeText(ActivityTestMain.this, |
| 67 | "Receiver executed as user " |
| 68 | + (user >= 0 ? Integer.toString(user) : "unknown"), |
| 69 | Toast.LENGTH_LONG).show(); |
| 70 | } |
| 71 | } |
| 72 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 73 | private void addThumbnail(LinearLayout container, Bitmap bm, |
| 74 | final ActivityManager.RecentTaskInfo task, |
| 75 | final ActivityManager.TaskThumbnails thumbs, final int subIndex) { |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 76 | ImageView iv = new ImageView(this); |
| 77 | if (bm != null) { |
| 78 | iv.setImageBitmap(bm); |
| 79 | } |
| 80 | iv.setBackgroundResource(android.R.drawable.gallery_thumb); |
| 81 | int w = getResources().getDimensionPixelSize(android.R.dimen.thumbnail_width); |
| 82 | int h = getResources().getDimensionPixelSize(android.R.dimen.thumbnail_height); |
| 83 | container.addView(iv, new LinearLayout.LayoutParams(w, h)); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 84 | |
| 85 | iv.setOnClickListener(new View.OnClickListener() { |
| 86 | @Override |
| 87 | public void onClick(View v) { |
| 88 | if (task.id >= 0 && thumbs != null) { |
| 89 | if (subIndex < (thumbs.numSubThumbbails-1)) { |
| 90 | mAm.removeSubTask(task.id, subIndex+1); |
| 91 | } |
| 92 | mAm.moveTaskToFront(task.id, ActivityManager.MOVE_TASK_WITH_HOME); |
| 93 | } else { |
| 94 | try { |
| 95 | startActivity(task.baseIntent); |
| 96 | } catch (ActivityNotFoundException e) { |
| 97 | Log.w("foo", "Unable to start task: " + e); |
| 98 | } |
| 99 | } |
| 100 | buildUi(); |
| 101 | } |
| 102 | }); |
| 103 | iv.setOnLongClickListener(new View.OnLongClickListener() { |
| 104 | @Override |
| 105 | public boolean onLongClick(View v) { |
| 106 | if (task.id >= 0 && thumbs != null) { |
| 107 | if (subIndex < 0) { |
| 108 | mAm.removeTask(task.id, ActivityManager.REMOVE_TASK_KILL_PROCESS); |
| 109 | } else { |
| 110 | mAm.removeSubTask(task.id, subIndex); |
| 111 | } |
| 112 | buildUi(); |
| 113 | return true; |
| 114 | } |
| 115 | return false; |
| 116 | } |
| 117 | }); |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | @Override |
| 121 | protected void onCreate(Bundle savedInstanceState) { |
| 122 | super.onCreate(savedInstanceState); |
| 123 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 124 | mAm = (ActivityManager)getSystemService(ACTIVITY_SERVICE); |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 125 | if (savedInstanceState != null) { |
| 126 | mOverrideConfig = savedInstanceState.getParcelable(KEY_CONFIGURATION); |
| 127 | if (mOverrideConfig != null) { |
| 128 | applyOverrideConfiguration(mOverrideConfig); |
| 129 | } |
| 130 | } |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 131 | |
| 132 | UserManager um = (UserManager)getSystemService(Context.USER_SERVICE); |
| 133 | List<UserInfo> users = um.getUsers(); |
| 134 | mSecondUser = Integer.MAX_VALUE; |
| 135 | for (UserInfo ui : users) { |
| 136 | if (ui.id != 0 && mSecondUser > ui.id) { |
| 137 | mSecondUser = ui.id; |
| 138 | } |
| 139 | } |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 140 | } |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 141 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 142 | @Override |
Dianne Hackborn | 8a59b7f | 2012-01-09 12:05:26 -0800 | [diff] [blame] | 143 | public boolean onCreateOptionsMenu(Menu menu) { |
| 144 | menu.add("Animate!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 145 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 146 | AlertDialog.Builder builder = new AlertDialog.Builder(ActivityTestMain.this, |
| 147 | R.style.SlowDialog); |
| 148 | builder.setTitle("This is a title"); |
| 149 | builder.show(); |
| 150 | return true; |
| 151 | } |
| 152 | }); |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 153 | menu.add("Bind!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 154 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 155 | Intent intent = new Intent(ActivityTestMain.this, SingleUserService.class); |
| 156 | ServiceConnection conn = new ServiceConnection() { |
| 157 | @Override |
| 158 | public void onServiceConnected(ComponentName name, IBinder service) { |
| 159 | Log.i(TAG, "Service connected " + name + " " + service); |
| 160 | } |
| 161 | @Override |
| 162 | public void onServiceDisconnected(ComponentName name) { |
| 163 | Log.i(TAG, "Service disconnected " + name); |
| 164 | } |
| 165 | }; |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 166 | if (bindService(intent, conn, Context.BIND_AUTO_CREATE)) { |
| 167 | mConnections.add(conn); |
| 168 | } else { |
| 169 | Toast.makeText(ActivityTestMain.this, "Failed to bind", |
| 170 | Toast.LENGTH_LONG).show(); |
| 171 | } |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 172 | return true; |
| 173 | } |
| 174 | }); |
| 175 | menu.add("Start!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 176 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 177 | Intent intent = new Intent(ActivityTestMain.this, SingleUserService.class); |
| 178 | startService(intent); |
| 179 | return true; |
| 180 | } |
| 181 | }); |
| 182 | menu.add("Send!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 183 | @Override public boolean onMenuItemClick(MenuItem item) { |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 184 | Intent intent = new Intent(ActivityTestMain.this, SingleUserReceiver.class); |
Dianne Hackborn | f4bf0ae | 2013-05-20 18:42:16 -0700 | [diff] [blame] | 185 | sendOrderedBroadcast(intent, null, new BroadcastResultReceiver(), |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 186 | null, Activity.RESULT_OK, null, null); |
| 187 | return true; |
| 188 | } |
| 189 | }); |
| 190 | menu.add("Call!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 191 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 192 | ContentProviderClient cpl = getContentResolver().acquireContentProviderClient( |
| 193 | SingleUserProvider.AUTHORITY); |
| 194 | Bundle res = null; |
| 195 | try { |
| 196 | res = cpl.call("getuser", null, null); |
| 197 | } catch (RemoteException e) { |
| 198 | } |
| 199 | int user = res != null ? res.getInt("user", -1) : -1; |
| 200 | Toast.makeText(ActivityTestMain.this, |
| 201 | "Provider executed as user " |
| 202 | + (user >= 0 ? Integer.toString(user) : "unknown"), |
| 203 | Toast.LENGTH_LONG).show(); |
| 204 | cpl.release(); |
| 205 | return true; |
| 206 | } |
| 207 | }); |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 208 | menu.add("Send to user 0!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 209 | @Override public boolean onMenuItemClick(MenuItem item) { |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 210 | Intent intent = new Intent(ActivityTestMain.this, UserTarget.class); |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 211 | sendOrderedBroadcastAsUser(intent, new UserHandle(0), null, |
| 212 | new BroadcastResultReceiver(), |
| 213 | null, Activity.RESULT_OK, null, null); |
| 214 | return true; |
| 215 | } |
| 216 | }); |
| 217 | menu.add("Send to user " + mSecondUser + "!").setOnMenuItemClickListener( |
| 218 | new MenuItem.OnMenuItemClickListener() { |
| 219 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 220 | Intent intent = new Intent(ActivityTestMain.this, UserTarget.class); |
| 221 | sendOrderedBroadcastAsUser(intent, new UserHandle(mSecondUser), null, |
Dianne Hackborn | 5ac72a2 | 2012-08-29 18:32:08 -0700 | [diff] [blame] | 222 | new BroadcastResultReceiver(), |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 223 | null, Activity.RESULT_OK, null, null); |
Dianne Hackborn | b4163a6 | 2012-08-02 18:31:26 -0700 | [diff] [blame] | 224 | return true; |
| 225 | } |
| 226 | }); |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 227 | menu.add("Bind to user 0!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 228 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 229 | Intent intent = new Intent(ActivityTestMain.this, ServiceUserTarget.class); |
| 230 | ServiceConnection conn = new ServiceConnection() { |
| 231 | @Override |
| 232 | public void onServiceConnected(ComponentName name, IBinder service) { |
| 233 | Log.i(TAG, "Service connected " + name + " " + service); |
| 234 | } |
| 235 | @Override |
| 236 | public void onServiceDisconnected(ComponentName name) { |
| 237 | Log.i(TAG, "Service disconnected " + name); |
| 238 | } |
| 239 | }; |
Amith Yamasani | 45c0924 | 2013-01-16 16:04:00 -0800 | [diff] [blame] | 240 | if (bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE, UserHandle.OWNER)) { |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 241 | mConnections.add(conn); |
| 242 | } else { |
| 243 | Toast.makeText(ActivityTestMain.this, "Failed to bind", |
| 244 | Toast.LENGTH_LONG).show(); |
| 245 | } |
| 246 | return true; |
| 247 | } |
| 248 | }); |
| 249 | menu.add("Bind to user " + mSecondUser + "!").setOnMenuItemClickListener( |
| 250 | new MenuItem.OnMenuItemClickListener() { |
| 251 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 252 | Intent intent = new Intent(ActivityTestMain.this, ServiceUserTarget.class); |
| 253 | ServiceConnection conn = new ServiceConnection() { |
| 254 | @Override |
| 255 | public void onServiceConnected(ComponentName name, IBinder service) { |
| 256 | Log.i(TAG, "Service connected " + name + " " + service); |
| 257 | } |
| 258 | @Override |
| 259 | public void onServiceDisconnected(ComponentName name) { |
| 260 | Log.i(TAG, "Service disconnected " + name); |
| 261 | } |
| 262 | }; |
Amith Yamasani | 45c0924 | 2013-01-16 16:04:00 -0800 | [diff] [blame] | 263 | if (bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE, |
| 264 | new UserHandle(mSecondUser))) { |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 265 | mConnections.add(conn); |
| 266 | } else { |
| 267 | Toast.makeText(ActivityTestMain.this, "Failed to bind", |
| 268 | Toast.LENGTH_LONG).show(); |
| 269 | } |
| 270 | return true; |
| 271 | } |
| 272 | }); |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 273 | menu.add("Density!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 274 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 275 | if (mOverrideConfig == null) { |
| 276 | mOverrideConfig = new Configuration(); |
| 277 | } |
| 278 | if (mOverrideConfig.densityDpi == Configuration.DENSITY_DPI_UNDEFINED) { |
| 279 | mOverrideConfig.densityDpi = (getApplicationContext().getResources() |
| 280 | .getConfiguration().densityDpi*2)/3; |
| 281 | } else { |
| 282 | mOverrideConfig.densityDpi = Configuration.DENSITY_DPI_UNDEFINED; |
| 283 | } |
| 284 | recreate(); |
| 285 | return true; |
| 286 | } |
| 287 | }); |
Dianne Hackborn | f4bf0ae | 2013-05-20 18:42:16 -0700 | [diff] [blame] | 288 | menu.add("HashArray").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { |
| 289 | @Override public boolean onMenuItemClick(MenuItem item) { |
| 290 | ArrayMapTests.run(); |
| 291 | return true; |
| 292 | } |
| 293 | }); |
Dianne Hackborn | 8a59b7f | 2012-01-09 12:05:26 -0800 | [diff] [blame] | 294 | return true; |
| 295 | } |
| 296 | |
| 297 | @Override |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 298 | protected void onStart() { |
| 299 | super.onStart(); |
| 300 | buildUi(); |
| 301 | } |
| 302 | |
Dianne Hackborn | 756220b | 2012-08-14 16:45:30 -0700 | [diff] [blame] | 303 | @Override |
| 304 | protected void onSaveInstanceState(Bundle outState) { |
| 305 | super.onSaveInstanceState(outState); |
| 306 | if (mOverrideConfig != null) { |
| 307 | outState.putParcelable(KEY_CONFIGURATION, mOverrideConfig); |
| 308 | } |
| 309 | } |
| 310 | |
Dianne Hackborn | 3992645 | 2012-09-25 14:53:52 -0700 | [diff] [blame] | 311 | @Override |
| 312 | protected void onStop() { |
| 313 | super.onStop(); |
| 314 | for (ServiceConnection conn : mConnections) { |
| 315 | unbindService(conn); |
| 316 | } |
| 317 | mConnections.clear(); |
| 318 | } |
| 319 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 320 | private View scrollWrap(View view) { |
| 321 | ScrollView scroller = new ScrollView(this); |
| 322 | scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, |
| 323 | ScrollView.LayoutParams.MATCH_PARENT)); |
| 324 | return scroller; |
| 325 | } |
| 326 | |
| 327 | private void buildUi() { |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 328 | LinearLayout top = new LinearLayout(this); |
| 329 | top.setOrientation(LinearLayout.VERTICAL); |
| 330 | |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 331 | List<ActivityManager.RecentTaskInfo> recents = mAm.getRecentTasks(10, |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 332 | ActivityManager.RECENT_WITH_EXCLUDED); |
| 333 | if (recents != null) { |
| 334 | for (int i=0; i<recents.size(); i++) { |
| 335 | ActivityManager.RecentTaskInfo r = recents.get(i); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 336 | ActivityManager.TaskThumbnails tt = mAm.getTaskThumbnails(r.persistentId); |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 337 | TextView tv = new TextView(this); |
| 338 | tv.setText(r.baseIntent.getComponent().flattenToShortString()); |
| 339 | top.addView(tv, new LinearLayout.LayoutParams( |
| 340 | LinearLayout.LayoutParams.WRAP_CONTENT, |
| 341 | LinearLayout.LayoutParams.WRAP_CONTENT)); |
| 342 | LinearLayout item = new LinearLayout(this); |
| 343 | item.setOrientation(LinearLayout.HORIZONTAL); |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 344 | addThumbnail(item, tt != null ? tt.mainThumbnail : null, r, tt, -1); |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 345 | for (int j=0; j<tt.numSubThumbbails; j++) { |
Dianne Hackborn | 0c5001d | 2011-04-12 18:16:08 -0700 | [diff] [blame] | 346 | addThumbnail(item, tt.getSubThumbnail(j), r, tt, j); |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 347 | } |
| 348 | top.addView(item, new LinearLayout.LayoutParams( |
| 349 | LinearLayout.LayoutParams.WRAP_CONTENT, |
| 350 | LinearLayout.LayoutParams.WRAP_CONTENT)); |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | setContentView(scrollWrap(top)); |
| 355 | } |
Dianne Hackborn | f26fd99 | 2011-04-08 18:14:09 -0700 | [diff] [blame] | 356 | } |