コード例 #1
0
ファイル: P1ActionBar.java プロジェクト: BurtKim/p1-android
 /**
  * Sets right view to arbitrary view
  *
  * @param view
  */
 public void setRightView(View view) {
   android.widget.LinearLayout.LayoutParams pl =
       new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
   if (view instanceof UserPictureView) pl.rightMargin = 0;
   else pl.rightMargin = mLayout.getPaddingLeft();
   pl.weight = 1;
   pl.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
   mLayout.addView(view, -1, pl);
   mLayout.setVisibility(View.VISIBLE);
 }
コード例 #2
0
  @SuppressLint("InflateParams")
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = LayoutInflater.from(context).inflate(R.layout.user_item, null);
      ItemViewCache itemViewCache = new ItemViewCache();
      itemViewCache.imageViewUser = (ImageView) convertView.findViewById(R.id.imageViewUser);
      itemViewCache.textViewUser = (TextView) convertView.findViewById(R.id.textViewUser);
      itemViewCache.textViewCount = (TextView) convertView.findViewById(R.id.textViewCount);
      itemViewCache.textViewDate = (TextView) convertView.findViewById(R.id.textViewDate);
      convertView.setTag(itemViewCache);
    }

    ItemViewCache cache = (ItemViewCache) convertView.getTag();
    User user = userList.get(position);
    URL url = user.getUserAvatar();
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(128, 128);
    layoutParams.leftMargin = 5;
    layoutParams.rightMargin = 5;
    layoutParams.topMargin = 5;
    layoutParams.bottomMargin = 5;
    cache.imageViewUser.setLayoutParams(layoutParams);
    if (url != null) {
      imageLoader.displayImage(url.toString(), cache.imageViewUser);
    }

    cache.textViewUser.setText(user.getTitle());
    cache.textViewCount.setText("随笔总数:" + user.getPostCount());
    cache.textViewDate.setText("最后更新:" + AppUtils.parseDateToString(user.getUpdatedDate()));

    return convertView;
  }
コード例 #3
0
  /** 设置显示的图片 */
  public void setImage(int[] res) {
    imgIds = res;

    linearLayout = (LinearLayout) findViewById(R.id.viewGroup);

    tips = new ImageView[imgIds.length];
    for (int i = 0; i < imgIds.length; i++) {
      ImageView mImageView = new ImageView(mContext);
      tips[i] = mImageView;
      LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      layoutParams.rightMargin = AppUtil.dip2px(mContext, 4);
      layoutParams.leftMargin = AppUtil.dip2px(mContext, 4);
      layoutParams.width = AppUtil.dip2px(mContext, 7);
      layoutParams.height = AppUtil.dip2px(mContext, 7);

      mImageView.setBackgroundResource(R.drawable.page_indicator_unfocused);
      linearLayout.addView(mImageView, layoutParams);
    }

    // 这个我是从上一个界面传过来的,上一个界面是一个GridView
    mImageSwitcher.setImageResource(imgIds[currentPosition]);

    setImageBackground(currentPosition);
  }
コード例 #4
0
  private void init(Context context) {
    inflater = LayoutInflater.from(context);
    view = inflater.inflate(R.layout.cs_message_about, null);
    LinearLayout.LayoutParams param_view =
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    param_view.leftMargin = DisplayManager.GetInstance().changeWidthSize(30);
    param_view.rightMargin = DisplayManager.GetInstance().changeWidthSize(30);
    param_view.topMargin = DisplayManager.GetInstance().changeWidthSize(20);
    view.setLayoutParams(param_view);
    version_title = (TextView) view.findViewById(R.id.version_title);
    version_content = (TextView) view.findViewById(R.id.version_content);
    help_title = (TextView) view.findViewById(R.id.help_title);
    help_title.setFocusable(true);
    help_title.setFocusableInTouchMode(true);
    help_content = (TextView) view.findViewById(R.id.help_content);

    version_title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE);
    version_content.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE);
    help_title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE);
    help_content.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE);

    version_title.setText("版本信息");
    version_content.setText("当前版本:" + Config.GetInstance().getVersionDisplayText());
    help_title.setText("使用帮助");
    addView(view);

    setContentData(getHelpContent(Config.OemType.getOemType(Config.GetInstance().getOemType())));
  }
コード例 #5
0
ファイル: StickyNote.java プロジェクト: lekd/Metaplan
  void initControl(Context ctx) {
    this.setBackground(ctx.getResources().getDrawable(R.drawable.sticky_note_background));
    this.setWeightSum(1.0f);
    this.setOrientation(LinearLayout.VERTICAL);

    writingCanvas = new NoteWritingCanvas(ctx);
    LinearLayout.LayoutParams writingCanvasLayoutParams =
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 0.95f);
    writingCanvasLayoutParams.topMargin = 5;
    writingCanvasLayoutParams.leftMargin = 2;
    writingCanvasLayoutParams.rightMargin = 2;
    writingCanvas.setLayoutParams(writingCanvasLayoutParams);
    writingCanvas.setWritingEventListener(this);
    this.addView(writingCanvas);

    okButton = new Button(ctx);
    okButton.setBackgroundResource(R.drawable.ok_button);
    LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams(75, 75);
    buttonLayoutParams.gravity = Gravity.BOTTOM | Gravity.END;
    okButton.setLayoutParams(buttonLayoutParams);
    okButton.setEnabled(false);
    okButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            okButton.setEnabled(false);
            if (contentSubmittedListener != null) {
              contentSubmittedListener.contentSubmittedEventHandler(myself);
            }
          }
        });
    this.addView(okButton);
  }
コード例 #6
0
 /** Show find dialog. Very pretty UI code ;) */
 public void showFindDialog() {
   Log.d(TAG, "find dialog...");
   final Dialog dialog = new Dialog(this);
   dialog.setTitle(R.string.find_dialog_title);
   LinearLayout contents = new LinearLayout(this);
   contents.setOrientation(LinearLayout.VERTICAL);
   this.findTextInputField = new EditText(this);
   this.findTextInputField.setWidth(this.pagesView.getWidth() * 80 / 100);
   Button goButton = new Button(this);
   goButton.setText(R.string.find_go_button);
   goButton.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           String text = OpenFileActivity.this.findTextInputField.getText().toString();
           OpenFileActivity.this.findText(text);
           dialog.dismiss();
         }
       });
   LinearLayout.LayoutParams params =
       new LinearLayout.LayoutParams(
           LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
   params.leftMargin = 5;
   params.rightMargin = 5;
   params.bottomMargin = 2;
   params.topMargin = 2;
   contents.addView(findTextInputField, params);
   contents.addView(goButton, params);
   dialog.setContentView(contents);
   dialog.show();
 }
コード例 #7
0
  /** 初始化Column栏目项 */
  private void initTabColumn() {
    mRadioGroup_content.removeAllViews();

    if (mUserChannelList != null) {
      int count = mUserChannelList.size();
      mColumnHorizontalScrollView.setParam(
          getActivity(),
          mScreenWidth,
          mRadioGroup_content,
          mShadeleft,
          mShaderight,
          ll_more_columns,
          rl_column);
      for (int i = 0; i < count; i++) {
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.leftMargin = 5;
        params.rightMargin = 5;
        //			TextView localTextView = (TextView) mInflater.inflate(R.layout.column_radio_item,
        // null);
        TextView columnTextView = new TextView(getActivity());
        columnTextView.setTextAppearance(getActivity(), R.style.top_category_scroll_view_item_text);
        //
        //	localTextView.setBackground(getResources().getDrawable(R.drawable.top_category_scroll_text_view_bg));
        columnTextView.setBackgroundResource(R.drawable.radio_buttong_bg);
        columnTextView.setGravity(Gravity.CENTER);
        columnTextView.setPadding(5, 5, 5, 5);
        columnTextView.setId(i);
        columnTextView.setText(mUserChannelList.get(i).getName());
        columnTextView.setTextColor(
            getResources().getColorStateList(R.color.top_category_scroll_text_color_day));
        if (columnSelectIndex == i) {
          columnTextView.setSelected(true);
        }
        columnTextView.setOnClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                for (int i = 0; i < mRadioGroup_content.getChildCount(); i++) {
                  View localView = mRadioGroup_content.getChildAt(i);
                  if (localView != v) localView.setSelected(false);
                  else {
                    localView.setSelected(true);
                    mViewPager.setCurrentItem(i);
                  }
                }
                Toast.makeText(
                        getActivity().getApplicationContext(),
                        mUserChannelList.get(v.getId()).getName(),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            });
        mRadioGroup_content.addView(columnTextView, i, params);
      }
    }
  }
 /**
  * Generate layout params for grid item view with appropriate horizontal spacing. The vertical
  * spacing between grid items should be set by the list's divider height. The grid's top and
  * bottom margins can be set on the list by enabling header and footer dividers or by disabling
  * clipToPadding and setting bottom padding on the listview
  */
 private LinearLayout.LayoutParams getGridItemLayoutParams(int column) {
   LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
   lp.leftMargin = (column == 0 ? gridItemHorizontalSpacing : gridItemHorizontalSpacing / 2);
   lp.rightMargin =
       (column == numColumns - 1 ? gridItemHorizontalSpacing : gridItemHorizontalSpacing / 2);
   lp.topMargin = 0;
   lp.bottomMargin = 0; // rely on the list divider for vertical spacing between rows
   return lp;
 }
コード例 #9
0
  // 进新浪微博、腾讯微博、Facebook和Twitter支持At功能
  private LinearLayout getAtLine(String platform) {
    if ("SinaWeibo".equals(platform)
        || "TencentWeibo".equals(platform)
        || "Facebook".equals(platform)
        || "Twitter".equals(platform)) {
      LinearLayout llAt = new LinearLayout(getContext());
      LinearLayout.LayoutParams lpAt =
          new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      lpAt.rightMargin = dipToPx(getContext(), 4);
      lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
      lpAt.weight = 1;
      llAt.setLayoutParams(lpAt);
      llAt.setOnClickListener(
          new OnClickListener() {
            public void onClick(View v) {
              FollowList subPage = new FollowList();
              String platform = String.valueOf(reqData.get("platform"));
              subPage.setPlatform(ShareSDK.getPlatform(platform));
              subPage.showForResult(activity, null, EditPage.this);
            }
          });

      TextView tvAt = new TextView(getContext());
      int resId = getBitmapRes(activity, "btn_back_nor");
      if (resId > 0) {
        tvAt.setBackgroundResource(resId);
      }
      int dp_32 = dipToPx(getContext(), 32);
      tvAt.setLayoutParams(new LinearLayout.LayoutParams(dp_32, dp_32));
      tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
      tvAt.setText("@");
      int dp_2 = dipToPx(getContext(), 2);
      tvAt.setPadding(0, 0, 0, dp_2);
      tvAt.setTypeface(Typeface.DEFAULT_BOLD);
      tvAt.setTextColor(0xff000000);
      tvAt.setGravity(Gravity.CENTER);
      llAt.addView(tvAt);

      TextView tvName = new TextView(getContext());
      tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
      tvName.setTextColor(0xff000000);
      resId = getStringRes(activity, "list_friends");
      String text = getContext().getString(resId, getName(platform));
      tvName.setText(text);
      LinearLayout.LayoutParams lpName =
          new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      lpName.gravity = Gravity.CENTER_VERTICAL;
      tvName.setLayoutParams(lpName);
      llAt.addView(tvName);

      return llAt;
    }

    return null;
  }
コード例 #10
0
  @Override
  public void initView(Bundle savedInstanceState) {

    RegisterActivity.this.setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_icon);

    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) toolbarTitleTv.getLayoutParams();
    params.rightMargin = DensityUtil.getActionBarSize(RegisterActivity.this);
    toolbarTitleTv.setVisibility(View.VISIBLE);
    toolbarTitleTv.setText("注 册");

    RegisterActivity.this.combineLatestEvents();
  }
コード例 #11
0
  @Override
  protected void setListener() {

    EventBus.getDefault().register(this);
    adapter = new CircleAdapter(activity, new ArrayList<CircleVo.ItemCircle>());
    list_circle.addFooter(adapter);
    list_circle.setAdapter(adapter);

    list_circle.setRefreshHeaderMode(list_circle.MODE_CLASSICDEFAULT_HEADER);
    list_circle.setLayoutManager(new LinearLayoutManager(activity));
    list_circle.setOnLoadMoreListener(
        new UltimateRecyclerView.OnLoadMoreListener() {
          @Override
          public void loadMore(int i, int i1) {
            if (list_circle.canLoadMore()) {
              query(false);
            }
          }
        });
    list_circle.setOnCustomRefreshListener(
        new CustomRecyclerView.OnCustomRefreshListener() {
          @Override
          public void OnCustomRefresh(PtrFrameLayout frame) {
            pageNum = 1;
            query(false);
          }
        });

    View header = activity.makeView(R.layout.view_circle_header);
    ll_label = (LinearLayout) header.findViewById(R.id.ll_label);
    RelativeLayout rl_more_tag = (RelativeLayout) header.findViewById(R.id.rl_more_tag);
    rl_more_tag.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            activity.skip(MoreTagsActivity.class);
          }
        });

    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            AppUtils.getWidth(activity) + 10, LinearLayout.LayoutParams.WRAP_CONTENT);
    header.setLayoutParams(lp);
    lp.rightMargin = -5;
    UltimateRecyclerView.CustomRelativeWrapper wrapper =
        new UltimateRecyclerView.CustomRelativeWrapper(activity);
    wrapper.addView(header);
    adapter.setCustomHeaderView(wrapper);

    query(true);
  }
コード例 #12
0
 public static void resetLL(View... view) {
   float rote = Handler_System.getWidthRoate(ApplicationBean.getApplication().getMode_w());
   if (view == null || rote == 1) {
     return;
   }
   for (View view2 : view) {
     LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view2.getLayoutParams();
     layoutParams.leftMargin = (int) (layoutParams.leftMargin * rote);
     layoutParams.rightMargin = (int) (layoutParams.rightMargin * rote);
     layoutParams.topMargin = (int) (layoutParams.topMargin * rote);
     layoutParams.bottomMargin = (int) (layoutParams.bottomMargin * rote);
     view2.setLayoutParams(layoutParams);
   }
 }
コード例 #13
0
  private void updateButtonState() {
    final boolean hasText = !TextUtils.isEmpty(mEditorTextView.getText());
    mClearBtn.setVisibility(hasText ? VISIBLE : GONE);
    final CharSequence cancelText = mCancelTextView.getText();
    final boolean hasCancelText = !TextUtils.isEmpty(cancelText);
    mCancelTextView.setVisibility((hasText || mAlwaysShowCancel) && hasCancelText ? VISIBLE : GONE);

    LinearLayout.LayoutParams plateParams =
        (LinearLayout.LayoutParams) mSearchTrack.getLayoutParams();
    if (hasText) {
      mTitleIcon.setAlpha(1.0f);
      mEditorTextView.setAlpha(1.0f);
      if (!mAlwaysShowCancel && hasCancelText) {
        plateParams.rightMargin = 0;
      }
    } else {
      mTitleIcon.setAlpha(unfocusAlpha);
      mEditorTextView.setAlpha(unfocusAlpha);
      if (!mAlwaysShowCancel && hasCancelText) {
        plateParams.rightMargin = mTrackMarginRight;
      }
    }
  }
コード例 #14
0
  private void initComponent() {
    imageViewAvatar = (ImageView) findViewById(R.id.imageViewUserAvatar);
    textViewUserName = (TextView) findViewById(R.id.textViewUserName);
    textViewUpdate = (TextView) findViewById(R.id.textViewUserUpdate);
    textViewUri = (TextView) findViewById(R.id.textViewUserUri);
    //		listViewBlogList = (ListView) findViewById(R.id.listViewUserBlogList);

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(128, 128);
    layoutParams.leftMargin = 15;
    layoutParams.topMargin = 15;
    layoutParams.rightMargin = 15;
    layoutParams.bottomMargin = 15;
    imageViewAvatar.setLayoutParams(layoutParams);
  }
コード例 #15
0
  @Override
  protected void initTitleView() {

    addTitleLeftBackView(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            mInputHandler.finishActivityBySoftInput(mEt);
          }
        });

    mEt = (EditText) getLayoutInflater().inflate(R.layout.view_search, null);
    mEt.setHint("请输入设备名称");
    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, DensityUtil.dip2px(36));
    lp.rightMargin = DensityUtil.dip2px(12);
    addTitleMiddleView(mEt, lp);

    mEt.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void afterTextChanged(Editable s) {

            String content = s.toString();
            abortAllHttpTask();
            if (TextUtil.isEmptyTrim(content)) {

              adapter.clear();
              adapter.notifyDataSetChanged();
              switchInvisible();
            } else {

              loadDataFromServer();
            }
          }
        });
  }
コード例 #16
0
 private void initialSetImageIndicators() {
   indicators = new ImageView[ALBUM_NUM];
   for (int i = 0; i < ALBUM_NUM; ++i) {
     ImageView imageView = new ImageView(this);
     if (i == 0) {
       imageView.setImageResource(R.drawable.indicator_select);
     } else {
       imageView.setImageResource(R.drawable.indicator_idle);
     }
     LinearLayout.LayoutParams lp =
         new LinearLayout.LayoutParams(
             ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
     lp.leftMargin = 5;
     lp.rightMargin = 5;
     indicators[i] = imageView;
     mLinearLayout.addView(imageView, lp);
   }
 }
コード例 #17
0
ファイル: PlayingIndicator.java プロジェクト: vovs/GMusic
 public PlayingIndicator(Context paramContext, AttributeSet paramAttributeSet) {
   super(paramContext, paramAttributeSet);
   BroadcastReceiver local1 =
       new BroadcastReceiver() {
         public void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent) {
           boolean bool1 = paramAnonymousIntent.getBooleanExtra("playing", false);
           boolean bool2 = paramAnonymousIntent.getBooleanExtra("streaming", false);
           boolean bool3 = paramAnonymousIntent.getBooleanExtra("preparing", false);
           PlayingIndicator.this.updatePlayState(bool1, bool2, bool3);
         }
       };
   this.mNowPlayingReceiver = local1;
   this.mContext = paramContext;
   LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -1);
   DisplayMetrics localDisplayMetrics = paramContext.getResources().getDisplayMetrics();
   int i = (int) TypedValue.applyDimension(1, 1.0F, localDisplayMetrics);
   localLayoutParams.rightMargin = i;
   ImageView localImageView1 = new ImageView(paramContext);
   this.mImage1 = localImageView1;
   this.mImage1.setLayoutParams(localLayoutParams);
   ImageView localImageView2 = this.mImage1;
   addView(localImageView2);
   ImageView localImageView3 = new ImageView(paramContext);
   this.mImage2 = localImageView3;
   this.mImage2.setLayoutParams(localLayoutParams);
   ImageView localImageView4 = this.mImage2;
   addView(localImageView4);
   ImageView localImageView5 = new ImageView(paramContext);
   this.mImage3 = localImageView5;
   this.mImage3.setLayoutParams(localLayoutParams);
   ImageView localImageView6 = this.mImage3;
   addView(localImageView6);
   AnimationDrawable localAnimationDrawable1 =
       (AnimationDrawable) paramContext.getResources().getDrawable(2131034124);
   this.mAnimation1 = localAnimationDrawable1;
   AnimationDrawable localAnimationDrawable2 =
       (AnimationDrawable) paramContext.getResources().getDrawable(2131034125);
   this.mAnimation2 = localAnimationDrawable2;
   AnimationDrawable localAnimationDrawable3 =
       (AnimationDrawable) paramContext.getResources().getDrawable(2131034126);
   this.mAnimation3 = localAnimationDrawable3;
 }
コード例 #18
0
ファイル: MainActivity.java プロジェクト: PeriForGWP/xinbei
 /**
  * 把下面的那个点放进viewgroup里
  *
  * @param
  */
 private void putTipsToViewGroup(ViewGroup group, ImageView[] tips) {
   Log.e("tips", "++++++++++++++++++++++++" + tips.length);
   for (int i = 0; i < tips.length; i++) {
     ImageView imageView = new ImageView(this);
     imageView.setLayoutParams(new LinearLayout.LayoutParams(10, 10));
     tips[i] = imageView;
     if (i == 0) {
       tips[i].setBackgroundResource(R.drawable.sy_qhs);
     } else {
       tips[i].setBackgroundResource(R.drawable.sy_qhk);
     }
     LinearLayout.LayoutParams layoutParams =
         new LinearLayout.LayoutParams(
             new ViewGroup.LayoutParams(
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
     layoutParams.leftMargin = 5;
     layoutParams.rightMargin = 5;
     group.addView(imageView, layoutParams);
   }
 }
コード例 #19
0
  /** 加载数据 */
  private void setMess() {
    adaper = new TypeAdaper();
    LinearLayout.LayoutParams paramsone =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);
    paramsone.topMargin = UtilPixelTransfrom.px2dip(activity, 20);
    LinearLayout.LayoutParams tempLayoutParams =
        new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    tempLayoutParams.rightMargin = UtilPixelTransfrom.px2dip(activity, 4);
    LinearLayout.LayoutParams paramstwo =
        new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    paramstwo.leftMargin = UtilPixelTransfrom.px2dip(activity, 4);

    for (int i = 0; i < 18 / 2; i++) {
      LinearLayout tempLayouttwo = new LinearLayout(activity);
      tempLayouttwo.setOrientation(LinearLayout.HORIZONTAL);
      tempLayouttwo.addView(adaper.getView(i * 2, null, null), tempLayoutParams);

      tempLayouttwo.addView(adaper.getView(i * 2 + 1, null, null), paramstwo);
      type_layout.addView(tempLayouttwo, paramsone);
    }
  }
コード例 #20
0
    /**
     * Creates a Button or ImageButton according to the path. e.g. {@code if(file.getAbsolutePath()
     * == '/')}, it should return an ImageButton with the home drawable on it.
     *
     * @param file The directory this button will represent.
     * @param navbar The {@link PathBar} which will contain the created buttons.
     * @return An {@link ImageButton} or a {@link Button}.
     */
    private static View newButton(File file, final PathBar navbar) {
      View btn = null;

      if (mPathDrawables.containsKey(file.getAbsolutePath())) {
        btn = new ImageButton(navbar.getContext());
        ((ImageButton) btn).setImageResource(mPathDrawables.get(file.getAbsolutePath()));
        ((ImageButton) btn).setAdjustViewBounds(true);
      } else {
        btn = new Button(navbar.getContext());

        ((Button) btn).setText(file.getName());
        ((Button) btn).setMaxLines(1);
        ((Button) btn).setTextColor(navbar.getResources().getColor(R.color.navbar_details));
        ((Button) btn).setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
      }

      android.widget.LinearLayout.LayoutParams params =
          new android.widget.LinearLayout.LayoutParams(
              LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
      params.rightMargin =
          (int)
              TypedValue.applyDimension(
                  TypedValue.COMPLEX_UNIT_DIP, 4, navbar.getResources().getDisplayMetrics());

      btn.setLayoutParams(params);
      btn.setTag(file);
      btn.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              navbar.cd((File) v.getTag());
            }
          });
      btn.setOnLongClickListener(navbar.getPathButtonLayout());
      btn.setBackgroundResource(R.drawable.bg_navbar_btn_standard);

      return btn;
    }
コード例 #21
0
ファイル: InChatActivity.java プロジェクト: randhika/in-chat
 private void Init_Point() {
   layout_point = (LinearLayout) findViewById(R.id.iv_image);
   pointViews = new ArrayList<ImageView>();
   ImageView imageView;
   System.out.println(views.size() + "init_point");
   for (int i = 0; i < views.size(); i++) {
     imageView = new ImageView(this);
     imageView.setBackgroundResource(R.drawable.d1);
     LinearLayout.LayoutParams layoutParams =
         new LinearLayout.LayoutParams(
             new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
     layoutParams.leftMargin = 10;
     layoutParams.rightMargin = 10;
     layoutParams.width = 8;
     layoutParams.height = 8;
     layout_point.addView(imageView, layoutParams);
     if (i == 0) {
       imageView.setBackgroundResource(R.drawable.d2);
     } else {
       imageView.setBackgroundResource(R.drawable.d1);
     }
     pointViews.add(imageView);
   }
 }
コード例 #22
0
  protected void onCreateContent(LinearLayout parent) {
    SizeHelper.prepare(context);

    LinearLayout rlCountry = new LinearLayout(context);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, SizeHelper.fromPxWidth(96));
    params.setMargins(
        SizeHelper.fromPx(26), SizeHelper.fromPxWidth(32), SizeHelper.fromPxWidth(26), 0);
    rlCountry.setLayoutParams(params);
    rlCountry.setId(Res.id.rl_country);

    TextView tv = new TextView(context);
    LinearLayout.LayoutParams tvParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    tvParams.gravity = Gravity.CENTER_VERTICAL;
    tv.setLayoutParams(tvParams);
    tv.setPadding(SizeHelper.fromPxWidth(14), 0, SizeHelper.fromPxWidth(14), 0);
    int resid = R.getStringRes(context, "smssdk_country");
    tv.setText(resid);
    tv.setTextColor(0xff000000);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
    rlCountry.addView(tv);

    TextView tvCountry = new TextView(context);
    tvCountry.setId(Res.id.tv_country);
    LinearLayout.LayoutParams tvCountryParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    tvCountryParams.gravity = Gravity.CENTER_VERTICAL;
    tvCountryParams.weight = 1;
    tvCountryParams.rightMargin = SizeHelper.fromPxWidth(14);
    tvCountry.setLayoutParams(tvCountryParams);
    tvCountry.setGravity(Gravity.RIGHT);
    tvCountry.setPadding(SizeHelper.fromPxWidth(14), 0, SizeHelper.fromPxWidth(14), 0);
    tvCountry.setTextColor(0xff45c01a);
    tvCountry.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
    rlCountry.addView(tvCountry);

    parent.addView(rlCountry);

    View line = new View(context);
    LinearLayout.LayoutParams lineParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, SizeHelper.fromPxWidth(1));
    lineParams.leftMargin = SizeHelper.fromPxWidth(26);
    lineParams.rightMargin = SizeHelper.fromPxWidth(26);
    line.setLayoutParams(lineParams);
    line.setBackgroundColor(Res.color.smssdk_gray_press);
    parent.addView(line);

    LinearLayout phoneLayout = new LinearLayout(context);
    LinearLayout.LayoutParams phoneParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, SizeHelper.fromPxWidth(70));
    phoneParams.setMargins(
        SizeHelper.fromPxWidth(26), SizeHelper.fromPxWidth(30), SizeHelper.fromPxWidth(26), 0);
    phoneLayout.setLayoutParams(phoneParams);

    TextView countryNum = new TextView(context);
    countryNum.setId(Res.id.tv_country_num);
    LinearLayout.LayoutParams countryNumParams =
        new LinearLayout.LayoutParams(
            SizeHelper.fromPxWidth(104), LinearLayout.LayoutParams.MATCH_PARENT);
    countryNum.setLayoutParams(countryNumParams);
    countryNum.setGravity(Gravity.CENTER);
    countryNum.setTextColor(0xff353535);
    countryNum.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
    resid = R.getBitmapRes(context, "smssdk_input_bg_focus");
    countryNum.setBackgroundResource(resid);
    phoneLayout.addView(countryNum);

    LinearLayout wrapperLayout = new LinearLayout(context);
    LinearLayout.LayoutParams wrapperParams =
        new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT);
    wrapperParams.weight = 1;
    wrapperLayout.setLayoutParams(wrapperParams);
    resid = R.getBitmapRes(context, "smssdk_input_bg_special_focus");
    wrapperLayout.setBackgroundResource(resid);

    EditText writePhone = new EditText(context);
    writePhone.setId(Res.id.et_write_phone);
    LinearLayout.LayoutParams writePhoneParams =
        new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT);
    writePhoneParams.gravity = Gravity.CENTER_VERTICAL;
    writePhoneParams.setMargins(SizeHelper.fromPxWidth(10), 0, SizeHelper.fromPxWidth(10), 0);
    writePhoneParams.weight = 1;
    writePhone.setLayoutParams(writePhoneParams);
    writePhone.setBackgroundDrawable(null);
    resid = R.getStringRes(context, "smssdk_write_mobile_phone");
    writePhone.setHint(resid);
    writePhone.setInputType(InputType.TYPE_CLASS_PHONE);
    writePhone.setTextColor(0xff353535);
    writePhone.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
    wrapperLayout.addView(writePhone);

    ImageView image = new ImageView(context);
    image.setId(Res.id.iv_clear);
    LinearLayout.LayoutParams imageParams =
        new LinearLayout.LayoutParams(SizeHelper.fromPxWidth(24), SizeHelper.fromPxWidth(24));
    imageParams.gravity = Gravity.CENTER_VERTICAL;
    imageParams.rightMargin = SizeHelper.fromPxWidth(20);
    image.setLayoutParams(imageParams);
    resid = R.getBitmapRes(context, "smssdk_clear_search");
    image.setBackgroundResource(resid);
    image.setScaleType(ScaleType.CENTER_INSIDE);
    image.setVisibility(View.GONE);
    wrapperLayout.addView(image);
    phoneLayout.addView(wrapperLayout);
    parent.addView(phoneLayout);

    Button nextBtn = new Button(context);
    nextBtn.setId(Res.id.btn_next);
    LinearLayout.LayoutParams nextParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, SizeHelper.fromPxWidth(72));
    nextParams.setMargins(
        SizeHelper.fromPxWidth(26), SizeHelper.fromPxWidth(36), SizeHelper.fromPxWidth(26), 0);
    nextBtn.setLayoutParams(nextParams);
    resid = R.getBitmapRes(context, "smssdk_btn_disenable");
    nextBtn.setBackgroundResource(resid);
    resid = R.getStringRes(context, "smssdk_next");
    nextBtn.setText(resid);
    nextBtn.setTextColor(0xffffffff);
    nextBtn.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
    nextBtn.setPadding(0, 0, 0, 0);
    parent.addView(nextBtn);
  }
コード例 #23
0
ファイル: DialogLoadMedia.java プロジェクト: lsortnj/MoMoNote
  public DialogLoadMedia(Context context, Handler handler) {
    super(context, R.style.Theme_Teansparent);
    _context = context;
    _handler = handler;
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    LinearLayout root_layout = new LinearLayout(_context);
    root_layout.setPadding(80, 40, 80, 70);
    root_layout.setBackgroundResource(R.drawable.dialog_bg_small);
    root_layout.setOrientation(LinearLayout.VERTICAL);
    root_layout.setLayoutParams(params);

    // Button Area
    params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    LinearLayout button_layout = new LinearLayout(_context);
    button_layout.setOrientation(LinearLayout.VERTICAL);
    button_layout.setLayoutParams(params);

    MomoImageButton btn_capture_image = new MomoImageButton(_context);
    MomoImageButton btn_record_video = new MomoImageButton(_context);
    MomoImageButton btn_record_audio = new MomoImageButton(_context);
    MomoImageButton btn_load_image = new MomoImageButton(_context);
    MomoImageButton btn_load_video = new MomoImageButton(_context);
    MomoImageButton btn_load_audio = new MomoImageButton(_context);

    params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.weight = 1;
    params.leftMargin = 10;
    params.rightMargin = 10;
    params.topMargin = 20;

    TextView title_text = new TextView(_context);
    title_text.setLayoutParams(params);
    title_text.setText(_context.getString(R.string.text_add_multi_media));
    title_text.setTextSize(15);
    title_text.setTextColor(Color.BLACK);

    btn_capture_image.setIcon(R.drawable.camera);
    btn_record_video.setIcon(R.drawable.vedio_recorder);
    btn_record_audio.setIcon(R.drawable.audio_recorder);
    btn_load_image.setIcon(R.drawable.import_image);
    btn_load_video.setIcon(R.drawable.import_video);
    btn_load_audio.setIcon(R.drawable.import_audio);

    btn_capture_image.setTextSize(18);
    btn_record_video.setTextSize(18);
    btn_record_audio.setTextSize(18);
    btn_load_image.setTextSize(18);
    btn_load_video.setTextSize(18);
    btn_load_audio.setTextSize(18);

    btn_capture_image.setText(_context.getString(R.string.text_take_photo));
    btn_record_video.setText(_context.getString(R.string.text_record_video));
    btn_record_audio.setText(_context.getString(R.string.text_record_audio));
    btn_load_image.setText(_context.getString(R.string.text_import_image));
    btn_load_video.setText(_context.getString(R.string.text_import_video));
    btn_load_audio.setText(_context.getString(R.string.text_import_audio));

    btn_capture_image.setLayoutParams(params);
    btn_load_image.setLayoutParams(params);
    btn_record_audio.setLayoutParams(params);
    btn_record_video.setLayoutParams(params);
    btn_load_video.setLayoutParams(params);
    btn_load_audio.setLayoutParams(params);

    btn_load_audio.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_LOAD_AUDIO);
            dismiss();
          }
        });

    btn_record_audio.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_RECORD_AUDIO);
            dismiss();
          }
        });

    btn_capture_image.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_CAPTURE_IMAGE);
            dismiss();
          }
        });

    btn_load_image.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_LOAD_IMAGE);
            dismiss();
          }
        });

    btn_record_video.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_RECORD_VIDEO);
            dismiss();
          }
        });

    btn_load_video.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _handler.sendEmptyMessage(ON_LOAD_VIDEO);
            dismiss();
          }
        });

    button_layout.addView(title_text);
    button_layout.addView(btn_capture_image);
    button_layout.addView(btn_record_video);
    button_layout.addView(btn_record_audio);
    button_layout.addView(btn_load_image);
    button_layout.addView(btn_load_video);
    button_layout.addView(btn_load_audio);

    root_layout.addView(button_layout);

    setContentView(root_layout);

    setCanceledOnTouchOutside(true);
  }
コード例 #24
0
  public LcSearchView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {

    super(context, attrs, defStyleAttr);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.lc_search_view, this, true);
    mSearchTrack = findViewById(R.id.lc_search_plate);
    mTitleIcon = (ImageView) findViewById(R.id.lc_search_icon);
    mEditorTextView = (SearchAutoComplete) findViewById(R.id.lc_search_src_text);
    mClearBtn = (ImageView) findViewById(R.id.lc_search_clear_btn);
    mCancelTextView = (TextView) findViewById(R.id.lc_search_text_cancel);

    mTitleIcon.setOnClickListener(mOnClickListener);
    mClearBtn.setOnClickListener(mOnClickListener);
    mCancelTextView.setOnClickListener(mOnClickListener);
    mEditorTextView.setOnClickListener(mOnClickListener);
    mEditorTextView.setOnEditorActionListener(mOnEditorActionListener);
    mEditorTextView.setOnItemClickListener(mOnItemClickListener);
    mEditorTextView.addTextChangedListener(mTextWatcher);
    mEditorTextView.setSearchView(this);
    mEditorTextView.ensureImeVisible(true);
    // Inform any listener of focus changes
    mEditorTextView.setOnFocusChangeListener(
        new OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
              mTitleIcon.setAlpha(unfocusAlpha);
              mEditorTextView.setAlpha(unfocusAlpha);
            } else {
              mTitleIcon.setAlpha(1.0f);
              mEditorTextView.setAlpha(1.0f);
            }

            if (mOnTextFocusChangeListener != null) {
              mOnTextFocusChangeListener.onFocusChange(LcSearchView.this, hasFocus);
            }
          }
        });

    mDropDownAnchor = findViewById(mEditorTextView.getDropDownAnchor());
    if (mDropDownAnchor != null) {
      mDropDownAnchor.addOnLayoutChangeListener(
          new OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(
                View v,
                int left,
                int top,
                int right,
                int bottom,
                int oldLeft,
                int oldTop,
                int oldRight,
                int oldBottom) {
              adjustDropDownSizeAndPosition();
            }
          });
    }

    int maxWidth = -1;
    CharSequence cancelText = null;
    CharSequence queryHintText = null;
    int clearBtnResId = R.drawable.lc_icon_search_view_clear_light;
    int titleIconId = R.drawable.lc_icon_search_view_search_light;
    int searchBgId = R.drawable.lc_selector_search_view_frame_light;
    int imeOptions = -1;
    int inputType = -1;
    boolean focusable = true;

    final Resources res = getResources();

    TypedValue out = new TypedValue();
    res.getValue(R.dimen.lc_search_view_default_text_alpha, out, true);
    unfocusAlpha = out.getFloat();

    int queryTextSize = res.getDimensionPixelSize(R.dimen.lc_default_search_query_text_size);
    ColorStateList queryTextColor =
        res.getColorStateList(R.color.lc_search_view_query_text_color_light);
    ColorStateList queryHintTextColor =
        res.getColorStateList(R.color.lc_search_view_query_hint_text_color_light);
    int cancelTextSize = res.getDimensionPixelSize(R.dimen.lc_default_search_query_text_size);
    ColorStateList cancelTextColor = null;

    int mTrackMarginLeft = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_left);
    mTrackMarginRight = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_right);
    int mTrackMarginTop = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_top);
    int mTrackMarginBottom = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_bottom);
    int mTrackPaddingLeft = res.getDimensionPixelSize(R.dimen.lc_search_track_padding_left);
    int mTrackPaddingRight = res.getDimensionPixelSize(R.dimen.lc_search_track_padding_right);

    mMatchColor = res.getColor(R.color.lc_search_view_drop_down_match_text_color_light);
    mCursorResId = R.drawable.lc_shape_search_view_cursor_light;
    mDropDownBg = res.getDrawable(R.drawable.lc_search_drop_down_bg);
    mDropDownBlurRadius = 10;
    mPopupItemLayoutResId = R.layout.lc_search_dropdown_item_icons_2line_light;
    mAlwaysShowCancel = true;
    Drawable popupDivider = res.getDrawable(R.drawable.lc_search_drop_down_divider);

    TypedArray a =
        context.obtainStyledAttributes(attrs, R.styleable.LcSearchView, defStyleAttr, defStyleRes);

    a.getValue(R.styleable.LcSearchView_lcSearchUnfocusAlpha, out);
    unfocusAlpha = out.getFloat();

    queryTextSize =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcQueryTextSize, queryTextSize);
    cancelTextSize =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcCancelTextSize, cancelTextSize);
    if (a.hasValue(R.styleable.LcSearchView_lcQueryTextColor)) {
      queryTextColor = a.getColorStateList(R.styleable.LcSearchView_lcQueryTextColor);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcQueryHintColor)) {
      queryHintTextColor = a.getColorStateList(R.styleable.LcSearchView_lcQueryHintColor);
    }
    if (a.hasValue(R.styleable.LcSearchView_lcCancelTextColor)) {
      cancelTextColor = a.getColorStateList(R.styleable.LcSearchView_lcCancelTextColor);
    } else {
      cancelTextColor = queryTextColor;
    }

    mTrackMarginBottom =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginBottom, mTrackMarginBottom);
    mTrackMarginLeft =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginLeft, mTrackMarginLeft);
    mTrackMarginRight =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginRight, mTrackMarginRight);
    mTrackMarginTop =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginTop, mTrackMarginTop);

    maxWidth = a.getDimensionPixelSize(R.styleable.LcSearchView_android_maxWidth, maxWidth);
    queryHintText = a.getText(R.styleable.LcSearchView_lcQueryHint);
    clearBtnResId = a.getResourceId(R.styleable.LcSearchView_lcClearIcon, clearBtnResId);
    titleIconId = a.getResourceId(R.styleable.LcSearchView_lcSearchIcon, titleIconId);
    searchBgId = a.getResourceId(R.styleable.LcSearchView_lcBackground, searchBgId);
    imeOptions = a.getInt(R.styleable.LcSearchView_android_imeOptions, imeOptions);
    inputType = a.getInt(R.styleable.LcSearchView_android_inputType, inputType);
    focusable = a.getBoolean(R.styleable.LcSearchView_android_focusable, focusable);

    mMatchColor = a.getColor(R.styleable.LcSearchView_lcMatchColor, mMatchColor);
    mCursorResId =
        a.getResourceId(R.styleable.LcSearchView_android_textCursorDrawable, mCursorResId);

    if (a.hasValue(R.styleable.LcSearchView_lcCancelText)) {
      cancelText = a.getString(R.styleable.LcSearchView_lcCancelText);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcPopupBackground)) {
      mDropDownBg = a.getDrawable(R.styleable.LcSearchView_lcPopupBackground);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcPopupListDivider)) {
      popupDivider = a.getDrawable(R.styleable.LcSearchView_lcPopupListDivider);
    }
    mDropDownBlurRadius =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcPopupBlurRadius, mDropDownBlurRadius);
    mPopupItemLayoutResId =
        a.getResourceId(R.styleable.LcSearchView_lcPopupItemLayout, mPopupItemLayoutResId);

    final int completeThreshold = a.getInt(R.styleable.LcSearchView_android_completionThreshold, 2);

    mAlwaysShowCancel =
        a.getBoolean(R.styleable.LcSearchView_lcAlwaysShowCancel, mAlwaysShowCancel);
    a.recycle();

    mEditorTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, queryTextSize);
    mEditorTextView.setTextColor(queryTextColor);
    mEditorTextView.setHintTextColor(queryHintTextColor);
    HIDDEN_METHOD.setCursorDrawableRes(mEditorTextView, mCursorResId);
    mEditorTextView.setPopupBackground(mDropDownBg);
    mEditorTextView.setPopupListDivider(popupDivider);
    mEditorTextView.setPopupBlurRadius(mDropDownBlurRadius);
    mEditorTextView.setThreshold(completeThreshold);

    if (mEditorTextView.hasFocus()) {
      mTitleIcon.setAlpha(1.0f);
      mEditorTextView.setAlpha(1.0f);
    } else {
      mTitleIcon.setAlpha(unfocusAlpha);
      mEditorTextView.setAlpha(unfocusAlpha);
    }

    mCancelTextView.setTextColor(cancelTextColor);
    mCancelTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, cancelTextSize);
    if (mAlwaysShowCancel) {
      mCancelTextView.setVisibility(View.VISIBLE);
    }
    mClearBtn.setImageResource(clearBtnResId);
    mTitleIcon.setImageResource(titleIconId);

    mSearchTrack.setBackgroundResource(searchBgId);
    LinearLayout.LayoutParams plateParams =
        (LinearLayout.LayoutParams) mSearchTrack.getLayoutParams();
    plateParams.topMargin = mTrackMarginTop;
    plateParams.bottomMargin = mTrackMarginBottom;
    plateParams.leftMargin = mTrackMarginLeft;
    plateParams.rightMargin = mAlwaysShowCancel ? 0 : mTrackMarginRight;

    LinearLayout.LayoutParams params = (LayoutParams) mTitleIcon.getLayoutParams();
    params.leftMargin = mTrackPaddingLeft;
    params = (LayoutParams) mClearBtn.getLayoutParams();
    params.rightMargin = mTrackPaddingRight;

    mCancelTextView.setPadding(mTrackMarginRight, 0, mTrackMarginRight, 0);

    if (maxWidth != -1) {
      setMaxWidth(maxWidth);
    }

    if (!TextUtils.isEmpty(queryHintText)) {
      setQueryHint(queryHintText);
    }

    if (imeOptions != -1) {
      setImeOptions(imeOptions);
    }
    if (inputType != -1) {
      setInputType(inputType);
    }

    if (cancelText != null) {
      mCancelTextView.setText(cancelText);
    }

    setFocusable(focusable);

    updateQueryHint();
  }
  private void initViewPager() {
    // indicator
    indicatorLayout = (LinearLayout) this.findViewById(R.id.indicatorLayout);
    indicatorLayout.removeAllViews();

    indicatorImageViews = new ImageView[imageURLList.size()];
    for (int i = 0; i < imageURLList.size(); i++) {
      ImageView imageView = new ImageView(this);
      imageView.setLayoutParams(new LinearLayout.LayoutParams(10, 10));
      if (i == 0) {
        imageView.setBackgroundResource(R.drawable.page_indicator_focused);
      } else {
        imageView.setBackgroundResource(R.drawable.page_indicator_unfocused);
      }

      indicatorImageViews[i] = imageView;

      LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              new ViewGroup.LayoutParams(
                  LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
      layoutParams.leftMargin = 10;
      layoutParams.rightMargin = 10;
      indicatorLayout.addView(indicatorImageViews[i], layoutParams);
    }

    // http://www.trinea.cn/android/auto-scroll-view-pager/
    // ViewPager
    viewPager = (AutoScrollViewPager) this.findViewById(R.id.viewPager);
    viewPager.setInterval(3000);
    viewPager.setCycle(true);
    viewPager.setAutoScrollDurationFactor(7.0);
    viewPager.setSlideBorderMode(AutoScrollViewPager.SLIDE_BORDER_MODE_CYCLE);
    viewPager.setStopScrollWhenTouch(false);
    viewPagerAdapter = new ImagePagerAdapter(this, imageURLList);

    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageScrollStateChanged(int arg0) {}

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageSelected(int index) {
            int position = index % imageURLList.size();
            for (int i = 0; i < imageURLList.size(); i++) {
              if (i == position) {
                indicatorImageViews[i].setBackgroundResource(R.drawable.page_indicator_focused);
              } else {
                indicatorImageViews[i].setBackgroundResource(R.drawable.page_indicator_unfocused);
              }
            }
          }
        });
    // viewPagerAdapter.setInfiniteLoop(true);
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.startAutoScroll();

    final GestureDetector tapGestureDetector = new GestureDetector(this, new TapGestureListener());
    viewPager.setOnTouchListener(
        new View.OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            tapGestureDetector.onTouchEvent(event);
            return false;
          }
        });
  }
コード例 #26
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    faceGridViewList = new ArrayList<View>();
    pointViews = new ArrayList<ImageView>();

    View rootView = inflater.inflate(R.layout.face_fragment, null);
    faceViewPager = (ViewPager) rootView.findViewById(R.id.faceViewPager);
    pagePointLayout = (LinearLayout) rootView.findViewById(R.id.pagePointLayout);

    for (int x = 0; x < (data.size() % 12 == 0 ? data.size() / 12 : (data.size() / 12) + 1); x++) {
      GridView view = new GridView(activity);
      final List<String> tempData =
          data.subList(x * 12, ((x + 1) * 12) > data.size() ? data.size() : ((x + 1) * 12));
      FaceAdapter faceAdapter = new FaceAdapter(activity, tempData);
      view.setAdapter(faceAdapter);

      view.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              if (onOperationListener != null) {
                onOperationListener.selectedFace(tempData.get(position));
              }
            }
          });
      view.setNumColumns(4);

      view.setBackgroundColor(Color.TRANSPARENT);
      view.setHorizontalSpacing(1);
      view.setVerticalSpacing(1);
      view.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
      view.setCacheColorHint(0);
      view.setPadding(5, 0, 5, 0);
      view.setSelector(new ColorDrawable(Color.TRANSPARENT));
      view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
      view.setGravity(Gravity.CENTER);

      faceGridViewList.add(view);

      ImageView imageView = new ImageView(activity);
      imageView.setBackgroundResource(R.drawable.point_normal);
      LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      layoutParams.leftMargin = 10;
      layoutParams.rightMargin = 10;
      layoutParams.width = 8;
      layoutParams.height = 8;
      pagePointLayout.addView(imageView, layoutParams);
      if (x == 0) {
        imageView.setBackgroundResource(R.drawable.point_selected);
      }
      pointViews.add(imageView);
    }

    PagerAdapter facePagerAdapter = new FacePagerAdapter(faceGridViewList);
    faceViewPager.setAdapter(facePagerAdapter);
    faceViewPager.addOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageSelected(int index) {

            for (int i = 0; i < pointViews.size(); i++) {
              if (index == i) {
                pointViews.get(i).setBackgroundResource(R.drawable.point_selected);
              } else {
                pointViews.get(i).setBackgroundResource(R.drawable.point_normal);
              }
            }
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });

    return rootView;
  }
コード例 #27
0
  private static void init() {
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    _root = new LinearLayout(_context);
    _root.setOrientation(LinearLayout.VERTICAL);
    _root.setLayoutParams(params);

    // Button Area
    params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    LinearLayout button_layout = new LinearLayout(_context);
    button_layout.setOrientation(LinearLayout.VERTICAL);
    button_layout.setLayoutParams(params);

    MomoImageButton btn_capture_image = new MomoImageButton(_context);
    MomoImageButton btn_record_video = new MomoImageButton(_context);
    MomoImageButton btn_record_audio = new MomoImageButton(_context);
    MomoImageButton btn_load_image = new MomoImageButton(_context);
    MomoImageButton btn_load_video = new MomoImageButton(_context);
    MomoImageButton btn_load_audio = new MomoImageButton(_context);

    params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.weight = 1;
    params.leftMargin = 10;
    params.rightMargin = 10;
    params.topMargin = 20;

    btn_capture_image.setIcon(R.drawable.camera);
    btn_record_video.setIcon(R.drawable.vedio_recorder);
    btn_record_audio.setIcon(R.drawable.audio_recorder);
    btn_load_image.setIcon(R.drawable.import_image);
    btn_load_video.setIcon(R.drawable.import_video);
    btn_load_audio.setIcon(R.drawable.import_audio);

    btn_capture_image.setTextSize(18);
    btn_record_video.setTextSize(18);
    btn_record_audio.setTextSize(18);
    btn_load_image.setTextSize(18);
    btn_load_video.setTextSize(18);
    btn_load_audio.setTextSize(18);

    btn_capture_image.setText(_context.getString(R.string.text_take_photo));
    btn_record_video.setText(_context.getString(R.string.text_record_video));
    btn_record_audio.setText(_context.getString(R.string.text_record_audio));
    btn_load_image.setText(_context.getString(R.string.text_import_image));
    btn_load_video.setText(_context.getString(R.string.text_import_video));
    btn_load_audio.setText(_context.getString(R.string.text_import_audio));

    btn_capture_image.setLayoutParams(params);
    btn_load_image.setLayoutParams(params);
    btn_record_audio.setLayoutParams(params);
    btn_record_video.setLayoutParams(params);
    btn_load_video.setLayoutParams(params);
    btn_load_audio.setLayoutParams(params);

    btn_load_audio.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onImportAudio();
          }
        });

    btn_record_audio.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onRecordAudio();
          }
        });

    btn_capture_image.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onTakePhoto();
          }
        });

    btn_load_image.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onImportImage();
          }
        });

    btn_record_video.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onRecordvideo();
          }
        });

    btn_load_video.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            _listener.onImportVideo();
          }
        });

    button_layout.addView(btn_capture_image);
    button_layout.addView(btn_record_video);
    button_layout.addView(btn_record_audio);
    button_layout.addView(btn_load_image);
    button_layout.addView(btn_load_video);
    button_layout.addView(btn_load_audio);

    _root.addView(button_layout);
  }
コード例 #28
0
  public AddPlayersToGameView(Context context) {
    this.context = context;

    mainScrollView = new ScrollView(context);
    mainScrollView.setFillViewport(true);
    mainScrollView.setLayoutParams(
        new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    LinearLayout mainView = new LinearLayout(context);
    mainView.setGravity(Gravity.CENTER_HORIZONTAL);
    LinearLayout.LayoutParams mainLayoutParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
    mainLayoutParams.leftMargin = UIConstants.MARGIN_SIZE;
    mainLayoutParams.rightMargin = UIConstants.MARGIN_SIZE;
    mainView.setLayoutParams(mainLayoutParams);
    BackgroundUtil.setBackground(mainView);
    mainView.setOrientation(LinearLayout.VERTICAL);
    mainScrollView.addView(mainView);

    TextView title = new TextView(context);
    title.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    title.setText("Add Players");
    title.setTextSize(UIConstants.TEXT_TITLE_SIZE);
    title.setTextColor(UIConstants.TEXT_COLOR);
    title.setGravity(Gravity.CENTER_HORIZONTAL);
    mainView.addView(title);

    LinearLayout controlView = new LinearLayout(context);
    controlView.setGravity(Gravity.CENTER_HORIZONTAL);
    LinearLayout.LayoutParams controlViewLayouParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    controlViewLayouParams.leftMargin = UIConstants.MARGIN_SIZE;
    controlViewLayouParams.rightMargin = UIConstants.MARGIN_SIZE;
    controlView.setLayoutParams(controlViewLayouParams);
    controlView.setOrientation(LinearLayout.HORIZONTAL);
    mainView.addView(controlView);

    Button firstDoneButton = new Button(context);
    firstDoneButton.setLayoutParams(
        new LayoutParams(LayoutParams.FILL_PARENT, UIConstants.BUTTON_HEIGHT));
    firstDoneButton.setText("Done");
    firstDoneButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            doneButtonListenerManager.notifyListeners();
          }
        });
    controlView.addView(firstDoneButton);

    allPlayersTable = new TableLayout(context);
    allPlayersTable.setLayoutParams(
        new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    allPlayersTable.setGravity(Gravity.CENTER_HORIZONTAL);
    TableLayout.LayoutParams allPlayersTableLayoutParams =
        new TableLayout.LayoutParams(
            TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT);
    allPlayersTableLayoutParams.leftMargin = UIConstants.MARGIN_SIZE;
    allPlayersTableLayoutParams.rightMargin = UIConstants.MARGIN_SIZE;
    allPlayersTable.setLayoutParams(allPlayersTableLayoutParams);

    allPlayersTable.setColumnStretchable(1, true);
    mainView.addView(allPlayersTable);

    Button secondDoneButton = new Button(context);
    secondDoneButton.setLayoutParams(
        new LayoutParams(LayoutParams.FILL_PARENT, UIConstants.BUTTON_HEIGHT));
    secondDoneButton.setText("Done");
    secondDoneButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            doneButtonListenerManager.notifyListeners();
          }
        });
    controlView.addView(secondDoneButton);
  }
コード例 #29
0
  @SuppressWarnings("deprecation")
  private void init(Context context, int initialColor) {
    setPadding(UI.dialogMargin, UI.dialogMargin, UI.dialogMargin, UI.dialogMargin);
    final int eachW = (UI._18sp * 7) >> 1;
    final boolean smallScreen = (UI.isLowDpiScreen && !UI.isLargeScreen);
    initialColor = 0xff000000 | (initialColor & 0x00ffffff);
    hsv = new HSV();
    hsv.fromRGB(initialColor);
    hsvTmp = new HSV();
    bmpRect = new Rect(0, 0, 1, 1);
    this.initialColor = initialColor;
    currentColor = initialColor;
    sliderColor = (UI.isAndroidThemeLight() ? 0xff000000 : 0xffffffff);
    final LinearLayout l = new LinearLayout(context);
    l.setId(1);
    l.setWeightSum(2);
    LayoutParams p = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    p.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    addView(l, p);
    final TextView lbl = new TextView(context);
    lbl.setBackgroundDrawable(new ColorDrawable(initialColor));
    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            smallScreen ? (UI.defaultControlSize) >> 1 : UI.defaultControlSize);
    lp.weight = 1;
    lp.rightMargin = UI.controlSmallMargin;
    l.addView(lbl, lp);
    bgCurrent = new ColorDrawable(initialColor);
    lblCurrent = new TextView(context);
    lblCurrent.setBackgroundDrawable(bgCurrent);
    lp =
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            smallScreen ? (UI.defaultControlSize) >> 1 : UI.defaultControlSize);
    lp.weight = 1;
    lp.leftMargin = UI.controlSmallMargin;
    l.addView(lblCurrent, lp);

    final int textSize = (smallScreen ? UI._14sp : UI._18sp);
    TextView lblTit = new TextView(context);
    lblTit.setId(2);
    lblTit.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    lblTit.setSingleLine();
    lblTit.setGravity(Gravity.CENTER);
    lblTit.setText("H");
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.BELOW, 1);
    addView(lblTit, p);
    lblTit = new TextView(context);
    lblTit.setId(3);
    lblTit.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    lblTit.setSingleLine();
    lblTit.setGravity(Gravity.CENTER);
    lblTit.setText("S");
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.BELOW, 1);
    addView(lblTit, p);
    lblTit = new TextView(context);
    lblTit.setId(4);
    lblTit.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    lblTit.setSingleLine();
    lblTit.setGravity(Gravity.CENTER);
    lblTit.setText("V");
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.BELOW, 1);
    addView(lblTit, p);

    barH = new BgSeekBar(context);
    barH.setId(5);
    barH.setMax(360);
    barH.setValue((int) (hsv.h * 360.0));
    barH.setSliderMode(true);
    barH.setVertical(true);
    p = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.leftMargin = ((eachW - UI.defaultControlSize) >> 1);
    p.addRule(RelativeLayout.ALIGN_LEFT, 2);
    p.addRule(RelativeLayout.BELOW, 2);
    p.addRule(RelativeLayout.ABOVE, 6);
    addView(barH, p);
    barS = new BgSeekBar(context);
    barS.setMax(100);
    barS.setValue((int) (hsv.s * 100.0));
    barS.setSliderMode(true);
    barS.setVertical(true);
    p = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.leftMargin = ((eachW - UI.defaultControlSize) >> 1);
    p.addRule(RelativeLayout.ALIGN_LEFT, 3);
    p.addRule(RelativeLayout.BELOW, 3);
    p.addRule(RelativeLayout.ABOVE, 6);
    addView(barS, p);
    barV = new BgSeekBar(context);
    barV.setMax(100);
    barV.setValue((int) (hsv.v * 100.0));
    barV.setSliderMode(true);
    barV.setVertical(true);
    p = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.leftMargin = ((eachW - UI.defaultControlSize) >> 1);
    p.addRule(RelativeLayout.ALIGN_LEFT, 4);
    p.addRule(RelativeLayout.BELOW, 4);
    p.addRule(RelativeLayout.ABOVE, 6);
    addView(barV, p);

    txtH = new EditText(context);
    txtH.setId(6);
    txtH.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    txtH.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    txtH.setSingleLine();
    txtH.setGravity(Gravity.CENTER);
    txtH.setText(Integer.toString((int) (hsv.h * 360.0)));
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ABOVE, 7);
    addView(txtH, p);
    txtS = new EditText(context);
    txtS.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    txtS.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    txtS.setSingleLine();
    txtS.setGravity(Gravity.CENTER);
    txtS.setText(Integer.toString((int) (hsv.s * 100.0)));
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ABOVE, 7);
    addView(txtS, p);
    txtV = new EditText(context);
    txtV.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    txtV.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    txtV.setSingleLine();
    txtV.setGravity(Gravity.CENTER);
    txtV.setText(Integer.toString((int) (hsv.v * 100.0)));
    p = new LayoutParams(eachW, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ABOVE, 7);
    addView(txtV, p);

    txt = new EditText(context);
    txt.setId(7);
    txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    txt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    txt.setSingleLine();
    txt.setGravity(Gravity.CENTER);
    txt.setText(ColorUtils.toHexColor(initialColor));
    p = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    p.topMargin = UI.dialogMargin;
    p.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    addView(txt, p);

    lbl.setOnClickListener(this);
    barH.setOnBgSeekBarChangeListener(this);
    barH.setOnBgSeekBarDrawListener(this);
    barS.setOnBgSeekBarChangeListener(this);
    barS.setOnBgSeekBarDrawListener(this);
    barV.setOnBgSeekBarChangeListener(this);
    barV.setOnBgSeekBarDrawListener(this);
    txtH.addTextChangedListener(this);
    txtS.addTextChangedListener(this);
    txtV.addTextChangedListener(this);
    txt.addTextChangedListener(this);
  }
コード例 #30
0
ファイル: UIShowBox.java プロジェクト: jackyzonewen/FrameQR
 @Override
 public void set_MarginRight(int marginRight) {
   LinearLayout.LayoutParams params = (LayoutParams) getLayoutParams();
   params.rightMargin = marginRight;
 }