コード例 #1
0
 @Override
 public View getGroupView(
     final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   if (convertView == null) {
     LayoutInflater inflater =
         (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     convertView = inflater.inflate(R.layout.group, null);
   }
   ImageButton btn = (ImageButton) convertView.findViewById(R.id.discardBtn);
   btn.setFocusable(false);
   btn.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Log.d(TAG, "group with time " + titles.get(groupPosition) + " clicked!");
         }
       });
   CheckedTextView tw = (CheckedTextView) convertView.findViewById(R.id.checkedTW);
   Title title = titles.get(groupPosition);
   tw.setText(title.getDate());
   tw.setChecked(isExpanded);
   TextView coordsView = (TextView) convertView.findViewById(R.id.coordsView);
   coordsView.setText(
       "Floor: " + title.getZ() + ". Position [" + title.getX() + ", " + title.getY() + "]");
   return convertView;
 }
コード例 #2
0
  private void rebuildComplicationsList() {
    ViewGroup complicationsContainer = (ViewGroup) mRootView.findViewById(R.id.complications_list);
    complicationsContainer.removeAllViews();

    LayoutInflater inflater = LayoutInflater.from(getActivity());

    for (int i = 0; i < PREF_KEYS.length; i++) {
      final String prefKey = PREF_KEYS[i];

      ViewGroup itemContainer =
          (ViewGroup)
              inflater.inflate(R.layout.config_complications_item, complicationsContainer, false);
      final CheckedTextView titleView =
          (CheckedTextView) itemContainer.findViewById(android.R.id.text1);
      final View checkmarkView = itemContainer.findViewById(R.id.checkmark);

      titleView.setText(PREF_TITLE_IDS[i]);
      boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false);

      checkmarkView.setVisibility(isPrefOn ? View.VISIBLE : View.INVISIBLE);
      titleView.setChecked(isPrefOn);

      itemContainer.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false);
              mSharedPreferences.edit().putBoolean(prefKey, !isPrefOn).apply();
              rebuildComplicationsList();
            }
          });

      complicationsContainer.addView(itemContainer);
    }
  }
コード例 #3
0
    public View getView(int position, View convertView, ViewGroup parent) {
      Vector categories = model.getVector(KEY_V_ALL_CATEGORIES);
      if (categories == null || position >= categories.size() + 1) {
        return convertView;
      }

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.add_place_category_item, null);
      }
      CheckedTextView categoryItem = (CheckedTextView) convertView;

      if (position == 0) {
        categoryItem.setText(R.string.addplace_category_label_none);
        categoryItem.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.list_icon_folder_disabled, 0, 0, 0);
      } else {
        FavoriteCatalog category = (FavoriteCatalog) categories.elementAt(position - 1);
        categoryItem.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.list_icon_folder_unfocused, 0, 0, 0);
        String categoryName;
        if (category.isReceivedCatalog()) {
          categoryName =
              ResourceManager.getInstance()
                  .getCurrentBundle()
                  .getString(IStringCommon.RES_RECEIVED_CATEGORY, IStringCommon.FAMILY_COMMON);
        } else {
          categoryName = category.getName();
        }
        categoryItem.setText(categoryName);
      }
      return convertView;
    }
コード例 #4
0
    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
      View item = inflater.inflate(R.layout.time_settings_dropdown_item, null);
      item.setMinimumHeight(60);

      if (position >= times.size()) {
        ((CheckedTextView) item).setText(getText(R.string.customTime));
      } else {
        SpannableString ss =
            new SpannableString(
                times.get(position)
                    + " "
                    + getString(R.string.min)
                    + " (+"
                    + increments.get(position)
                    + getString(R.string.secPerMove)
                    + ")");
        ss.setSpan(new ForegroundColorSpan(0xFF000000), 0, 6, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        ss.setSpan(
            new ForegroundColorSpan(0xFF666666),
            6,
            ss.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        ((CheckedTextView) item).setText(ss);
      }

      return item;
    }
コード例 #5
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    AlarmPre alarmPreference = (AlarmPre) getItem(position);
    LayoutInflater layoutInflater = LayoutInflater.from(getContext());
    switch (alarmPreference.getType()) {
      case BOOLEAN:
        if (null == convertView || convertView.getId() != android.R.layout.simple_list_item_checked)
          convertView = layoutInflater.inflate(android.R.layout.simple_list_item_checked, null);

        CheckedTextView checkedTextView =
            (CheckedTextView) convertView.findViewById(android.R.id.text1);
        checkedTextView.setText(alarmPreference.getTitle());
        checkedTextView.setChecked((Boolean) alarmPreference.getValue());
        break;

      case INTEGER:
      case STRING:
      case LIST:
      case MULTIPLE_LIST:
      case TIME:
      default:
        if (null == convertView || convertView.getId() != android.R.layout.simple_list_item_2)
          convertView = layoutInflater.inflate(android.R.layout.simple_list_item_2, null);

        TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
        text1.setTextSize(18);
        text1.setText(alarmPreference.getTitle());

        TextView text2 = (TextView) convertView.findViewById(android.R.id.text2);
        text2.setText(alarmPreference.getSummary());
        break;
    }

    return convertView;
  }
コード例 #6
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
   DialogOption option = mOptions[position];
   view.setChecked(mSelectedOptions.contains(option));
   view.setEnabled(!mDisabledOptions.contains(option));
   return view;
 }
コード例 #7
0
ファイル: Checker.java プロジェクト: brycecovert/robotium
 /**
  * Checks if a {@link CheckedTextView} with a given text is checked.
  *
  * @param checkedTextView the {@code CheckedTextView} object
  * @param text the text that is expected to be checked
  * @return {@code true} if {@code CheckedTextView} is checked and {@code false} if it is not
  *     checked
  */
 public boolean isCheckedTextChecked(String text) {
   waiter.waitForText(text, 0, 10000, true, true);
   ArrayList<CheckedTextView> list = viewFetcher.getCurrentViews(CheckedTextView.class);
   for (CheckedTextView checkedText : list) {
     if (checkedText.getText().equals(text) && checkedText.isChecked()) return true;
   }
   return false;
 }
コード例 #8
0
ファイル: MarqueeTextView.java プロジェクト: anaelwu/yuanlin
 @Override
 protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
   /** requestFocus和clearFocus均导致这里被调用 */
   if (focused) {
     super.onFocusChanged(focused, direction, previouslyFocusedRect);
   } else {
     if (!mBMyFocus) {
       super.onFocusChanged(focused, direction, previouslyFocusedRect);
     }
   }
 }
コード例 #9
0
 @Override
 public View getGroupView(
     int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   if (convertView == null) {
     convertView = inflater.inflate(R.layout.listrow_group, null);
   }
   amarre group = (amarre) getGroup(groupPosition);
   ((CheckedTextView) convertView).setText(group.string);
   ((CheckedTextView) convertView).setChecked(isExpanded);
   return convertView;
 }
コード例 #10
0
 // Check compatibility against SensorTypes
 void setCompatibility(TextView tv, CheckedTextView ctv, SensorTypes sensor) {
   if (sensors.isCompatible(sensor)) {
     tv.setTextColor(Color.parseColor("#00AA00"));
     tv.setText(R.string.compatible);
     ctv.setChecked(true);
   } else {
     tv.setTextColor(Color.parseColor("#AA0000"));
     tv.setText(R.string.incompatible);
     ctv.setChecked(false);
     ctv.setCheckMarkDrawable(R.drawable.red_x);
   }
 }
コード例 #11
0
ファイル: AdapterDiary.java プロジェクト: nhulq2116/test
  @Override
  public View getGroupView(
      int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

    if (convertView == null) {
      convertView = inflater.inflate(R.layout.layout_for_diary_group, null);
    }

    ((CheckedTextView) convertView).setText(parentItems.get(groupPosition));
    ((CheckedTextView) convertView).setChecked(isExpanded);

    return convertView;
  }
コード例 #12
0
 private void onClickShutter() {
   boolean isRecording = RecorderModel.getModel().isRecorderRunning();
   LogUtil.i(MODULE_TAG, "onClick() isRecording=" + isRecording);
   mShutter.toggle();
   mShutter.setEnabled(false);
   if (!isRecording) {
     start_rec();
     getActivity().finish();
     EventBus.getDefault().unregister(this);
   } else {
     stop_rec();
   }
 }
コード例 #13
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      final View itemView = super.getView(position, convertView, parent);

      // Hide the checkable drawable.  This assumes that the item views
      // are CheckedTextView objects
      final CheckedTextView checkedTextView = (CheckedTextView) itemView;
      if (!getItemIsCheckable(position)) {
        checkedTextView.setCheckMarkDrawable(null);
      }

      return checkedTextView;
    }
コード例 #14
0
  @Override
  public View getGroupView(
      int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

    if (convertView == null) {
      convertView = inflater.inflate(R.layout.activity_terms_parent_expandablelist, null);
    }

    ((CheckedTextView) convertView).setText(parentItems.get(groupPosition));
    ((CheckedTextView) convertView).setChecked(isExpanded);

    return convertView;
  }
コード例 #15
0
  private void setAcceptedFields() {
    acceptedFields = new LinkedList<String>();
    scrollViewLayout.removeView(errorTV);
    for (int i = 0; i < scrollViewLayout.getChildCount(); i++) {
      View v = scrollViewLayout.getChildAt(i);

      CheckedTextView ctv = (CheckedTextView) v.findViewById(R.id.sensorlabel);
      if (ctv.isChecked()) acceptedFields.add(ctv.getText().toString());
      else acceptedFields.add(getString(R.string.null_string));
    }

    buildPrefsString();
  }
コード例 #16
0
 @Override
 public View getView(final int position, final View convertView, final ViewGroup parent) {
   CheckedTextView tv = (CheckedTextView) convertView;
   if (tv == null) {
     tv =
         (CheckedTextView)
             LayoutInflater.from(AnimateDismissActivity.this)
                 .inflate(R.layout.item_animateremoval_row, parent, false);
   }
   tv.setText(String.valueOf(getItem(position)));
   tv.setChecked(mSelectedPositions.contains(position));
   return tv;
 }
コード例 #17
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      if (convertView == null) {
        convertView = inflater.inflate(layoutId, parent, false);
      }

      ((CheckedTextView) convertView).setText(_listView.getItemAtPosition(position).toString());
      if (position == _listView.getCheckedItemPosition()) {
        ((CheckedTextView) convertView).setBackgroundColor(Color.MAGENTA);
      } else {
        ((CheckedTextView) convertView).setBackgroundColor(Color.TRANSPARENT);
      }
      return convertView;
    }
コード例 #18
0
 @Override
 public void setBackgroundDrawable(Drawable drawable) {
   Drawable background = getBackground();
   if (background instanceof RippleDrawable && !(drawable instanceof RippleDrawable))
     ((RippleDrawable) background).setBackgroundDrawable(drawable);
   else super.setBackgroundDrawable(drawable);
 }
コード例 #19
0
 public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
   View localView = paramView;
   if (paramView == null) {
     localView =
         LayoutInflater.from(paramViewGroup.getContext())
             .inflate(2130903372, paramViewGroup, false);
     localView.setTag(new a.a(localView));
   }
   paramView = (a.a) localView.getTag();
   paramViewGroup = (Category) getItem(paramInt);
   Object localObject = (Drawable) a.get(paramViewGroup.d());
   a.setCompoundDrawablesWithIntrinsicBounds((Drawable) localObject, null, null, null);
   if ((c) && (paramViewGroup.f() > 0)) {
     b.setVisibility(0);
     localObject = a;
     if ((!b.contains(paramViewGroup)) || (paramViewGroup.f() != 0)) {
       break label169;
     }
   }
   label169:
   for (boolean bool = true; ; bool = false) {
     ((CheckedTextView) localObject).setChecked(bool);
     a.setText(paramViewGroup.a());
     return localView;
     b.setVisibility(8);
     break;
   }
 }
コード例 #20
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.defaulterlist);
    setTitle(R.string.titleView);
    addPreferencesFromResource(R.layout.defaulterlist);

    n1 = (CheckedTextView) findViewById(R.id.name1);
    n1.setOnClickListener(this);

    n2 = (CheckedTextView) findViewById(R.id.name2);
    n2.setOnClickListener(this);

    n3 = (CheckedTextView) findViewById(R.id.name3);
    n3.setOnClickListener(this);
  }
コード例 #21
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.sensor_ok:
        setAcceptedFields();
        setResult(RESULT_OK);
        finish();
        break;

      case R.id.check_layout:
        CheckedTextView ctv = (CheckedTextView) v.findViewById(R.id.sensorlabel);
        if (ctv.isChecked()) ctv.setCheckMarkDrawable(R.drawable.red_x);
        else ctv.setCheckMarkDrawable(R.drawable.checkmark);
        ctv.toggle();
        break;
    }
  }
コード例 #22
0
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   if (mStyleId != 0) {
     ThemeManager.getInstance().registerOnThemeChangedListener(this);
     onThemeChanged(null);
   }
 }
コード例 #23
0
 @Override
 public void setOnClickListener(OnClickListener l) {
   RippleManager rippleManager = getRippleManager();
   if (l == rippleManager) super.setOnClickListener(l);
   else {
     rippleManager.setOnClickListener(l);
     setOnClickListener(rippleManager);
   }
 }
コード例 #24
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;

    if (row == null) {
      //            LayoutInflater inflater = getLayoutInflater();
      row = inflater.inflate(R.layout.play_list_item, parent, false);
    }

    CheckedTextView checkedTextView = (CheckedTextView) row.findViewById(R.id.play_list_item);
    checkedTextView.setText(this.playlist.get(position));

    Boolean checked = cds.myChecked.get(position);
    if (checked != null) {
      checkedTextView.setChecked(checked);
    }

    return row;
  }
コード例 #25
0
 @Override
 protected void onDraw(@NonNull Canvas canvas) {
   if (customBackground != null) {
     canvas.getClipBounds(tempRect);
     customBackground.setBounds(tempRect);
     customBackground.setState(getDrawableState());
     customBackground.draw(canvas);
   }
   super.onDraw(canvas);
 }
コード例 #26
0
ファイル: HostAdapter.java プロジェクト: 6a209/AHosts
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   CheckedTextView checkView = null;
   if (null == convertView) {
     LayoutInflater inflater = LayoutInflater.from(mCtx);
     convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
     checkView = (CheckedTextView) convertView.findViewById(android.R.id.text1);
     checkView.setTextSize(14);
     //			((CheckedTextView)convertView)
   } else {
     checkView = (CheckedTextView) convertView.getTag();
   }
   String item = mHostList.get(position);
   if (item.contains("#")) {
     checkView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
   }
   checkView.setText(item);
   convertView.setTag(checkView);
   return convertView;
 }
コード例 #27
0
ファイル: SongView.java プロジェクト: Trupal00p/Subsonic
  public void setSong(MusicDirectory.Entry song, boolean checkable) {
    this.song = song;
    StringBuilder artist = new StringBuilder(40);

    String bitRate = null;
    if (song.getBitRate() != null) {
      bitRate =
          String.format(getContext().getString(R.string.song_details_kbps), song.getBitRate());
    }

    String fileFormat = null;
    if (song.getTranscodedSuffix() != null
        && !song.getTranscodedSuffix().equals(song.getSuffix())) {
      fileFormat = String.format("%s > %s", song.getSuffix(), song.getTranscodedSuffix());
    } else {
      fileFormat = song.getSuffix();
    }

    if (!song.isVideo()) {
      artist
          .append(song.getArtist())
          .append(" (")
          .append(
              String.format(
                  getContext().getString(R.string.song_details_all),
                  bitRate == null ? "" : bitRate,
                  fileFormat))
          .append(")");
    } else {
      artist.append(
          String.format(
              getContext().getString(R.string.song_details_all),
              bitRate == null ? "" : bitRate,
              fileFormat));
    }

    titleTextView.setText(song.getTitle());
    artistTextView.setText(artist);
    durationTextView.setText(Util.formatDuration(song.getDuration()));
    checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);
    starButton.setVisibility(
        (Util.isOffline(getContext()) || !song.isStarred()) ? View.GONE : View.VISIBLE);
    starButton.setFocusable(false);

    moreButton = (ImageView) findViewById(R.id.artist_more);
    moreButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.showContextMenu();
          }
        });

    update();
  }
コード例 #28
0
  @Override
  protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);

    // Put dummy popupWindow over the control
    // so that relativeLayout can pass through touch events to native
    // activity for a background area
    if (changed) {
      dummyPopupWindow.update(this);
    }
  }
コード例 #29
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   if (convertView == null) {
     convertView = mInflater.inflate(R.layout.listitem_device, parent, false);
   }
   if (convertView instanceof CheckedTextView) {
     final UsbDevice device = getItem(position);
     ((CheckedTextView) convertView)
         .setText(
             String.format("UVC Camera:(%x:%x)", device.getVendorId(), device.getProductId()));
   }
   return convertView;
 }
コード例 #30
0
    @Override
    public void onItemClick(AdapterView<?> arrayAdapter, View view, int position, long arg3) {
      // TODO Auto-generated method stub
      clickedListItem = (String) lv.getItemAtPosition(position);
      Log.i("", "this is the clickedListItem: " + clickedListItem);
      CheckedTextView check = (CheckedTextView) view;
      check.setChecked(check.isChecked());
      workout.addExercise(clickedListItem);
      workout.addSpotClicked(position);
      // isSelected[position] = true;

      if (weightArray[
          position]) { // this will always make a cardio becasue they are both SETUPEXERCISE.class
        Intent newWeightActivity = new Intent(ClickableCreateWorkOutList.this, SetUpExercise.class);
        newWeightActivity.putExtra("theExtra", workout);
        startActivity(newWeightActivity);
      } else {
        Intent newCardioActivity = new Intent(ClickableCreateWorkOutList.this, SetUpExercise.class);
        newCardioActivity.putExtra("theExtra", workout);
        startActivity(newCardioActivity);
      }
    }