Java Code Examples for android.widget.RelativeLayout

The following are top voted examples for showing how to use android.widget.RelativeLayout. 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: qmui   File: QMUITopBar.java   Source Code and License 6 votes vote down vote up
/**
 * 在 TopBar 的中间添加 View,如果此前已经有 View 通过该方法添加到 TopBar,则旧的View会被 remove
 *
 * @param view 要添加到TopBar中间的View
 */
public void setCenterView(View view) {
    if (mCenterView == view) {
        return;
    }
    if (mCenterView != null) {
        removeView(mCenterView);
    }
    mCenterView = view;
    LayoutParams params = (LayoutParams) mCenterView.getLayoutParams();
    if (params == null) {
        params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    }
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    addView(view, params);
}
 
Example 2
Project: treetracker-android   File: NoteFragment.java   Source Code and License 6 votes vote down vote up
@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (resultCode == Activity.RESULT_OK) {
			
			mCurrentPhotoPath = data.getStringExtra(ValueHelper.TAKEN_IMAGE_PATH);
			
			if (mCurrentPhotoPath != null) {
				((RelativeLayout)getActivity().findViewById(R.id.fragment_note)).setVisibility(View.VISIBLE);
				setPic();			
			}
		} else if (resultCode == Activity.RESULT_CANCELED) {
//			if (((RelativeLayout)getActivity().findViewById(R.id.fragment_new_tree)).getVisibility() != View.VISIBLE) {
//				getActivity().getSupportFragmentManager().popBackStack();
//			}
		}
		
	}
 
Example 3
Project: ImitateZHRB   File: Banner.java   Source Code and License 6 votes vote down vote up
private void setTitleStyleUI() {
    if (titles.size() != imageUrls.size()) {
        throw new RuntimeException("[Banner] --> The number of titles and images is different");
    }
    if (titleBackground != -1) {
        titleView.setBackgroundColor(titleBackground);
    }
    if (titleHeight != -1) {
        titleView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, titleHeight));
    }
    if (titleTextColor != -1) {
        bannerTitle.setTextColor(titleTextColor);
    }
    if (titleTextSize != -1) {
        bannerTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    }
    if (titles != null && titles.size() > 0) {
        bannerTitle.setText(titles.get(0));
        bannerTitle.setVisibility(View.VISIBLE);
        titleView.setVisibility(View.VISIBLE);
    }
}
 
Example 4
Project: TYT   File: T_WarningCenter_InvoiceWarning.java   Source Code and License 6 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);
    tv_warning_export_invoice_number = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_export_invoice_number);
    tv_warning_foreign_businessman = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_foreign_businessman);
    tv_warning_invoice_unit = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_unit);
    tv_warning_amount = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_amount);
    tv_warning_invoice_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_date);
    tv_warning_declare_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_declare_date);
    tv_warning_approve_expiration_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_approve_expiration_date);
    tv_warning_order_serial_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_order_serial_number);
    tv_warning_po_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_po_number);
    tv_warning_create_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_create_date);
    rl_content = (RelativeLayout) itemView.findViewById(R.id.rl_content);
    rl_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });
}
 
Example 5
Project: DaiGo   File: ComplexButton.java   Source Code and License 6 votes vote down vote up
public ComplexButton(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater.from(context).inflate(R.layout.complex_button, this);

    button = (RelativeLayout) findViewById(R.id.complex_button_body);
    rightArrow = (ImageView) findViewById(R.id.complex_button_item_right_arrow);
    circleImageView = (CircleImageView) findViewById(R.id.complex_button_item_image);
    itemName = (TextView) findViewById(R.id.complex_button_item_name);
    detail = (TextView) findViewById(R.id.complex_button_item_detail);
    redDot = (ImageView) findViewById(R.id.complex_button_red_dot);

    redDot.setVisibility(GONE);

    setButtonClickable(true);
    button.setLongClickable(true);
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            return true;
        }
    });

    selectType(TYPE_IMAGE_ROUND);
}
 
Example 6
Project: GCSApp   File: ShoppingCartAdapter.java   Source Code and License 6 votes vote down vote up
public MyViewHolder(final View itemView) {
            super(itemView);
            rl_cb_item = (RelativeLayout) itemView.findViewById(R.id.rl_cb_item);
            cb_item = (CheckBox) itemView.findViewById(R.id.cb_item);

            iv_item_goods = (ImageView) itemView.findViewById(R.id.iv_item_goods);
            iv_item_plus = (ImageView) itemView.findViewById(R.id.iv_item_plus);
            iv_item_reduce = (ImageView) itemView.findViewById(R.id.iv_item_reduce);
            iv_csb_jifen = (ImageView) itemView.findViewById(R.id.iv_csb_jifen);
            iv_text_csb_jifen = (ImageView) itemView.findViewById(R.id.iv_text_csb_jifen);

            tv_item_name = (TextView) itemView.findViewById(R.id.tv_item_name);
            tv_item_price_one = (TextView) itemView.findViewById(R.id.tv_item_price_one);
            tv_item_type = (TextView) itemView.findViewById(R.id.tv_item_type);
            tv_item_price_add = (TextView) itemView.findViewById(R.id.tv_item_price_add);
            tv_item_num = (TextView) itemView.findViewById(R.id.tv_item_num);

//            dl_item_cart = (DrawerLayout) itemView.findViewById(R.id.dl_item_cart);
            tv_item_cart_delete = (TextView) itemView.findViewById(R.id.tv_item_cart_delete);
        }
 
Example 7
Project: OSchina_resources_android   File: DiaryPageContentView.java   Source Code and License 6 votes vote down vote up
/**
 * 只允许new View的形式创建
 */
public DiaryPageContentView(Context context, int teamId, int year, int week) {
    this.teamId = teamId;
    this.year = year;
    this.week = week;
    this.cxt = (Activity) context;

    rootView = (RelativeLayout) View.inflate(context,
            R.layout.pager_item_diary, null);
    listview = (ListView) rootView.findViewById(R.id.diary_listview);
    pullHeadView = (SwipeRefreshLayout) rootView
            .findViewById(R.id.swiperefreshlayout);
    errorLayout = (EmptyLayout) rootView.findViewById(R.id.error_layout);
    adapter = new TeamDiaryListAdapter(cxt, null);
    initView();
    requestData(true);
}
 
Example 8
Project: MuslimMateAndroid   File: CompassFragment.java   Source Code and License 6 votes vote down vote up
private void init(View view) {

        countryName = (TextView) view.findViewById(R.id.textView11);
        if( MainActivity.locationInfo != null)
            countryName.setText(getResources().getConfiguration().locale.getDisplayLanguage()
                    .equals("العربية") ? ConfigPreferences.getLocationConfig(getContext()).name_english :
                    ConfigPreferences.getLocationConfig(getContext()).name);
        Quibladegree = (TextView) view.findViewById(R.id.textView12);
        Quibladegree.setText("Qibla direction from North: "+ ConfigPreferences.getQuibla(getContext()));
        indicator = (ImageView) view.findViewById(R.id.imageView2);
        compass = (RelativeLayout) view.findViewById(R.id.compassContainer);
        mSensorManager = (SensorManager) getContext().getSystemService(getContext().SENSOR_SERVICE);
        RotateAnimation ra = new RotateAnimation(currentDegree, MainActivity.quiblaDegree,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        ra.setDuration(400);
        ra.setFillAfter(true);
        indicator.startAnimation(ra);

    }
 
Example 9
Project: Canvas-Vision   File: CollectionAdapter.java   Source Code and License 6 votes vote down vote up
@Override
public void onBindViewHolder(WallpViewHolder holder, int position) {

    Hit photo = this.hit.get(position);
    RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) holder.discWallp.getLayoutParams();
    float height =photo.getPreviewHeight();
    float width = photo.getPreviewWidth();
    float ratio =  height/width ;
    rlp.height = (int) (rlp.width * ratio);
    holder.discWallp.setLayoutParams(rlp);
    holder.discWallp.setRatio(ratio);
    File file = new File(Environment.getExternalStoragePublicDirectory("/"+R.string.app_name), photo.getId()+context.getResources().getString(R.string.jpg));
    Picasso.with(context)
            .load(file)
            .placeholder(R.drawable.plh)
            .into(holder.discWallp);
}
 
Example 10
Project: ElAhorcado   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tvPulsa = (TextView) findViewById(R.id.tvPulsa);
    rl = (RelativeLayout) findViewById(R.id.activity_main);
    animation = AnimationUtils.loadAnimation(this, R.anim.fadeinout);

    tvPulsa.startAnimation(animation);

    rl.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {

            Intent intent = new Intent(MainActivity.this, MenuActivity.class);
            startActivity(intent);

            return true;
        }
    });
}
 
Example 11
Project: Beach-Android   File: GroupDetailsAdapter.java   Source Code and License 6 votes vote down vote up
public ViewHolder(View itemView, Context c) {
    super(itemView);

    rlContactRow = (RelativeLayout) itemView.findViewById(R.id.rlContactRow);
    ivContactImage = (ImageView) itemView.findViewById(R.id.ivContactImage);
    tvContactName = (TextView) itemView.findViewById(R.id.tvContactName);
    tvAffiliation = (TextView) itemView.findViewById(R.id.tvAffiliation);

    rlContactRow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(!StringUtils.isNullOrEmpty(member.getAffiliation().val()) && StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.ADMIN.val()) ||
                    StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.OWNER.val())){
                ChatRoom.ChatRoomMember m = memberList.get(getAdapterPosition());
                if(!StringUtils.safeEquals(member.getUserJID().getBareJID(), m.getUserJID().getBareJID())){
                    showRemoveParticipantAlert(member.getUserJID(), getAdapterPosition());
                }
            }
        }
    });
}
 
Example 12
Project: GitHub   File: HorMediaControllView.java   Source Code and License 6 votes vote down vote up
private void initView(Context context) {
    rootView = View.inflate(context, R.layout.widget_hor_controller, this);
    layout_topbar = (RelativeLayout) findViewById(R.id.layout_topbar);
    img_btn_back = (ImageView) findViewById(R.id.img_btn_back);
    top_ll = (LinearLayout) findViewById(R.id.top_ll);
    check_gift_switch = (CheckBox) findViewById(R.id.check_gift_switch);
    txt_btn_clarity = (TextView) findViewById(R.id.txt_btn_clarity);
    check_focus = (CheckBox) findViewById(R.id.check_focus);
    img_btn_share = (ImageView) findViewById(R.id.img_btn_share);
    txt_btn_describe = (TextView) findViewById(R.id.txt_btn_describe);
    txt_get_seed = (TextView) findViewById(R.id.txt_get_seed);
    lv_quality = (ListView) findViewById(R.id.lv_quality);
    tv_volume_brightness = (TextView) findViewById(R.id.tv_volume_brightness);
    layout_bottom_thelive = (LinearLayout) findViewById(R.id.layout_bottom_thelive);
    player_switch = (CheckBox) findViewById(R.id.rad_btn_player_switch);
    img_btn_refresh = (ImageView) findViewById(R.id.img_btn_refresh);
    txt_btn_hot_word = (ImageView) findViewById(R.id.txt_btn_hot_word);
    ediit_comment = (EditText) findViewById(R.id.ediit_comment);
    img_btn_send = (ImageView) findViewById(R.id.img_btn_send);
    rad_btn_danmu_switch = (CheckBox) findViewById(R.id.rad_btn_danmu_switch);
    img_btn_gift = (ImageView) findViewById(R.id.img_btn_gift);
}
 
Example 13
Project: FabulousFilter   File: MySampleFabFragment.java   Source Code and License 6 votes vote down vote up
@Override

    public void setupDialog(Dialog dialog, int style) {
        View contentView = View.inflate(getContext(), R.layout.filter_sample_view, null);

        RelativeLayout rl_content = (RelativeLayout) contentView.findViewById(R.id.rl_content);
        LinearLayout ll_buttons = (LinearLayout) contentView.findViewById(R.id.ll_buttons);
        contentView.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                closeFilter("closed");
            }
        });

        //params to set
        setAnimationDuration(600); //optional; default 500ms
        setPeekHeight(300); // optional; default 400dp
        setCallbacks((Callbacks) getActivity()); //optional; to get back result
        setViewgroupStatic(ll_buttons); // optional; layout to stick at bottom on slide
//        setViewPager(vp_types); //optional; if you use viewpager that has scrollview
        setViewMain(rl_content); //necessary; main bottomsheet view
        setMainContentView(contentView); // necessary; call at end before super
        super.setupDialog(dialog, style); //call super at last
    }
 
Example 14
Project: RabbitCloud   File: SearchBar.java   Source Code and License 6 votes vote down vote up
private void init(Context context) {
    mContainerView = LayoutInflater.from(context).inflate(R.layout.widget_searchbar,this,false);

    search_img_bt = (ImageButton) mContainerView.findViewById(R.id.search_img_bt);
    search_edit_content = (RelativeLayout) mContainerView.findViewById(R.id.search_edit_content);
    search_edit = (EditText) mContainerView.findViewById(R.id.search_edit);
    search_tv = (TextView) mContainerView.findViewById(R.id.search_tv);
    search_clear = (ImageView) mContainerView.findViewById(R.id.search_clear);

    measureView(mContainerView);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
            mContainerView.getMeasuredHeight());
    addView(mContainerView, params);

    if (isInterceptChild) {
        search_img_bt.setVisibility(GONE);
        search_tv.setVisibility(GONE);
    } else {
        search_img_bt.setVisibility(VISIBLE);
        search_tv.setVisibility(VISIBLE);
    }
}
 
Example 15
Project: Remindy   File: ProgrammedRepeatingTaskViewHolder.java   Source Code and License 6 votes vote down vote up
public ProgrammedRepeatingTaskViewHolder(View itemView, ViewHolderClickListener listener) {
    super(itemView);

    mClickListener = listener;

    mContainer = (RelativeLayout) itemView.findViewById(R.id.item_task_programmed_repeating_container);
    mCategoryIcon = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_category_icon);

    mAttachmentList = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_list);
    mAttachmentLink = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_link);
    mAttachmentAudio = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_audio);
    mAttachmentImage = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_image);
    mAttachmentText = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_text);

    mTitle = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_title);
    mDescription = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_description);

    mRepeat = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_repeat);
    mTime = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_time);
    mItemDecoration = itemView.findViewById(R.id.item_task_programmed_repeating_item_decoration);

}
 
Example 16
Project: Hotspot-master-devp   File: PictureSetActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void getViews() {
    headLayout = (LinearLayout) findViewById(R.id.head_layout);
    iv_left = (ImageView) findViewById(R.id.iv_left);
    iv_right = (ImageView) findViewById(R.id.iv_right);
    toleft_iv_right = (ImageView) findViewById(R.id.toleft_iv_right);
    photoViewpager = (SolveViewPager) findViewById(R.id.photoViewpager);
    bottomTextLayout = (LinearLayout) findViewById(R.id.bottomTextLayout);
    pageNumLayout = (RelativeLayout) findViewById(R.id.page_num_layout);
    bottomPageNumberTV = (TextView) findViewById(R.id.bottomPageNumber);
    bottomPageTotalTV = (TextView) findViewById(R.id.pageNumberTotal);
    describeTV = (TextView) findViewById(R.id.describe);
    main_al = (RelativeLayout) findViewById(R.id.main_al);
    mProgressLayout = (ProgressBarView) findViewById(R.id.pbv_loading);

}
 
Example 17
Project: GCSApp   File: EaseShowVideoActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
			WindowManager.LayoutParams.FLAG_FULLSCREEN);
	setContentView(R.layout.ease_showvideo_activity);
	loadingLayout = (RelativeLayout) findViewById(R.id.loading_layout);
	progressBar = (ProgressBar) findViewById(R.id.progressBar);

	final EMMessage message = getIntent().getParcelableExtra("msg");
	if (!(message.getBody() instanceof EMVideoMessageBody)) {
		Toast.makeText(EaseShowVideoActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
		finish();
		return;
	}
	EMVideoMessageBody messageBody = (EMVideoMessageBody)message.getBody();

	localFilePath = messageBody.getLocalUrl();

	if (localFilePath != null && new File(localFilePath).exists()) {
		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.setDataAndType(Uri.fromFile(new File(localFilePath)),
				"video/mp4");
		startActivity(intent);
		finish();
	} else {
		EMLog.d(TAG, "download remote video file");
		downloadVideo(message);
	}
}
 
Example 18
Project: EosCommander   File: BaseDialog.java   Source Code and License 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // the content
    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    // creating the fullscreen dialog
    final Dialog dialog = new Dialog(getContext());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    if (dialog.getWindow() != null) {
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.getWindow().setLayout(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
}
 
Example 19
Project: ywApplication   File: EditPage.java   Source Code and License 6 votes vote down vote up
private LinearLayout getPageBody() {
	llBody = new LinearLayout(getContext());
	llBody.setId(2);
	int resId = getBitmapRes(activity, "edittext_back");
	if (resId > 0) {
		llBody.setBackgroundResource(resId);
	}
	llBody.setOrientation(LinearLayout.VERTICAL);
	RelativeLayout.LayoutParams lpBody = new RelativeLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpBody.addRule(RelativeLayout.ALIGN_LEFT, llTitle.getId());
	lpBody.addRule(RelativeLayout.BELOW, llTitle.getId());
	lpBody.addRule(RelativeLayout.ALIGN_RIGHT, llTitle.getId());
	if (!dialogMode) {
		lpBody.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	}
	int dp_3 = dipToPx(getContext(), 3);
	lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
	llBody.setLayoutParams(lpBody);

	llBody.addView(getMainBody());
	llBody.addView(getSep());
	llBody.addView(getPlatformList());

	return llBody;
}
 
Example 20
Project: PlusGram   File: SeekBarPreference.java   Source Code and License 6 votes vote down vote up
/**
 * Update a SeekBarPreference view with our current state
 * @param view
 */
protected void updateView(View view) {

	try {
		RelativeLayout layout = (RelativeLayout)view;

		mStatusText = (TextView)layout.findViewById(R.id.seekBarPrefValue);
		mStatusText.setText(String.valueOf(mCurrentValue));
		mStatusText.setMinimumWidth(30);
		
		mSeekBar.setProgress(mCurrentValue - mMinValue);

		TextView unitsRight = (TextView)layout.findViewById(R.id.seekBarPrefUnitsRight);
		unitsRight.setText(mUnitsRight);
		
		TextView unitsLeft = (TextView)layout.findViewById(R.id.seekBarPrefUnitsLeft);
		unitsLeft.setText(mUnitsLeft);
		
	}
	catch(Exception e) {
		Log.e(TAG, "Error updating seek bar preference", e);
	}
	
}
 
Example 21
Project: GitHub   File: FloatOnKeyboardLayout.java   Source Code and License 6 votes vote down vote up
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
    int childSum = this.getChildCount();
    if(childSum > 1) {
        throw new IllegalStateException("can host only one direct child");
    } else {
        super.addView(child, index, params);
        android.widget.RelativeLayout.LayoutParams paramsChild;
        if(childSum == 0) {
            if(child.getId() < 0) {
                child.setId(ID_CHILD);
            }

            paramsChild = (android.widget.RelativeLayout.LayoutParams)child.getLayoutParams();
            paramsChild.addRule(12);
            child.setLayoutParams(paramsChild);
        } else if(childSum == 1) {
            paramsChild = (android.widget.RelativeLayout.LayoutParams)child.getLayoutParams();
            paramsChild.addRule(2, ID_CHILD);
            child.setLayoutParams(paramsChild);
        }

    }
}
 
Example 22
Project: CXJPadProject   File: KeyBoardPopWindow.java   Source Code and License 6 votes vote down vote up
private void initView() {
    // 设置SelectPicPopupWindow弹出窗体可点击
    this.setFocusable(true);
    this.setOutsideTouchable(true);
    // 刷新状态
    this.update();
    // 设置SelectPicPopupWindow弹出窗体的宽
    this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
    // 设置SelectPicPopupWindow弹出窗体的高
    this.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
    //设置背景透明
    setBackgroundDrawable(new ColorDrawable(0));

    closeBtn = (ImageView) mainView.findViewById(R.id.closeBtn);
    closeBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
}
 
Example 23
Project: yphoto   File: SignInActivity.java   Source Code and License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (isSignedIn()) {
        // sign in already, show main activity
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
        return;
    }
    getSupportActionBar().hide();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //透明状态栏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    setContentView(R.layout.activity_sign_in);

    RelativeLayout signin_btn = (RelativeLayout) findViewById(R.id.signin_btn);
    signin_btn.setOnClickListener(this);

    TextView github_btn = (TextView) findViewById(R.id.github_btn);
    github_btn.setOnClickListener(this);
}
 
Example 24
Project: sdl2-cross-platform-vs2017   File: SDLActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void run() {
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
    params.leftMargin = x;
    params.topMargin = y;

    if (mTextEdit == null) {
        mTextEdit = new DummyEdit(getContext());

        mLayout.addView(mTextEdit, params);
    } else {
        mTextEdit.setLayoutParams(params);
    }

    mTextEdit.setVisibility(View.VISIBLE);
    mTextEdit.requestFocus();

    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(mTextEdit, 0);
}
 
Example 25
Project: letv   File: BasePlayActivity.java   Source Code and License 6 votes vote down vote up
private void initViews() {
    this.mPlayUpperLayout = (FrameLayout) findViewById(R.id.play_upper_layout);
    this.mPlayUpper = (FrameLayout) findViewById(2131361905);
    this.mPlayLower = (RelativeLayout) findViewById(R.id.play_lower);
    this.mPlayGestrue = (LetvPlayGestureLayout) findViewById(2131363812);
    this.mBtnGestureLock = (ImageView) findViewById(2131364024);
    this.mRect = new Rect();
    if (this.mPlayType == 1) {
        this.mPlayFragment = new PlayLiveFragment();
    }
    this.mPlayFragment.setIntent(getIntent());
    if (this.mIsVr) {
        this.mPlayFragment.setSourceType(2);
    } else {
        this.mPlayFragment.setSourceType(this.mIsPanoramaVideo ? 1 : 0);
    }
    showFragmentIfNeeded(this.mPlayFragment, false);
    initSensor();
    initController();
    this.mLiveBarrageController = new LiveBarrageController(this, this.mPlayController.mLiveBarrageSentCallback, getSupportFragmentManager(), R.id.play_live_barrage_contain, 3);
    initWindowDirection(true);
    registerReceiver();
    LeMessageManager.getInstance().dispatchMessage(this, new LeMessage(801));
    initTask();
}
 
Example 26
Project: ThunderMusic   File: MediaLockscreenActivity.java   Source Code and License 5 votes vote down vote up
private void snapBack() {
    if (mMainWindows.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
        final RelativeLayout.LayoutParams marginLayoutParams = (RelativeLayout.LayoutParams) mMainWindows.getLayoutParams();

        final int startValueX = marginLayoutParams.leftMargin;
        final int startValueY = marginLayoutParams.topMargin;
        final int endValueX = 0;
        final int endValueY = 0;

        mMainWindows.clearAnimation();

        Animation animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                int leftMarginInterpolatedValue = (int) (startValueX + (endValueX - startValueX) * interpolatedTime);
                marginLayoutParams.leftMargin = leftMarginInterpolatedValue;

                int topMarginInterpolatedValue = (int) (startValueY + (endValueY - startValueY) * interpolatedTime);
                marginLayoutParams.topMargin = topMarginInterpolatedValue;

                mMainWindows.requestLayout();
            }
        };
        animation.setDuration(400);
        animation.setInterpolator(new DecelerateInterpolator());
        mMainWindows.startAnimation(animation);
    }
}
 
Example 27
Project: sealtalk-android-master   File: MainActivity.java   Source Code and License 5 votes vote down vote up
private void initViews() {
    RelativeLayout chatRLayout = (RelativeLayout) findViewById(R.id.seal_chat);
    RelativeLayout contactRLayout = (RelativeLayout) findViewById(R.id.seal_contact_list);
    RelativeLayout foundRLayout = (RelativeLayout) findViewById(R.id.seal_find);
    RelativeLayout mineRLayout = (RelativeLayout) findViewById(R.id.seal_me);

    mImageChats = (ImageView) findViewById(R.id.tab_img_chats);
    mImageContact = (ImageView) findViewById(R.id.tab_img_contact);
    mImageFind = (ImageView) findViewById(R.id.tab_img_find);
    mImageMe = (ImageView) findViewById(R.id.tab_img_me);

    mTextChats = (TextView) findViewById(R.id.tab_text_chats);
    mTextContact = (TextView) findViewById(R.id.tab_text_contact);
    mTextFind = (TextView) findViewById(R.id.tab_text_find);
    mTextMe = (TextView) findViewById(R.id.tab_text_me);

    mMineRed = (ImageView) findViewById(R.id.mine_red);
    moreImage = (ImageView) findViewById(R.id.seal_more);
    mSearchImageView = (ImageView) findViewById(R.id.ac_iv_search);

    chatRLayout.setOnClickListener(this);
    contactRLayout.setOnClickListener(this);
    foundRLayout.setOnClickListener(this);
    mineRLayout.setOnClickListener(this);
    moreImage.setOnClickListener(this);
    mSearchImageView.setOnClickListener(this);

    //接收MineFragment发现新版本信息发送的广播 显示 ”我“ 的Fragment中红色圆形图标
    BroadcastManager.getInstance(mContext).addAction(MineFragment.SHOW_RED, new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mMineRed.setVisibility(View.VISIBLE);
        }
    });
}
 
Example 28
Project: DragPhotoView   File: ZoomRelativeLayoutActivity.java   Source Code and License 5 votes vote down vote up
private void init() {
    flTitle = (FrameLayout) findViewById(R.id.fl_title);
    rlImageMessage = (RelativeLayout) findViewById(R.id.rl_image_message);

    ImageView ivBack = (ImageView) findViewById(R.id.iv_back);
    ivBack.setOnClickListener(this);

    ZoomRelativeLayout zoomParentLayout = (ZoomRelativeLayout) findViewById(R.id.rl_zoom_parent);
    DragPhotoView dragPhotoview = (DragPhotoView) findViewById(R.id.dragphotoview);
    dragPhotoview.setZoomParentView(zoomParentLayout);
    dragPhotoview.setOnViewTapListener(this);
}
 
Example 29
Project: FanChat   File: EaseShowVideoActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
			WindowManager.LayoutParams.FLAG_FULLSCREEN);
	setContentView(R.layout.ease_showvideo_activity);
	loadingLayout = (RelativeLayout) findViewById(R.id.loading_layout);
	progressBar = (ProgressBar) findViewById(R.id.progressBar);

	final EMMessage message = getIntent().getParcelableExtra("msg");
	if (!(message.getBody() instanceof EMVideoMessageBody)) {
		Toast.makeText(EaseShowVideoActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
		finish();
		return;
	}
	EMVideoMessageBody messageBody = (EMVideoMessageBody)message.getBody();

	localFilePath = messageBody.getLocalUrl();

	if (localFilePath != null && new File(localFilePath).exists()) {
		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.setDataAndType(Uri.fromFile(new File(localFilePath)),
				"video/mp4");
		startActivity(intent);
		finish();
	} else {
		EMLog.d(TAG, "download remote video file");
		downloadVideo(message);
	}
}
 
Example 30
Project: ParsingPlayer   File: ParsingVideoView.java   Source Code and License 5 votes vote down vote up
private void initSeekTextView(Context context) {
    mTextView = new TextView(context);
    mTextView.setBackgroundColor(getResources().getColor(R.color.panel_slide_background));
    int padding = Util.getScreenWidth(context);
    mTextView.setPadding(padding / 50, padding / 50, padding / 50, padding / 50);
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    addView(mTextView, lp);
    mTextView.setTextColor(getResources().getColor(android.R.color.white));
    mTextView.setTextSize(14);
    mTextView.setVisibility(GONE);
}
 
Example 31
Project: GSB-2017-Android   File: BrandsFragment.java   Source Code and License 5 votes vote down vote up
private void setupViews(View rootView) {
    progressBarLoadingData = (ProgressBar) rootView.findViewById(R.id.progressBar_loadingData);
    recyclerView_brands = (RecyclerView) rootView.findViewById(R.id.recyclerView_brands);
    relativeLayout_noInternet  = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_noInternet);
    relativeLayout_serverError = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_serverError);
    relativeLayout_noData      = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_noBrands);
    setupRecyclerView();
}
 
Example 32
Project: letv   File: LeBoxMainActivity.java   Source Code and License 5 votes vote down vote up
private void initView() {
    this.mLeBoxName = (EditText) findViewById(R.id.lebox_main_et_nickname);
    this.mLeBoxStatus = (TextView) findViewById(R.id.lebox_main_status);
    this.mLeBoxShare = (Button) findViewById(R.id.btn_lebox_main_share);
    this.mLeBoxRename = (Button) findViewById(R.id.btn_lebox_main_rename);
    this.mLeBoxMyDownload = (RelativeLayout) findViewById(R.id.le_box_my_download);
    this.mLeBoxMyFollow = (RelativeLayout) findViewById(R.id.le_box_my_follow);
    this.mLeBoxIntroduce = (RelativeLayout) findViewById(R.id.le_box_introduce);
    this.mLeBoxBuy = (RelativeLayout) findViewById(R.id.le_box_buy);
    this.mLeBoxSettings = (RelativeLayout) findViewById(R.id.le_box_settings);
    this.mLeBoxRoomUpdate = (RelativeLayout) findViewById(R.id.le_box_room_update);
    this.mExitImageView = (ImageView) findViewById(R.id.common_nav_left);
    this.mScanImageView = (ImageView) findViewById(R.id.common_nav_right);
    int paddingPx = Util.dip2px(this, TitleBar.SHAREBTN_RIGHT_MARGIN);
    Logger.d(TAG, "---initView---paddingPx=" + paddingPx);
    this.mScanImageView.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
    this.mScanImageView.setImageResource(R.drawable.lebox_selector_navigation_right_scan);
    this.mScanImageView.setVisibility(0);
    this.mTitle = (TextView) findViewById(R.id.common_nav_title);
    this.mTitle.setText(R.string.lebox_main_navigation_title);
    this.mLeboxAdmin = (TextView) findViewById(R.id.lebox_main_admin);
    this.mLeBoxVersion = (TextView) findViewById(R.id.le_box_room_version);
    this.le_box_room_status = (ImageView) findViewById(R.id.le_box_room_status);
    this.mLeboxBtnGroup = (LinearLayout) findViewById(R.id.lebox_main_btn_layout);
    this.mLeBoxWifiConnect = (RelativeLayout) findViewById(R.id.lebox_main_valid_wifi);
    this.mPullToRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.lebox_main_pull_refresh_scrollview);
    this.mPullToRefreshScrollView.setMode(Mode.PULL_FROM_START);
    this.mleboxNetState = (RelativeLayout) findViewById(R.id.lebox_main_net_state);
    this.mLeboxCleanUser = (RelativeLayout) findViewById(R.id.lebox_main_clean_user);
    this.mLeboxWifiName = (TextView) findViewById(R.id.lebox_main_valid_wifi_name);
}
 
Example 33
Project: sectioned-recycler-view   File: SectionHeaderLayout.java   Source Code and License 5 votes vote down vote up
@Override
public void addHeaderView(final View headerView, final int nextHeaderPos) {
    LayoutParams newParams = new LayoutParams(headerView.getLayoutParams());
    newParams.addRule(RelativeLayout.ALIGN_TOP);
    headerView.setLayoutParams(newParams);
    runJustBeforeBeingDrawn(headerView, new Runnable() {
        @Override
        public void run() {
            headerView.setTranslationY(calcTranslation(headerView.getHeight(), nextHeaderPos));
            headerView.requestLayout();
        }
    });
    addView(headerView);
    removePrevHeaderView();
}
 
Example 34
Project: lqrwechatrongcloud   File: EditPage.java   Source Code and License 5 votes vote down vote up
/** 动态适配编辑界面的高度 */
public void run() {
	int height = svContent.getChildAt(0).getHeight();
	RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
	if (height > maxBodyHeight && lp.height != maxBodyHeight) {
		lp.height = maxBodyHeight;
		svContent.setLayoutParams(lp);
	} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
		lp.height = LayoutParams.WRAP_CONTENT;
		svContent.setLayoutParams(lp);
	}
}
 
Example 35
Project: android-advanced-light   File: TitleBar.java   Source Code and License 5 votes vote down vote up
private void initView(Context context) {
    LayoutInflater.from(context).inflate(R.layout.view_customtitle, this, true);
    iv_titlebar_left = (ImageView) findViewById(R.id.iv_titlebar_left);
    iv_titlebar_right = (ImageView) findViewById(R.id.iv_titlebar_right);
    tv_titlebar_title = (TextView) findViewById(R.id.tv_titlebar_title);
    layout_titlebar_rootlayout = (RelativeLayout) findViewById(R.id.layout_titlebar_rootlayout);
    //设置背景颜色
    layout_titlebar_rootlayout.setBackgroundColor(mColor);
    //设置标题文字颜色
    tv_titlebar_title.setTextColor(mTextColor);
    setTitle(titlename);
}
 
Example 36
Project: GitHub   File: HalfPieChartActivity.java   Source Code and License 5 votes vote down vote up
private void moveOffScreen() {

        Display display = getWindowManager().getDefaultDisplay();
        int height = display.getHeight();  // deprecated

        int offset = (int)(height * 0.65); /* percent to move */

        RelativeLayout.LayoutParams rlParams =
                (RelativeLayout.LayoutParams)mChart.getLayoutParams();
        rlParams.setMargins(0, 0, 0, -offset);
        mChart.setLayoutParams(rlParams);
    }
 
Example 37
Project: QuranAndroid   File: TranslationAdapter.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor for listview
 * @param layout layout to get view objects
 */
public ViewHolder(View layout)
{
    Typeface type = Typeface.createFromAsset(context.getAssets(),"simple.otf");
    translationName = (TextView) layout.findViewById(R.id.textView5);
    translationInfo = (TextView) layout.findViewById(R.id.textView6);
    title = (TextView) layout.findViewById(R.id.title);
    transaltionStatus = (ImageView) layout.findViewById(R.id.Action);
    split = (LinearLayout) layout.findViewById(R.id.split);
    normal = (RelativeLayout)layout.findViewById(R.id.normal);
    downloading = (ProgressBar)layout.findViewById(R.id.downloading);
    translationName.setTypeface(type);
    translationInfo.setTypeface(type);
}
 
Example 38
Project: Swift-Braille-Soft-keyboard   File: RightLeftButtonsBar.java   Source Code and License 5 votes vote down vote up
private void changeDirectionBtn(String tag) {
    try {
        if (tag.equals("left")) {
            moveKeyboardRightLeft.setImageResource(R.mipmap.ic_keyboard_arrow_left_white_48dp);
            ((LayoutParams) surfaceContainer.getLayoutParams()).leftMargin = ((RelativeLayout) surfaceContainer.getParent()).getWidth() - surfaceContainer.getWidth();
            ((LayoutParams) surfaceContainer.getLayoutParams()).rightMargin = 0;
            moveKeyboardRightLeft.setTag("right");
            Common.startKeyboardContainerFromRight = true;
            //Speech it
            Common.defaultTextSpeech.speechText(context.getString(R.string.keyboard_is_top_right));
        } else if (tag.equals("right")) {
            moveKeyboardRightLeft.setImageResource(R.mipmap.ic_keyboard_arrow_right_white_48dp);
            ((LayoutParams) surfaceContainer.getLayoutParams()).rightMargin = ((RelativeLayout) surfaceContainer.getParent()).getWidth() - surfaceContainer.getWidth();
            ((LayoutParams) surfaceContainer.getLayoutParams()).leftMargin = 0;
            moveKeyboardRightLeft.setTag("left");
            Common.startKeyboardContainerFromRight = false;
            //Speech it
            Common.defaultTextSpeech.speechText(context.getString(R.string.keyboard_is_top_left));
        }

        surfaceContainer.removeAllViews();
        brailleLayout.renderBrailleLayout();
        requestLayout();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 39
Project: civify-app   File: IssueDetailsFragment.java   Source Code and License 5 votes vote down vote up
private void setUser(final User user) {
    Log.v(TAG, "setUser: init");

    UserAttacher.get((DrawerActivity) getActivity(),
            (RelativeLayout) mViewDetails.findViewById(R.id.userLayout), user)
            .setFullName((TextView) mViewDetails.findViewById(R.id.userName))
            .setUsername((TextView) mViewDetails.findViewById(R.id.userUsername))
            .setLevel((TextView) mViewDetails.findViewById(R.id.userLevel))
            .setProgress((ProgressBar) mViewDetails.findViewById(R.id.userProgress))
            .setAvatar((ImageView) mViewDetails.findViewById(R.id.userImage));

    Log.v(TAG, "setUser finished");
}
 
Example 40
Project: Notepad-For-Android   File: DisplayNote.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewnotepad);


    name = (EditText) findViewById(R.id.txtname);

    name.setFocusable(true);
    content = (EditText) findViewById(R.id.txtcontent);
    coordinatorLayout = (RelativeLayout) findViewById(R.id.coordinatorLayout);
    mydb = new NDb(this);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        int Value = extras.getInt("id");
        if (Value > 0) {
            snackbar = Snackbar
                    .make(coordinatorLayout, "Note Name : "+String.valueOf(Value), Snackbar.LENGTH_LONG);
            snackbar.show();
            Cursor rs = mydb.getData(Value);
            id_To_Update = Value;
            rs.moveToFirst();
            String nam = rs.getString(rs.getColumnIndex(NDb.name));
            String contents = rs.getString(rs.getColumnIndex(NDb.remark));
            if (!rs.isClosed()) {
                rs.close();
            }
            name.setText((CharSequence) nam);
            content.setText((CharSequence) contents);
        }
    }
}
 
Example 41
Project: letv   File: MyCollectActivity.java   Source Code and License 5 votes vote down vote up
private void initView() {
    this.mBottomLoginBtn = (RelativeLayout) findViewById(R.id.my_collect_bottom_login_btn);
    this.mLoginTitle = (TextView) findViewById(R.id.my_collect_account_login);
    this.mBottomActionView = findViewById(R.id.my_collect_layout_delete_and_select);
    this.mSelectBtn = (Button) findViewById(2131362349);
    this.mDeleteBtn = (Button) findViewById(2131362350);
    this.mLoginTitle.setText(TipUtils.getTipMessage(DialogMsgConstantId.CONSTANT_FAVORITE_BOTTOM_LOGIN_GUIDE_TITLE, 2131100462));
    this.mBottomLoginBtn.setOnClickListener(this.onClickEvent);
    this.mSelectBtn.setOnClickListener(this.onClickEvent);
    this.mDeleteBtn.setOnClickListener(this.onClickEvent);
}
 
Example 42
Project: ParsingPlayer   File: QualityView.java   Source Code and License 5 votes vote down vote up
public void attachViewWithInfo(final ParsingVideoView videoView, Set<Integer> qualitySet, final TextView qualityTextView) {
    LogUtil.d(TAG, "hd's size " + qualitySet.size());
    for (final int q : qualitySet) {
        TextView tv = new TextView(getContext());
        LinearLayout.LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        lp.bottomMargin = 16;
        lp.topMargin = 16;
        lp.leftMargin = 16;
        lp.rightMargin = 16;
        tv.setLayoutParams(lp);
        tv.setPadding(16, 16, 16, 16);
        tv.setBackground(getResources().getDrawable(R.drawable.quality_text_bgd));
        tv.setTextSize(14);
        tv.setText(getString(q));
        tv.setGravity(Gravity.CENTER);
        tv.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
        tv.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                qualityTextView.setText(getString(q));
                videoView.setQuality(q);
            }
        });
        addView(tv);
    }
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(videoView.getWidth() / 6,
            LayoutParams.WRAP_CONTENT);
    params.setMargins(videoView.getWidth() * 5 / 6, Util.dip2px(getContext(), 45), 0, 0);
    videoView.addView(this, params);
}
 
Example 43
Project: GitHub   File: XListView.java   Source Code and License 5 votes vote down vote up
private void initWithContext(Context context) {
	setFadingEdgeLength(0); // 消除边界模糊
	setOverScrollMode(View.OVER_SCROLL_NEVER); // 消除滚动边框

	mScroller = new Scroller(context, new DecelerateInterpolator());
	// XListView need the scroll event, and it will dispatch the event to
	// user's listener (as a proxy).
	super.setOnScrollListener(this);

	// init header view
	mHeaderView = new XListViewHeader(context);
	mHeaderViewContent = (RelativeLayout) mHeaderView
			.findViewById(R.id.xlistview_header_content);
	mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
	addHeaderView(mHeaderView);

	// init footer view
	mFooterView = new XListViewFooter(context);

	// init header height
	mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(
			new OnGlobalLayoutListener() {
				@SuppressWarnings("deprecation")
				@Override
				public void onGlobalLayout() {
					mHeaderViewHeight = mHeaderViewContent.getHeight();
					getViewTreeObserver()
					.removeGlobalOnLayoutListener(this);
				}
			});
}
 
Example 44
Project: MNProgressHUD   File: MProgressDialog.java   Source Code and License 5 votes vote down vote up
private void initDialog() {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View mProgressDialogView = inflater.inflate(R.layout.mn_progress_dialog_layout, null);// 得到加载view
        mDialog = new Dialog(mContext, R.style.MNCustomDialog);// 创建自定义样式dialog
        mDialog.setCancelable(false);// 不可以用“返回键”取消
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setContentView(mProgressDialogView);// 设置布局

        //设置整个Dialog的宽高
        DisplayMetrics dm = new DisplayMetrics();
        WindowManager windowManager = ((Activity) mContext).getWindowManager();
        windowManager.getDefaultDisplay().getMetrics(dm);
        int screenW = dm.widthPixels;
        int screenH = dm.heightPixels;

        WindowManager.LayoutParams layoutParams = mDialog.getWindow().getAttributes();
        layoutParams.width = screenW;
        layoutParams.height = screenH;
        mDialog.getWindow().setAttributes(layoutParams);


        //布局相关
        dialog_window_background = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_window_background);
        dialog_view_bg = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_view_bg);
        progress_wheel = (MProgressWheel) mProgressDialogView.findViewById(R.id.progress_wheel);
        tv_show = (TextView) mProgressDialogView.findViewById(R.id.tv_show);

        //点击事件
        dialog_window_background.setOnClickListener(this);

        //默认相关
        progress_wheel.stopSpinning();
        tv_show.setText(defaultTextShow);

        //设置默认配置
        configView();

    }
 
Example 45
Project: letv   File: RedPacketDialog.java   Source Code and License 5 votes vote down vote up
private void initView() {
    this.mRootView = (RelativeLayout) findViewById(R.id.root_view);
    LayoutParams root = this.mRootView.getLayoutParams();
    root.width = this.mContext.getResources().getDisplayMetrics().widthPixels;
    root.height = this.mContext.getResources().getDisplayMetrics().heightPixels;
    this.mRootView.setLayoutParams(root);
    this.mShakeLayout = (RelativeLayout) findViewById(R.id.shake_layout);
    this.mShakeCloseView = findViewById(R.id.shake_close_view);
    this.mResultCloseView = findViewById(R.id.result_close_view);
    this.mLogoImage = (ImageView) findViewById(R.id.logo_image);
    this.mRedPacketTitleTextView = (TextView) findViewById(R.id.redpacket_title);
    this.mShakeView = (ImageView) findViewById(R.id.shake_image);
    this.mShakeButton = (ImageView) findViewById(R.id.shake_button);
    this.mLoadingLayout = (RelativeLayout) findViewById(R.id.loading_layout);
    this.mGiftLoading = (ImageView) findViewById(R.id.gift_loading);
    this.mResultLayout = (RelativeLayout) findViewById(R.id.result_layout);
    this.mGiftImage = (ImageView) findViewById(R.id.gift_imageview);
    this.mJumpToListButton = (Button) findViewById(R.id.go_to_list_button);
    this.mShareButton = (ImageView) findViewById(R.id.share_button);
    this.mGiftTitleTextView = (TextView) findViewById(R.id.result_gift_title);
    this.mGiftTitleImage = (ImageView) findViewById(R.id.result_title_image);
    this.mTimeAndShareLayout = (LinearLayout) findViewById(R.id.time_and_share_layout);
    this.mTimeLayout = (LinearLayout) findViewById(R.id.time_layout);
    this.mTimeTextView = (TextView) findViewById(R.id.time_textview);
    this.mResultActivityDescribeLayout = (RelativeLayout) findViewById(R.id.result_activity_describe);
    this.mShakeActivityDescribeLayout = (RelativeLayout) findViewById(R.id.shacke_activity_describe);
}
 
Example 46
Project: QMark   File: GuideActy.java   Source Code and License 5 votes vote down vote up
protected void initBtnNextPosition() {
	int screenWidth = Device.getInstance(getView().getContext()).width;
	int screenHeight = Device.getInstance(getView().getContext()).height;
	RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mBtnComplete.getLayoutParams();
	float widthScale = screenWidth * 1.0f / WIDTH;
	float heightScale = screenHeight * 1.0f / HEIGHT;
	lp.width = (int) (widthScale * WIDTH_BTN);
	lp.height = (int) (heightScale * HEIGHT_BTN);
	lp.rightMargin = (int) (widthScale * RIGHT_BTN);
	lp.bottomMargin = (int) (heightScale * BOTTOM_BTN);
	mBtnComplete.setLayoutParams(lp);
}
 
Example 47
Project: MuslimMateAndroid   File: IslamicEventAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    final Event event = eventList.get(position);

    //convert from islamic to georgian
    String[] date = event.hejriDate.split("/");
    HGDate hgd = new HGDate();
    hgd.setHigri(Integer.valueOf(date[2]), Integer.valueOf(date[1]), Integer.valueOf(date[0]));


    //Show event name
    holder.eventName.setText(event.eventName.trim().equals(context.getString(R.string.milad_al_naby))? event.eventName+" "+"ﷺ" : event.eventName);

    //set event icon in right or left according to language
    if (ConfigPreferences.getApplicationLanguage(context).equals("en"))
        holder.eventName.setCompoundDrawablesWithIntrinsicBounds(event.icon, 0, 0, 0);
    else
        holder.eventName.setCompoundDrawablesWithIntrinsicBounds(0, 0, event.icon, 0);

    //Show dates
    holder.hejriDate.setText(NumbersLocal.convertNumberType(context, date[0]) + " " +
            Dates.islamicMonthName(context, Integer.valueOf(date[1])-1) + " " +
            NumbersLocal.convertNumberType(context, date[2]));
    hgd.toGregorian();
    holder.meladyDate.setText(NumbersLocal.convertNumberType(context, hgd.getDay() + "") +
            " " + Dates.gregorianMonthName(context, hgd.getMonth()-1) + " " +
            NumbersLocal.convertNumberType(context, hgd.getYear() + ""));

    //make layout is clickable to fo to show event prayer
    ((RelativeLayout) holder.eventName.getParent()).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            context.startActivity(new Intent(context, PrayShowActivity.class).putExtra("date", event.hejriDate));
        }
    });

}
 
Example 48
Project: tumbviewer   File: PhotoPostVH.java   Source Code and License 5 votes vote down vote up
private void createTrailView(int count) {
    while (count > trailViewCache.size()) {
        RelativeLayout layout = (RelativeLayout) LayoutInflater.from(context)
                .inflate(R.layout.item_trail, null);
        layout.setOnClickListener(this);
        trailViewCache.add(layout);
    }
}
 
Example 49
Project: FlexibleRichTextView   File: FlexibleRichTextView.java   Source Code and License 5 votes vote down vote up
private void myAddView(View view) {
    if (view instanceof FImageView && ((FImageView) view).centered) {
        // TODO: 17-2-13 any more efficient way?
        RelativeLayout rl = new RelativeLayout(mContext);
        RelativeLayout.LayoutParams rlLp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        rlLp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
        rl.addView(view);
        rl.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        addView(rl);
    } else {
        addView(view);
    }
}
 
Example 50
Project: Tribe   File: LoginActivity.java   Source Code and License 5 votes vote down vote up
/**
 * 初始化事件
 */
private void initListener(){
    mCommitUserBtn.setOnClickListener(this);
    mRegistertv.setOnClickListener(this);
    mRegisterButton.setOnClickListener(this);
    mForgetPassword.setOnClickListener(this);
    //找到布局
    mLoginrl=(RelativeLayout)findViewById(R.id.login_rl);
    mRegisetrrl=(RelativeLayout)findViewById(R.id.register_rl);
}
 
Example 51
Project: CircleControlView   File: TemperatureActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_temperature);

    rlRoot = (RelativeLayout) findViewById(R.id.root_view);
    rlRoot.setBackgroundColor(Color.parseColor("#FF9D6E"));

    temperatureView = (CircleControlView) findViewById(R.id.temperature_cv_degree);
    temperatureView.setOnValueChangedCallback(onValueChangedCallback);

    setBackgroundColor(temperatureView.getValue());
}
 
Example 52
Project: DailyStudy   File: CoordinatorLayoutActivity.java   Source Code and License 5 votes vote down vote up
private void initViews() {
        mIndicator = (SimpleViewPagerIndicator) findViewById(R.id.id_stickynavlayout_indicator);
        mViewPager = (ViewPager) findViewById(R.id.id_stickynavlayout_viewpager);
        textView = (ImageView) findViewById(R.id.textView);
        textView1 = (ImageView) findViewById(R.id.textView1);
        title = (ImageView) findViewById(R.id.title);
        title1 = (ImageView) findViewById(R.id.title1);
        bifen1 = (TextView) findViewById(R.id.bifen1);
        bifen2 = (TextView) findViewById(R.id.bifen2);
        bifen3 = (TextView) findViewById(R.id.bifen3);
        bifen = (TextView) findViewById(R.id.bifen);
        mAppBar = (AppBarLayout) findViewById(R.id.appbar);
        mAppBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
//                scrollY(verticalOffset, appBarLayout.getTotalScrollRange());
                Log.e(TAG, "onOffsetChanged: " + verticalOffset);
            }
        });
        zhudui = (FrameLayout) findViewById(R.id.zhudui);
        kedui = (FrameLayout) findViewById(R.id.kedui);
        bifenlayout = (FrameLayout) findViewById(R.id.bifenlayout);
        bifen1layout = (RelativeLayout) findViewById(R.id.bifen1layout);

        toolbarTitle = (RelativeLayout) findViewById(R.id.toolbar_title);

//        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//        setSupportActionBar(toolbar);
//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    }
 
Example 53
Project: DMAudioStreamer   File: AdapterMusic.java   Source Code and License 5 votes vote down vote up
private static void progressEvent(View v, boolean isShowing) {
    try {
        RelativeLayout rl = (RelativeLayout) ((ImageView) v).getParent();
        ProgressBar pg = (ProgressBar) rl.findViewById(R.id.pg);
        pg.setVisibility(isShowing ? View.GONE : View.VISIBLE);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 54
Project: GitHub   File: AdGoogleDisplaySupport.java   Source Code and License 5 votes vote down vote up
private static <ad extends ViewGroup> void panelAdjustApply(ad view, final int height_pixel) {
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, height_pixel);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    view.setLayoutParams(params);
}
 
Example 55
Project: Discover   File: BaseFragment.java   Source Code and License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View ll = inflater.inflate(R.layout.fragment_base, null);
    bindingView = DataBindingUtil.inflate(getActivity().getLayoutInflater(), setContentView(), null, false);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    bindingView.getRoot().setLayoutParams(params);
    container = ll.findViewById(R.id.container);
    container.addView(bindingView.getRoot());
    return ll;
}
 
Example 56
Project: LuaViewPlayground   File: LVPagerAdapter.java   Source Code and License 5 votes vote down vote up
/**
 * 创建一个layout params,并不能改变view的大小
 *
 * @param container
 * @return
 */
private RelativeLayout.LayoutParams createLayoutParams(ViewGroup container) {
    final RelativeLayout.LayoutParams layoutParams = LuaViewUtil.createRelativeLayoutParamsWM();
    if(container != null) {
        layoutParams.width = container.getMeasuredWidth();
        layoutParams.height = container.getMeasuredHeight();
    }
    return layoutParams;
}
 
Example 57
Project: WeiXinRecordedDemo   File: CutSizeActivity.java   Source Code and License 5 votes vote down vote up
private void initUI() {

        vv_play = (MyVideoView) findViewById(R.id.vv_play);
        cv_video = (CutView) findViewById(R.id.cv_video);
        RelativeLayout rl_close = (RelativeLayout) findViewById(R.id.rl_close);
        TextView rl_finish = (TextView) findViewById(R.id.rl_finish);

        rl_close.setOnClickListener(this);
        rl_finish.setOnClickListener(this);
    }
 
Example 58
Project: Pocket-Plays-for-Twitch   File: StreamFragment.java   Source Code and License 5 votes vote down vote up
private void setVideoViewLayout() {
	DisplayMetrics displaymetrics = new DisplayMetrics();
	getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
	int width = displaymetrics.widthPixels;
	RelativeLayout.LayoutParams layoutWrapper = (RelativeLayout.LayoutParams) mVideoWrapper.getLayoutParams();
	if(isLandscape) {
		layoutWrapper.height = FrameLayout.LayoutParams.MATCH_PARENT;
	} else {
		layoutWrapper.height = (int) Math.ceil(1.0*width/(16.0/9.0));
	}
	layoutWrapper.width = RelativeLayout.LayoutParams.MATCH_PARENT;
	mVideoWrapper.setLayoutParams(layoutWrapper);
}
 
Example 59
Project: Show_Chat   File: MovieFragment.java   Source Code and License 5 votes vote down vote up
public ItemMovieViewHolder(View itemView) {
    super(itemView);
    iconGroup = (TextView) itemView.findViewById(R.id.icon_group);
    txtGroupName = (TextView) itemView.findViewById(R.id.txtName);
    btnMore = (ImageButton) itemView.findViewById(R.id.btnMoreAction);
    groupBG = (RelativeLayout) itemView.findViewById(R.id.groupBG);
}
 
Example 60
Project: boohee_v5.6   File: OrderDetailsActivity.java   Source Code and License 5 votes vote down vote up
private void initView() {
    this.orderDetailList = (ListView) findViewById(R.id.order_detail_list);
    this.btnPay = (Button) findViewById(R.id.btn_pay);
    this.btnReceive = (Button) findViewById(R.id.btn_receive);
    this.btnRefund = (Button) findViewById(R.id.btn_refund);
    this.tv_unpaid = (TextView) findViewById(R.id.tv_unpaid);
    this.rlBottom = (RelativeLayout) findViewById(R.id.rl_bottom);
    this.btnPay.setOnClickListener(this);
    this.btnRefund.setOnClickListener(this);
    this.btnReceive.setOnClickListener(this);
    this.headerView = LayoutInflater.from(this.ctx).inflate(R.layout.nk, null);
    this.footerView = LayoutInflater.from(this.ctx).inflate(R.layout.nj, null);
}