コード例 #1
0
 public static AddressWrapper createAddressWrapper(final Address address, final String title) {
   final AddressWrapper wrapper = new AddressWrapper();
   wrapper.title = title;
   wrapper.address = address;
   wrapper.locateMe = false;
   return wrapper;
 }
コード例 #2
0
  @Override
  public View getView(final int position, final View convertView, final ViewGroup parent) {
    final TextView view = (TextView) super.getView(position, convertView, parent);

    final AddressWrapper item = getItem(position);
    view.setText(item.getTitle());

    if (item.isLocateMe()) {
      view.setTextColor(mHoloBlueColor);
      view.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_locate_selector, 0, 0, 0);
      view.setCompoundDrawablePadding(mPadding);
    } else {
      view.setTextColor(mTextColorColor);
      view.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    }

    return view;
  }
コード例 #3
0
  public AddressArrayAdapter(final Context context) {
    super(context, android.R.layout.simple_dropdown_item_1line);
    mGeocoder = new Geocoder(context);
    mCurrenPositionWrapper =
        AddressWrapper.createLocateMe(context.getString(R.string.itineraire_current_location));
    mHoloBlueColor = context.getResources().getColorStateList(R.color.card_selectable_text);
    mTextColorColor = context.getResources().getColorStateList(android.R.color.primary_text_light);
    mPadding = context.getResources().getDimensionPixelSize(R.dimen.padding_small);

    add(mCurrenPositionWrapper);
  }
コード例 #4
0
 public static AddressWrapper createLocateMe(final String title) {
   final AddressWrapper wrapper = new AddressWrapper();
   wrapper.title = title;
   wrapper.locateMe = true;
   return wrapper;
 }