/**
   * Style view for line
   *
   * @param line
   * @param view
   */
  public void updateColors(final CharSequence line, final TextView view) {
    if (TextUtils.isEmpty(line)) {
      view.setBackgroundResource(R.drawable.list_item_background);
      view.setTextColor(defaultColor);
      return;
    }

    switch (line.charAt(0)) {
      case '@':
        view.setBackgroundResource(R.drawable.diff_marker_background);
        view.setTextColor(markerColor);
        return;
      case '+':
        view.setBackgroundResource(R.drawable.diff_add_background);
        view.setTextColor(defaultColor);
        return;
      case '-':
        view.setBackgroundResource(R.drawable.diff_remove_background);
        view.setTextColor(defaultColor);
        return;
      default:
        view.setBackgroundResource(R.drawable.list_item_background);
        view.setTextColor(defaultColor);
    }
  }
 /** 促销列表 */
 private void initPromotionList() {
   List<Promotion> promotionList = product.getPromotionList();
   if (null == promotionList) {
     return;
   }
   for (Promotion promotion : promotionList) {
     if (null == promotion) {
       continue;
     }
     View view = getLayoutInflater().inflate(R.layout.item_product_promotion_list, null);
     TextView type = (TextView) view.findViewById(R.id.item_product_promotin_list_type);
     if ("0".equals(promotion.getType())) {
       type.setText("满减");
       type.setBackgroundResource(R.drawable.promotion_type_full_cut);
     }
     if ("1".equals(promotion.getType())) {
       type.setText("满包邮");
       type.setBackgroundResource(R.drawable.promotion_type_full_baoyou);
     }
     if ("2".equals(promotion.getType())) {
       type.setBackgroundResource(R.drawable.promotion_type_full_cut);
     }
     TextView desc = (TextView) view.findViewById(R.id.item_product_promotin_list_desc);
     desc.setText(promotion.getDesc());
     llytPromotionList.addView(view);
   }
 }
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    if (row == null) {
      LayoutInflater inflater =
          (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = inflater.inflate(layoutId, parent, false);
    }
    messageContainer = (LinearLayout) row.findViewById(R.id.singleMessageContainer);
    PikachuMessage message = getItem(position);
    String messageStr = message.getMsg();
    singleMessage = (TextView) row.findViewById(R.id.singleMessage);

    processMessage(message.getMsg());

    //		singleMessage.setText(messageStr);
    if (message
        .getUser()
        .getUsername()
        .equals(((MyApplication) context.getApplication()).user.getUsername())) {
      singleMessage.setBackgroundResource(R.drawable.bubble_a);
      messageContainer.setGravity(Gravity.RIGHT);
    } else {
      singleMessage.setBackgroundResource(R.drawable.bubble_b);
      messageContainer.setGravity(Gravity.LEFT);
    }
    return row;
  }
 @Override
 public void handleMsg(Message msg) {
   String json = msg.getData().getString(Constant.JSON_DATA);
   if (TextUtils.equals(getString(R.string.try_agin), json)) {
     MethodUtils.showToast(this, getResources().getString(R.string.try_agin), Toast.LENGTH_SHORT);
     setRefreFalse();
     return;
   }
   switch (msg.what) {
     case TAG_DETAIL_BUSSINESS:
       currentData = JosnUtil.gson.fromJson(json, type);
       if (currentData == null) {
         break;
       }
       if (TextUtils.equals("0", currentData.getResult())) {
         MethodUtils.showToast(
             this, getResources().getString(R.string.try_agin), Toast.LENGTH_SHORT);
         setRefreFalse();
         break;
       }
       if (TextUtils.equals(currentData.getDetail().getStatusvalue(), "-1")) {
         progress.setBackgroundResource(R.mipmap.dark_red_bg);
       } else if (TextUtils.equals(currentData.getDetail().getStatusvalue(), "200")) {
         progress.setBackgroundResource(R.drawable.green_bg);
       } else {
         progress.setBackgroundResource(R.mipmap.dark_blue_bg);
       }
       title.setText(currentData.getDetail().getTitle());
       time.setText(MethodUtils.returnTime(currentData.getDetail().getCreatedate()));
       progress.setText(currentData.getDetail().getStatus());
       yewuNumber.setText(currentData.getDetail().getContractid());
       hetongNumber.setText(currentData.getDetail().getBusinessid());
       writeNumber.setText(MethodUtils.returnTime(currentData.getDetail().getCreatedate()));
       writePeople.setText(currentData.getDetail().getCusname());
       if (TextUtils.equals(
           MyApplication.getInstance().getUserInfor().getUserdetail().getSid(), data.getSid())) {
         if (!TextUtils.isEmpty(currentData.getDetail().getRefereename())) {
           recommentName.setText(currentData.getDetail().getRefereename());
         }
         if (!TextUtils.isEmpty(currentData.getDetail().getRefereeamount())) {
           reCommentPrice.setText(
               new DecimalFormat("0.00")
                   .format(Double.valueOf(currentData.getDetail().getRefereeamount())));
         }
         if (!TextUtils.isEmpty(currentData.getDetail().getAmount())) {
           totalPrice.setText(
               new DecimalFormat("0.00")
                   .format(Double.valueOf(currentData.getDetail().getAmount())));
         }
         if (!TextUtils.isEmpty(currentData.getDetail().getSaleamount())) {
           price.setText(
               new DecimalFormat("0.00")
                   .format(Double.valueOf(currentData.getDetail().getSaleamount())));
         }
         content = currentData.getDetail().getText();
       }
       setRefreFalse();
       break;
   }
 }
  public void bindView(Cursor cursor) {
    // Reinflate layout
    removeAllViewsInLayout();
    View view = LayoutInflater.from(getContext()).inflate(R.layout.sets_table, this);

    TableRow tableRowWeight = (TableRow) view.findViewById(R.id.tableRowWeight);
    TableRow tableRowReps = (TableRow) view.findViewById(R.id.tableRowReps);

    if (cursor != null && cursor.moveToFirst()) {
      do {
        TextView textViewWeight = new TextView(getContext());
        TextView textViewReps = new TextView(getContext());

        textViewWeight.setBackgroundResource(R.drawable.cell_right_border);
        textViewReps.setBackgroundResource(R.drawable.cell_right_top_border);

        textViewWeight.setPadding(4, 0, 5, 0);
        textViewReps.setPadding(4, 0, 5, 0);

        textViewWeight.setGravity(Gravity.CENTER_HORIZONTAL);
        textViewReps.setGravity(Gravity.CENTER_HORIZONTAL);

        tableRowWeight.addView(textViewWeight);
        tableRowReps.addView(textViewReps);

        // Bind data
        float weight = cursor.getFloat(cursor.getColumnIndex(Sets.WEIGHT));
        String reps = cursor.getString(cursor.getColumnIndex(Sets.REPS));

        textViewWeight.setText(SetUtils.weightFormat(weight));
        textViewReps.setText(reps);
      } while (cursor.moveToNext());
    }
  }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.new_two_find:
        if (current == 0) {
          return;
        }
        current = 0;
        fm.beginTransaction().replace(R.id.new_two_frameLayout, list.get(current)).commit();
        tv_find.setBackgroundResource(R.drawable.corners_left_bg_red);
        tv_find.setTextColor(Color.WHITE);
        tv_ranking.setBackgroundResource(R.drawable.corners_right_bg_white);
        tv_ranking.setTextColor(Color.BLACK);
        break;
      case R.id.new_two_ranking:
        if (current == 1) {
          return;
        }
        current = 1;
        fm.beginTransaction().replace(R.id.new_two_frameLayout, list.get(current)).commit();
        tv_find.setBackgroundResource(R.drawable.corners_left_bg_white);
        tv_find.setTextColor(Color.BLACK);
        tv_ranking.setBackgroundResource(R.drawable.corners_right_bg_red);
        tv_ranking.setTextColor(Color.WHITE);
        break;
      case R.id.new_tow_back:
        ((NewMainActivity) getActivity()).switchFragment(0);
        break;

      default:
        break;
    }
  }
Beispiel #7
0
 private void changeBtnBg(TextView showTextView) {
   btn_qyjs.setBackgroundResource(R.color.gary_bg_btn);
   btn_gsxx.setBackgroundResource(R.color.gary_bg_btn);
   btn_rytp.setBackgroundResource(R.color.gary_bg_btn);
   btn_lxwm.setBackgroundResource(R.color.gary_bg_btn);
   showTextView.setBackgroundResource(R.drawable.bg_white_red);
 }
Beispiel #8
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.login_number:
       iv_code.setVisibility(View.GONE);
       iv_password.setImageResource(R.drawable.icon_pwd);
       login_number.setBackgroundResource(R.drawable.background_view_green_left);
       login_Code.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.white));
       login_Code.setTextColor(getResources().getColor(R.color.black));
       type = "number";
       break;
     case R.id.login_Code:
       iv_code.setVisibility(View.VISIBLE);
       iv_password.setImageResource(R.drawable.icon_code);
       login_Code.setBackgroundResource(R.drawable.background_view_green_right);
       login_number.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.black));
       login_Code.setTextColor(getResources().getColor(R.color.white));
       passwordEditText.setHint("验证码为4位数字");
       type = "code";
       break;
     case R.id.iv_code:
       currentUsername = usernameEditText.getText().toString().trim();
       Log.e("username", currentUsername);
       if (!currentUsername.equals("") && currentUsername != null) {
         registercode(currentUsername);
       } else {
         Toast.makeText(context, "请输入手机号码", Toast.LENGTH_SHORT).show();
       }
       break;
   }
 }
  @Override
  public void onPageSelected(int arg0) {
    // TODO Auto-generated method stub
    switch (arg0) {
      case 0:
        tabHonor.setTextColor(Color.WHITE);
        tabHonor.setBackgroundResource(R.drawable.tab_left_b);

        tabBaseInfo.setTextColor(Color.BLACK);
        tabBaseInfo.setBackgroundResource(R.drawable.tab_right);
        break;

      case 1:
        tabHonor.setTextColor(Color.BLACK);
        tabHonor.setBackgroundResource(R.drawable.tab_left);

        tabBaseInfo.setTextColor(Color.WHITE);
        tabBaseInfo.setBackgroundResource(R.drawable.tab_right_b);

        break;

      default:
        break;
    }
  }
 @OnClick({R.id.mid_left_ys, R.id.mid_right_yy})
 public void midIcon(TextView textView) {
   if (tempTv != textView)
     if (textView.getId() == R.id.mid_left_ys) {
       midLeftText.setTextColor(getResources().getColor(R.color.white));
       midLeftText.setBackgroundResource(R.drawable.bg_tab_left_hl);
       midRightText.setTextColor(getResources().getColor(R.color.global_title_color));
       midRightText.setBackgroundResource(R.drawable.bg_tab_right);
       tempTv = midLeftText;
       NetworkAPI.getNetworkAPI()
           .chuzhenbydoc(
               getApp().getLongitude() + "",
               getApp().getLatitude() + "",
               showProgressDialog(),
               this);
     } else {
       midLeftText.setTextColor(getResources().getColor(R.color.global_title_color));
       midLeftText.setBackgroundResource(R.drawable.bg_tab_left);
       midRightText.setTextColor(getResources().getColor(R.color.white));
       midRightText.setBackgroundResource(R.drawable.bg_tab_right_hl);
       tempTv = midRightText;
       NetworkAPI.getNetworkAPI()
           .nearbyhosp(
               getApp().getLongitude() + "",
               getApp().getLatitude() + "",
               showProgressDialog(),
               this);
     }
 }
 @Override
 public void afterTextChanged(Editable s) {
   if (collegeField.getText().toString().trim().length() > 0
       && graduationDateField.getText().toString().trim().length() > 0) {
     informationSubmitButton.setBackgroundResource(R.drawable.orange_round_box);
   } else {
     informationSubmitButton.setBackgroundResource(R.drawable.grey_round_box);
   }
 }
 private void toggleMicro() {
   LinphoneCore lc = LinphoneManager.getLc();
   isMicMuted = !isMicMuted;
   lc.muteMic(isMicMuted);
   if (isMicMuted) {
     micro.setBackgroundResource(R.drawable.micro_off);
   } else {
     micro.setBackgroundResource(R.drawable.micro_on);
   }
 }
Beispiel #13
0
  private void showMessage(Message message) {
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);

    params.setMargins(0, 0, 0, 20);

    TextView textView = new TextView(ChatActivity.this);

    String nameSender;

    if (message.getReceiver() != user.getID()) {
      params.gravity = Gravity.RIGHT;
      textView.setBackgroundResource(R.drawable.message_1);

      nameSender = user.getNick();
    } else {
      params.gravity = Gravity.LEFT;
      textView.setBackgroundResource(R.drawable.message_2);

      nameSender =
          User.getInstance()
              .getFriendsHashMap()
              .get(String.valueOf(message.getIdFriend()))
              .getNick();
    }

    String text =
        "<font color=#161F89><small><b>"
            + nameSender
            + ":"
            + "</b></small></font><br/>"
            + message.getText();

    textView.setText(Html.fromHtml(text));

    textView.setLayoutParams(params);
    messagesLayout.addView(textView);

    textView.setPadding(16, 16, 16, 16);
    textView.setTextSize(16);

    keyboard.setText("");
    try {
      scrollView.post(
          new Runnable() {
            @Override
            public void run() {
              scrollView.fullScroll(View.FOCUS_DOWN);
            }
          });
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 @Override
 public void handleMessage(Message msg) {
   super.handleMessage(msg);
   if (msg.what == 0) {
     mTxtGetCheck.setText("获取验证码");
     mTxtGetCheck.setBackgroundResource(R.drawable.register_get_check_number_normal);
   } else {
     mTxtGetCheck.setText("获取中(" + msg.what + ")");
     mTxtGetCheck.setBackgroundResource(R.drawable.register_get_check_number_down);
   }
 }
 private void toggleSpeaker() {
   isSpeakerEnabled = !isSpeakerEnabled;
   if (isSpeakerEnabled) {
     LinphoneManager.getInstance().routeAudioToSpeaker();
     speaker.setBackgroundResource(R.drawable.speaker_on);
     LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
   } else {
     Log.d("Toggle speaker off, routing back to earpiece");
     LinphoneManager.getInstance().routeAudioToReceiver();
     speaker.setBackgroundResource(R.drawable.speaker_off);
   }
 }
Beispiel #16
0
  @Override
  protected void onResume() {
    super.onResume();

    et_Num.setText(Integer.toString(fillNum));

    if (GTMemFillEngine.getInstance().isFilled()) {
      tv_switch.setBackgroundResource(R.drawable.switch_off_border);
      tv_switch.setText(getString(R.string.pi_memfill_off));
    } else {
      tv_switch.setBackgroundResource(R.drawable.switch_on_border);
      tv_switch.setText(getString(R.string.pi_memfill_on));
    }
  }
 private void refreshView() {
   if (uploadState) {
     uploadSwitchBg.setBackgroundResource(R.drawable.switch_on_bg);
     uploadOn.setVisibility(View.VISIBLE);
     uploadOn.setBackgroundResource(R.drawable.switch_fore_on);
     uploadOff.setVisibility(View.INVISIBLE);
     uploadOff.setBackgroundResource(0);
     uploadText.setEnabled(true);
   } else {
     uploadSwitchBg.setBackgroundResource(R.drawable.switch_off_bg);
     uploadOff.setVisibility(View.VISIBLE);
     uploadOff.setBackgroundResource(R.drawable.switch_fore_on);
     uploadOn.setVisibility(View.INVISIBLE);
     uploadOn.setBackgroundResource(0);
     uploadText.setEnabled(false);
   }
   if (downloadState) {
     downloadSwitchBg.setBackgroundResource(R.drawable.switch_on_bg);
     downloadOn.setVisibility(View.VISIBLE);
     downloadOn.setBackgroundResource(R.drawable.switch_fore_on);
     downloadOff.setVisibility(View.INVISIBLE);
     downloadOff.setBackgroundResource(0);
     downloadText.setEnabled(true);
   } else {
     downloadSwitchBg.setBackgroundResource(R.drawable.switch_off_bg);
     downloadOff.setVisibility(View.VISIBLE);
     downloadOff.setBackgroundResource(R.drawable.switch_fore_on);
     downloadOn.setVisibility(View.INVISIBLE);
     downloadOn.setBackgroundResource(0);
     downloadText.setEnabled(false);
   }
 }
Beispiel #18
0
  public void setMarker(ArrayList<Station> list) {
    View view = LayoutInflater.from(mContext).inflate(R.layout.marker, null);
    final TextView tv = (TextView) view.findViewById(R.id.tv_marker);
    for (int i = 0; i < list.size(); i++) {
      Station s = list.get(i);
      tv.setText((i + 1) + "");
      if (i == 0) {
        tv.setBackgroundResource(R.mipmap.icon_focus_mark);
      } else {
        tv.setBackgroundResource(R.mipmap.icon_mark);
      }
      BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(tv);
      LatLng latLng = new LatLng(s.getLat(), s.getLon());
      Bundle b = new Bundle();
      b.putParcelable("s", list.get(i));
      OverlayOptions oo =
          new MarkerOptions().position(latLng).icon(bitmap).title((i + 1) + "").extraInfo(b);
      if (i == 0) {
        lastMarker = (Marker) mBaiduMap.addOverlay(oo);
        mStation = s;
        showLayoutInfo((i + 1) + "", mStation);
      } else {
        mBaiduMap.addOverlay(oo);
      }
    }

    mBaiduMap.setOnMarkerClickListener(
        new BaiduMap.OnMarkerClickListener() {

          @Override
          public boolean onMarkerClick(Marker marker) {
            // TODO Auto-generated method stub
            if (lastMarker != null) {
              tv.setText(lastMarker.getTitle());
              tv.setBackgroundResource(R.mipmap.icon_mark);
              BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(tv);
              lastMarker.setIcon(bitmap);
            }
            lastMarker = marker;
            String position = marker.getTitle();
            tv.setText(position);
            tv.setBackgroundResource(R.mipmap.icon_focus_mark);
            BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(tv);
            marker.setIcon(bitmap);
            mStation = marker.getExtraInfo().getParcelable("s");
            showLayoutInfo(position, mStation);
            return false;
          }
        });
  }
Beispiel #19
0
  private void updatePinColor() {
    view.setTextColor(view.getContext().getResources().getColor(android.R.color.white));

    switch (configuredAction) {
      case TOGGLE_ACTIVATION:
        view.setBackgroundResource(R.drawable.tinker_pin);
      case ANALOG_READ:
        view.setBackgroundResource(R.drawable.tinker_pin_emerald);
        break;
      case ANALOG_WRITE:
        view.setBackgroundResource(R.drawable.tinker_pin_sunflower);
        break;
      case DIGITAL_READ:
        if (digitalValue == DigitalValue.HIGH) {
          view.setBackgroundResource(R.drawable.tinker_pin_read_high);
          view.setTextColor(
              view.getContext().getResources().getColor(R.color.tinker_pin_text_dark));
        } else {
          view.setBackgroundResource(R.drawable.tinker_pin_cyan);
        }
        break;
      case DIGITAL_WRITE:
        if (digitalValue == DigitalValue.HIGH) {
          view.setBackgroundResource(R.drawable.tinker_pin_write_high);
          view.setTextColor(
              view.getContext().getResources().getColor(R.color.tinker_pin_text_dark));
        } else {
          view.setBackgroundResource(R.drawable.tinker_pin_alizarin);
        }
        break;
      case NONE:
        view.setBackgroundResource(R.drawable.tinker_pin);
        break;
    }
  }
        public void handleMessage(android.os.Message msg) {

          if (msg.what == STSTE) {
            quxioaTextView.setEnabled(false);
            quxioaTextView.setClickable(false);
            quxioaTextView.setBackgroundResource(R.drawable.focus_n_btn);
            quxioaTextView.setTextColor(getResources().getColor(R.color.gr_color_03));

            kefuTextView.setEnabled(false);
            kefuTextView.setClickable(false);
            kefuTextView.setBackgroundResource(R.drawable.focus_n_btn);
            kefuTextView.setTextColor(getResources().getColor(R.color.gr_color_03));
          }
        };
Beispiel #21
0
 @Override
 public View getView(int pos, View convertView, ViewGroup parent) {
   TextView iconNote = new TextView(context);
   String date = getItem(pos).DATE;
   String yyyy = date.substring(0, 4);
   String mm = date.substring(4, 6);
   String dd = date.substring(6, 8);
   date = dd + "/" + mm + "/" + yyyy;
   iconNote.setText(date + "\n" + getItem(pos).TITLE);
   iconNote.setPadding(20, 5, 5, 5);
   if (getItem(pos).ISIMPORTANT > 0)
     iconNote.setBackgroundResource(R.drawable.note_important_container_icon_200x100);
   else iconNote.setBackgroundResource(R.drawable.note_container_icon_200x100);
   return iconNote;
 }
Beispiel #22
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.tv_locked:
       tv_locked.setBackgroundResource(R.drawable.tab_right_pressed);
       tv_unlock.setBackgroundResource(R.drawable.tab_left_default);
       ll_unlock.setVisibility(View.GONE);
       break;
     case R.id.tv_unlock:
       tv_locked.setBackgroundResource(R.drawable.tab_right_default);
       tv_unlock.setBackgroundResource(R.drawable.tab_left_pressed);
       ll_unlock.setVisibility(View.VISIBLE);
       break;
   }
 }
  @Override
  public void onClick(View v) {
    int id = v.getId();

    if (id == R.id.micro) {
      toggleMicro();
    } else if (id == R.id.speaker) {
      toggleSpeaker();
    } else if (id == R.id.addCall) {
      goBackToDialer();
    } else if (id == R.id.pause) {
      pauseOrResumeCall();
    } else if (id == R.id.hangUp) {
      hangUp();
    } else if (id == R.id.dialer) {
      hideOrDisplayNumpad();
    } else if (id == R.id.conference) {
      enterConference();
    } else if (id == R.id.transfer) {
      goBackToDialerAndDisplayTransferButton();
    } else if (id == R.id.options) {
      hideOrDisplayCallOptions();
    } else if (id == R.id.audioRoute) {
      hideOrDisplayAudioRoutes();
    } else if (id == R.id.routeBluetooth) {
      if (BluetoothManager.getInstance().routeAudioToBluetooth()) {
        isSpeakerEnabled = false;
        routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_on);
        routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
        routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
      }
      hideOrDisplayAudioRoutes();
    } else if (id == R.id.routeReceiver) {
      LinphoneManager.getInstance().routeAudioToReceiver();
      isSpeakerEnabled = false;
      routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
      routeReceiver.setBackgroundResource(R.drawable.route_receiver_on);
      routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
      hideOrDisplayAudioRoutes();
    } else if (id == R.id.routeSpeaker) {
      LinphoneManager.getInstance().routeAudioToSpeaker();
      isSpeakerEnabled = true;
      routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
      routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
      routeSpeaker.setBackgroundResource(R.drawable.route_speaker_on);
      hideOrDisplayAudioRoutes();
    } else if (id == R.id.callStatus) {
      LinphoneCall call = (LinphoneCall) v.getTag();
      pauseOrResumeCall(call);
    } else if (id == R.id.conferenceStatus) {
      pauseOrResumeConference();
    }
  }
 /** tab的title,icon,边距设定等等 */
 @Override
 protected void setTabItemTextView(TextView textView, int position) {
   textView.setPadding(3, 3, 3, 3);
   textView.setText(mItems.get(position).getTitle());
   textView.setBackgroundResource(mItems.get(position).getBg());
   textView.setCompoundDrawablesWithIntrinsicBounds(0, mItems.get(position).getIcon(), 0, 0);
 }
  private void hideOrDisplayNumpad() {
    if (numpad == null) {
      return;
    }

    if (numpad.getVisibility() == View.VISIBLE) {
      hideNumpad();
    } else {
      dialer.setBackgroundResource(R.drawable.dialer_alt_back);
      if (isAnimationDisabled) {
        numpad.setVisibility(View.VISIBLE);
      } else {
        Animation animation = slideInBottomToTop;
        animation.setAnimationListener(
            new AnimationListener() {
              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationRepeat(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                numpad.setVisibility(View.VISIBLE);
                animation.setAnimationListener(null);
              }
            });
        numpad.startAnimation(animation);
      }
    }
  }
Beispiel #26
0
 public void addItem(Item item) {
   int size = icon + padding + padding;
   ViewGroup.LayoutParams params =
       new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, size);
   TextView row = new TextView(getContext());
   row.setId(item.getId());
   row.setLayoutParams(params);
   row.setMaxLines(1);
   row.setEllipsize(TextUtils.TruncateAt.END);
   row.setGravity(Gravity.CENTER_VERTICAL);
   row.setText(item.getTitle());
   row.setTypeface(Typeface.DEFAULT_BOLD);
   row.setOnClickListener(this);
   row.setTextColor(BottomUtils.colorStateListText(getContext()));
   TypedValue typedValue = new TypedValue();
   getContext()
       .getTheme()
       .resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true);
   row.setBackgroundResource(typedValue.resourceId);
   if (item.getIcon() != null) {
     row.setCompoundDrawablesWithIntrinsicBounds(icon(item.getIcon()), null, null, null);
     row.setCompoundDrawablePadding(padding);
     row.setPadding(padding, padding, padding, padding);
   } else {
     row.setPadding(size, padding, padding, padding);
   }
   container.addView(row);
 }
    /**
     * Constructor
     *
     * @param parent the container view of this one
     * @param tabId drawable for the tab
     * @param barId drawable for the bar
     * @param targetId drawable for the target
     */
    Slider(ViewGroup parent, int tabId, int barId, int targetId) {
      // Create tab
      tab = new ImageView(parent.getContext());
      tab.setBackgroundResource(tabId);
      tab.setScaleType(ScaleType.CENTER);
      tab.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

      // Create hint TextView
      text = new TextView(parent.getContext());
      text.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
      text.setBackgroundResource(barId);
      text.setTextAppearance(parent.getContext(), R.style.TextAppearance_SlidingTabNormal);
      // hint.setSingleLine();  // Hmm.. this causes the text to disappear off-screen

      // Create target
      target = new ImageView(parent.getContext());
      target.setImageResource(targetId);
      target.setScaleType(ScaleType.CENTER);
      target.setLayoutParams(
          new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      target.setVisibility(View.INVISIBLE);

      parent.addView(target); // this needs to be first - relies on painter's algorithm
      parent.addView(tab);
      parent.addView(text);
    }
Beispiel #28
0
  /**
   * 生成MyViewGroup的子元素
   *
   * @param text
   */
  private void createView1(String text, String number) {

    if (etMess.getText().toString().equals(" ") || etMess.getText().toString().equals("")) {
    } else {
      TextView t = new TextView(this);
      t.setText(text);
      t.setTextColor(Color.BLACK);
      t.setGravity(Gravity.CENTER);
      t.setBackgroundResource(R.drawable.bg_sms_contact_btn);
      t.setHeight(60);
      t.setPadding(2, 0, 2, 0);
      t.setOnClickListener(new MyListener());
      t.setTag(number);
      mvg.addView(t, mvg.getChildCount() - 1);

      ContactBean cb = new ContactBean();
      cb.setDisplayName(text);
      cb.setPhoneNum(number);
      if (null == selectContactList) {
        selectContactList = new ArrayList<ContactBean>();
      }
      selectContactList.add(cb);
      queryListView.setVisibility(View.INVISIBLE);
    }
  }
  /**
   * Create a default view to be used for tabs. This is called if a custom tab view is not set via
   * {@link #setCustomTabView(int, int)}.
   */
  @SuppressLint("NewApi")
  protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      // If we're running on Honeycomb or newer, then we can use the Theme's
      // selectableItemBackground to ensure that the View has a pressed state
      TypedValue outValue = new TypedValue();
      getContext()
          .getTheme()
          .resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
      textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
      textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
  }
Beispiel #30
0
 public void setnc() {
   phonebindtx.setTextColor(999999);
   phonebindim.setImageResource(R.drawable.phonebindno);
   cridbindtx.setText("");
   cridbindtx.setTextColor(Color.rgb(33, 66, 33));
   cridbindtx.setBackgroundResource(R.drawable.crididbindno);
 }