@Override
 public void onLoadMore() {
   if (placeList != null && this.model.getState() == STATE_MAIN) {
     AndroidCitizenUiHelper.triggerCommand(
         AddPlaceViewTouch.this, placeList, IAddPlaceConstants.CMD_GETTING_MORE);
   }
 }
 private View CreateNewCategoryItem() {
   Context context = AndroidPersistentContext.getInstance().getContext();
   View newCategoryButton =
       LayoutInflater.from(context).inflate(R.layout.add_place_new_category, null);
   AndroidCitizenUiHelper.setOnClickCommand(this, newCategoryButton, CMD_ADD_CATEGORY);
   return newCategoryButton;
 }
  @SuppressWarnings("deprecation")
  protected TnScreen createAddPlaceMainScreen(int state) {
    int type = this.model.getInt(KEY_I_PLACE_OPERATION_TYPE);
    CitizenScreen screen = UiFactory.getInstance().createScreen(state);
    addPlaceMainView = AndroidCitizenUiHelper.addContentView(screen, R.layout.add_place_main);

    Drawable bgImage = new AssetsImageDrawable(NinePatchImageDecorator.FTUE_BG_UNFOCUSED);
    addPlaceMainView.setBackgroundDrawable(bgImage);

    TextView title = (TextView) addPlaceMainView.findViewById(R.id.commonTitle0TextView);
    title.setText(getScreenMainResource(state, type));

    TextView promptLabel = (TextView) addPlaceMainView.findViewById(R.id.addplace_prompt_label);
    promptLabel.setText(getPromptLableResource(type));

    final PoiDataWrapper poiDataWrapper = (PoiDataWrapper) model.get(KEY_O_POI_DATA_WRAPPER);
    placeListAdapter =
        new PlaceListAdapter(addPlaceMainView.getContext(), poiDataWrapper.getPublisher());
    placeList = (TnListView) addPlaceMainView.findViewById(R.id.addplaceListView);
    placeList.addHeaderView(createCurrentLocationItem());
    placeList.setPullRefreshEnable(false);
    placeList.setHitBottomLoadEnable(poiDataWrapper.getAnchorStop() != null);
    placeList.setAdapter(placeListAdapter);
    placeList.setTnListViewListener(this);

    placeList.setOnItemClickListener(
        new OnItemClickListener() {

          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Address address = null;
            Context context = AndroidPersistentContext.getInstance().getContext();
            if (view == currentLocationItem
                && !currentLocationItem
                    .getLastLine()
                    .equals(context.getString(R.string.addplace_current_location_loading))) {
              address = (Address) AddPlaceViewTouch.this.model.get(KEY_O_CURRENT_ADDRESS);
              if (address == null) {
                address = new Address();
                address.setStop(poiDataWrapper.getAnchorStop());
              }
              KontagentLogger.getInstance()
                  .addCustomEvent(
                      KontagentLogger.CATEGORY_CHOOSE_PLACE,
                      KontagentLogger.CHOOSEPLACE_CURRENT_LOCATION_CLICKED);
            } else if (position >= placeList.getHeaderViewsCount()
                && position < placeList.getHeaderViewsCount() + poiDataWrapper.getAddressSize()) {
              poiDataWrapper.setSelectedIndex(position - placeList.getHeaderViewsCount());
              address = poiDataWrapper.getSelectedAddress();
              KontagentLogger.getInstance()
                  .addCustomEvent(
                      KontagentLogger.CATEGORY_CHOOSE_PLACE,
                      KontagentLogger.CHOOSEPLACE_OTHER_PLACE_CLICKED);
            }
            if (address != null) {
              AddPlaceViewTouch.this.model.put(KEY_O_SELECTED_ADDRESS, address);
              AndroidCitizenUiHelper.triggerCommand(AddPlaceViewTouch.this, view, CMD_SELECT_ITEM);
            }
          }
        });
    return screen;
  }
  private TnScreen createCustomAddressScreen(int state) {
    int type = this.model.getInt(KEY_I_PLACE_OPERATION_TYPE);
    Address address = (Address) this.model.get(KEY_O_SELECTED_ADDRESS);

    final Context context = AndroidPersistentContext.getInstance().getContext();
    CitizenScreen screen = UiFactory.getInstance().createScreen(state);
    addPlaceCustomView = AndroidCitizenUiHelper.addContentView(screen, R.layout.add_place_custom);
    if (address == null) {
      return screen;
    }

    TextView title = (TextView) addPlaceCustomView.findViewById(R.id.commonTitle0TextView);
    title.setText(getScreenMainResource(state, type));
    Button doneButton = (Button) addPlaceCustomView.findViewById(R.id.commonTitle0TextButton);
    doneButton.setText(R.string.addplace_custom_done);
    doneButton.setVisibility(View.VISIBLE);
    AndroidCitizenUiHelper.setOnClickCommand(this, doneButton, CMD_CUSTOM_PLACE_DONE);

    ImageView icon = (ImageView) addPlaceCustomView.findViewById(R.id.addplaceCustomIcon);
    icon.setBackgroundResource(R.drawable.list_icon_see_all_unfocused);
    Poi poi = address.getPoi();
    if (poi != null && poi.getBizPoi() != null) {
      BizPoi bizPoi = poi.getBizPoi();
      if (bizPoi.getCategoryLogo() != null && bizPoi.getCategoryLogo().length() > 0) {
        int iconId =
            context
                .getResources()
                .getIdentifier(
                    bizPoi.getCategoryLogo(),
                    "drawable",
                    AndroidPersistentContext.getInstance().getContext().getPackageName());
        if (iconId != 0) {
          icon.setBackgroundResource(iconId);
        }
      }
    }

    this.model.put(KEY_S_PLACE_LABEL, address.getLabel());
    ViewGroup editAddressViewGroup =
        (ViewGroup) addPlaceCustomView.findViewById(R.id.addplaceCustomFilterContainer);
    addAddressEditView(editAddressViewGroup);
    if (type == ICommonConstants.PLACE_OPERATION_TYPE_EDIT
        || type == ICommonConstants.PLACE_OPERATION_TYPE_ADD) {
      addressEditView.requestFocus();
    }

    TextView firstLineView =
        (TextView) addPlaceCustomView.findViewById(R.id.addplaceCustomFirstLine);
    TextView secondLineView =
        (TextView) addPlaceCustomView.findViewById(R.id.addplaceCustomSecondLine);
    String displayText = address.getDisplayedText();

    if (displayText == null
        || displayText.length() == 0
        || containsLatLon(displayText)) // Unkown address just with lat/lon
    {
      ResourceBundle bundle = ResourceManager.getInstance().getCurrentBundle();
      addressEditView.setText(
          bundle.getString(IStringDashboard.RES_STRING_UNKNOWN, IStringDashboard.FAMILY_DASHBOARD));
      firstLineView.setText(
          context.getString(
              R.string.addplace_location_info,
              address.getStop().getLat() / 100000.0d,
              address.getStop().getLon() / 100000.0d));
    } else {
      addressEditView.setText(address.getLabel());
      firstLineView.setText(address.getStop().getFirstLine());
    }
    secondLineView.setText(
        ResourceManager.getInstance().getStringConverter().convertSecondLine(address.getStop()));

    categoryListAdapter = new CustomPlaceCategoryAdapter(addPlaceCustomView.getContext());
    categoryList = (ListView) addPlaceCustomView.findViewById(R.id.addplaceCustomCategoryList);
    categoryList.setOnScrollListener(
        new OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            resetKeyboard();
          }
        });
    categoryList.setItemsCanFocus(false);
    categoryList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    categoryList.addFooterView(CreateNewCategoryItem());
    categoryList.setAdapter(categoryListAdapter);
    categoryList.setDivider(null);
    int selectedIndex = this.model.getInt(KEY_I_SELECTED_CATEGORY_INDEX);
    categoryList.setItemChecked(selectedIndex + categoryList.getHeaderViewsCount() + 1, true);
    return screen;
  }