Example usage for android.util SparseArray SparseArray

List of usage examples for android.util SparseArray SparseArray

Introduction

In this page you can find the example usage for android.util SparseArray SparseArray.

Prototype

public SparseArray() 

Source Link

Document

Creates a new SparseArray containing no mappings.

Usage

From source file:com.joanzapata.android.BasePagerAdapter.java

/**
 * //from  w w w. j av  a 2 s  . c o  m
 * 
 * @param position
 * @param view
 */
private void put(int position, View view) {
    if (mViews == null)
        mViews = new SparseArray<View>();
    if (mViews.indexOfValue(view) == -1) {
        mViews.put(position, view);
    }
}

From source file:com.android.messaging.mmslib.util.PduCache.java

private PduCache() {
    mMessageBoxes = new SparseArray<HashSet<Uri>>();
    mThreads = new SimpleArrayMap<Long, HashSet<Uri>>();
    mUpdating = new HashSet<Uri>();
}

From source file:fr.cph.chicago.core.adapter.NearbyAdapter.java

public NearbyAdapter(@NonNull final Context context) {
    this.context = context.getApplicationContext();
    this.line1PaddingColor = (int) context.getResources()
            .getDimension(R.dimen.activity_station_stops_line1_padding_color);
    this.stopsPaddingTop = (int) context.getResources()
            .getDimension(R.dimen.activity_station_stops_padding_top);
    this.busStops = new ArrayList<>();
    this.busArrivals = new SparseArray<>();
    this.stations = new ArrayList<>();
    this.bikeStations = new ArrayList<>();
    this.trainArrivals = new SparseArray<>();
}

From source file:br.ufrgs.ufrgsmapas.views.BuildingClusterRenderer.java

public BuildingClusterRenderer(Context context, GoogleMap map, ClusterManager<MapPositionVo> clusterManager) {
    super(context, map, clusterManager);

    mContext = context;//from   w w w . j av  a2 s. co  m

    createMarkerBitmaps(mContext);

    this.mMap = map;
    this.mDensity = context.getResources().getDisplayMetrics().density;
    this.mIconGenerator = new IconGenerator(context);
    this.mIconGenerator.setContentView(this.makeSquareTextView(context));
    this.mIconGenerator.setTextAppearance(com.google.maps.android.R.style.ClusterIcon_TextAppearance);
    this.mIconGenerator.setBackground(this.makeClusterBackground());
    this.mIcons = new SparseArray<>();
    this.mClusterManager = clusterManager;

}

From source file:org.openbmap.activities.DialogPreferenceCatalogs.java

@Override
protected void onBindDialogView(View v) {
    super.onBindDialogView(v);
    groups = new SparseArray<>();
    ExpandableListView listView = (ExpandableListView) v.findViewById(R.id.list);
    mAdapter = new DialogPreferenceCatalogsListAdapter(getContext(), groups, this);
    listView.setAdapter(mAdapter);/*from  www .  j a v  a 2  s.  c o  m*/

    if (checkDialog == null || !checkDialog.isShowing()) {
        checkDialog = new ProgressDialog(getContext());
    }
    // retrieve online Catalogs
    GetAvailableCatalogsTask data = new GetAvailableCatalogsTask();
    data.execute();
}

From source file:com.stfalcon.frescoimageviewer.adapter.RecyclingPagerAdapter.java

@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;//from  w  w w.ja v  a 2 s . c  o m
        bundle.setClassLoader(loader);
        SparseArray<Parcelable> ss = bundle.containsKey(STATE) ? bundle.getSparseParcelableArray(STATE) : null;
        mSavedStates = ss != null ? ss : new SparseArray<Parcelable>();
    }
    super.restoreState(state, loader);
}

From source file:com.joanzapata.android.BasePagerAdapter.java

/**
 * ?//  ww w  . java2  s. c om
 * 
 * @return
 */
private View get(int position) {
    if (mViews == null)
        mViews = new SparseArray<View>();
    return mViews.get(position);
}

From source file:com.blueskyconnie.visitheritage.LocationMapFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    super.onCreateView(inflater, container, savedInstanceState);
    View rootView = (View) inflater.inflate(R.layout.fragment_location, null);
    mapView = (MapView) rootView.findViewById(R.id.mapView);

    String placeKey = getArguments().getString(Constants.PLACE_KEY);
    TextView tvArea = (TextView) rootView.findViewById(R.id.tvArea);
    tvArea.setText(placeKey);//from  ww  w.j  a  va  2  s.c  o  m

    lstPlace = getArguments().getParcelableArrayList(Constants.PLACES);
    hmNamePlace = new SparseArray<Place>();
    if (lstPlace != null) {
        for (Place place : lstPlace) {
            hmNamePlace.put(place.getId(), place);
        }
    }
    markerArray = new SparseArray<Marker>();
    return rootView;
}

From source file:org.openbmap.activities.DialogPreferenceMaps.java

@Override
protected void onBindDialogView(View v) {
    super.onBindDialogView(v);
    groups = new SparseArray<>();
    ExpandableListView listView = (ExpandableListView) v.findViewById(R.id.list);
    mAdapter = new DialogPreferenceMapsListAdapter(getContext(), groups, this);
    listView.setAdapter(mAdapter);/*from w w  w  .j  a  v a  2  s .  com*/

    if (checkDialog == null || !checkDialog.isShowing()) {
        checkDialog = new ProgressDialog(getContext());
    }
    // retrieve online maps
    GetAvailableMapsTask data = new GetAvailableMapsTask();
    data.execute();
}

From source file:com.sgu.findyourfriend.screen.InstructioActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_emergency);
    getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    setContentView(R.layout.instruction);

    final ImageButton btNext = (ImageButton) findViewById(R.id.button_ins_next);
    final ImageButton btBack = (ImageButton) findViewById(R.id.button_ins_back);
    final ImageButton btSkip = (ImageButton) findViewById(R.id.button_ins_skip);

    ins = new SparseArray<Fragment>();
    ins.append(0, new Ins_Main());
    ins.append(1, new Ins_Tsk_Main());
    ins.append(2, new Ins_Tsk_Map());
    ins.append(3, new Ins_Tsk_Msg());
    ins.append(4, new Ins_Tsk_Friend());
    ins.append(5, new Ins_Tsk_Setting());
    ins.append(6, new Ins_Tsk_Alert());
    ins.append(7, new Ins_Tsk_Friend_List());

    ins.append(8, new Ins_Add_Friend_Main());
    ins.append(9, new Ins_Add_Friend());

    ins.append(10, new Ins_Map_Icon());

    ins.append(11, new Ins_Friend_Shared_Main());
    ins.append(12, new Ins_Friend_Shared_0());
    ins.append(13, new Ins_Friend_Shared_1());
    ins.append(14, new Ins_Friend_Shared_2());
    ins.append(15, new Ins_Friend_Shared_3());
    ins.append(16, new Ins_Friend_Shared_4());
    ins.append(17, new Ins_Friend_Shared_5());
    ins.append(18, new Ins_Friend_Shared_6());
    ins.append(19, new Ins_Friend_Shared_7());

    ins.append(20, new Ins_Friend_Main());
    ins.append(21, new Ins_Friend_0());
    ins.append(22, new Ins_Friend_1());

    ins.append(23, new Ins_Me_Main());
    ins.append(24, new Ins_Me_0());
    ins.append(25, new Ins_End());

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    // transaction.setCustomAnimations(R.anim.enter, R.anim.exit,
    // R.anim.pop_enter, R.anim.pop_exit);
    transaction.addToBackStack(null);/*from w ww.j a v a  2  s . c o  m*/
    transaction.replace(R.id.container_framelayout, ins.get(0));
    transaction.commit();
    btBack.setEnabled(false);
    btBack.setAlpha(0.3f);

    OnClickListener btNextListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            if (idx < ins.size() - 1) {
                idx++;
                transaction.replace(R.id.container_framelayout, ins.get(idx));
                transaction.commit();
            }
            if (idx == ins.size() - 1) {
                btNext.setEnabled(false);
                btNext.setAlpha(0.3f);
                btSkip.setEnabled(false);
                btSkip.setAlpha(0.3f);
            }

            btBack.setEnabled(true);
            btBack.setAlpha(1.0f);
        }
    };

    OnClickListener btBackListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            if (idx > 0) {
                idx--;
                transaction.replace(R.id.container_framelayout, ins.get(idx));
                transaction.commit();
            }
            if (idx == 0) {
                btBack.setEnabled(false);
                btBack.setAlpha(0.3f);
            }

            btNext.setEnabled(true);
            btNext.setAlpha(1.0f);
            btSkip.setEnabled(true);
            btSkip.setAlpha(1.0f);

        }
    };

    OnClickListener btSkipListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            idx = ins.size() - 1;
            transaction.replace(R.id.container_framelayout, ins.get(idx));
            transaction.commit();

            btNext.setEnabled(false);
            btNext.setAlpha(0.3f);
            btSkip.setEnabled(false);
            btSkip.setAlpha(0.3f);
            btBack.setEnabled(true);
            btBack.setAlpha(1.0f);

        }
    };
    btNext.setOnClickListener(btNextListener);
    btBack.setOnClickListener(btBackListener);
    btSkip.setOnClickListener(btSkipListener);

}