Java Code Examples for android.widget.LinearLayout

The following are top voted examples for showing how to use android.widget.LinearLayout. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ShangHanLun   File: ATableViewCellAccessoryView.java   Source Code and License 7 votes vote down vote up
private static ImageView getAccessoryView(ATableViewCell cell, ATableViewCellAccessoryType accessoryType) {
    LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView);

    // check if accessoryView already exists for current cell before creating a new instance.
    ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView);
    if (accessoryView == null) {
        Resources res = cell.getResources();

        // get marginRight for accessoryView, DisclosureButton has a different one.
        LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin);
        if (accessoryType == ATableViewCellAccessoryType.DisclosureButton) {
            marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right);
        }
        params.setMargins(0, 0, marginRight, 0);

        // setup.
        accessoryView = new ATableViewCellAccessoryView(cell.getContext());
        accessoryView.setId(R.id.accessoryView);
        accessoryView.setLayoutParams(params);

        containerView.addView(accessoryView);
    }

    return accessoryView;
}
 
Example 2
Project: Hotspot-master-devp   File: SlidesActivity.java   Source Code and License 6 votes vote down vote up
@Override
    public void getViews() {
        mProjectionBtn = (TextView) findViewById(R.id.tv_projectin_btn);
        mBackBtn = (LinearLayout) findViewById(R.id.ll_slide_back);
        mViewPager = (LoopViewPager) findViewById(R.id.viewpager);
        finsh = (LinearLayout) findViewById(R.id.ll_slide_finish);
        mCurrentPaeTv = (TextView) findViewById(R.id.tv_current_page);
        tv_current_type = (TextView) findViewById(R.id.tv_current_type);
        mSectorMenu = (SectorMenuButton) findViewById(R.id.sectorMenuBtn);
        mSlideAdapter = new SlideAdapter(this);
        mSlideAdapter.setData(mSlideList);
        mViewPager.setAdapter(mSlideAdapter);
        mViewPager.setOnPageChangeListener(this);
        currentPager = mDefaultPosition;
//        mViewPager.setCurrentItem(currentPager, false);
        mPauseBtn = (ImageView) findViewById(R.id.iv_pause);
    }
 
Example 3
Project: TYT   File: T_ContactsCompanyListFragment.java   Source Code and License 6 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);
    tv_nameCn = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left);
    tv_down_left = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left);
    tv_country = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right);
    tv_status = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right);

    ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content);
    ll_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            T_ContactsCompanyEntity.RowsEntity rowsEntity = list.get(getLayoutPosition());
            T_ContactsCompanyDetailsActivity_.intent(T_ContactsCompanyListFragment.this).extra(AppDelegate.ROWS_ENTITY, rowsEntity).start();
        }
    });
}
 
Example 4
Project: AnimatedPullToRefresh-master   File: CharacterAnimatorHeaderView.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize view
 */
public void initView() {
    isInitialized = true;
    removeAllViews();
    setOrientation(VERTICAL);
    setGravity(Gravity.BOTTOM);
    setBackgroundColor(headerBackgroundColor);

    LinearLayout mContainer = viewHelper.generateContainerLayout();
    addView(mContainer);

    characterViewList = viewHelper.generateCharacterViewList(headerText);
    for (TextView textView : characterViewList) {
        mContainer.addView(textView);
    }

    setupAnimation();
}
 
Example 5
Project: Android-Wear-Projects   File: ChatActivity.java   Source Code and License 6 votes vote down vote up
public void addMessageBox(String message, int type){
    TextView textView = new TextView(ChatActivity.this);
    textView.setText(message);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 0, 0, 10);
    textView.setLayoutParams(lp);

    if(type == 1) {
        textView.setBackgroundResource(R.drawable.rounded_corner1);
    }
    else{
        textView.setBackgroundResource(R.drawable.rounded_corner2);
    }

    mLinearlayout.addView(textView);
    mScrollview.fullScroll(View.FOCUS_DOWN);
}
 
Example 6
Project: FlycoTabLayout   File: SlidingTabLayout.java   Source Code and License 6 votes vote down vote up
public SlidingTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setFillViewport(true);//设置滚动视图是否可以伸缩其内容以填充视口
    setWillNotDraw(false);//重写onDraw方法,需要调用这个方法来清除flag
    setClipChildren(false);
    setClipToPadding(false);

    this.mContext = context;
    mTabsContainer = new LinearLayout(context);
    addView(mTabsContainer);

    obtainAttributes(context, attrs);

    //get layout_height
    String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");

    if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) {
    } else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) {
    } else {
        int[] systemAttrs = {android.R.attr.layout_height};
        TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs);
        mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        a.recycle();
    }
}
 
Example 7
Project: androidtools   File: ToastUtils.java   Source Code and License 6 votes vote down vote up
public static void showCenterToast(Context context, String title, @DrawableRes int drawableId, int duration) {
    Toast toast = makeText(context.getApplicationContext(), title, duration);
    toast.setGravity(Gravity.CENTER, 0, 0);
    View view = LayoutInflater.from(context).inflate(R.layout.layout_center_toast, null);
    LinearLayout rlContent = (LinearLayout) view.findViewById(R.id.rl_content);
    TextView content = (TextView) view.findViewById(R.id.tv_content);
    ImageView alertIcon = (ImageView) view.findViewById(R.id.iv_icon);
    if (drawableId != 0) {
        alertIcon.setVisibility(View.VISIBLE);
        alertIcon.setImageResource(drawableId);
    } else {
        alertIcon.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(title)) {
        content.setText(title);
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    int screenWidth = wm.getDefaultDisplay().getWidth();
    int width = (int) (screenWidth / 2f);
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rlContent.getLayoutParams();
    lp.width = width;
    rlContent.setLayoutParams(lp);
    rlContent.requestLayout();
    toast.setView(view);
    toast.show();
}
 
Example 8
Project: appinventor-extensions   File: AppInvCaptureActivity.java   Source Code and License 6 votes vote down vote up
@Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

   Window window = getWindow();
   window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   viewLayout = new LinearLayout(this);
   viewLayout.setOrientation(LinearLayout.HORIZONTAL);
   frameLayout = new FrameLayout(this);
   frameLayout.addView(viewLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
   frameLayout.setBackgroundColor(0xFFFFFFFF); // COLOR_WHITE XXX

   setContentView(frameLayout);
   frameLayout.requestLayout();

   hasSurface = false;
 }
 
Example 9
Project: tumbviewer   File: PhotoPostVH.java   Source Code and License 6 votes vote down vote up
public PhotoPostVH(View itemView) {
    super(itemView);
    context = itemView.getContext();
    avatarView = (SimpleDraweeView) itemView.findViewById(R.id.post_avatar);
    nameView = (TextView) itemView.findViewById(R.id.post_name);
    itemView.findViewById(R.id.post_header).setOnClickListener(this);
    timeView = (TextView) itemView.findViewById(R.id.post_time);
    sourceView = (TextView) itemView.findViewById(R.id.post_source);
    sourceView.setOnClickListener(this);
    contentLayout = (FlexboxLayout) itemView.findViewById(R.id.post_content);
    trailLayout = (LinearLayout) itemView.findViewById(R.id.post_trail);
    noteCountView = (TextView) itemView.findViewById(R.id.note_count);
    reblogView = (ImageView) itemView.findViewById(R.id.post_reblog);
    reblogView.setOnClickListener(this);
    likeView = (ImageView) itemView.findViewById(R.id.post_like);
    likeView.setOnClickListener(this);
    dividerWidth = (int) Utils.dp2Pixels(context, 4);
    deleteStub = (ViewStub) itemView.findViewById(R.id.stub_delete_forever);

    isSimpleMode = DataManager.getInstance().isSimpleMode();
    if (isSimpleMode) {
        trailLayout.setVisibility(View.GONE);
    }
}
 
Example 10
Project: springreplugin   File: ThemeDialogActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LinearLayout root = new LinearLayout(this);
    root.setPadding(30, 30, 30, 30);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    root.setLayoutParams(lp);

    setContentView(root);

    // textView
    TextView textView = new TextView(this);
    textView.setText("Theme: Dialog");
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(30);
    LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    textView.setLayoutParams(lp2);
    root.addView(textView);
}
 
Example 11
Project: AgentWebX5   File: CustomIndicatorFragment.java   Source Code and License 6 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

    CommonIndicator mCommonIndicator=new CommonIndicator(this.getActivity());
    FrameLayout.LayoutParams lp=new FrameLayout.LayoutParams(-2,-2);
    lp.gravity= Gravity.CENTER;
    ProgressBar mProgressBar=new ProgressBar(this.getActivity());
    mProgressBar.setBackground(this.getResources().getDrawable(R.drawable.indicator_shape));
    mCommonIndicator.addView(mProgressBar,lp);

    this.mAgentWebX5 = AgentWebX5.with( this)//
            .setAgentWebParent((ViewGroup) view, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))//
            .setCustomIndicator(mCommonIndicator)
            .setWebSettings(WebDefaultSettingsManager.getInstance())//
            .setWebViewClient(mWebViewClient)
            .setReceivedTitleCallback(mCallback)
            .setSecurityType(AgentWebX5.SecurityType.strict)
            .createAgentWeb()//
            .ready()//
            .go(getUrl());


    initView(view);
}
 
Example 12
Project: TitleBarView   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void initView(Bundle bundle) {
    super.initView(bundle);
    GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead);
    titleBarDrawer.setImmersible(mContext, isImmersible, isLight);
    vHeader = View.inflate(mContext, R.layout.layout_title_header, null);
    sBtnImmersible = (SwitchCompat) vHeader.findViewById(R.id.sBtn_immersible);
    sBtnLight = (SwitchCompat) vHeader.findViewById(R.id.sBtn_light);
    sBtnLine = (SwitchCompat) vHeader.findViewById(R.id.sBtn_line);
    lLayoutAlpha = (LinearLayout) vHeader.findViewById(R.id.lLayout_alpha);
    sBarAlpha = (SeekBar) vHeader.findViewById(R.id.sBar_alpha);
    tvStatusAlpha = (TextView) vHeader.findViewById(R.id.tv_statusAlpha);
    initView();
    setDrawerList();
    initData();
}
 
Example 13
Project: MyCreditCardDemo   File: CmbChinaLoginActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cmb_china_login);
    /** init view **/

    mMainContainer = (LinearLayout) findViewById(R.id.activity_cmb_china_login);
    mCardNum = (BootstrapEditText) findViewById(R.id.user_card_num);
    mPassword = (BootstrapEditText) findViewById(R.id.user_password);
    mValidCode = (BootstrapEditText) findViewById(R.id.user_valid_code);
    valideCodeImage = (ImageView) findViewById(R.id.image_valid_code);

    valideCodeImage.setOnClickListener(this);
    mContext = this;

    loginBtn = (BootstrapButton) findViewById(R.id.loginCmbChinaBtn);
    loginBtn.setOnClickListener(this);

    httpRequestManager = HttpRequestManager.getInstance();
    updateValidCodeAction();
}
 
Example 14
Project: microMathematics   File: FormulaListView.java   Source Code and License 5 votes vote down vote up
/*********************************************************
 * Helper static methods
 *********************************************************/

private static FormulaBase getNextFormula(LinearLayout l, int idx)
{
    if (idx == ViewUtils.INVALID_INDEX)
    {
        return null;
    }
    int targetIdx = ViewUtils.INVALID_INDEX;
    if (idx < l.getChildCount())
    {
        targetIdx = idx;
    }
    else if ((idx - 1) < l.getChildCount())
    {
        targetIdx = idx - 1;
    }
    else if (l.getChildCount() > 0)
    {
        targetIdx = l.getChildCount() - 1;
    }
    FormulaBase f = null;
    if (targetIdx != ViewUtils.INVALID_INDEX)
    {
        View v = l.getChildAt(targetIdx);
        if (v instanceof ListRow)
        {
            ListRow row = (ListRow) v;
            if (row.getChildCount() > 0)
            {
                v = row.getChildAt(0);
            }
        }
        if (v instanceof FormulaBase)
        {
            f = (FormulaBase) v;
        }
    }
    return f;
}
 
Example 15
Project: POCenter   File: PRTHeader.java   Source Code and License 5 votes vote down vote up
public PRTHeader(Context context) {
	super(context);
	int[] size = ResHelper.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
Example 16
Project: SmartChart   File: SmartTabLayout.java   Source Code and License 5 votes vote down vote up
/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(CharSequence title) {
  TextView textView = new TextView(getContext());
  textView.setGravity(Gravity.CENTER);
  textView.setText(title);
  textView.setTextColor(tabViewTextColors);
  textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabViewTextSize);
  textView.setTypeface(Typeface.DEFAULT_BOLD);
  textView.setLayoutParams(new LinearLayout.LayoutParams(
      LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));

  if (tabViewBackgroundResId != NO_ID) {
    textView.setBackgroundResource(tabViewBackgroundResId);
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    // If we're running on Honeycomb or newer, then we can use the Theme's
    // selectableItemBackground to ensure that the View has a pressed state
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
        outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
    textView.setAllCaps(tabViewTextAllCaps);
  }

  textView.setPadding(
      tabViewTextHorizontalPadding, 0,
      tabViewTextHorizontalPadding, 0);

  if (tabViewTextMinWidth > 0) {
    textView.setMinWidth(tabViewTextMinWidth);
  }

  return textView;
}
 
Example 17
Project: LiuAGeAndroid   File: PlatformPageAdapter.java   Source Code and License 5 votes vote down vote up
public View getView(int index, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = createPanel(parent.getContext());
	}

	LinearLayout llPanel = ResHelper.forceCast(convertView);
	LinearLayout[] llCells = ResHelper.forceCast(llPanel.getTag());
	refreshPanel(llCells, cells[index]);
	return convertView;
}
 
Example 18
Project: decoy   File: InputPanel.java   Source Code and License 5 votes vote down vote up
private void initViews() {
    // input bar
    messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout);
    messageInputBar = view.findViewById(R.id.textMessageLayout);
    switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage);
    switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage);
    moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText);
    emojiButtonInInputBar = view.findViewById(R.id.emoji_button);
    sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage);
    messageEditText = (EditText) view.findViewById(R.id.editTextMessage);

    // 语音
    audioRecordBtn = (Button) view.findViewById(R.id.audioRecord);
    audioAnimLayout = view.findViewById(R.id.layoutPlayAudio);
    time = (Chronometer) view.findViewById(R.id.timer);
    timerTip = (TextView) view.findViewById(R.id.timer_tip);
    timerTipContainer = (LinearLayout) view.findViewById(R.id.timer_tip_container);

    // 表情
    emoticonPickerView = (EmoticonPickerView) view.findViewById(R.id.emoticon_picker_view);

    // 显示录音按钮
    switchToTextButtonInInputBar.setVisibility(View.GONE);
    switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);

    // 文本录音按钮切换布局
    textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout);
    if (isTextAudioSwitchShow) {
        textAudioSwitchLayout.setVisibility(View.VISIBLE);
    } else {
        textAudioSwitchLayout.setVisibility(View.GONE);
    }
}
 
Example 19
Project: decoy   File: BaseMessageActivity.java   Source Code and License 5 votes vote down vote up
private void addRightCustomViewOnActionBar(UI activity, List<SessionCustomization.OptionsButton> buttons) {
    if (buttons == null || buttons.size() == 0) {
        return;
    }

    Toolbar toolbar = getToolBar();
    if (toolbar == null) {
        return;
    }

    LinearLayout view = (LinearLayout) LayoutInflater.from(activity).inflate(R.layout.nim_action_bar_custom_view, null);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
    for (final SessionCustomization.OptionsButton button : buttons) {
        ImageView imageView = new ImageView(activity);
        imageView.setImageResource(button.iconId);
        imageView.setBackgroundResource(R.drawable.nim_nim_action_bar_button_selector);
        imageView.setPadding(ScreenUtil.dip2px(10), 0, ScreenUtil.dip2px(10), 0);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                button.onClick(BaseMessageActivity.this, v, sessionId);
            }
        });
        view.addView(imageView, params);
    }

    toolbar.addView(view, new Toolbar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.RIGHT | Gravity.CENTER));
}
 
Example 20
Project: DoApp   File: Splashscreen.java   Source Code and License 5 votes vote down vote up
private void StartAnimations() {


        Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
        anim.reset();
        LinearLayout l = (LinearLayout) findViewById(R.id.lin_lay);
        l.clearAnimation();
        l.startAnimation(anim);
        anim = AnimationUtils.loadAnimation(this, R.anim.rotate);
        anim.reset();

        ImageView iv = (ImageView) findViewById(R.id.splash);

        iv.clearAnimation();
        iv.startAnimation(anim);

        splashTread = new Thread() {
            @Override
            public void run() {
                try {
                    int waited = 0;
                    while (waited < 3500) {
                        sleep(100);
                        waited += 100;
                    }
                    Intent intent = new Intent(Splashscreen.this,
                            MainActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

                    startActivity(intent);
                    Splashscreen.this.finish();

                } catch (InterruptedException e) {

                } finally {
                    Splashscreen.this.finish();
                }
            }
        };
        splashTread.start();
    }
 
Example 21
Project: ClouldReader   File: StatusBarUtil.java   Source Code and License 5 votes vote down vote up
/**
 * 生成一个和状态栏大小相同的半透明矩形条
 *
 * @param activity 需要设置的activity
 * @param color    状态栏颜色值
 * @param alpha    透明值
 * @return 状态栏矩形条
 */
private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color, int alpha) {
    // 绘制一个和状态栏一样高的矩形
    StatusBarView statusBarView = new StatusBarView(activity);
    LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
    statusBarView.setLayoutParams(params);
    statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
    return statusBarView;
}
 
Example 22
Project: Sega   File: Fullscreen.java   Source Code and License 5 votes vote down vote up
@Override
public View instantiateItem(ViewGroup container, int position) {

    TouchImageView img = new TouchImageView(container.getContext());
    ImageLoader mLoader = new ImageLoader(container.getContext());
    mLoader.DisplayImageFull(listimage.get(position), img);
    container.addView(img, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    return img;
}
 
Example 23
Project: Remindy   File: ListItemAttachmentViewHolder.java   Source Code and License 5 votes vote down vote up
public ListItemAttachmentViewHolder(View itemView) {
    super(itemView);

    mContainer = (LinearLayout) itemView.findViewById(R.id.item_attachment_list_item_container);
    mCheckBox = (CheckBox) itemView.findViewById(R.id.list_item_attachment_list_item_checkbox);
    mTapToAdd = (ImageView) itemView.findViewById(R.id.list_item_attachment_list_item_tap_to_add);
    mText = (TextView) itemView.findViewById(R.id.list_item_attachment_list_item_text);
    //mMoreBtn = (ImageButton) itemView.findViewById(R.id.list_item_attachment_list_item_more);
}
 
Example 24
Project: Pole-Beacon-Android-SDK   File: QuestionAdapter.java   Source Code and License 5 votes vote down vote up
public SliderViewHolder(View view) {
    super(view);

    rootView = (LinearLayout) view.findViewById(R.id.root_view);
    tickMarkLabelsRelativeLayout = (RelativeLayout) view.findViewById(R.id.tick_mark_labels_rl);
    discreteSlider = (DiscreteSlider) view.findViewById(R.id.slider);
    title = (TextView) view.findViewById(R.id.title);
}
 
Example 25
Project: lecrec-android   File: RecyclerAdapterText.java   Source Code and License 5 votes vote down vote up
public ViewHolder(View view) {
    super(view);
    mView = view;
    llTitleContainer = (LinearLayout) view.findViewById(R.id.llTitleContainer);
    tvTitle = (TextView) view.findViewById(R.id.tvTitle);
    tvDatetime = (TextView) view.findViewById(R.id.tvDatetime);
    tvText = (TextView) view.findViewById(R.id.tvText);
}
 
Example 26
Project: lqrwechatrongcloud   File: PlatformPageAdapter.java   Source Code and License 5 votes vote down vote up
public View getView(int index, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = createPanel(parent.getContext());
	}

	LinearLayout llPanel = ResHelper.forceCast(convertView);
	LinearLayout[] llCells = ResHelper.forceCast(llPanel.getTag());
	refreshPanel(llCells, cells[index]);
	return convertView;
}
 
Example 27
Project: cafebar   File: CafeBar.java   Source Code and License 5 votes vote down vote up
@NonNull
public View getView() {
    Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) mSnackBar.getView();

    boolean tabletMode = mBuilder.mContext.getResources().getBoolean(R.bool.cafebar_tablet_mode);

    if (tabletMode || mBuilder.mFloating) {
        CardView cardView = (CardView) snackBarLayout.getChildAt(0);
        return cardView.getChildAt(0);
    }

    LinearLayout linearLayout = (LinearLayout) snackBarLayout.getChildAt(0);
    if (mBuilder.mShowShadow) return linearLayout.getChildAt(1);
    return linearLayout.getChildAt(0);
}
 
Example 28
Project: NeoStream   File: PlayerFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if(getView() == null)
        return;

    LinearLayout playerContainer = getView().findViewById(R.id.player_container);
    LinearLayout chatContainer = getView().findViewById(R.id.chat_container);

    // Checks the orientation of the screen
    if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        oldPlayerLayoutParams = playerContainer.getLayoutParams();
        oldChatLayoutParams = chatContainer.getLayoutParams();

        chatContainer.setVisibility(View.GONE);

        playerContainer.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

        hideSystemUi();
    } else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
        showSystemUi();

        chatContainer.setVisibility(View.VISIBLE);

        playerContainer.setLayoutParams(oldPlayerLayoutParams);
        chatContainer.setLayoutParams(oldChatLayoutParams);
    }
}
 
Example 29
Project: Expert-Android-Programming   File: ProfileReviewAdapter.java   Source Code and License 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);

    place_image = (ImageView) itemView.findViewById(R.id.place_image);
    place_name = (TextView) itemView.findViewById(R.id.place_name);
    place_location = (TextView) itemView.findViewById(R.id.place_location);

    //TIMING
    timing_lay = (LinearLayout) itemView.findViewById(R.id.timing_lay);
    rating_view = (LinearLayout) itemView.findViewById(R.id.rating_view);
    created_time = (TextView) itemView.findViewById(R.id.created_time);
    dineline_rating = (TextView) itemView.findViewById(R.id.dineline_rating);

    //FOR REVIEW
    review_lay = (LinearLayout) itemView.findViewById(R.id.review_lay);
    review_details = (TextView) itemView.findViewById(R.id.review_details);
    review_image_lay = (LinearLayout) itemView.findViewById(R.id.review_image_lay);
    image1_holder = (CardView) itemView.findViewById(R.id.image1_holder);
    image2_holder = (CardView) itemView.findViewById(R.id.image2_holder);
    image3_holder = (CardView) itemView.findViewById(R.id.image3_holder);
    image4_holder = (CardView) itemView.findViewById(R.id.image4_holder);
    image5_holder = (CardView) itemView.findViewById(R.id.image5_holder);
    image1 = (ImageView) itemView.findViewById(R.id.image1);
    image2 = (ImageView) itemView.findViewById(R.id.image2);
    image3 = (ImageView) itemView.findViewById(R.id.image3);
    image4 = (ImageView) itemView.findViewById(R.id.image4);
    image5 = (ImageView) itemView.findViewById(R.id.image5);

    //FOR OPTIONS
    options_lay = (LinearLayout) itemView.findViewById(R.id.options_lay);


    myFont.setAppFont((ViewGroup) itemView, MyFont.FONT_REGULAR);
    //myFont.setFont(name, MyFont.FONT_BOLD);

}
 
Example 30
Project: AndroidGeneralUtils   File: ViewUtil.java   Source Code and License 5 votes vote down vote up
public static LinearLayout.LayoutParams getLinearLayoutParams(View v) {
    LinearLayout.LayoutParams genericParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    if (v == null) {
        return genericParam;
    }
    LinearLayout.LayoutParams viewParams = (LinearLayout.LayoutParams) v.getLayoutParams();
    if (viewParams != null) {
        return viewParams;
    } else {
        return genericParam;
    }

}
 
Example 31
Project: Celebino   File: GardenAdapter.java   Source Code and License 5 votes vote down vote up
public ViewHolder(View view) {
    super(view);
    tvId = (TextView) view.findViewById(R.id.tvId);
    tvLocality = (TextView) view.findViewById(R.id.tvLocality);
    linearLayout = (LinearLayout) view.findViewById(R.id.linearLayout);
    btUpdate = (ImageButton) view.findViewById(R.id.btUpdate);

}
 
Example 32
Project: FinalProject   File: CommunityGroupFragment.java   Source Code and License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_community_group, container, false);
    mSwipeStack = (SwipeStack) view.findViewById(R.id.swipeStack);
    mButtonLeft = (Button) view.findViewById(R.id.buttonSwipeLeft);
    mButtonRight = (Button) view.findViewById(R.id.buttonSwipeRight);

    joinedGroupsList = new ArrayList<>();
    progressBar = (ProgressBar) view.findViewById(R.id.main_progress);
    progressFrame = view.findViewById(R.id.community_Fragment_frame);
    txtError = (TextView) view.findViewById(R.id.error_txt_cause);
    error_btn_retry = (Button) view.findViewById(R.id.error_btn_retry);

    errorLayout = (LinearLayout) view.findViewById(R.id.error_layout);

    mButtonLeft.setOnClickListener(this);
    mButtonRight.setOnClickListener(this);

    groupId = new ArrayList<>();

    try {
        loadFirstPage();
    } catch (Exception e) {
        e.printStackTrace();
    }

   // fillWithTestData();
    return view;

}
 
Example 33
Project: lrs_android   File: AutoScrollViewPager.java   Source Code and License 5 votes vote down vote up
public void setupIndicator(RelativeLayout indicator) {
    this.indicator = indicator;
    if (indicator == null) {
        return;
    }
    if (indicator.getChildCount() > 0) {
        indicator.removeAllViews();
    }
    ringList = new ArrayList<ImageView>();
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    LinearLayout ll = new LinearLayout(context);
    ll.setLayoutParams(lp);
    indicator.addView(ll);
    LinearLayout.LayoutParams lpp = new LinearLayout.LayoutParams(DisplayUtil.dp2px(7), DisplayUtil.dp2px(7));
    for (int i = 0; i < pageCount; i++) {
        ImageView iv = new ImageView(context);
        iv.setLayoutParams(lpp);
        if (pageCount == 1) {
            iv.setBackgroundResource(R.drawable.ring_imageview_select);
        }
        if (i > 0) {
            lpp.leftMargin = DisplayUtil.dp2px(3);
        }
        ringList.add(iv);
        ll.addView(iv);
    }
}
 
Example 34
Project: boohee_v5.6   File: HelloWebView.java   Source Code and License 5 votes vote down vote up
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(1);
    this.layout = new LinearLayout(this);
    LayoutParams layoutParams = new LayoutParams(-1, -1);
    setContentView(this.layout);
    this.intent = getIntent();
    Bundle bundle = this.intent.getExtras();
    this.appid = bundle.getString("appid");
    this.accesstoken = bundle.getString("accesstoken");
    init();
}
 
Example 35
Project: CodeMineProject1   File: ComputerPartAdapter.java   Source Code and License 5 votes vote down vote up
public ComputerPartViewHolder(View view) {
    super(view);
    cardView = (CardView)view.findViewById(R.id.card_view);
    //TODO change the image programatically
    computer_part_img = (ImageView)view.findViewById(R.id.card_view_img);

    LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.card_view_linear_layout);
    textViews = new TextView[ComputerPartAdapter.listSize + 1]; //for space
    for (int i = 0; i < textViews.length; i++) {
        textViews[i] = new TextView(view.getContext());
        linearLayout.setBackgroundColor(Color.TRANSPARENT);
        linearLayout.addView(textViews[i]);
    }
}
 
Example 36
Project: CustomAndroidOneSheeld   File: FacebookFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    lastPostTextCont = (LinearLayout) v.findViewById(R.id.postsCont);
    userNameTextView = (TextView) v
            .findViewById(R.id.facebook_shield_username_textview);
    facebookLogin = (Button) v.findViewById(R.id.login);
    facebookLogout = (Button) v.findViewById(R.id.logout);
    progress = (ProgressBar) v.findViewById(R.id.progress);
}
 
Example 37
Project: POCenter   File: EditPageLand.java   Source Code and License 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = ResHelper.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example 38
Project: EasyReader   File: StatusBarUtil.java   Source Code and License 5 votes vote down vote up
/**
 * 创建半透明矩形 View
 *
 * @param alpha 透明值
 * @return 半透明 View
 */
private static StatusBarView createTranslucentStatusBarView(Activity activity, int alpha) {
    // 绘制一个和状态栏一样高的矩形
    StatusBarView statusBarView = new StatusBarView(activity);
    LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
    statusBarView.setLayoutParams(params);
    statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0));
    return statusBarView;
}
 
Example 39
Project: PlusGram   File: userAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public View getItemView(int section, int position, View convertView, ViewGroup parent) {

    View x = null;
    if (x == null) {


        LinearLayout base = new LinearLayout(context);
        base.setOrientation(LinearLayout.VERTICAL);
        base.setGravity(Gravity.CENTER_VERTICAL);

        LinearLayout l = new LinearLayout(context);
        l.setOrientation(LinearLayout.HORIZONTAL);
        l.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT));
        l.setPadding(50,0,50,0);


        picup = new ImageView(context);
        picup.setScaleType(ImageView.ScaleType.CENTER);
        picup.setVisibility(View.GONE);
        picup.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.attach_file));


        statusup = new ImageView(context);
        statusup.setScaleType(ImageView.ScaleType.CENTER);
        statusup.setVisibility(View.GONE);
        statusup.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.attach_contact));

        phoneup = new ImageView(context);
        phoneup.setScaleType(ImageView.ScaleType.CENTER);
        phoneup.setVisibility(View.GONE);
        phoneup.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.specific_phoneup));

        isonetime = new ImageView(context);
        isonetime.setScaleType(ImageView.ScaleType.CENTER);
        isonetime.setVisibility(View.GONE);
        isonetime.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.specific_one_time));

        setVisiblity(users.get(position));

        l.addView(picup , 100 , 100);
        l.addView(statusup , 100 , 100);
        l.addView(phoneup , 100 , 100);
        l.addView(isonetime , 100 , 100);



        x = new CustomUserCell(context, 5, 1, false);
        base.addView(x , LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT , LayoutHelper.WRAP_CONTENT ));

        base.addView(l , LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT , LayoutHelper.WRAP_CONTENT ));
        base.addView(new DividerCell(context) , LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT , LayoutHelper.WRAP_CONTENT ));


        convertView = base ;
        ((CustomUserCell) x).setStatusColors(0xffa8a8a8, 0xff3b84c0);
        convertView.setTag("Contacts");
    }


    TLRPC.User user = MessagesController.getInstance().getUser(users.get(position).getUid());
    ((CustomUserCell) x).setData(user, null,null, 0);
    convertView.setTag("Contacts");
    return convertView;
}
 
Example 40
Project: CommonFramework   File: ItemTouchBuilder.java   Source Code and License 5 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (viewType == RecyclerView.INVALID_TYPE) {
        return new RecyclerView.ViewHolder(new LinearLayout(parent.getContext())) {
        };
    }
    return mAdapter.onCreateViewHolder(parent, viewType);
}
 
Example 41
Project: sctalk   File: EmoGridView.java   Source Code and License 5 votes vote down vote up
private void initViewPage() {
    setOrientation(VERTICAL);
    _viewPager = new ViewPager(_context);
    _llDot = new LinearLayout(_context);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
            CommonUtil.getDefaultPannelHeight(_context));
    params.gravity=Gravity.BOTTOM;
    _viewPager.setLayoutParams(params);
    _llDot.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    _llDot.setGravity(Gravity.CENTER);
    _llDot.setOrientation(HORIZONTAL);
    addView(_viewPager);
    addView(_llDot);
}
 
Example 42
Project: TestChat   File: SelectedFriendsActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void initView() {
        display = (RecyclerView) findViewById(R.id.rcv_selected_friends_display);
        mMyLetterView = (MyLetterView) findViewById(R.id.ml_selected_friends_letter);
        middle = (TextView) findViewById(R.id.tv_selected_friends_middle);
        bottomDisplay = (LinearLayout) findViewById(R.id.ll_selected_friends_bottom);
        mMyLetterView.setListener(this);
}
 
Example 43
Project: TYT   File: T_ContactsCompanyDetailsMoreInlandFragment.java   Source Code and License 5 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);
    tv_saleOrder = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left);
    tv_orderCommodityName = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left);
    tv_orderCommodityAmount = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right);
    tv_createDate = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right);

    ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content);
    ll_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
Example 44
Project: FastReading   File: CurrentBook.java   Source Code and License 5 votes vote down vote up
private void findUiElements() {
    appBarLayout = (AppBarLayout) findViewById(R.id.current_book_app_bar_layout);

    topManagePanel = (LinearLayout) findViewById(R.id.current_book_top_manage_panel);
    bottomManagePanel = (LinearLayout) findViewById(R.id.current_book_bottom_manage_panel);
    readingPanel = (RelativeLayout) findViewById(R.id.current_book_reading_space);

    currentPositionSeekBar = (SeekBar) findViewById(R.id.current_book_current_position_seek_bar);
    currentBookProgress = (TextView) findViewById(R.id.current_book_progress);
    currentWordLeftPart = (TextView) findViewById(R.id.current_book_left_part);
    currentWordCenterPart = (TextView) findViewById(R.id.current_book_center_part);
    currentWordRightPart = (TextView) findViewById(R.id.current_book_right_part);
    //currentSpeed = (TextView) findViewById(R.id.current_book_current_speed);
    positionForwardBack = (ImageButton) findViewById(R.id.current_book_speed_forward_back);
    positionBack = (ImageButton) findViewById(R.id.current_book_speed_back);
    positionUp = (ImageButton) findViewById(R.id.current_book_speed_up);
    positionForwardUp = (ImageButton) findViewById(R.id.current_book_speed_forward_up);

    speedPlus = (ImageButton) findViewById(R.id.current_book_speed_plus);
    speedMinus = (ImageButton) findViewById(R.id.current_book_speed_minus);

    topBoundaryLine = (TextView) findViewById(R.id.current_book_top_boundary_line);
    bottomBoundaryLine = (TextView) findViewById(R.id.current_book_bottom_boundary_line);

    newSpeedOnPlaying = (TextView) findViewById(R.id.current_book_online_new_speed);
    newSpeedOnPlaying.setVisibility(View.GONE);
}
 
Example 45
Project: Shared-Route   File: NormalListDialog.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final DialogMenuItem item = contents.get(position);

    LinearLayout ll_item = new LinearLayout(context);
    ll_item.setOrientation(LinearLayout.HORIZONTAL);
    ll_item.setGravity(Gravity.CENTER_VERTICAL);

    ImageView iv_item = new ImageView(context);
    iv_item.setPadding(0, 0, dp2px(15), 0);
    ll_item.addView(iv_item);

    TextView tv_item = new TextView(context);
    tv_item.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    tv_item.setSingleLine(true);
    tv_item.setTextColor(itemTextColor);
    tv_item.setTextSize(TypedValue.COMPLEX_UNIT_SP, itemTextSize_SP);

    ll_item.addView(tv_item);
    float radius = dp2px(cornerRadius_DP);
    if (isTitleShow) {
        ll_item.setBackgroundDrawable((CornerUtils.listItemSelector(radius, Color.TRANSPARENT, itemPressColor,
                position == contents.size() - 1)));
    } else {
        ll_item.setBackgroundDrawable(CornerUtils.listItemSelector(radius, Color.TRANSPARENT, itemPressColor,
                contents.size(), position));
    }

    int left = item.resId == 0 ? dp2px(18) : dp2px(16);
    int top = dp2px(10);
    int right = 0;
    int bottom = dp2px(10);
    ll_item.setPadding(left + itemExtraLeft, top + itemExtraTop, right + itemExtraRight, bottom + itemExtraBottom);

    iv_item.setImageResource(item.resId);
    tv_item.setText(item.operName);
    iv_item.setVisibility(item.resId == 0 ? View.GONE : View.VISIBLE);

    return ll_item;
}
 
Example 46
Project: Image-Text-Reader-And-Tools   File: NoteActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    String[] names_of = fileList(); //arr.length
    int name_size = names_of.length;
    not=(LinearLayout)findViewById(R.id.not);
    ListView names = (ListView)findViewById(R.id.LIST);
    ArrayAdapter<String> nameAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, names_of);

    if (names_of.length<1){
        not.setVisibility(View.VISIBLE);
        names.setVisibility(View.GONE);
    }else {
        not.setVisibility(View.GONE);
        names.setVisibility(View.VISIBLE);
    }

    names.setAdapter(nameAdapter);

}
 
Example 47
Project: Aurora   File: BannerAdapter.java   Source Code and License 5 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);
    mImageView = (ImageView) itemView.findViewById(R.id.iv_bg);
    mTvTitle = (TextView) itemView.findViewById(R.id.tv_name);
    mTvdesc = (TextView) itemView.findViewById(R.id.tv_desc);
    mLlRoot = (LinearLayout) itemView.findViewById(R.id.ll_root);
}
 
Example 48
Project: Remindy   File: TaskActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_task);

    if(getIntent().hasExtra(TASK_TO_EDIT)) {
        mTask = (Task) getIntent().getSerializableExtra(TASK_TO_EDIT);
        editingTask = true;
    } else {
        mTask = new Task();
        editingTask = false;
    }

    mContainer = (LinearLayout) findViewById(R.id.activity_task_container);
    mViewpager = (ViewPager) findViewById(R.id.activity_task_viewpager);
    mTabLayout = (TabLayout) findViewById(R.id.activity_task_tab_layout);

    setUpToolbar();
    setupViewPagerAndTabLayout();

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();
    mGoogleApiClient.connect();
}
 
Example 49
Project: nongbeer-mvp-android-demo   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void bindView(){
    toolbar = (Toolbar) findViewById( R.id.toolbar );
    icCart = (ImageView) findViewById( R.id.toolbar_cart );
    vpMain = (ViewPager) findViewById( R.id.container );
    tabLayout = (TabLayout) findViewById( R.id.tabs );
    tvBeerAmount = (TextView) findViewById( R.id.tv_product_count );

    menu = new SlidingMenu( this );
    menu.setMenu( R.layout.sliding_cart );
    rvCart = (RecyclerView) menu.getRootView().findViewById( R.id.rv_cart );
    containerEmpty = (LinearLayout) menu.findViewById( R.id.container_empty_cart );
    tvTotalPrice = (TextView) menu.findViewById( R.id.tv_total_price );
    btnConfirmOrder = (Button) menu.findViewById( R.id.btn_confirm_order );
}
 
Example 50
Project: GitHub   File: XListViewHeader.java   Source Code and License 5 votes vote down vote up
public void setVisiableHeight(int height) {
	if (height < 0)
		height = 0;
	LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContainer
			.getLayoutParams();
	lp.height = height;
	mContainer.setLayoutParams(lp);
}
 
Example 51
Project: FastAndroid   File: CallUserGridView.java   Source Code and License 5 votes vote down vote up
public void removeChild(String childId) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    List<LinearLayout> containerList = new ArrayList<>();
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        containerList.add(container);
    }
    for (LinearLayout resultContainer : containerList) {
        if (lastContainer == null) {
            LinearLayout child = (LinearLayout) resultContainer.findViewWithTag(childId);
            if (child != null) {
                resultContainer.removeView(child);
                if (resultContainer.getChildCount() == 0) {
                    linearLayout.removeView(resultContainer);
                    break;
                } else {
                    lastContainer = resultContainer;
                }
            }
        } else {
            View view = resultContainer.getChildAt(0);
            resultContainer.removeView(view);
            lastContainer.addView(view);
            if (resultContainer.getChildCount() == 0) {
                linearLayout.removeView(resultContainer);
                break;
            } else {
                lastContainer = resultContainer;
            }
        }
    }
}
 
Example 52
Project: qmui   File: QDQQFaceBasePagerView.java   Source Code and License 5 votes vote down vote up
public QDQQFaceBasePagerView(Context context) {
    super(context);

    mTestData = new QDQQFaceTestData();

    setOrientation(VERTICAL);
    mListView = new ListView(context);
    LinearLayout.LayoutParams listLp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
    listLp.weight = 1;
    mListView.setLayoutParams(listLp);
    mListView.setDivider(null);
    mListView.setDividerHeight(0);
    mListView.setAdapter(new MyAdapter());
    addView(mListView);

    mLogTv = new TextView(context);
    LinearLayout.LayoutParams logLp = new LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.dp2px(context, 60));
    mLogTv.setLayoutParams(logLp);
    mLogTv.setTextSize(12);
    mLogTv.setBackgroundResource(R.drawable.qmui_divider_top_bitmap);
    int paddingHor = QMUIDisplayHelper.dp2px(context, 16);
    mLogTv.setPadding(paddingHor, 0, paddingHor, 0);
    mLogTv.setTextColor(ContextCompat.getColor(context, R.color.qmui_config_color_black));
    mLogTv.setMovementMethod(QMUIScrollingMovementMethod.getInstance());
    addView(mLogTv);
}
 
Example 53
Project: HeaderDialog   File: HeaderDialog.java   Source Code and License 5 votes vote down vote up
private void init(Context context) {
    View view = LayoutInflater.from(context).inflate(R.layout.header_dialog_content, null);
    ctvj = (ContentTextViewJustified) view.findViewById(R.id.content_justified);
    ctv = (ContentTextView) view.findViewById(R.id.content);
    tv = (TextView) view.findViewById(R.id.title);
    tv.setGravity(Gravity.CENTER_HORIZONTAL);
    ctv.setMovementMethod(LinkMovementMethod.getInstance());
    iv = (ImageView) view.findViewById(R.id.icon);
    ly = (LinearLayout) view.findViewById(R.id.layout);
    shadow = view.findViewById(R.id.top_shadow);
    customLayout = (LinearLayout) view.findViewById(R.id.contentView);
    setView(view);
}
 
Example 54
Project: FiveMinsMore   File: DetailDialog.java   Source Code and License 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle values) {
    if (values != null){
        mTitle = values.getString("title");
        mLatLng = new LatLng(values.getDouble("latitude"), values.getDouble("longitude"));
    }

    // See the example: https://developer.android.com/guide/topics/ui/dialogs.html?hl=zh-tw#DialogFragment
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();
    LinearLayout detailView = (LinearLayout) inflater.inflate(R.layout.view_cluster_item_detail, null);
    builder.setView(detailView);

    ((TextView) detailView.findViewById(R.id.title)).setText(mTitle);
    String coor_wgs84_d = ProjFuncs.latLng2DString(mLatLng, false);
    ((TextView) detailView.findViewById(R.id.wgs84_d)).setText(coor_wgs84_d);
    String coor_wgs84_dms = ProjFuncs.latLng2DmsString(mLatLng, false);
    ((TextView) detailView.findViewById(R.id.wgs84_dms)).setText(coor_wgs84_dms);
    String coor_twd97 = ProjFuncs.twd2String(ProjFuncs.latlon2twd97(mLatLng), "");
    ((TextView) detailView.findViewById(R.id.twd97)).setText(coor_twd97);
    String coor_twd67 = ProjFuncs.twd2String(ProjFuncs.latlon2twd67(mLatLng), "");
    ((TextView) detailView.findViewById(R.id.twd67)).setText(coor_twd67);

    detailView.findViewById(R.id.download_trk_file).setOnClickListener(this);

    return builder.create();
}
 
Example 55
Project: youtube_background_android   File: SearchFragment.java   Source Code and License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final View v = inflater.inflate(R.layout.fragment_list, container, false);
    SurfaceView surfaceView = (SurfaceView) v.findViewById(R.id.surfaceView);
    surfaceView.setVisibility(View.GONE);
    LinearLayout spinner = (LinearLayout) v.findViewById(R.id.playlist_management);
    spinner.setVisibility(View.GONE);
    LinearLayout deleteRecent = (LinearLayout) v.findViewById(R.id.delete_recent_container);
    deleteRecent.setVisibility(View.GONE);

    int videoContainerHeight = SharedPrefs.getVideoContainerHeight(context);
    if(videoContainerHeight == 0) {
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                int height = SharedPrefs.getVideoContainerHeight(context);
                resizeVideoContainer(v, height);
            }
        }, 100);
    } else {
        resizeVideoContainer(v, videoContainerHeight);
    }


    videosFoundListView = (RecyclerView) v.findViewById(R.id.fragment_list_items);
    videosFoundListView.setLayoutManager(new LinearLayoutManager(context));
    loadingProgressBar = (ProgressBar) v.findViewById(R.id.fragment_progress_bar);
    videoListAdapter = new VideosAdapter(context, searchResultsList,"searchFragment");
    videoListAdapter.setOnItemEventsListener(this);
    videosFoundListView.setAdapter(videoListAdapter);

    //disable swipe to refresh for this tab
    v.findViewById(R.id.swipe_to_refresh).setEnabled(false);
    return v;
}
 
Example 56
Project: XposedNavigationBar   File: NavBarHook.java   Source Code and License 5 votes vote down vote up
public static void setHomePointPosition(LinearLayout homeNavbar) {
    int position = DataHook.homePointPosition;
    ImageButton pointbtn = (ImageButton) homeNavbar.getChildAt(0);
    if (position == SPUtil.LEFT) {
        homeNavbar.setGravity(Gravity.LEFT);
    } else if (position == SPUtil.RIGHT) {
        homeNavbar.setGravity(Gravity.RIGHT);
    } else if (position == SPUtil.DISMISS) {
        pointbtn.setVisibility(View.GONE);
    }
}
 
Example 57
Project: True-Weather   File: ShowWeather.java   Source Code and License 5 votes vote down vote up
private void showMap() {
    if (!Setting.isShowMap(this)) {
        removeMapIV();
        return;
    }
    if (formatAddress != null) {
        //showMap

        String address = formatAddress;
        //String preUrl= "https://maps.googleapis.com/maps/api/staticmap?zoom=10&size=200x200&scale=2&markers=";
        String preUrl = "https://maps.googleapis.com/maps/api/staticmap?size=200x200&scale=2&maptype=hybrid&markers=";
        String rowUrl = "";
        try {
            rowUrl = URLEncoder.encode(address, "utf-8");
        } catch (Exception e) {
        }
        String url = preUrl + rowUrl;


        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        lp.setMargins(15, 10, 15, 20);

        removeMapIV();
        mapTitleV = prepareTitleView(fullDetailsTitleV, "Map");
        upperLay.addView(mapTitleV);
        mapIV = new ImageView(this);
        mapIV.setLayoutParams(lp);
        upperLay.addView(mapIV);
        mapIV.setBackgroundResource(R.drawable.map_back_shape);
        Glide.with(this).load(url).into(mapIV);

    }
}
 
Example 58
Project: GitHub   File: ViewGragHelperActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_grag_helper_layout);
    top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
    top_bar_linear_back.setOnClickListener(new CustomOnClickListener());
    top_bar_title=(TextView)findViewById(R.id.top_bar_title);
    top_bar_title.setText("ViewGragHelper使用详解");
}
 
Example 59
Project: RLibrary   File: RViewPager.java   Source Code and License 5 votes vote down vote up
public RViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (mOrientation == LinearLayout.HORIZONTAL) {
        setPageTransformer(true, new FadeInOutPageTransformer());
    } else {
        setPageTransformer(true, new DefaultVerticalTransformer());
    }
    mGestureDetectorCompat = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            if (mOnPagerEndListener != null &&
                    getAdapter() != null &&
                    getCurrentItem() == getAdapter().getCount() - 1) {
                if (mOrientation == LinearLayout.VERTICAL) {
                    if (velocityY < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                } else {
                    if (velocityX < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                }
            }
            return super.onFling(e1, e2, velocityX, velocityY);
        }
    });
}
 
Example 60
Project: HiBangClient   File: HeaderSpinner.java   Source Code and License 5 votes vote down vote up
private void init(Context context) {
	mInflater = LayoutInflater.from(context);
	mView = mInflater.inflate(R.layout.common_headerbar_spinner, null);
	LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	addView(mView, params);
	initViews();
	initEvents();
}