public void destory() {
   try {
     windowManager.removeView(dialogPosition);
   } catch (Exception e) {
     Log.d("GROUPPINGLIST", "dupliation remove : " + dialogPosition.hashCode());
   }
 }
Beispiel #2
0
 public MQuery id(int id) {
   if (useCache) {
     // 10W次调用测试耗时:2316ms 2323ms 2348ms
     if (mqCache == null) {
       mqCache = new SparseArray<MQuery>();
     }
     MQuery mq = mqCache.get(view.hashCode() + id);
     if (mq == null) {
       mq = new MQuery(view.findViewById(id));
       mqCache.put(view.hashCode() + id, mq);
     }
     return mq;
   } else {
     // 10W次调用测试用时:5154ms 4808ms 5270ms
     return id(view.findViewById(id));
   }
 }
Beispiel #3
0
  public MQuery id(View view) {

    if (useCache) {
      // 10W次调用测试用时:2882ms 3142秒 3024秒
      if (mqCache == null) {
        mqCache = new SparseArray<MQuery>();
      }
      MQuery mq = mqCache.get(view.hashCode());
      if (mq == null) {
        mq = new MQuery(view);
        mqCache.put(view.hashCode(), mq);
      }
      return mq;
    } else {
      // 10W次调用测试用时:6467ms 6091ms 6001ms7
      return new MQuery(view);
    }
  }
 public void PartList04(View v) {
   for (int i = 0; i < Manager.getCommunities().size(); i++) {
     if (Manager.getCommunities().get(i).getCode() == v.hashCode()) {
       Manager.setCurrentCommunity(Manager.getCommunities().get(i));
       Intent in = new Intent(this, CommunityOptions.class);
       startActivity(in);
       finish();
       return;
     }
   }
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;

    if (v == null) {
      LayoutInflater vi =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = vi.inflate(R.layout.list_item, null);
    }

    Log.i("Akella_ids", Integer.toString(v.hashCode()));

    ExMoviePage pData = items.get(position);

    if (pData != null) {

      TextView twMovieTitle = (TextView) v.findViewById(R.id.movie_title);
      twMovieTitle.setText(pData.Title);

      ImageView imageView = (ImageView) v.findViewById(R.id.movie_image);

      if (pData.Image == null) {

        pData.Image = SyncBitmapCache.fetch(pData.GetImageLink(BitmapSize.Small.size()));

        Log.i("Akella_fetch", pData.GetImageLink(BitmapSize.Small.size()));

        if (pData.Image == null) {
          Log.i("Akella_download", pData.GetImageLink(BitmapSize.Small.size()));
          new DownloadImage(imageView, BitmapSize.Small).execute(pData);
        }
      }

      if (pData.Image != null) imageView.setImageBitmap(pData.Image);
      else
        ((ImageView) imageView)
            .setImageDrawable(getContext().getResources().getDrawable(R.drawable.reel_film));
    }

    return v;
  }
 /**
  * It is very important that this wrapper class just returns the {@link View#hashCode()} method,
  * because it will be used as a {@link Map} key.
  */
 @Override
 public int hashCode() {
   return view.hashCode();
 }
  public DownloadConfirmLayout(
      final Context context,
      String adm,
      String message,
      String appName,
      String okText,
      OnClickListener okListener,
      String cancelText,
      OnClickListener cancelListener)
      throws Exception {
    super(context);

    this.setBackgroundColor(Color.WHITE);

    JSONObject nativeAdAdm = new JSONObject(adm);
    String logoUrl = nativeAdAdm.getString("logo");
    String title = appName;
    String desc = nativeAdAdm.getString("desc");
    double density = context.getResources().getDisplayMetrics().density;
    RelativeLayout titleLayout = new RelativeLayout(context);
    titleLayout.setId(titleLayout.hashCode());

    iconContainer = new RelativeLayout(context);
    iconContainer.setId(iconContainer.hashCode());
    iconContainer.setVisibility(GONE);
    //        iconContainer.setBackgroundColor(Color.parseColor("#CCCCCC"));
    iconImageView = new ImageView(context);
    iconImageView.setScaleType(ImageView.ScaleType.FIT_XY);
    RelativeLayout.LayoutParams rllp = new LayoutParams(getPx(178, density), getPx(178, density));
    rllp.addRule(CENTER_IN_PARENT);
    rllp.topMargin = getPx(1, density);
    rllp.leftMargin = getPx(1, density);
    iconContainer.addView(iconImageView, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(ALIGN_PARENT_TOP);
    titleLayout.addView(iconContainer, rllp);

    RelativeLayout titleDescLayout = new RelativeLayout(context);
    titleDescLayout.setId(titleDescLayout.hashCode());

    TextView titleTextView = new TextView(context);
    titleTextView.setId(titleTextView.hashCode());
    titleTextView.setEllipsize(TextUtils.TruncateAt.END);
    titleTextView.setSingleLine();
    titleTextView.setText(title);
    titleTextView.setTextSize(20);
    titleTextView.setTypeface(Typeface.DEFAULT_BOLD);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    titleDescLayout.addView(titleTextView, rllp);

    TextView descTextView = new TextView(context);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(BELOW, titleTextView.getId());
    rllp.topMargin = getPx(24, density);
    descTextView.setText(desc);
    descTextView.setTextSize(13);
    descTextView.setEllipsize(TextUtils.TruncateAt.END);
    descTextView.setSingleLine();
    titleDescLayout.addView(descTextView, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.leftMargin = getPx(44, density);
    rllp.addRule(RIGHT_OF, iconContainer.getId());
    titleLayout.addView(titleDescLayout, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.leftMargin = getPx(56, density);
    rllp.topMargin = getPx(56, density);
    rllp.addRule(ALIGN_PARENT_TOP);
    addView(titleLayout, rllp);

    View ToplineView = new View(context);
    ToplineView.setId(ToplineView.hashCode());
    ToplineView.setBackgroundColor(Color.parseColor("#1C1C1C"));
    rllp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getPx(3, density));
    rllp.addRule(BELOW, titleLayout.getId());
    rllp.topMargin = getPx(21, density);
    addView(ToplineView, rllp);

    TextView messageTextView = new TextView(context);
    messageTextView.setText(message);
    messageTextView.setTextSize((float) 49.0 / 3);
    messageTextView.setId(messageTextView.hashCode());
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(CENTER_HORIZONTAL);
    rllp.addRule(BELOW, ToplineView.getId());
    rllp.topMargin = getPx(39, density);
    rllp.bottomMargin = rllp.topMargin;
    rllp.leftMargin = getPx(56, density);
    addView(messageTextView, rllp);

    View ButtomlineView = new View(context);
    ButtomlineView.setId(ButtomlineView.hashCode());
    ButtomlineView.setBackgroundColor(Color.parseColor("#929292"));
    rllp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getPx(2, density));
    rllp.addRule(BELOW, messageTextView.getId());
    addView(ButtomlineView, rllp);

    LinearLayout buttonLayout = new LinearLayout(context);
    buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
    Button okBtn = new Button(context);
    okBtn.setId(okBtn.hashCode());
    okBtn.setText(okText);
    okBtn.setOnClickListener(okListener);
    LinearLayout.LayoutParams lllp =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lllp.weight = 0.5f;
    buttonLayout.addView(okBtn, lllp);

    View MiddlelineView = new View(context);
    MiddlelineView.setId(ButtomlineView.hashCode());
    MiddlelineView.setBackgroundColor(Color.parseColor("#929292"));
    rllp = new LayoutParams(getPx(2, density), ViewGroup.LayoutParams.MATCH_PARENT);
    rllp.addRule(RIGHT_OF, okBtn.getId());
    buttonLayout.addView(MiddlelineView, rllp);

    Button cancelBtn = new Button(context);
    cancelBtn.setOnClickListener(cancelListener);
    cancelBtn.setText(cancelText);
    buttonLayout.addView(cancelBtn, lllp);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(BELOW, messageTextView.getId());
    addView(buttonLayout, rllp);

    okBtn.setBackgroundColor(Color.argb(0, 0, 0, 0));
    cancelBtn.setBackgroundColor(Color.argb(0, 0, 0, 0));

    okBtn.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            Button btn = (Button) v;
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              btn.setBackgroundColor(Color.argb(130, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_UP) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_CANCEL) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }

            return false;
          }
        });

    cancelBtn.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            Button btn = (Button) v;
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              btn.setBackgroundColor(Color.argb(130, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_UP) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_CANCEL) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }

            return false;
          }
        });

    HttpRequester.getAsynData(
        context,
        logoUrl,
        true,
        new HttpRequester.Listener() {
          @Override
          public void onGetDataSucceed(byte[] data) {
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
            iconImageView.setImageBitmap(bitmap);
            iconContainer.setVisibility(VISIBLE);
          }

          @Override
          public void onGetDataFailed(String error) {
            MVLog.e(MvErrorCode.COMMON_ERROR, error);
          }
        });
  }
Beispiel #8
0
 @Override
 public int hashCode() {
   final View view = get();
   return view != null ? view.hashCode() : 0;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
      convertView =
          mLayoutInflater.inflate(R.layout.view_inspector_profile_result_listitem, parent, false);
      viewHolder = new ViewHolder();
      viewHolder.viewClass = (TextView) convertView.findViewById(R.id.view_class);
      viewHolder.viewId = (TextView) convertView.findViewById(R.id.view_id);
      viewHolder.measureTime = (TextView) convertView.findViewById(R.id.column1);
      viewHolder.layoutTime = (TextView) convertView.findViewById(R.id.column2);
      viewHolder.drawTime = (TextView) convertView.findViewById(R.id.column3);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    View view = viewSuspects.get(position);
    viewHolder.viewClass.setText(ViewUtil.getClassName(view));
    viewHolder.viewId.setText(ViewUtil.getSimpleViewId(view));

    String sql =
        "select avg("
            + ViewProfile.MEASURE_DURATION
            + "), "
            + "avg("
            + ViewProfile.LAYOUT_DURATION
            + "), "
            + "avg("
            + ViewProfile.DRAW_DURATION
            + ") "
            + " from "
            + ViewProfile.TABLE
            + " where "
            + ViewProfile.VIEW_HASHCODE
            + " = ?";
    Cursor cursor =
        db.getReadableDatabase().rawQuery(sql, new String[] {Integer.toHexString(view.hashCode())});
    if (cursor.moveToNext()) {
      double measure = cursor.getInt(0) / 1000.0;
      double layout = cursor.getInt(1) / 1000.0;
      double draw = cursor.getInt(2) / 1000.0;

      viewHolder.measureTime.setText(String.format("%4.2f", measure));
      viewHolder.layoutTime.setText(String.format("%4.2f", layout));
      viewHolder.drawTime.setText(String.format("%4.2f", draw));

      if (measure > mAvgMeasure) {
        viewHolder.measureTime.setBackgroundColor(Color.RED);
      } else if (measure == mAvgMeasure) {
        viewHolder.measureTime.setBackgroundColor(Color.YELLOW);
      } else {
        viewHolder.measureTime.setBackgroundColor(Color.TRANSPARENT);
      }

      if (layout > mAvgLayout) {
        viewHolder.layoutTime.setBackgroundColor(Color.RED);
      } else if (layout == mAvgLayout) {
        viewHolder.layoutTime.setBackgroundColor(Color.YELLOW);
      } else {
        viewHolder.layoutTime.setBackgroundColor(Color.TRANSPARENT);
      }

      if (draw > mAvgDraw) {
        viewHolder.drawTime.setBackgroundColor(Color.RED);
      } else if (draw == mAvgDraw) {
        viewHolder.drawTime.setBackgroundColor(Color.YELLOW);
      } else {
        viewHolder.drawTime.setBackgroundColor(Color.TRANSPARENT);
      }
    }
    cursor.close();

    return convertView;
  }
 private void snapshotView(JsonWriter paramJsonWriter, View paramView) throws IOException {
   int i = paramView.getId();
   Object localObject1;
   if (-1 == i) {
     localObject1 = null;
     paramJsonWriter.beginObject();
     paramJsonWriter.name("hashCode").value(paramView.hashCode());
     paramJsonWriter.name("id").value(i);
     paramJsonWriter.name("mp_id_name").value((String) localObject1);
     localObject1 = paramView.getContentDescription();
     if (localObject1 != null) {
       break label418;
     }
     paramJsonWriter.name("contentDescription").nullValue();
     label81:
     localObject1 = paramView.getTag();
     if (localObject1 != null) {
       break label438;
     }
     paramJsonWriter.name("tag").nullValue();
   }
   Object localObject2;
   int j;
   for (; ; ) {
     paramJsonWriter.name("top").value(paramView.getTop());
     paramJsonWriter.name("left").value(paramView.getLeft());
     paramJsonWriter.name("width").value(paramView.getWidth());
     paramJsonWriter.name("height").value(paramView.getHeight());
     paramJsonWriter.name("scrollX").value(paramView.getScrollX());
     paramJsonWriter.name("scrollY").value(paramView.getScrollY());
     paramJsonWriter.name("visibility").value(paramView.getVisibility());
     float f1 = 0.0F;
     float f2 = 0.0F;
     if (Build.VERSION.SDK_INT >= 11) {
       f1 = paramView.getTranslationX();
       f2 = paramView.getTranslationY();
     }
     paramJsonWriter.name("translationX").value(f1);
     paramJsonWriter.name("translationY").value(f2);
     paramJsonWriter.name("classes");
     paramJsonWriter.beginArray();
     localObject1 = paramView.getClass();
     do {
       paramJsonWriter.value((String) this.mClassnameCache.get(localObject1));
       localObject2 = ((Class) localObject1).getSuperclass();
       if (localObject2 == Object.class) {
         break;
       }
       localObject1 = localObject2;
     } while (localObject2 != null);
     paramJsonWriter.endArray();
     addProperties(paramJsonWriter, paramView);
     localObject1 = paramView.getLayoutParams();
     if (!(localObject1 instanceof RelativeLayout.LayoutParams)) {
       break label469;
     }
     localObject1 = ((RelativeLayout.LayoutParams) localObject1).getRules();
     paramJsonWriter.name("layoutRules");
     paramJsonWriter.beginArray();
     j = localObject1.length;
     i = 0;
     while (i < j) {
       paramJsonWriter.value(localObject1[i]);
       i += 1;
     }
     localObject1 = this.mResourceIds.nameForId(i);
     break;
     label418:
     paramJsonWriter.name("contentDescription").value(((CharSequence) localObject1).toString());
     break label81;
     label438:
     if ((localObject1 instanceof CharSequence)) {
       paramJsonWriter.name("tag").value(localObject1.toString());
     }
   }
   paramJsonWriter.endArray();
   label469:
   paramJsonWriter.name("subviews");
   paramJsonWriter.beginArray();
   if ((paramView instanceof ViewGroup)) {
     localObject1 = (ViewGroup) paramView;
     j = ((ViewGroup) localObject1).getChildCount();
     i = 0;
     while (i < j) {
       localObject2 = ((ViewGroup) localObject1).getChildAt(i);
       if (localObject2 != null) {
         paramJsonWriter.value(localObject2.hashCode());
       }
       i += 1;
     }
   }
   paramJsonWriter.endArray();
   paramJsonWriter.endObject();
   if ((paramView instanceof ViewGroup)) {
     paramView = (ViewGroup) paramView;
     j = paramView.getChildCount();
     i = 0;
     while (i < j) {
       localObject1 = paramView.getChildAt(i);
       if (localObject1 != null) {
         snapshotView(paramJsonWriter, (View) localObject1);
       }
       i += 1;
     }
   }
 }
 private String viewToString(View view) {
   return view.getClass().getSimpleName() + "@" + Integer.toHexString(view.hashCode());
 }
Beispiel #12
0
 @Override
 public int getId() {
   View view = viewRef.get();
   return view == null ? super.hashCode() : view.hashCode();
 }