Home | History | Annotate | Download | only in cts
      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 android.holo.cts;
     18 
     19 import android.content.Intent;
     20 
     21 import java.util.Iterator;
     22 
     23 class SingleThemeLayoutIterator implements Iterator<Intent> {
     24 
     25     private final int mThemeIndex;
     26     private final int mLayoutIndex;
     27     private final int mTask;
     28     private final int mLayoutAdapterMode;
     29 
     30     private boolean hasNext = true;
     31 
     32     SingleThemeLayoutIterator(int themeIndex, int layoutIndex, int task, int layoutAdapterMode) {
     33         mThemeIndex = themeIndex;
     34         mLayoutIndex = layoutIndex;
     35         mTask = task;
     36         mLayoutAdapterMode = layoutAdapterMode;
     37     }
     38 
     39     @Override
     40     public boolean hasNext() {
     41         return hasNext;
     42     }
     43 
     44     @Override
     45     public Intent next() {
     46         Intent intent = new Intent();
     47         intent.putExtra(LayoutTestActivity.EXTRA_THEME_INDEX, mThemeIndex);
     48         intent.putExtra(LayoutTestActivity.EXTRA_LAYOUT_INDEX, mLayoutIndex);
     49         intent.putExtra(LayoutTestActivity.EXTRA_TASK, mTask);
     50         intent.putExtra(LayoutTestActivity.EXTRA_LAYOUT_ADAPTER_MODE, mLayoutAdapterMode);
     51 
     52         hasNext = false;
     53 
     54         return intent;
     55     }
     56 
     57     @Override
     58     public void remove() {
     59         throw new UnsupportedOperationException("I can't let you do that...");
     60     }
     61 }
     62