Java Code Examples for android.widget.RelativeLayout

The following examples show how to use android.widget.RelativeLayout. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * Initialization of the Activity after it is first created.  Must at least
 * call {@link android.app.Activity#setContentView setContentView()} to
 * describe what is to be displayed in the screen.
 */
@Override
protected void onCreate(Bundle icicle) {
    // Be sure to call the super class.
    super.onCreate(icicle);

    // Have the system blur any windows behind this one.
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
            WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    
    RelativeLayout container = new RelativeLayout(this);
    
    ImageButton button = new ImageButton(this);
    button.setImageResource(getIntent().getIntExtra("moodimg", 0));
    button.setOnClickListener(this);
    
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    
    container.addView(button, lp);
    
    setContentView(container);
}
 
Example 2
Source Project: Simple-Solitaire   Source File: FortyEight.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void setStacks(RelativeLayout layoutGame, boolean isLandscape, Context context) {

        setUpCardWidth(layoutGame, isLandscape, 8 + 1, 8 + 4);

        int spacing = setUpHorizontalSpacing(layoutGame, 8, 9);
        int startPos = (int) (layoutGame.getWidth() / 2 - 4 * Card.width - 3.5 * spacing);

        stacks[17].view.setX((int) (layoutGame.getWidth() / 2 + 3 * Card.width + 3.5 * spacing));
        stacks[17].view.setY((isLandscape ? Card.width / 4 : Card.width / 2) + 1);
        stacks[17].setImageBitmap(Stack.backgroundTalon);

        stacks[16].setX(stacks[17].getX() - spacing - Card.width);
        stacks[16].setY(stacks[17].getY());

        for (int i = 0; i < 8; i++) {
            stacks[8 + i].setX(startPos + i * (spacing + Card.width));
            stacks[8 + i].setY(stacks[17].getY() + Card.height + (isLandscape ? Card.width / 4 : Card.width / 2));
            stacks[8 + i].setImageBitmap(Stack.background1);
        }

        for (int i = 0; i < 8; i++) {
            stacks[i].setX(startPos + i * (spacing + Card.width));
            stacks[i].setY(stacks[8].getY() + Card.height + (isLandscape ? Card.width / 4 : Card.width / 2));
        }

    }
 
Example 3
Source Project: AndroidReview   Source File: FavActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void creatView() {
    //小圆点
    mFAB = (FloatingActionButton) findViewById(R.id.fab);

    //布局
    mMainLayout = (ScrollView) findViewById(R.id.sv_main_test);
    mAnswerSelectLayout = (LinearLayout) findViewById(R.id.ly_select_answers);
    mRyAnswer = (RelativeLayout) findViewById(R.id.rl_answer);

    //TextView
    mTvQuestion = (TextView) findViewById(R.id.tv_test_question);
    mTvAnswer = (TextView) findViewById(R.id.tv_answer);
    mTvAnswerLong = (TextView) findViewById(R.id.tv_answer_long);

    //button
    mBtShowAnswer = (TextView) findViewById(R.id.bt_show_answer);

}
 
Example 4
Source Project: QRefreshLayout   Source File: DefaultLoadView.java    License: MIT License 6 votes vote down vote up
public DefaultLoadView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    tvContent = new TextView(context);
    tvContent.setId(View.generateViewId());
    addView(tvContent);
    RelativeLayout.LayoutParams contentParams = (LayoutParams) tvContent.getLayoutParams();
    contentParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    progressBar = new ProgressBar(context);
    addView(progressBar);
    final float density = getContext().getResources().getDisplayMetrics().density;
    RelativeLayout.LayoutParams params = (LayoutParams) progressBar.getLayoutParams();
    params.width = (int) (20 * density);
    params.height = (int) (20 * density);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    params.rightMargin = (int) (10 * density);
    params.addRule(RelativeLayout.LEFT_OF, tvContent.getId());
    progressBar.setLayoutParams(params);
}
 
Example 5
Source Project: NavigationBar   Source File: NavitationLayout.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 设置导航条颜色
 * @param context
 * @param height
 * @param color
 * @param currentPosition
 */
public void setNavLine(Activity context, int height, int color, int currentPosition)
{
    if(textViews != null)
    {
        navWidth = getScreenWidth(context) / textViews.length;
    }
    height = dip2px(context,height);
    System.out.println("width:" + navWidth);

    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, height);
    navLine = new View(context);
    navLine.setLayoutParams(layoutParams);
    navLine.setBackgroundColor(context.getResources().getColor(color));

    LayoutParams lp = new LayoutParams(navWidth, height);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    addView(navLine, lp);
    moveBar(navLine, navWidth, widOffset, currentPosition);
}
 
Example 6
private void setupDeviderView(View view, int parentLayout, int childVerticalLineLayout) {
    final RelativeLayout layout = (RelativeLayout) view.findViewById(parentLayout);
    final RelativeLayout childLayout = (RelativeLayout) view.findViewById(childVerticalLineLayout);
    ViewTreeObserver viewTreeObserver = layout.getViewTreeObserver();


    viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            layout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            int height = layout.getMeasuredHeight();
            float marginPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, LEFT_MARGIN, getActivity().getResources().getDisplayMetrics());
            float liineWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, LINE_WIDTH, getActivity().getResources().getDisplayMetrics());
            RelativeLayout.LayoutParams layoutPrams = new RelativeLayout.LayoutParams((int) liineWidth, height);
            layoutPrams.setMargins((int) marginPx, 0, 0, 0);
            childLayout.setLayoutParams(layoutPrams);
        }
    });
}
 
Example 7
Source Project: SearchListView   Source File: SearchListViewNoText.java    License: MIT License 6 votes vote down vote up
/**
 * 获取头部视图
 *
 * @return View
 */
private View getHeaderView() {
    if (viewHeader == null) {
        viewHeader = LayoutInflater.from(getContext()).inflate(R.layout.model_pull_listview_head_no_text, null);

        headContentLayout = (RelativeLayout) viewHeader.findViewById(R.id.head_contentLayout);
        progressBarHeader = (ProgressBar) viewHeader.findViewById(R.id.pulldown_footer_loading);

        layoutContent = (RelativeLayout) viewHeader.findViewById(R.id.layoutContent);

        final ViewConfiguration configuration = ViewConfiguration.get(getContext());
        mTouchSlop = configuration.getScaledTouchSlop();
    }

    if (!isEnableRefresh) {
        headContentLayout.setVisibility(View.GONE);
    }

    return viewHeader;
}
 
Example 8
Source Project: ChatMessageView   Source File: ChatMessageView.java    License: Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void initContent() {
    arrowImage = new ImageView(getContext());
    arrowImage.setId(ViewUtil.generateViewId());

    containerLayout = new RelativeLayout(getContext());
    containerLayout.setId(ViewUtil.generateViewId());

    setShowArrow(showArrow);
    setContentPadding((int) contentPadding);

    super.addView(arrowImage, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    super.addView(containerLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    updatePositionAndGravity();

    updateColors();
    this.setClickable(true);
}
 
Example 9
Source Project: AssistantBySDK   Source File: NaviSetLineActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void switchShowRouteLineDetail() {
    if (showState == ShowState.showing || showState == ShowState.unshowing)
        return;
    height = mAnslMapBox.getHeight();

    if (showState == ShowState.unshow) {
        if (showState == ShowState.showed)
            return;
        mAnslOutBottomBox.setVisibility(View.GONE);
        mAnslVoiceBt.setVisibility(View.GONE);
        findViewById(R.id.ansl_route_detail_list_box).setVisibility(View.VISIBLE);
        startHeight = mAnslRouteLineBox.getHeight();
        mAnslRouteLineBox.getLayoutParams().height = startHeight;
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mAnslRouteDetailBottomBox.getLayoutParams();
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        layoutParams.height = RelativeLayout.LayoutParams.MATCH_PARENT;
    }

    mAnimateToTargetPosition.reset();
    mAnimateToTargetPosition.setInterpolator(new AccelerateInterpolator());
    mAnimateToTargetPosition.setDuration(300);
    mAnimateToTargetPosition.setAnimationListener(animationListener);
    mAnslRouteDetailBottomBox.startAnimation(mAnimateToTargetPosition);
}
 
Example 10
Source Project: Hangar   Source File: Settings.java    License: GNU General Public License v3.0 6 votes vote down vote up
public synchronized static void updateListView(final boolean setAdapter) {
    Runnable runnable = new Runnable() {
        public void run() {
            if (!mAppsLoaded) {
                RelativeLayout bg = (RelativeLayout) lv.getParent();
                bg.findViewById(R.id.loading_text).setVisibility(View.GONE);

                mAppsLoaded = true;
            }
            if (setAdapter) {
                lv.setAdapter(mAppRowAdapter);
            }
            lv.invalidateViews();
            mAppRowAdapter.notifyDataSetChanged();
        }
    };
    mInstance.runOnUiThread(runnable);
}
 
Example 11
Source Project: letv   Source File: GarbageCleanActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void initView() {
    this.mBack = (ImageView) findViewById(R.id.phone_garbage_clean_back);
    this.mScanButton = (Button) findViewById(R.id.phone_garbage_clean_scan);
    this.mBackgroundView = (ImageView) findViewById(R.id.bg_phone_garbage_clean_image);
    this.mBackgroundView.setBackgroundResource(2130837643);
    this.mHousekeeperView = (ImageView) findViewById(R.id.iv_phone_garbage_housekeeper);
    this.mHousekeeperView.setBackgroundResource(2130838207);
    this.mGarbageFileTotalSizeTextView = (TextView) findViewById(R.id.garbage_file_total_size);
    this.mGarbageFileUnitTextView = (TextView) findViewById(R.id.garbage_file_size_unit);
    this.mGarbageFileText = (TextView) findViewById(R.id.garbage_file_text);
    this.mLayout = (RelativeLayout) findViewById(R.id.rl_garbage_file_info);
    this.mLayout.setVisibility(4);
    this.mListAdapter = new GarbageFileListAdapter(this, this.mGarbageFileList);
    this.mListAdapter.setSelectionList(this.mGarbageFileTypeSelectionList);
    this.mListView = (ListView) findViewById(R.id.garbage_file_list);
    this.mListView.setAdapter(this.mListAdapter);
    this.mListView.setChoiceMode(1);
    this.mListView.setVisibility(4);
}
 
Example 12
Source Project: Skeleton   Source File: AddViewsByJavaActivity.java    License: Apache License 2.0 6 votes vote down vote up
void startAndEndViewsSkeleton() {

        // Bind view
        RelativeLayout mainLayout2 = findViewById(R.id.mainLayout2);
        AppCompatImageButton btn3 = findViewById(R.id.btn3);
        AppCompatImageButton btn4 = findViewById(R.id.btn4);

        SkeletonViewGroup skeletonViewGroup = new SkeletonViewGroup(getApplicationContext());
        ArrayList<SkeletonModel> skeletonModels = new ArrayList<>();

        // Add Btn 1 and Btn 2
        skeletonModels.add(new SkeletonModelBuilder()
                .setStartView(btn3) // AddView start
                .setEndView(btn4)// AddView end
                .build());


        skeletonViewGroup.setSkeletonModels(skeletonModels);

        // Add SkeletonGroup
        ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        mainLayout2.addView(skeletonViewGroup, layout);
    }
 
Example 13
Source Project: FimiX8-RE   Source File: X8CameraEVShutterISOController.java    License: MIT License 5 votes vote down vote up
public void initViews(View rootView) {
    this.handleView = rootView.findViewById(R.id.camera_params_setting);
    this.tabHost = (X8TabHost) rootView.findViewById(R.id.camera_tab);
    this.isoRecycler = (RecyclerView) rootView.findViewById(R.id.iso_recycler);
    this.shutterRecycler = (RecyclerView) rootView.findViewById(R.id.shutter_recycler);
    this.rulerView = (X8RulerView) rootView.findViewById(R.id.rulerView);
    this.tvEv = (TextView) rootView.findViewById(R.id.ev_value);
    this.shutterView = (RelativeLayout) rootView.findViewById(R.id.shutter_layout);
    this.tvIso = (TextView) rootView.findViewById(R.id.iso_title);
    this.tvShutter = (TextView) rootView.findViewById(R.id.shutter_title);
    this.isoView = (RelativeLayout) rootView.findViewById(R.id.iso_layout);
    this.evView = (RelativeLayout) rootView.findViewById(R.id.ev_layout);
    this.ev_add_btn = (TextView) rootView.findViewById(R.id.ev_add_btn);
    this.ev_reduct_btn = (TextView) rootView.findViewById(R.id.ev_reduce_btn);
    this.layoutManager = new LinearLayoutManager(this.mContext);
    this.layoutManager.setOrientation(0);
    this.isoRecycler.setLayoutManager(this.layoutManager);
    this.isoRecycler.setHasFixedSize(true);
    this.isoRecycler.setAnimation(null);
    this.shutterLayout = new LinearLayoutManager(this.mContext);
    this.shutterLayout.setOrientation(0);
    this.shutterRecycler.setLayoutManager(this.shutterLayout);
    this.shutterRecycler.setHasFixedSize(true);
    this.shutterRecycler.setAnimation(null);
    this.ev_reduct_btn.setOnClickListener(this);
    this.ev_add_btn.setOnClickListener(this);
}
 
Example 14
@Override public void bind(@NonNull FolderModel folderModel) {
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();
    String letter = InputHelper.getTwoLetters(folderModel.getFolderName());
    int color = folderModel.getColor() == 0 ? ColorGenerator.MATERIAL.getRandomColor() : folderModel.getColor();
    imageIcon.setImageDrawable(builder.build(letter.toUpperCase(), color));
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageIcon.getLayoutParams();
    int gap = PrefConstant.getGapSize(imageIcon.getResources());
    if (!isHorizontal) params.setMargins(0, 0, 0, gap);
    else params.setMargins(0, 0, gap, 0);
}
 
Example 15
Source Project: relight   Source File: BaseAndroidWidget.java    License: Apache License 2.0 5 votes vote down vote up
public T addRule(Integer verb, Integer rule) {
    if (null == relativeParams) {
        relativeParams = new RelativeLayout.LayoutParams(wrapContent, wrapContent);
    }
    relativeParams.addRule(verb, rule);
    return self();
}
 
Example 16
Source Project: UberSplash   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void playVideo(File videoFile) {
    mVideoView.setVideoPath(videoFile.getPath());
    mVideoView.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            mediaPlayer.setLooping(true);
            mediaPlayer.start();
        }
    });
}
 
Example 17
Source Project: HaiNaBaiChuan   Source File: MainFragment.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 布局到顶部
 */
@Override
public void contentLayoutToTop() {
    if (scrollRunning || MainActivity.isMenuVisible()) {
        return;
    }
    if (runnableTop != null) {
        contentLayoutToTopListener(true);
        handler.post(runnableTop);
        return;
    }
    runnableTop = new Runnable() {
        @Override
        public void run() {
            if (params == null) {
                params = (RelativeLayout.LayoutParams) dl3.getLayoutParams();
                oldTopMargin = params.topMargin;
                minTopMargin = appbar.getHeight();
            }

            if (params.topMargin > minTopMargin) {
                params.topMargin -= 30;
                dl3.setLayoutParams(params);
                handler.post(this);
            } else {
                imgScrollInfo.setImageResource(R.drawable.ic_scroll_down);
                handler.removeCallbacks(this);
                contentLayoutToTopListener(false);
            }
        }
    };
    contentLayoutToTopListener(true);
    handler.post(runnableTop);
}
 
Example 18
Source Project: Android   Source File: FriendDelAdapter.java    License: MIT License 5 votes vote down vote up
public FriendHolder(View itemView) {
    super(itemView);
    contentLayout = (RelativeLayout) itemView.findViewById(R.id.content_layout);
    deleteTv = (ImageView) itemView.findViewById(R.id.delete_tv);
    avater = (RoundedImageView) itemView.findViewById(R.id.avater_rimg);
    name = (TextView)itemView.findViewById(R.id.name_tv);

    ((SideScrollView) itemView).setSideScrollListener(sideScrollListener);
}
 
Example 19
Source Project: APDE   Source File: EditorActivity.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
    * Called when the user selects "Load Sketch" - this will open the navigation drawer
    */
   private void loadSketch() {
   	//Opens the navigation drawer
   	
	DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer);
	RelativeLayout drawerLayout = (RelativeLayout) findViewById(R.id.drawer_wrapper);
	
	drawer.openDrawer(drawerLayout);
}
 
Example 20
Source Project: VideoOS-Android-SDK   Source File: UDView.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * 设置Y坐标
 *
 * @param y
 * @return
 */
public UDView setY(int y) {
    View view = getView();
    if (view != null) {
        if (view.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
            RelativeLayout.LayoutParams layoutParams =
                    (RelativeLayout.LayoutParams) view.getLayoutParams();
            layoutParams.topMargin = y;
            view.setLayoutParams(layoutParams);
        }
    }
    return this;
}
 
Example 21
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContainerGroupLayout = (RelativeLayout) inflater.inflate(
            R.layout.fragment_navigation_drawer, container, false);

    setupModeSelectListView();
    setupPageSelectListView();

    return mContainerGroupLayout;
}
 
Example 22
Source Project: android-Ultra-Pull-To-Refresh   Source File: Utils.java    License: MIT License 5 votes vote down vote up
public static View createSimpleLoadingTip(Context context) {
    final View view = LayoutInflater.from(context).inflate(R.layout.cube_ptr_simple_loading, null);
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(-2, -2);
    lp.setMargins(0, 0, 0, LocalDisplay.dp2px(4));
    lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    lp.addRule(RelativeLayout.CENTER_VERTICAL);
    view.setLayoutParams(lp);
    view.setVisibility(View.INVISIBLE);
    return view;
}
 
Example 23
@Override
protected void createLayout() {

    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    final ViewGroup mainView = (ViewGroup) inflater.inflate(R.layout.activity_base, null, false);
    View contentView = inflater.inflate(getLayout(), mainView, false);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.BELOW, R.id.toolbar_main);
    contentView.setLayoutParams(params);
    mainView.addView(contentView, 0);

    setContentView(mainView);

}
 
Example 24
Source Project: SimplifyReader   Source File: LoadMoreListView.java    License: Apache License 2.0 5 votes vote down vote up
private void init(Context context) {
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // footer
    mFooterView = (RelativeLayout) mInflater.inflate(R.layout.common_load_more_footer, this, false);
    mLabLoadMore = (TextView) mFooterView.findViewById(R.id.common_load_more_footer_msg);
    mProgressBarLoadMore = (CircularProgressBar) mFooterView.findViewById(R.id.common_load_more_footer_progress);

    addFooterView(mFooterView);

    super.setOnScrollListener(this);
}
 
Example 25
/**
 * 动态添加多图裁剪底部预览图片列表
 */
private void addPhotoRecyclerView() {
    mRecyclerView = new RecyclerView(this);
    mRecyclerView.setId(R.id.id_recycler);
    mRecyclerView.setBackgroundColor(ContextCompat.getColor(this, R.color.ucrop_color_widget_background));
    RelativeLayout.LayoutParams lp =
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, dip2px(80));
    mRecyclerView.setLayoutParams(lp);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
    mLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    resetCutDataStatus();
    list.get(cutIndex).setCut(true);
    adapter = new PicturePhotoGalleryAdapter(this, list);
    mRecyclerView.setAdapter(adapter);
    adapter.setOnItemClickListener((position, view) -> {
        if (cutIndex == position) {
            return;
        }
        cutIndex = position;
        resetCutData();
    });

    uCropMultiplePhotoBox.addView(mRecyclerView);
    changeLayoutParams();
    FrameLayout uCropFrame = findViewById(R.id.ucrop_frame);
    ((RelativeLayout.LayoutParams) uCropFrame.getLayoutParams())
            .addRule(RelativeLayout.ABOVE, R.id.id_recycler);
}
 
Example 26
public PromptDialog(Context context) {
    super(context);
    finder = ResoureFinder.getInstance(context);
    final LayoutInflater inflater = LayoutInflater.from(getContext());
    final RelativeLayout layout = (RelativeLayout) inflater.inflate(
            finder.getLayoutId("platform_window_dialog_prompt_layout"), null);
    tvDesc = (TextView) layout.findViewById(finder.getId("tv_dialog_input_desc"));
    etInput = (EditText) layout.findViewById(finder.getId("et_dialog_input_text"));
    etInput.setSelectAllOnFocus(true);
    setView(layout);
}
 
Example 27
Source Project: GodotAds   Source File: GDMopub.java    License: Apache License 2.0 5 votes vote down vote up
private void createBanner() {
       RelativeLayout layout = new RelativeLayout(activity);
       layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
       ((Godot)activity).layout.addView(layout);

	FrameLayout.LayoutParams AdParams = new FrameLayout.LayoutParams(
					 FrameLayout.LayoutParams.MATCH_PARENT,
					 FrameLayout.LayoutParams.WRAP_CONTENT);

	if(moPubView != null) { layout.removeView(moPubView); }

	if (_config.optString("BannerGravity", "BOTTOM").equals("BOTTOM")) {
		AdParams.gravity = Gravity.BOTTOM;
	} else { AdParams.gravity = Gravity.TOP; }

	final String banner_unit_id =
	_config.optString("BannerAdId", activity.getString(R.string.gads_mopub_banner_test_id));

	moPubView = new MoPubView(activity);
	moPubView.setLayoutParams(AdParams);
	moPubView.setAdUnitId(banner_unit_id); // Enter your Ad Unit ID from www.mopub.com
	moPubView.setBannerAdListener(banner_listener);
	moPubView.setAutorefreshEnabled(true);
	moPubView.setVisibility(View.INVISIBLE);
	moPubView.loadAd();

	layout.addView(moPubView);
}
 
Example 28
Source Project: arcusandroid   Source File: DeviceControlCardItemView.java    License: Apache License 2.0 5 votes vote down vote up
private void showCloudOfflineBanner(DeviceControlCard card) {
    View banner = findViewById(R.id.card_device_bottom_part);
    banner.setVisibility(View.VISIBLE);
    banner.setBackgroundColor(getResources().getColor(R.color.pink_banner));

    View waiting = findViewById(R.id.waiting_on_label_device_list);
    if(card.isIsEventInProcess()) {
        waiting.setVisibility(View.VISIBLE);
    }
    else {
        waiting.setVisibility(View.GONE);
    }

    if(card.getDeviceId() !=null) {
        final DeviceModel model = SessionModelManager.instance().getDeviceWithId(card.getDeviceId(), false);
        if (model != null) {
            ImageView icon = (ImageView) findViewById(R.id.product_icon);
            String vendorName = String.valueOf(model.getVendor()).toUpperCase();
            ImageManager.with(getContext())
                    .putBrandImage(vendorName)
                    .withTransform(new BlackWhiteInvertTransformation(Invert.BLACK_TO_WHITE))
                    .into(icon)
                    .execute();
        }
    }

    RelativeLayout offlineBanner = (RelativeLayout) findViewById(R.id.device_offline_banner);
    offlineBanner.setVisibility(INVISIBLE);

    setBackgroundColor(getContext().getResources().getColor(R.color.cardview_dark_background));
    hideControls();
}
 
Example 29
Source Project: GPS2SMS   Source File: RepoCoordsFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void dialogAdjustment(Dialog dialog) {
    dialog.findViewById(R.id.btnSave2).setVisibility(View.GONE);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) btnMap.getLayoutParams();
    params.addRule(RelativeLayout.LEFT_OF, 0);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    btnMap.setLayoutParams(params); //causes layout update
}
 
Example 30
Source Project: FileManager   Source File: AccessibilityGuideFloatView.java    License: Apache License 2.0 5 votes vote down vote up
private void initWindowView() {
    mContentView = (RelativeLayout) LayoutInflater.from(mContext).inflate(R.layout.accessibility_guide_float_window_layout, null);
    mContentView.setFocusableInTouchMode(true);
    mFloatViewLayout = (AccessibilityGuideFloatViewLayout) mContentView.findViewById(R.id.guide_float_window_layout);
    mFloatViewLayout.getCloseView().setOnClickListener(this);
    mContentView.setOnKeyListener((v, keyCode, event) -> {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            dimiss();
        }
        return false;
    });
}