コード例 #1
0
  private boolean canListScroll(int direction) {
    AdapterView<?> absListView = (AdapterView<?>) mTargetView;
    final int itemCount = absListView.getCount();
    final int childCount = absListView.getChildCount();
    final int firstPosition = absListView.getFirstVisiblePosition();
    final int lastPosition = firstPosition + childCount;

    if (itemCount == 0) {
      return false;
    }
    if (direction > 0) {
      // Are we already showing the entire last item?
      if (lastPosition >= itemCount) {
        final View lastView = absListView.getChildAt(childCount - 1);
        if (lastView != null && lastView.getBottom() >= mTargetView.getHeight()) {
          return false;
        }
      }
    } else if (direction < 0) {
      // Are we already showing the entire first item?
      if (firstPosition <= 0) {
        final View firstView = absListView.getChildAt(0);
        if (firstView != null && firstView.getTop() >= 0) {
          return false;
        }
      }
    }
    return true;
  }
コード例 #2
0
  private boolean listViewStatus() {
    boolean flag = false;
    AdapterView<?> listView = null;
    for (int i = 0; i < getChildCount(); i++) {
      View v = getChildAt(i);
      if (v instanceof AdapterView<?>) {
        listView = (AdapterView<?>) v;
      }
    }
    if (listView == null) { //
      return false;
    }
    int frist = listView.getFirstVisiblePosition();
    int last = listView.getLastVisiblePosition();

    View top = listView.getChildAt(0);
    View bottom = listView.getChildAt(listView.getChildCount() - 1);

    if (top != null && frist == 0 && top.getTop() == 0) { // 最顶端
      moveStatus = STATUS_REFRESH_TOP;
      flag = true;
    } else if (bottom != null
        && last >= (listView.getCount() - 1)
        && bottom.getBottom() == listView.getHeight()) { // 最底端
      moveStatus = STATUS_REFRESH_FOOTER;
      flag = true;
    } else {
      moveStatus = STATUS_REFRESH_NONE;
      flag = false;
    }
    return flag;
  }
コード例 #3
0
  @Override
  public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

      View layout = view.findViewById(R.id.brick_change_variable_layout);
      Drawable background = layout.getBackground();
      background.setAlpha(alphaValue);

      TextView textSetVariable = (TextView) view.findViewById(R.id.brick_change_variable_label);
      TextView textTo = (TextView) view.findViewById(R.id.brick_change_variable_by);
      TextView editVariable = (TextView) view.findViewById(R.id.brick_change_variable_edit_text);
      Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner);

      ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue);
      variablebrickSpinner.getBackground().setAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color);
      }
      textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue));
      textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue));
      editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue));
      editVariable.getBackground().setAlpha(alphaValue);

      this.alphaValue = (alphaValue);
    }
    return view;
  }
コード例 #4
0
ファイル: BookServiceActivity.java プロジェクト: khiemvu/ATA
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
          for (int i = 0; i < serviceTypeArrayList.size(); i++) {
            if (i != position) {
              serviceTypeArrayList.get(i).setSelected(false);
            }
          }
          ImageView imgChecked;
          for (int i = 0; i < adapterView.getAdapter().getCount(); i++) {
            View v1 = adapterView.getChildAt(i);
            if (v1 != null) {
              imgChecked = (ImageView) v1.findViewById(R.id.service_type_imageView);
              imgChecked.setVisibility(View.GONE);
            }
          }
          imgChecked = (ImageView) view.findViewById(R.id.service_type_imageView);
          ServiceType serviceType = serviceTypeArrayList.get(position);

          if (!serviceType.isSelected()) {
            imgChecked.setVisibility(View.VISIBLE);
            serviceType.setSelected(true);
            new SharedPreferencesManager(BookServiceActivity.this)
                .setValue(Constant.VALUE_CURRENT_KEY, serviceType.getName());
          } else {
            imgChecked.setVisibility(View.VISIBLE);
          }
        }
コード例 #5
0
 public View findItemContainingText(String targetText) {
   int itemIndex = findIndexOfItemContainingText(targetText);
   if (itemIndex == -1) {
     return null;
   }
   return realAdapterView.getChildAt(itemIndex);
 }
コード例 #6
0
ファイル: MDRootLayout.java プロジェクト: cuishenghu/hewuzhe
  private static boolean canAdapterViewScroll(AdapterView lv) {
    /* Force it to layout it's children */
    if (lv.getLastVisiblePosition() == -1) return false;

    /* We can scroll if the first or last item is not visible */
    boolean firstItemVisible = lv.getFirstVisiblePosition() == 0;
    boolean lastItemVisible = lv.getLastVisiblePosition() == lv.getCount() - 1;

    if (firstItemVisible && lastItemVisible && lv.getChildCount() > 0) {
      /* Or the first item's top is above or own top */
      if (lv.getChildAt(0).getTop() < lv.getPaddingTop()) return true;
      /* or the last item's bottom is beyond our own bottom */
      return lv.getChildAt(lv.getChildCount() - 1).getBottom()
          > lv.getHeight() - lv.getPaddingBottom();
    }

    return true;
  }
コード例 #7
0
ファイル: SearchFrag.java プロジェクト: sevenk/AppGUI
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    TextView child = (TextView) parent.getChildAt(position);
    // TODO suche nach irdi und öffne item und ändere sidelist
    //		Cursor c =adapter.getCursor();
    //		getSupportFragmentManager()

    Toast.makeText(getActivity(), child.getText(), Toast.LENGTH_SHORT).show();
  }
コード例 #8
0
 public static void resetListViewSelection(AdapterView<?> adapterView) {
   for (int i = 0; i < adapterView.getChildCount(); i++) {
     View listItem = adapterView.getChildAt(i);
     TextView nameTextView = (TextView) listItem.findViewById(R.id.level_name_textview);
     nameTextView.setTextColor(Color.BLACK);
     TextView statsTextView = (TextView) listItem.findViewById(R.id.level_stats_textview);
     statsTextView.setTextColor(Color.BLACK);
   }
 }
コード例 #9
0
  @SuppressWarnings("unused")
  @Override
  public void onItemClick(AdapterView<?> Parent, View view, int position, long id) {
    // TODO Auto-generated method stub
    int Itemposition = Parent.getSelectedItemPosition();

    int ChildCount = Parent.getChildCount();
    View view1 = Parent.getChildAt(position);

    ViewHolder holder = (ViewHolder) view.getTag();

    Txt01 = (String) holder.text01.getText();
    Txt02 = (String) holder.text02.getText();
    Txt03 = (String) holder.text03.getText();

    AlertDialog.Builder dial = new AlertDialog.Builder(this);
    dial.setTitle("Que voulez vous faire avec :" + "\"" + Txt03 + "\"");
    dial.setIcon(R.drawable.ad_question);
    CharSequence[] items = {"Afficher les details", "Copier le produit dans une note"};
    dial.setSingleChoiceItems(
        items,
        -1,
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int item) {
            /* User clicked on a radio button do some stuff */
            if (item == 0) { // afficher les details
              detail = true;
            }
            if (item == 1) { // créer une nouvelle note avec ce
              // produit
              newNote = true;
            }
          }
        });
    dial.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int id) {

            if (detail) { // on affiche le detail du produit
              gotoAffDetail(Txt01);
            }
            if (newNote) { // on supprime le produit
              // gotoSupprDetail(Txt01,Txt03);
              gotoCreateNewNote(Integer.parseInt(Txt01));
            }
          }
        });
    dial.show();
  }
コード例 #10
0
 public void resetItemState(AdapterView<?> parent, int position) {
   int firstVisiblePosition = parent.getFirstVisiblePosition();
   int lastVisiblePosition = parent.getLastVisiblePosition();
   for (int i = firstVisiblePosition; i <= lastVisiblePosition; i++) {
     View view = parent.getChildAt(i - firstVisiblePosition);
     if (view.getTag() instanceof MediaViewHolder) {
       MediaViewHolder holder = (MediaViewHolder) view.getTag();
       setIndex(holder.indexTv, false);
     }
   }
 }
コード例 #11
0
 public void updateItemState(AdapterView<?> parent, int position) {
   int firstVisiblePosition = parent.getFirstVisiblePosition();
   int lastVisiblePosition = parent.getLastVisiblePosition();
   if (position >= firstVisiblePosition && position <= lastVisiblePosition) {
     View view = parent.getChildAt(position - firstVisiblePosition);
     if (view.getTag() instanceof MediaViewHolder) {
       MediaViewHolder holder = (MediaViewHolder) view.getTag();
       Media media = getItem(position);
       setIndex(holder.indexTv, contains(media));
     }
   }
 }
コード例 #12
0
ファイル: SwipeLayout.java プロジェクト: SNXJ/working
 private void performAdapterViewItemClick(MotionEvent e) {
   ViewParent t = getParent();
   while (t != null) {
     if (t instanceof AdapterView) {
       AdapterView view = (AdapterView) t;
       int p = view.getPositionForView(SwipeLayout.this);
       if (p != AdapterView.INVALID_POSITION
           && view.performItemClick(view.getChildAt(p), p, view.getAdapter().getItemId(p))) return;
     } else {
       if (t instanceof View && ((View) t).performClick()) return;
     }
     t = t.getParent();
   }
 }
コード例 #13
0
  @Override
  public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

      LinearLayout layout = (LinearLayout) view.findViewById(R.id.brick_nxt_motor_action_layout);
      Drawable background = layout.getBackground();
      background.setAlpha(alphaValue);

      TextView textLegoMotorActionLabel =
          (TextView) view.findViewById(R.id.lego_motor_action_label);
      TextView textLegoMotorActionSpeed =
          (TextView) view.findViewById(R.id.lego_motor_action_speed);
      TextView textLegoMotorActionPercent =
          (TextView) view.findViewById(R.id.lego_motor_action_percent);
      TextView textLegoMotorActionLabelSpeedView =
          (TextView) view.findViewById(R.id.motor_action_speed_text_view);
      EditText editSpeed = (EditText) view.findViewById(R.id.motor_action_speed_edit_text);

      textLegoMotorActionLabel.setTextColor(
          textLegoMotorActionLabel.getTextColors().withAlpha(alphaValue));
      textLegoMotorActionSpeed.setTextColor(
          textLegoMotorActionSpeed.getTextColors().withAlpha(alphaValue));
      textLegoMotorActionPercent.setTextColor(
          textLegoMotorActionPercent.getTextColors().withAlpha(alphaValue));
      textLegoMotorActionLabelSpeedView.setTextColor(
          textLegoMotorActionLabelSpeedView.getTextColors().withAlpha(alphaValue));
      Spinner motorSpinner = (Spinner) view.findViewById(R.id.lego_motor_action_spinner);
      ColorStateList color =
          textLegoMotorActionLabelSpeedView.getTextColors().withAlpha(alphaValue);
      motorSpinner.getBackground().setAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color);
      }
      editSpeed.setTextColor(editSpeed.getTextColors().withAlpha(alphaValue));
      editSpeed.getBackground().setAlpha(alphaValue);

      this.alphaValue = (alphaValue);
    }

    return view;
  }
コード例 #14
0
ファイル: NominateActivity.java プロジェクト: jiacunhe/xz_cei
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   String functionId = columnEntries.get(position).getId();
   currentFunctionId = functionId;
   if (oldFunctionId.equals(currentFunctionId)) return;
   oldFunctionId = currentFunctionId;
   for (int i = 0; i < parent.getChildCount(); i++) {
     RelativeLayout rl = (RelativeLayout) parent.getChildAt(i);
     if (i == position) {
       ((ImageView) rl.getChildAt(0)).setImageResource(R.drawable.phone_study_menu_select);
       ((TextView) rl.getChildAt(1)).setTextColor(Color.WHITE);
     } else {
       ((ImageView) rl.getChildAt(0)).setImageDrawable(null);
       ((TextView) rl.getChildAt(1)).setTextColor(Color.BLUE);
     }
   }
   index = 0;
   courses.clear();
   coursewares.clear();
   loadDataForView(functionId);
 }
コード例 #15
0
  @Override
  public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

      View layout = view.findViewById(R.id.brick_point_to_layout);
      layout.getBackground().setAlpha(alphaValue);

      TextView textPointToLabel = (TextView) view.findViewById(R.id.brick_point_to_label);
      textPointToLabel.setTextColor(textPointToLabel.getTextColors().withAlpha(alphaValue));
      Spinner pointToSpinner = (Spinner) view.findViewById(R.id.brick_point_to_spinner);
      ColorStateList color = textPointToLabel.getTextColors().withAlpha(alphaValue);
      pointToSpinner.getBackground().setAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color);
      }

      this.alphaValue = alphaValue;
    }

    return view;
  }
コード例 #16
0
  @Override
  public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

      View layout = view.findViewById(R.id.brick_phiro_motor_stop_layout);
      Drawable background = layout.getBackground();
      background.setAlpha(alphaValue);

      TextView textPhiroProMotorStopLabel = (TextView) view.findViewById(R.id.ValueTextView);
      textPhiroProMotorStopLabel.setTextColor(
          textPhiroProMotorStopLabel.getTextColors().withAlpha(alphaValue));
      Spinner motorSpinner = (Spinner) view.findViewById(R.id.brick_phiro_stop_motor_spinner);
      ColorStateList color = textPhiroProMotorStopLabel.getTextColors().withAlpha(alphaValue);
      motorSpinner.getBackground().setAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color);
      }

      this.alphaValue = (alphaValue);
    }

    return view;
  }
コード例 #17
0
  @Override
  public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

      View layout = view.findViewById(R.id.brick_phiro_rgb_led_layout);
      Drawable background = layout.getBackground();
      background.setAlpha(alphaValue);

      TextView textPhiroProLabel =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_action_label);
      TextView textPhiroProEyeRed =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_red_text_view);
      TextView editRed =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_action_red_edit_text);

      // red
      TextView textPhiroProEyeRedView =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_red_text_view);
      textPhiroProLabel.setTextColor(textPhiroProLabel.getTextColors().withAlpha(alphaValue));
      textPhiroProEyeRed.setTextColor(textPhiroProEyeRed.getTextColors().withAlpha(alphaValue));
      Spinner eyeSpinner = (Spinner) view.findViewById(R.id.brick_phiro_rgb_light_spinner);
      ColorStateList color = textPhiroProEyeRedView.getTextColors().withAlpha(alphaValue);
      eyeSpinner.getBackground().setAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color);
      }
      editRed.setTextColor(editRed.getTextColors().withAlpha(alphaValue));
      editRed.getBackground().setAlpha(alphaValue);

      // green
      TextView textPhiroProEyeGreen =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_green_text_view);
      TextView editGreen =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_action_green_edit_text);
      TextView textPhiroProEyeGreenView =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_green_text_view);
      editGreen.setTextColor(editGreen.getTextColors().withAlpha(alphaValue));
      editGreen.getBackground().setAlpha(alphaValue);
      ColorStateList color2 = textPhiroProEyeGreenView.getTextColors().withAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color2);
      }
      textPhiroProEyeGreen.setTextColor(textPhiroProEyeGreen.getTextColors().withAlpha(alphaValue));

      // blue
      TextView textPhiroProEyeBlue =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_blue_text_view);
      TextView editBlue =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_action_blue_edit_text);
      TextView textPhiroProEyeBlueView =
          (TextView) view.findViewById(R.id.brick_phiro_rgb_led_action_blue_edit_text);
      editBlue.setTextColor(editGreen.getTextColors().withAlpha(alphaValue));
      editBlue.getBackground().setAlpha(alphaValue);
      ColorStateList color3 = textPhiroProEyeBlueView.getTextColors().withAlpha(alphaValue);
      if (adapterView != null) {
        ((TextView) adapterView.getChildAt(0)).setTextColor(color3);
      }
      textPhiroProEyeBlue.setTextColor(textPhiroProEyeBlue.getTextColors().withAlpha(alphaValue));

      this.alphaValue = alphaValue;
    }

    return view;
  }
コード例 #18
0
 public boolean performItemClick(int position) {
   return realAdapterView.performItemClick(
       realAdapterView.getChildAt(position),
       position,
       realAdapterView.getItemIdAtPosition(position));
 }