예제 #1
0
  private TnPopupContainer createNoGPSWarning(int state) {
    ResourceBundle bundle = ResourceManager.getInstance().getCurrentBundle();
    String noGps = bundle.getString(IStringCommon.RES_GPS_ERROR, IStringCommon.FAMILY_COMMON);

    TnMenu menu = UiFactory.getInstance().createMenu();

    String cancel = bundle.getString(IStringCommon.RES_BTTN_OK, IStringCommon.FAMILY_COMMON);
    menu.add(cancel, CMD_COMMON_BACK);

    FrogMessageBox messageBox = UiFactory.getInstance().createMessageBox(state, noGps, menu);
    return messageBox;
  }
예제 #2
0
  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;
  }