コード例 #1
1
ファイル: CustomViewAbove.java プロジェクト: tobberguo/Riding
 public void setAboveOffset(int i) {
   //		RelativeLayout.LayoutParams params =
   // ((RelativeLayout.LayoutParams)mContent.getLayoutParams());
   //		params.setMargins(i, params.topMargin, params.rightMargin, params.bottomMargin);
   mContent.setPadding(
       i, mContent.getPaddingTop(), mContent.getPaddingRight(), mContent.getPaddingBottom());
 }
コード例 #2
1
 public void onRadioButtonClicked(View v) {
   if (v.getId() == R.id.group_closed_radio) {
     groupLogo.setImageResource(R.drawable.group_closed);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_closed_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_closed
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_closed_description);
   } else if (v.getId() == R.id.group_open_radio) {
     groupLogo.setImageResource(R.drawable.group_open);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_open_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_open
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_open_description);
   }
 }
コード例 #3
1
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.carbon_cycle_view, container, false);

    TextView diagramTxt = (TextView) view.findViewById(R.id.txt_diagram);
    TextView savedScoreTxt = (TextView) view.findViewById(R.id.score_saved);

    Button startBtn = (Button) view.findViewById(R.id.go_diagram_btn);

    diagramTxt.setTypeface(tfThin);
    startBtn.setTypeface(tfThin);
    savedScoreTxt.setText((int) ((score / GAME_SCORE) * 100) + "% Sucess");

    startBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            Intent carbonIntent = new Intent(getActivity(), DiagramPlayCarbonCycle.class);
            carbonIntent.putExtra("SOURCE", "Fragment");
            carbonIntent.putExtra("TRY_CYCLE", 0);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(carbonIntent);
          }
        });

    return view;
  }
コード例 #4
1
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.inflater = inflater;
    if (diseaseview != null) container.removeAllViews();
    diseaseview = inflater.inflate(R.layout.fragment_symptomdisease, container, false);
    InitWidth(diseaseview);

    lcontent = (LinearLayout) diseaseview.findViewById(R.id.lcontainer);
    btjianjie = (Button) diseaseview.findViewById(R.id.jianjie);
    btdescription = (Button) diseaseview.findViewById(R.id.description);
    btjianjie.setEnabled(true);
    btdescription.setEnabled(true);
    btjianjie.setOnClickListener(this);
    btdescription.setOnClickListener(this);

    if (data.getType() == Constants.ZHENGZHUANG) {
      btdescription.setText("¿ÉÄܼ²²¡");
    } else {
      btdescription.setText("°éËæÖ¢×´");
    }
    onjianjie();

    return diseaseview;
  }
コード例 #5
1
ファイル: FingerTracker.java プロジェクト: Sai-Teja/Blaubot
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    if (!activated) return true;
    if (!canSend()) return true;
    int viewWidth = mView.getWidth();
    int viewHeight = mView.getHeight();
    final int pointerCount = event.getPointerCount();
    Finger[] newFingers = new Finger[pointerCount];

    for (int p = 0; p < pointerCount; p++) {
      event.getPointerCoords(p, pc);
      Finger f = new Finger();
      float x = (float) pc.x / (float) viewWidth;
      float y = (float) pc.y / (float) viewHeight;
      f.setX(x);
      f.setY(y);
      f.setColor(randomColor);
      newFingers[p] = f;
    }
    FingerMessage msg = new FingerMessage();
    msg.setClientUUID(clientUUIDString);
    msg.setFingers(newFingers);
    msg.setColor(randomColor);
    String json = gson.toJson(msg);

    this.channel.publish(json.getBytes());
    lastSentTimestamp = System.currentTimeMillis();

    return true;
  }
コード例 #6
1
ファイル: PhotoTable.java プロジェクト: zst123/p201-packages
  /** Put a nice border on the bitmap. */
  private static View applyFrame(
      final PhotoTable table, final BitmapFactory.Options options, Bitmap decodedPhoto) {
    LayoutInflater inflater =
        (LayoutInflater) table.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View photo = inflater.inflate(R.layout.photo, null);
    ImageView image = (ImageView) photo;
    Drawable[] layers = new Drawable[2];
    int photoWidth = options.outWidth;
    int photoHeight = options.outHeight;
    if (decodedPhoto == null || options.outWidth <= 0 || options.outHeight <= 0) {
      photo = null;
    } else {
      decodedPhoto.setHasMipMap(true);
      layers[0] = new BitmapDrawable(table.mResources, decodedPhoto);
      layers[1] = table.mResources.getDrawable(R.drawable.frame);
      LayerDrawable layerList = new LayerDrawable(layers);
      layerList.setLayerInset(0, table.mInset, table.mInset, table.mInset, table.mInset);
      image.setImageDrawable(layerList);

      photo.setTag(R.id.photo_width, Integer.valueOf(photoWidth));
      photo.setTag(R.id.photo_height, Integer.valueOf(photoHeight));

      photo.setOnTouchListener(new PhotoTouchListener(table.getContext(), table));
    }
    return photo;
  }
コード例 #7
1
  public void addRow(View view) {

    EditText editText = (EditText) _popPopupWindow.getContentView().findViewById(R.id.skillInput);

    if (!_newsTopics.contains(editText.getText().toString())) {
      LinearLayout linear = (LinearLayout) findViewById(R.id.LinearLayout1);

      LayoutInflater inflater =
          (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View rowView = (View) inflater.inflate(R.layout.row, null, false);

      TextView skillName = (TextView) rowView.findViewById(R.id.skillName);
      skillName.setText(editText.getText().toString());
      final Context mainActivity = this;

      rowView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(mainActivity, NewsActivity.class);

              TextView skillName = (TextView) v.findViewById(R.id.skillName);
              intent.putExtra(SKILL_NAME, skillName.getText().toString());
              startActivity(intent);
            }
          });

      linear.addView(rowView);
      linear.addView(getHorSep());
    }

    _popPopupWindow.dismiss();
    _popPopupWindow = null;
  }
コード例 #8
1
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int count = getChildCount();
    for (int i = 0; i < count; i++) {
      final View child = getChildAt(i);
      if (child.getVisibility() != GONE) {
        CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
        int childLeft = lp.x;
        int childTop = lp.y;
        child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height);

        if (lp.dropped) {
          lp.dropped = false;

          final int[] cellXY = mTmpCellXY;
          getLocationOnScreen(cellXY);
          mWallpaperManager.sendWallpaperCommand(
              getWindowToken(),
              WallpaperManager.COMMAND_DROP,
              cellXY[0] + childLeft + lp.width / 2,
              cellXY[1] + childTop + lp.height / 2,
              0,
              null);
        }
      }
    }
  }
コード例 #9
1
ファイル: UpdateAdapter.java プロジェクト: kvite/Tasquid
  private void setupHistoryRow(View view, History history, User user) {
    final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture);
    {
      if (user.containsNonNullValue(USER_PICTURE)) {
        String pictureUrl = user.getPictureUrl(USER_PICTURE, RemoteModel.PICTURE_THUMB);
        pictureView.setUrl(pictureUrl);
      } else {
        pictureView.setUrl(null);
      }
      pictureView.setVisibility(View.VISIBLE);
    }

    final AsyncImageView commentPictureView =
        (AsyncImageView) view.findViewById(R.id.comment_picture);
    commentPictureView.setVisibility(View.GONE);

    final TextView nameView = (TextView) view.findViewById(R.id.title);
    {
      nameView.setText(
          getHistoryComment(
              (AstridActivity) fragment.getActivity(), history, user, linkColor, fromView));
      nameView.setTextColor(grayColor);
    }

    final TextView date = (TextView) view.findViewById(R.id.date);
    {
      CharSequence dateString =
          DateUtils.getRelativeTimeSpanString(
              history.getValue(History.CREATED_AT),
              DateUtilities.now(),
              DateUtils.MINUTE_IN_MILLIS,
              DateUtils.FORMAT_ABBREV_RELATIVE);
      date.setText(dateString);
    }
  }
コード例 #10
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.offline_media);
    setTitle(getString(R.string.offline));

    mLoadingBar = findViewById(R.id.offline_loading_bar);
    mLoadingBar.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mLoadingCount > 0) {
              Intent intent = new Intent(OfflineMediaActivity.this, OfflineActivity.class);
              startActivity(intent);
            }
          }
        });
    mLoadingCountTextView = (TextView) mLoadingBar.findViewById(R.id.offline_media_bar_title);
    mLoadingProgressTextView = (TextView) mLoadingBar.findViewById(R.id.offline_media_bar_subtitle);

    setLoadingCount(0);
    setLoadingProgress(0, 0);

    adapter = new RelativeAdapter(getBaseContext(), null, true);
    mListView = (GridView) findViewById(R.id.offline_media_block_grids);

    // update UI
    mListView.setAdapter(adapter);
    mLoadingView =
        makeEmptyLoadingView(getBaseContext(), (RelativeLayout) findViewById(R.id.tabs_content));

    findViewById(R.id.offline_media_block).setVisibility(View.GONE);
    // after check then load
    getSupportLoaderManager().initLoader(cursorFinishedLoaderID, null, this);
  }
コード例 #11
0
ファイル: PhotoTable.java プロジェクト: zst123/p201-packages
 /** Dispose of the photo gracefully, in case we can see some of it. */
 public void fadeAway(final View photo, final boolean replace) {
   // fade out of view
   mOnTable.remove(photo);
   exitStageLeft(photo);
   photo.setOnTouchListener(null);
   photo.animate().cancel();
   photo
       .animate()
       .withLayer()
       .alpha(0f)
       .setDuration(mPickUpDuration)
       .withEndAction(
           new Runnable() {
             @Override
             public void run() {
               if (photo == getFocus()) {
                 clearFocus();
               }
               mStageLeft.removeView(photo);
               recycle(photo);
               if (replace) {
                 scheduleNext(mNowDropDelay);
               }
             }
           });
 }
コード例 #12
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder = null;
   DataModel model = listData.get(position);
   if (convertView == null) {
     convertView =
         View.inflate(getActivity(), R.layout.item_message_fragment_order_message, null);
     holder = new ViewHolder(convertView);
   }
   holder = (ViewHolder) convertView.getTag();
   int state = model.state, refund_state = model.refund_state;
   if (state == 9 && refund_state == 9) {
     model.result = "退款申请已处理.";
   } else if (state == 9 && refund_state != 9) {
     model.result = "订单已支付";
   } else if (state == 0) {
     model.result = "订单已关闭";
   } else if (state == 1) {
     model.result = "订单未支付";
   }
   holder.tv_result.setText(model.result);
   holder.tv_ordernum.setText(
       String.format(getResources().getString(R.string.order_message_ordernum), model.order_id));
   return convertView;
 }
コード例 #13
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.local_video_menu, menu);
    final View view = menu.findItem(R.id.local_video_scan_menu).getActionView();
    if (view != null) {
      textView = (TextView) view.findViewById(R.id.right_title_text);
      //            textView.setTextColor(getResources().getColor(R.color.common_text_color));
      //            textView.setText("扫描视频");

      textView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              vandaAlert.show();
              view.setClickable(false);
              allStorages = StorageUtil.getAllStorage(LoaclVideoActivity.this);
              myTask = new ScanVideoTask();
              myTask.execute();
              isRunning = true;
            }
          });
    }

    return true;
  }
コード例 #14
0
  public void displayPopup(View view) {
    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View popView = (View) inflater.inflate(R.layout.add_popup, null, false);
    Button okButton = (Button) popView.findViewById(R.id.okButton);
    okButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            addRow(v);
          }
        });

    Button cancelButton = (Button) popView.findViewById(R.id.cancelButton);
    cancelButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            _popPopupWindow.dismiss();
            _popPopupWindow = null;
          }
        });

    _popPopupWindow = new PopupWindow(popView, 400, 300, true);
    _popPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    _popPopupWindow.setOutsideTouchable(false);
    _popPopupWindow.setFocusable(true);

    _popPopupWindow.showAtLocation(this.findViewById(R.id.LinearLayout1), Gravity.CENTER, 0, 0);
  }
コード例 #15
0
  /** @return Calculates the position to which the ListView should be scrolled. */
  public int getScrollToPosition() {
    int childCount = getChildCount();
    if (childCount == 0) {
      return -1;
    }
    if (childCount == 1) {
      return 0;
    }

    int firstPos = getFirstVisiblePosition();
    View firstChild = getChildAt(0);

    // If the first child is scrolled past at least half,
    // scroll to the next item. Else, scroll back to the first child.
    int top = firstChild.getTop();
    int height = firstChild.getHeight();
    boolean halfScrolled = Math.abs(top) >= (height / 2);

    int position = firstPos;
    if (halfScrolled) {
      position++;
    }
    // Sanity check.
    if (position >= mMonthAdapter.getCount()) {
      position = mMonthAdapter.getCount() - 1;
    }
    return position;
  }
コード例 #16
0
ファイル: TabManager.java プロジェクト: AreYouLoco/openbmap
 @Override
 public View createTabContent(final String tag) {
   final View v = new View(mContext);
   v.setMinimumWidth(0);
   v.setMinimumHeight(0);
   return v;
 }
コード例 #17
0
ファイル: ListAdapter.java プロジェクト: narmold/Memorable3
  @Override
  public View getView(int position, View bankView, ViewGroup parent) {
    // set the rowview
    View rowView = bankView;
    // reuse views
    if (rowView == null) {
      // if the row view is not null then inflate for display
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_bank_item, null);
    }

    // get the text views and set the values to the values in the list
    TextView username = (TextView) rowView.findViewById(R.id.value_username);
    TextView website = (TextView) rowView.findViewById(R.id.value_website);
    TextView password = (TextView) rowView.findViewById(R.id.value_password);
    TextView expiration = (TextView) rowView.findViewById(R.id.value_expires);

    username.setText(PasswordInfoArrayList.get(position).getUsername());
    website.setText(PasswordInfoArrayList.get(position).getWebsite());
    password.setText(PasswordInfoArrayList.get(position).getPassword());

    DateHelper expires = PasswordInfoArrayList.get(position).getExpiration();
    boolean expired = expires.isLaterThan(DateHelper.getCurrentDate());
    if (expired) {
      expiration.setTextColor(Color.RED);
    }
    String expStr = PasswordInfoArrayList.get(position).getExpiration().toString();
    expiration.setText(expStr);

    return rowView;
  }
コード例 #18
0
ファイル: UpdateManager.java プロジェクト: uwitec/hckpApp
  /** 显示下载对话框 */
  private void showDownloadDialog() {
    Builder builder = new Builder(mContext);
    builder.setTitle("正在下载新版本");

    final LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = inflater.inflate(R.layout.update_progress, null);
    mProgress = (ProgressBar) v.findViewById(R.id.update_progress);
    mProgressText = (TextView) v.findViewById(R.id.update_progress_text);

    builder.setView(v);
    builder.setNegativeButton(
        "取消",
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    builder.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    downloadDialog = builder.create();
    downloadDialog.setCanceledOnTouchOutside(false);
    downloadDialog.show();

    downloadApk();
  }
コード例 #19
0
  public boolean onLongClick(View v) {
    // Return if workspace is locked
    if (mLauncher.getLockWorkspace()) return false;
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) return true;

    Object tag = v.getTag();
    if (tag instanceof ShortcutInfo) {
      ShortcutInfo item = (ShortcutInfo) tag;
      if (!v.isInTouchMode()) {
        return false;
      }

      mLauncher.getWorkspace().beginDragShared(v, this);

      mCurrentDragInfo = item;
      mEmptyCell[0] = item.cellX;
      mEmptyCell[1] = item.cellY;
      mCurrentDragView = v;

      mContent.removeView(mCurrentDragView);
      mInfo.remove(mCurrentDragInfo);
      mDragInProgress = true;
      mItemAddedBackToSelfViaIcon = false;
    }
    return true;
  }
コード例 #20
0
ファイル: PhotoTable.java プロジェクト: zst123/p201-packages
  /** On deck is to the left or right of the selected photo. */
  private void placeOnDeck(final View photo, final int slot) {
    if (slot < mOnDeck.length) {
      if (mOnDeck[slot] != null && mOnDeck[slot] != photo) {
        fadeAway(mOnDeck[slot], false);
      }
      mOnDeck[slot] = photo;
      float photoWidth = photo.getWidth();
      float photoHeight = photo.getHeight();
      float scale = Math.min(getHeight() / photoHeight, getWidth() / photoWidth);

      float x = (getWidth() - photoWidth) / 2f;
      float y = (getHeight() - photoHeight) / 2f;

      float offset = (((float) mWidth + scale * (photoWidth - 2f * mInset)) / 2f);
      x += (slot == NEXT ? 1f : -1f) * offset;

      photo
          .animate()
          .withLayer()
          .rotation(0f)
          .rotationY(0f)
          .scaleX(scale)
          .scaleY(scale)
          .x(x)
          .y(y)
          .setDuration(mPickUpDuration)
          .setInterpolator(new DecelerateInterpolator(2f));
    }
  }
コード例 #21
0
ファイル: PhotoTable.java プロジェクト: zst123/p201-packages
 /** Move in response to touch. */
 public void move(final View photo, float x, float y, float a) {
   photo.animate().cancel();
   photo.setAlpha(1f);
   photo.setX((int) x);
   photo.setY((int) y);
   photo.setRotation((int) a);
 }
コード例 #22
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // Changed to ViewHolder and Picasso error load as per feedback received
    ViewHolder holder = new ViewHolder();

    // Inflate view if it is null
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.grid_item, null);
      holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster);
      MovieDetailDO movie = movieList.get(position);
      convertView.setTag(holder);

      Picasso.with(context)
          .load(movie.getPoster_path())
          // .placeholder(R.drawable.def_pos)
          .error(R.drawable.def_pos)
          .into(holder.imageView);

    } else {
      holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster);
      MovieDetailDO movie = movieList.get(position);
      convertView.setTag(holder);

      Picasso.with(context)
          .load(movie.getPoster_path())
          // .placeholder(R.drawable.def_pos)
          .error(R.drawable.def_pos)
          .into(holder.imageView);
    }

    return convertView;
  }
コード例 #23
0
ファイル: WallAdapter.java プロジェクト: WunderEye/H2Icons
    public SimpleItemViewHolder(final View view) {
      super(view);
      wall = (ImageView) view.findViewById(R.id.wall_grid_art);
      name = (TextView) view.findViewById(R.id.wall_grid_name);
      author = (TextView) view.findViewById(R.id.wall_grid_desc);
      pb = (ProgressBar) view.findViewById(R.id.progressBar_wall_grid);
      realBackground = (RelativeLayout) view.findViewById(R.id.wall_real_background);
      mainView = view;

      target =
          new Target() {
            @Override
            public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
              pb.setVisibility(View.GONE);
              wall.setImageBitmap(bitmap);
              realBackground.setBackgroundColor(
                  view.getContext().getResources().getColor(android.R.color.white));
              new ColorGridTask(view.getContext(), bitmap, SimpleItemViewHolder.this).execute();
            }

            @Override
            public void onBitmapFailed(Drawable errorDrawable) {}

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {}
          };
    }
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.purchaselistrow, null);
      }
      PurchaseHistoryEntity watchListAllEntity = items.get(position);

      if (watchListAllEntity != null) {
        // TextView nt = (TextView)
        // v.findViewById(R.id.fileNameTextView);
        TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1);
        TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2);
        TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3);
        TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4);
        TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5);

        /*STATUS
        注文日 (order date)
        納品日 (delivery date)
        依頼枚数(no. of request)
        納品枚数(no. of delivery)*/

        tv1.setText("STATUS: " + watchListAllEntity.get_status_ja());
        tv2.setText("注文日: " + watchListAllEntity.get_order_created_at());
        tv3.setText("納品日: " + watchListAllEntity.get_order_created_at());
        tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount());
        tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount());
      }

      return v;
    }
コード例 #25
0
  private void blur(Bitmap bg, View view) {
    long startMs = System.currentTimeMillis();

    float radius = 20;
    Bitmap overlay =
        Bitmap.createBitmap(
            view.getMeasuredWidth() / scaleFactor,
            view.getMeasuredHeight() / scaleFactor,
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(overlay);
    canvas.translate(-view.getLeft() / scaleFactor, -view.getTop() / scaleFactor);
    // scale参数为float类型
    canvas.scale(1.0f / scaleFactor, 1.0f / scaleFactor);
    // 开启双缓冲
    Paint paint = new Paint();
    paint.setFlags(Paint.FILTER_BITMAP_FLAG);

    canvas.drawBitmap(bg, 0, 0, paint);
    // Bitmap result = blurBitmap(overlay, 2);
    Bitmap result = blurBitmapStack(overlay, 2);
    view.setBackground(new BitmapDrawable(result));
    long endMs = System.currentTimeMillis();
    String time = (endMs - startMs) + "ms";
    Toast.makeText(this, time, Toast.LENGTH_SHORT).show();
  }
コード例 #26
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.left_fragment, null);
    LinearLayout userLayout = (LinearLayout) view.findViewById(R.id.userLayout);
    userLayout.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View v) {
            // 创建用户信息界面
            UserFragment user = UserFragment.newInstance(((MainActivity) getActivity()).getToken());
            FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
            ft.replace(R.id.center_frame, user);
            ft.commit();
            ((MainActivity) getActivity()).showLeft();
          }
        });

    LinearLayout mainPage = (LinearLayout) view.findViewById(R.id.mainPage); // 添加主页按钮响应
    mainPage.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            ((MainActivity) getActivity()).showCenter();
            ((MainActivity) getActivity()).showLeft();
          }
        });
    return view;
  }
コード例 #27
0
  /** Inflate the layout for this fragment */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false);

    mSelectKeysButton = (BootstrapButton) view.findViewById(R.id.btn_selectEncryptKeys);
    mSign = (CheckBox) view.findViewById(R.id.sign);
    mMainUserId = (TextView) view.findViewById(R.id.mainUserId);
    mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
    mSelectKeysButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            selectPublicKeys();
          }
        });
    mSign.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            CheckBox checkBox = (CheckBox) v;
            if (checkBox.isChecked()) {
              selectSecretKey();
            } else {
              setSignatureKeyId(Constants.key.none);
            }
          }
        });

    return view;
  }
コード例 #28
0
 public void addTrailerView() {
   LayoutInflater vi =
       (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   Log.d("vi", "Null " + Boolean.toString(vi == null));
   for (int i = 0; i < trailerVideo.size(); i++) {
     View trailerView = vi.inflate(R.layout.trailer_view, null);
     final TextView trailerTitleView = (TextView) trailerView.findViewById(R.id.trailer_title);
     trailerTitleView.setText(trailerVideo.get(i).getName());
     ImageButton imageButton = (ImageButton) trailerView.findViewById(R.id.trailer_play_button);
     final String source = trailerVideo.get(i).getSource();
     imageButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + source));
             startActivity(intent);
           }
         });
     insertTrailerPoint.addView(
         trailerView,
         0,
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
   }
 }
コード例 #29
0
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View view = inflater.inflate(R.layout.fragment_company_list, container, false);
   companyList = (ListView) view.findViewById(R.id.company_list);
   return view;
 }
コード例 #30
0
  public void measureChild(View child) {
    final LauncherAppState app = LauncherAppState.getInstance();
    final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    final int cellWidth = mCellWidth;
    final int cellHeight = mCellHeight;
    CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
    if (!lp.isFullscreen) {
      lp.setup(cellWidth, cellHeight, mWidthGap, mHeightGap, invertLayoutHorizontally(), mCountX);

      if (child instanceof LauncherAppWidgetHostView) {
        // Widgets have their own padding, so skip
      } else {
        // Otherwise, center the icon
        int cHeight = getCellContentHeight();
        int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
        int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
        child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
      }
    } else {
      lp.x = 0;
      lp.y = 0;
      lp.width = getMeasuredWidth();
      lp.height = getMeasuredHeight();
    }
    int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
    int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
    child.measure(childWidthMeasureSpec, childheightMeasureSpec);
  }