List of usage examples for android.widget RelativeLayout ALIGN_PARENT_BOTTOM
int ALIGN_PARENT_BOTTOM
To view the source code for android.widget RelativeLayout ALIGN_PARENT_BOTTOM.
Click Source Link
From source file:com.frostytornado.cordova.plugin.ad.admob.Util.java
protected void addBannerViewOverlap(String position, String size) { removeBannerViewOverlap();/*from w w w . j a v a 2 s. c o m*/ if (bannerViewLayout == null) { bannerViewLayout = new RelativeLayout(plugin.getCordova().getActivity());// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); bannerViewLayout.setLayoutParams(params); ((ViewGroup) getView(plugin.getWebView())).addView(bannerViewLayout); params = new RelativeLayout.LayoutParams(AdView.LayoutParams.WRAP_CONTENT, AdView.LayoutParams.WRAP_CONTENT); if (position.equals("top-left")) { Log.d(LOG_TAG, "top-left"); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); } else if (position.equals("top-center")) { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } else if (position.equals("top-right")) { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } else if (position.equals("left")) { params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("center")) { params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("right")) { params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("bottom-left")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); } else if (position.equals("bottom-center")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } else if (position.equals("bottom-right")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } else { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } bannerView.setLayoutParams(params); bannerViewLayout.addView(bannerView); } }
From source file:com.svpino.longhorn.fragments.StockListFragment.java
private void displayStockOverview(Integer position, boolean animate) { if (position != null) { setCurrentTile(position);/*w w w .ja v a2 s.c o m*/ setStockOverviewState(StockOverviewState.OVERVIEW); } displayStockInViewFlipper(position); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, Extensions.dpToPixels(getResources(), STOCK_OVERVIEW_HEIGHT)); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); this.viewFlipper.setLayoutParams(layoutParams); if (animate) { Animation animation = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_in_from_bottom); animation.setAnimationListener( new StockOverviewAnimationListener(this.animateStockOverviewContentCallback)); this.viewFlipper.setVisibility(View.VISIBLE); this.viewFlipper.startAnimation(animation); } else { this.viewFlipper.setVisibility(View.VISIBLE); } collapseSearchActionView(); invalidateOptionsMenu(); }
From source file:de.mrapp.android.dialog.decorator.MaterialDialogDecorator.java
/** * Creates and returns the layout params, which should be used by the dialog's root view. * * @return The layout params, which have been created, as an instance of the class {@link * RelativeLayout.LayoutParams}//w w w . j a v a 2 s.co m */ private RelativeLayout.LayoutParams createLayoutParams() { Rect windowDimensions = new Rect(); Window window = getWindow(); assert window != null; window.getDecorView().getWindowVisibleDisplayFrame(windowDimensions); int shadowWidth = isFullscreen() ? 0 : getContext().getResources().getDimensionPixelSize(R.dimen.dialog_shadow_width); int leftInset = isFitsSystemWindowsLeft() && isFullscreen() && windowInsets != null ? windowInsets.left : 0; int topInset = isFitsSystemWindowsTop() && isFullscreen() && windowInsets != null ? windowInsets.top : 0; int rightInset = isFitsSystemWindowsRight() && isFullscreen() && windowInsets != null ? windowInsets.right : 0; int bottomInset = isFitsSystemWindowsBottom() && isFullscreen() && windowInsets != null ? windowInsets.bottom : 0; int leftMargin = getLeftMargin() - shadowWidth + leftInset; int topMargin = getTopMargin() - shadowWidth + topInset; int rightMargin = getRightMargin() - shadowWidth + rightInset; int bottomMargin = getBottomMargin() - shadowWidth + bottomInset; int width = getLayoutDimension(getWidth(), leftMargin + rightMargin, windowDimensions.right); int height = getLayoutDimension(getHeight(), topMargin + bottomMargin, windowDimensions.bottom); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(width, height); layoutParams.leftMargin = leftMargin; layoutParams.topMargin = topMargin; layoutParams.rightMargin = rightMargin; layoutParams.bottomMargin = bottomMargin; if ((getGravity() & Gravity.CENTER_HORIZONTAL) == Gravity.CENTER_HORIZONTAL) { layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); } if ((getGravity() & Gravity.CENTER_VERTICAL) == Gravity.CENTER_VERTICAL) { layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); } if ((getGravity() & Gravity.LEFT) == Gravity.LEFT) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); } if ((getGravity() & Gravity.TOP) == Gravity.TOP) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); } if ((getGravity() & Gravity.RIGHT) == Gravity.RIGHT) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); } if ((getGravity() & Gravity.BOTTOM) == Gravity.BOTTOM) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); } return layoutParams; }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
@SuppressLint("NewApi") private static void applyAttributes(View view, Map<String, String> attrs, ViewGroup parent) { if (viewRunnables == null) createViewRunnables();//w ww . j a va 2s .c o m ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); int layoutRule; int marginLeft = 0, marginRight = 0, marginTop = 0, marginBottom = 0, paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0; boolean hasCornerRadius = false, hasCornerRadii = false; for (Map.Entry<String, String> entry : attrs.entrySet()) { String attr = entry.getKey(); if (viewRunnables.containsKey(attr)) { viewRunnables.get(attr).apply(view, entry.getValue(), parent, attrs); continue; } if (attr.startsWith("cornerRadius")) { hasCornerRadius = true; hasCornerRadii = !attr.equals("cornerRadius"); continue; } layoutRule = NO_LAYOUT_RULE; boolean layoutTarget = false; switch (attr) { case "id": String idValue = parseId(entry.getValue()); if (parent != null) { DynamicLayoutInfo info = getDynamicLayoutInfo(parent); int newId = highestIdNumberUsed++; view.setId(newId); info.nameToIdNumber.put(idValue, newId); } break; case "width": case "layout_width": switch (entry.getValue()) { case "wrap_content": layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; break; case "fill_parent": case "match_parent": layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; break; default: layoutParams.width = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, true); break; } break; case "height": case "layout_height": switch (entry.getValue()) { case "wrap_content": layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; break; case "fill_parent": case "match_parent": layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; break; default: layoutParams.height = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, false); break; } break; case "layout_gravity": if (parent != null && parent instanceof LinearLayout) { ((LinearLayout.LayoutParams) layoutParams).gravity = parseGravity(entry.getValue()); } else if (parent != null && parent instanceof FrameLayout) { ((FrameLayout.LayoutParams) layoutParams).gravity = parseGravity(entry.getValue()); } break; case "layout_weight": if (parent != null && parent instanceof LinearLayout) { ((LinearLayout.LayoutParams) layoutParams).weight = Float.parseFloat(entry.getValue()); } break; case "layout_below": layoutRule = RelativeLayout.BELOW; layoutTarget = true; break; case "layout_above": layoutRule = RelativeLayout.ABOVE; layoutTarget = true; break; case "layout_toLeftOf": layoutRule = RelativeLayout.LEFT_OF; layoutTarget = true; break; case "layout_toRightOf": layoutRule = RelativeLayout.RIGHT_OF; layoutTarget = true; break; case "layout_alignBottom": layoutRule = RelativeLayout.ALIGN_BOTTOM; layoutTarget = true; break; case "layout_alignTop": layoutRule = RelativeLayout.ALIGN_TOP; layoutTarget = true; break; case "layout_alignLeft": case "layout_alignStart": layoutRule = RelativeLayout.ALIGN_LEFT; layoutTarget = true; break; case "layout_alignRight": case "layout_alignEnd": layoutRule = RelativeLayout.ALIGN_RIGHT; layoutTarget = true; break; case "layout_alignParentBottom": layoutRule = RelativeLayout.ALIGN_PARENT_BOTTOM; break; case "layout_alignParentTop": layoutRule = RelativeLayout.ALIGN_PARENT_TOP; break; case "layout_alignParentLeft": case "layout_alignParentStart": layoutRule = RelativeLayout.ALIGN_PARENT_LEFT; break; case "layout_alignParentRight": case "layout_alignParentEnd": layoutRule = RelativeLayout.ALIGN_PARENT_RIGHT; break; case "layout_centerHorizontal": layoutRule = RelativeLayout.CENTER_HORIZONTAL; break; case "layout_centerVertical": layoutRule = RelativeLayout.CENTER_VERTICAL; break; case "layout_centerInParent": layoutRule = RelativeLayout.CENTER_IN_PARENT; break; case "layout_margin": marginLeft = marginRight = marginTop = marginBottom = DimensionConverter .stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; case "layout_marginLeft": marginLeft = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, true); break; case "layout_marginTop": marginTop = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, false); break; case "layout_marginRight": marginRight = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, true); break; case "layout_marginBottom": marginBottom = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics(), parent, false); break; case "padding": paddingBottom = paddingLeft = paddingRight = paddingTop = DimensionConverter .stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; case "paddingLeft": paddingLeft = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; case "paddingTop": paddingTop = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; case "paddingRight": paddingRight = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; case "paddingBottom": paddingBottom = DimensionConverter.stringToDimensionPixelSize(entry.getValue(), view.getResources().getDisplayMetrics()); break; } if (layoutRule != NO_LAYOUT_RULE && parent instanceof RelativeLayout) { if (layoutTarget) { int anchor = idNumFromIdString(parent, parseId(entry.getValue())); ((RelativeLayout.LayoutParams) layoutParams).addRule(layoutRule, anchor); } else if (entry.getValue().equals("true")) { ((RelativeLayout.LayoutParams) layoutParams).addRule(layoutRule); } } } // TODO: this is a giant mess; come up with a simpler way of deciding what to draw for the background if (attrs.containsKey("background") || attrs.containsKey("borderColor")) { String bgValue = attrs.containsKey("background") ? attrs.get("background") : null; if (bgValue != null && bgValue.startsWith("@drawable/")) { view.setBackground(getDrawableByName(view, bgValue)); } else if (bgValue == null || bgValue.startsWith("#") || bgValue.startsWith("@color")) { if (view instanceof Button || attrs.containsKey("pressedColor")) { int bgColor = parseColor(view, bgValue == null ? "#00000000" : bgValue); int pressedColor; if (attrs.containsKey("pressedColor")) { pressedColor = parseColor(view, attrs.get("pressedColor")); } else { pressedColor = adjustBrightness(bgColor, 0.9f); } GradientDrawable gd = new GradientDrawable(); gd.setColor(bgColor); GradientDrawable pressedGd = new GradientDrawable(); pressedGd.setColor(pressedColor); if (hasCornerRadii) { float radii[] = new float[8]; for (int i = 0; i < CORNERS.length; i++) { String corner = CORNERS[i]; if (attrs.containsKey("cornerRadius" + corner)) { radii[i * 2] = radii[i * 2 + 1] = DimensionConverter.stringToDimension( attrs.get("cornerRadius" + corner), view.getResources().getDisplayMetrics()); } gd.setCornerRadii(radii); pressedGd.setCornerRadii(radii); } } else if (hasCornerRadius) { float cornerRadius = DimensionConverter.stringToDimension(attrs.get("cornerRadius"), view.getResources().getDisplayMetrics()); gd.setCornerRadius(cornerRadius); pressedGd.setCornerRadius(cornerRadius); } if (attrs.containsKey("borderColor")) { String borderWidth = "1dp"; if (attrs.containsKey("borderWidth")) { borderWidth = attrs.get("borderWidth"); } int borderWidthPx = DimensionConverter.stringToDimensionPixelSize(borderWidth, view.getResources().getDisplayMetrics()); gd.setStroke(borderWidthPx, parseColor(view, attrs.get("borderColor"))); pressedGd.setStroke(borderWidthPx, parseColor(view, attrs.get("borderColor"))); } StateListDrawable selector = new StateListDrawable(); selector.addState(new int[] { android.R.attr.state_pressed }, pressedGd); selector.addState(new int[] {}, gd); view.setBackground(selector); getDynamicLayoutInfo(view).bgDrawable = gd; } else if (hasCornerRadius || attrs.containsKey("borderColor")) { GradientDrawable gd = new GradientDrawable(); int bgColor = parseColor(view, bgValue == null ? "#00000000" : bgValue); gd.setColor(bgColor); if (hasCornerRadii) { float radii[] = new float[8]; for (int i = 0; i < CORNERS.length; i++) { String corner = CORNERS[i]; if (attrs.containsKey("cornerRadius" + corner)) { radii[i * 2] = radii[i * 2 + 1] = DimensionConverter.stringToDimension( attrs.get("cornerRadius" + corner), view.getResources().getDisplayMetrics()); } gd.setCornerRadii(radii); } } else if (hasCornerRadius) { float cornerRadius = DimensionConverter.stringToDimension(attrs.get("cornerRadius"), view.getResources().getDisplayMetrics()); gd.setCornerRadius(cornerRadius); } if (attrs.containsKey("borderColor")) { String borderWidth = "1dp"; if (attrs.containsKey("borderWidth")) { borderWidth = attrs.get("borderWidth"); } gd.setStroke( DimensionConverter.stringToDimensionPixelSize(borderWidth, view.getResources().getDisplayMetrics()), parseColor(view, attrs.get("borderColor"))); } view.setBackground(gd); getDynamicLayoutInfo(view).bgDrawable = gd; } else { view.setBackgroundColor(parseColor(view, bgValue)); } } } if (layoutParams instanceof ViewGroup.MarginLayoutParams) { ((ViewGroup.MarginLayoutParams) layoutParams).setMargins(marginLeft, marginTop, marginRight, marginBottom); } view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); view.setLayoutParams(layoutParams); }
From source file:com.spoiledmilk.ibikecph.navigation.SMRouteNavigationActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.route_navigation_activity); LayoutInflater inflater = LayoutInflater.from(this); reportProblemsView = (RelativeLayout) inflater.inflate(R.layout.report_problems_view, null); textReport = (TextView) reportProblemsView.findViewById(R.id.textReport); instructionsViewMaxContainer = (RelativeLayout) findViewById(R.id.instructionsViewMaxContainer); paramsForInstMaxContainer = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); paramsForInstMaxContainer.addRule(RelativeLayout.ALIGN_PARENT_TOP); paramsForInstMaxContainer.addRule(RelativeLayout.CENTER_HORIZONTAL); paramsForInstMaxContainer.topMargin = 0; instructionsViewMaxContainer.setLayoutParams(paramsForInstMaxContainer); routeFinishedContainer = (RelativeLayout) findViewById(R.id.routeFinishedContainer); imgClose = (ImageButton) findViewById(R.id.imgClose); imgClose.setOnClickListener(new OnClickListener() { @Override/*w w w. j a va2 s. c om*/ public void onClick(View arg0) { Bundle conData = new Bundle(); conData.putInt("overlaysShown", getOverlaysShown()); Intent intent = new Intent(); intent.putExtras(conData); setResult(MapActivity.RESULT_RETURN_FROM_NAVIGATION, intent); setResult(MapActivity.RESULT_RETURN_FROM_NAVIGATION); finish(); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); } }); progressBar = (ProgressBar) findViewById(R.id.progressBar); textGoodRide = (TextView) findViewById(R.id.textGoodRide); textRecalculating = (TextView) findViewById(R.id.textRecalculating); textBicycle = (TextView) findViewById(R.id.textBicycle); textCargo = (TextView) findViewById(R.id.textCargo); textGreen = (TextView) findViewById(R.id.textGreen); FrameLayout.LayoutParams rootParams = new FrameLayout.LayoutParams((int) (9 * Util.getScreenWidth() / 5), FrameLayout.LayoutParams.MATCH_PARENT); findViewById(R.id.root_layout).setLayoutParams(rootParams); this.maxSlide = (int) (4 * Util.getScreenWidth() / 5); Util.init(getWindowManager()); leftContainer = (RelativeLayout) findViewById(R.id.leftContainer); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) Util.getScreenWidth() * 4 / 5, RelativeLayout.LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); leftContainer.setLayoutParams(params); parentContainer = (RelativeLayout) findViewById(R.id.parent_container); params = new RelativeLayout.LayoutParams((int) Util.getScreenWidth(), RelativeLayout.LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); parentContainer.setLayoutParams(params); imgCargoSlider = (ImageView) findViewById(R.id.imgCargoSlider); imgCargoSlider.setOnTouchListener(new OnTouchListener() { // Swipe the view horizontally @Override public boolean onTouch(View v, MotionEvent event) { return onSliderTouch(v, event); } }); darkenedView = findViewById(R.id.darkenedView); darkenedView.setBackgroundColor(Color.BLACK); viewDistance = (RelativeLayout) findViewById(R.id.viewDistance); textTime = (TextView) findViewById(R.id.textTime); mapDisabledView = findViewById(R.id.mapDisabledView); mapDisabledView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // used to disable the map touching when sliden return onSliderTouch(v, event); } }); paramsInstructionsMaxNormal.topMargin = (int) (Util.getScreenHeight() - Util.dp2px(146)); paramsInstructionsMaxNormal.bottomMargin = -(int) ((Util.getScreenHeight())); paramsInstructionsMaxMaximized.topMargin = INSTRUCTIONS_TOP_MARGIN; paramsInstructionsMaxMinimized.topMargin = (int) (Util.getScreenHeight() - Util.getScreenHeight() / 10); paramsInstructionsMaxMinimized.bottomMargin = -(int) ((Util.getScreenHeight())); overviewLayout = (RelativeLayout) findViewById(R.id.overviewLayout); btnStart = (Button) overviewLayout.findViewById(R.id.btnStart); btnStart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { viewDistance.setVisibility(View.VISIBLE); btnStart.setEnabled(false); hideOverview(); textTime.setText(mapFragment.getEstimatedArrivalTime()); mapFragment.startRouting(); IbikeApplication.getTracker().sendEvent("Route", "Overview", mapFragment.destination, (long) 0); // instructionsView.setVisibility(View.VISIBLE); setInstructionViewState(InstrcutionViewState.Normal); RelativeLayout.LayoutParams paramsBtnTrack = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); paramsBtnTrack.setMargins(Util.dp2px(10), Util.dp2px(10), Util.dp2px(10), Util.dp2px(10)); paramsBtnTrack.alignWithParent = true; paramsBtnTrack.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); paramsBtnTrack.addRule(RelativeLayout.ABOVE, instructionsView.getId()); btnTrack.setLayoutParams(paramsBtnTrack); startTrackingUser(); } }); btnClose = ((ImageButton) findViewById(R.id.btnClose)); btnClose.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showStopDlg(); } }); // Darken the button on touch : btnClose.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent me) { if (me.getAction() == MotionEvent.ACTION_DOWN) { btnClose.setColorFilter(Color.argb(150, 155, 155, 155)); return false; } else if (me.getAction() == MotionEvent.ACTION_UP || me.getAction() == MotionEvent.ACTION_CANCEL) { btnClose.setColorFilter(Color.argb(0, 155, 155, 155)); return false; } return false; } }); // increased touch area for the normal pull handle pullTouchNormal = findViewById(R.id.pullTouchNormal); pullTouchNormal.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent event) { isPulledFromNormal = true; return onPullHandleTouch(null, event); } }); // increased touch area for the max pull handle pullTouchMax = findViewById(R.id.pullTouchMax); pullTouchMax.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent event) { isPulledFromNormal = false; yFix = Util.dp2px(16); return onPullHandleTouch(null, event); } }); mapTopDisabledView = findViewById(R.id.mapTopDisabledView); mapTopDisabledView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent event) { isPulledFromNormal = false; yFix = Util.dp2px(42); // return onPullHandleTouch(null, event); return true; } }); instructionsView = (RelativeLayout) findViewById(R.id.instructionsView); instructionsView.setBackgroundColor(Color.BLACK); pullHandle = (ImageButton) instructionsView.findViewById(R.id.imgPullHandle); pullHandle.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent event) { isPulledFromNormal = true; return onPullHandleTouch(null, event); } }); instructionsViewMin = (LinearLayout) findViewById(R.id.instructionsViewMin); pullHandleMin = (ImageButton) instructionsViewMin.findViewById(R.id.imgPullHandleMin); pullHandleMin.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { return onPullHandleTouch(arg0, arg1); } }); instructionsViewMax = (RelativeLayout) findViewById(R.id.instructionsViewMax); params = new RelativeLayout.LayoutParams((int) Util.getScreenWidth(), RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); instructionsView.setLayoutParams(params); params = new RelativeLayout.LayoutParams((int) Util.getScreenWidth(), RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); findViewById(R.id.overviewLayout).setLayoutParams(params); pullHandleMax = (ImageButton) instructionsViewMax.findViewById(R.id.imgPullHandleMax); pullHandleMax.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { isPulledFromNormal = false; return onPullHandleTouch(arg0, arg1); } }); instructionList = (ListView) instructionsViewMax.findViewById(R.id.listView); instructionList.addFooterView(reportProblemsView); setInstructionViewState(InstrcutionViewState.Invisible); FragmentManager fm = this.getSupportFragmentManager(); mapFragment = getMapFragment(); fm.beginTransaction().add(R.id.map_container, mapFragment).commit(); viewPager = (ViewPager) instructionsView.findViewById(R.id.viewPager); // viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { if (!instructionsUpdated || (mapFragment.isRecalculation && !mapFragment.getTrackingMode())) { SMTurnInstruction turn = mapFragment.route.getTurnInstructions().get(position); if (turn.drivingDirection == SMTurnInstruction.TurnDirection.ReachedYourDestination || turn.drivingDirection == SMTurnInstruction.TurnDirection.ReachingDestination) { mapFragment.animateTo(mapFragment.route.getEndLocation()); } else { mapFragment.animateTo(turn.getLocation()); } stopTrackingUser(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); pagerAdapter = getPagerAdapter(); viewPager.setAdapter(pagerAdapter); viewPager.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // used to disable viewPager swiping when the left menu is // opened return slidden; } }); btnTrack = (ImageButton) findViewById(R.id.btnTrack); btnTrack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mapFragment.getTrackingMode()) { startTrackingUser(); } else { mapFragment.switchTracking(); changeTrackingIcon(); } } }); textReport.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { launchReportIssuesActivity(); } }); textReport2 = (TextView) findViewById(R.id.textReport2); textReport2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { launchReportIssuesActivity(); } }); textDestAddress = (TextView) findViewById(R.id.textDestAddress); textDestAddress.setTypeface(IbikeApplication.getNormalFont()); Config.OSRM_SERVER = Config.OSRM_SERVER_FAST; if (savedInstanceState != null) { final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(SMRouteNavigationActivity.this, getSplashActivityClass()); intent.putExtra("timeout", 0); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } }, 400); } instructionsViewMax.setLayoutParams(paramsInstructionsMaxNormal); RelativeLayout.LayoutParams paramsBtnTrack = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); paramsBtnTrack.setMargins(Util.dp2px(10), Util.dp2px(10), Util.dp2px(10), Util.dp2px(10)); paramsBtnTrack.alignWithParent = true; paramsBtnTrack.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); paramsBtnTrack.addRule(RelativeLayout.ABOVE, overviewLayout.getId()); btnTrack.setLayoutParams(paramsBtnTrack); instructionsView.measure(0, 0); instructionsViewHeight = instructionsView.getMeasuredHeight(); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
From source file:org.protocoderrunner.apprunner.AppRunnerFragment.java
public RelativeLayout initLayout() { LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); // add main layout mainLayout = new RelativeLayout(mActivity); mainLayout.setLayoutParams(layoutParams); mainLayout.setGravity(Gravity.BOTTOM); // mainLayout.setBackgroundColor(getResources().getColor(R.color.transparent)); mainLayout.setBackgroundColor(getResources().getColor(R.color.white)); // set the parent parentScriptedLayout = new RelativeLayout(mActivity); parentScriptedLayout.setLayoutParams(layoutParams); parentScriptedLayout.setGravity(Gravity.BOTTOM); parentScriptedLayout.setBackgroundColor(getResources().getColor(R.color.transparent)); mainLayout.addView(parentScriptedLayout); // editor layout editorLayout = new FrameLayout(mActivity); FrameLayout.LayoutParams editorParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);//from w w w. j a va2 s . com editorLayout.setLayoutParams(editorParams); editorLayout.setId(EDITOR_ID); mainLayout.addView(editorLayout); // console layout consoleRLayout = new RelativeLayout(mActivity); RelativeLayout.LayoutParams consoleLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.apprunner_console)); consoleLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); consoleLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); consoleRLayout.setLayoutParams(consoleLayoutParams); consoleRLayout.setGravity(Gravity.BOTTOM); consoleRLayout.setBackgroundColor(getResources().getColor(R.color.blacktransparent)); consoleRLayout.setVisibility(View.GONE); mainLayout.addView(consoleRLayout); // Create the text view to add to the console layout consoleText = new TextView(mActivity); LayoutParams consoleTextParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); consoleText.setBackgroundColor(getResources().getColor(R.color.transparent)); consoleText.setTextColor(getResources().getColor(R.color.white)); consoleText.setLayoutParams(consoleTextParams); int textPadding = getResources().getDimensionPixelSize(R.dimen.apprunner_console_text_padding); consoleText.setPadding(textPadding, textPadding, textPadding, textPadding); consoleRLayout.addView(consoleText); //add a close button Button closeBtn = new Button(mActivity); closeBtn.setText("x"); closeBtn.setPadding(5, 5, 5, 5); closeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showConsole(false); } }); RelativeLayout.LayoutParams closeBtnLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); closeBtnLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); closeBtnLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); closeBtn.setLayoutParams(closeBtnLayoutParams); consoleRLayout.addView(closeBtn); liveCoding = new PLiveCodingFeedback(mActivity); mainLayout.addView(liveCoding.add()); return mainLayout; }
From source file:com.cranberrygame.cordova.plugin.ad.admob.Util.java
protected void addBannerViewOverlap(String position, String size) { if (bannerViewLayout == null) { bannerViewLayout = new RelativeLayout(plugin.getCordova().getActivity());// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); bannerViewLayout.setLayoutParams(params); //plugin.getWebView().addView(bannerViewLayout, params); //plugin.getWebView().addView(bannerViewLayout);//only for ~cordova4 //((ViewGroup)plugin.getWebView().getRootView()).addView(bannerViewLayout);//only for ~cordova4 //((ViewGroup)plugin.getWebView().getView()).addView(bannerViewLayout);//only for cordova5~ ((ViewGroup) getView(plugin.getWebView())).addView(bannerViewLayout); }// w w w . ja v a 2 s . c o m //http://tigerwoods.tistory.com/11 //http://developer.android.com/reference/android/widget/RelativeLayout.html //http://stackoverflow.com/questions/24900725/admob-banner-poitioning-in-android-on-bottom-of-the-screen-using-no-xml-relative RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(AdView.LayoutParams.WRAP_CONTENT, AdView.LayoutParams.WRAP_CONTENT); if (position.equals("top-left")) { Log.d(LOG_TAG, "top-left"); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); } else if (position.equals("top-center")) { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } else if (position.equals("top-right")) { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } else if (position.equals("left")) { params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("center")) { params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("right")) { params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.CENTER_VERTICAL); } else if (position.equals("bottom-left")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); } else if (position.equals("bottom-center")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } else if (position.equals("bottom-right")) { params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } else { params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.addRule(RelativeLayout.CENTER_HORIZONTAL); } //bannerViewLayout.addView(bannerView, params); bannerView.setLayoutParams(params); bannerViewLayout.addView(bannerView); }
From source file:org.odk.collect.android.views.MediaLayout.java
public void setAVT(FormIndex index, String selectionDesignator, TextView text, String audioURI, String imageURI, String videoURI, final String bigImageURI) { this.selectionDesignator = selectionDesignator; this.index = index; viewText = text;/* w w w . ja v a 2 s. c o m*/ originalText = text.getText(); viewText.setId(ViewIds.generateViewId()); this.videoURI = videoURI; // Layout configurations for our elements in the relative layout RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams audioParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams videoParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // First set up the audio button if (audioURI != null) { // An audio file is specified audioButton = new AudioButton(getContext(), this.index, this.selectionDesignator, audioURI, player); audioButton.setPadding(22, 12, 22, 12); audioButton.setBackgroundColor(Color.LTGRAY); audioButton.setOnClickListener(this); audioButton.setId(ViewIds.generateViewId()); // random ID to be used by the // relative layout. } else { // No audio file specified, so ignore. } // Then set up the video button if (videoURI != null) { // An video file is specified videoButton = new AppCompatImageButton(getContext()); Bitmap b = BitmapFactory.decodeResource(getContext().getResources(), android.R.drawable.ic_media_play); videoButton.setImageBitmap(b); videoButton.setPadding(22, 12, 22, 12); videoButton.setBackgroundColor(Color.LTGRAY); videoButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "playVideoPrompt" + MediaLayout.this.selectionDesignator, MediaLayout.this.index); MediaLayout.this.playVideo(); } }); videoButton.setId(ViewIds.generateViewId()); } else { // No video file specified, so ignore. } // Now set up the image view String errorMsg = null; final int imageId = ViewIds.generateViewId(); if (imageURI != null) { try { String imageFilename = ReferenceManager.instance().DeriveReference(imageURI).getLocalURI(); final File imageFile = new File(imageFilename); if (imageFile.exists()) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int screenWidth = metrics.widthPixels; int screenHeight = metrics.heightPixels; Bitmap b = FileUtils.getBitmapScaledToDisplay(imageFile, screenHeight, screenWidth); if (b != null) { imageView = new ImageView(getContext()); imageView.setPadding(2, 2, 2, 2); imageView.setImageBitmap(b); imageView.setId(imageId); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (bigImageURI != null) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "showImagePromptBigImage" + MediaLayout.this.selectionDesignator, MediaLayout.this.index); try { File bigImage = new File(ReferenceManager.instance() .DeriveReference(bigImageURI).getLocalURI()); Intent i = new Intent("android.intent.action.VIEW"); i.setDataAndType(Uri.fromFile(bigImage), "image/*"); getContext().startActivity(i); } catch (InvalidReferenceException e) { Timber.e(e, "Invalid image reference due to %s ", e.getMessage()); } catch (ActivityNotFoundException e) { Timber.d(e, "No Activity found to handle due to %s", e.getMessage()); ToastUtils.showShortToast( getContext().getString(R.string.activity_not_found, "view image")); } } else { if (viewText instanceof RadioButton) { ((RadioButton) viewText).setChecked(true); } else if (viewText instanceof CheckBox) { CheckBox checkbox = (CheckBox) viewText; checkbox.setChecked(!checkbox.isChecked()); } } } }); } else { // Loading the image failed, so it's likely a bad file. errorMsg = getContext().getString(R.string.file_invalid, imageFile); } } else { // We should have an image, but the file doesn't exist. errorMsg = getContext().getString(R.string.file_missing, imageFile); } if (errorMsg != null) { // errorMsg is only set when an error has occurred Timber.e(errorMsg); missingImage = new TextView(getContext()); missingImage.setText(errorMsg); missingImage.setPadding(10, 10, 10, 10); missingImage.setId(imageId); } } catch (InvalidReferenceException e) { Timber.e(e, "Invalid image reference due to %s ", e.getMessage()); } } else { // There's no imageURI listed, so just ignore it. } // e.g., for TextView that flag will be true boolean isNotAMultipleChoiceField = !RadioButton.class.isAssignableFrom(text.getClass()) && !CheckBox.class.isAssignableFrom(text.getClass()); // Determine the layout constraints... // Assumes LTR, TTB reading bias! if (viewText.getText().length() == 0 && (imageView != null || missingImage != null)) { // No text; has image. The image is treated as question/choice icon. // The Text view may just have a radio button or checkbox. It // needs to remain in the layout even though it is blank. // // The image view, as created above, will dynamically resize and // center itself. We want it to resize but left-align itself // in the resized area and we want a white background, as otherwise // it will show a grey bar to the right of the image icon. if (imageView != null) { imageView.setScaleType(ScaleType.FIT_START); } // // In this case, we have: // Text upper left; image upper, left edge aligned with text right edge; // audio upper right; video below audio on right. textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); if (isNotAMultipleChoiceField) { imageParams.addRule(RelativeLayout.CENTER_HORIZONTAL); } else { imageParams.addRule(RelativeLayout.RIGHT_OF, viewText.getId()); } imageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); if (audioButton != null && videoButton == null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } else if (audioButton == null && videoButton != null) { videoParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null && videoButton != null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.addRule(RelativeLayout.BELOW, audioButton.getId()); videoParams.setMargins(0, 20, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else { // the image will implicitly scale down to fit within parent... // no need to bound it by the width of the parent... if (!isNotAMultipleChoiceField) { imageParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } } imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } else { // We have a non-blank text label -- image is below the text. // In this case, we want the image to be centered... if (imageView != null) { imageView.setScaleType(ScaleType.FIT_START); } // // Text upper left; audio upper right; video below audio on right. // image below text, audio and video buttons; left-aligned with text. textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); if (audioButton != null && videoButton == null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } else if (audioButton == null && videoButton != null) { videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null && videoButton != null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 20, 11, 0); videoParams.addRule(RelativeLayout.BELOW, audioButton.getId()); } else { textParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } if (imageView != null || missingImage != null) { imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); if (videoButton != null) { imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null) { imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } imageParams.addRule(RelativeLayout.BELOW, viewText.getId()); } else { textParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } } addView(viewText, textParams); if (audioButton != null) { addView(audioButton, audioParams); } if (videoButton != null) { addView(videoButton, videoParams); } if (imageView != null) { addView(imageView, imageParams); } else if (missingImage != null) { addView(missingImage, imageParams); } }
From source file:com.almalence.opencam.PluginManager.java
@Override public void onGUICreate() { for (int i = 0; i < activeVF.size(); i++) pluginList.get(activeVF.get(i)).onGUICreate(); if (null != pluginList.get(activeCapture)) pluginList.get(activeCapture).onGUICreate(); if (null != pluginList.get(activeProcessing)) pluginList.get(activeProcessing).onGUICreate(); // for (int i = 0; i < activeFilter.size(); i++) // pluginList.get(i).onGUICreate(); if (null != pluginList.get(activeExport)) pluginList.get(activeExport).onGUICreate(); isRestarting = true;//from w w w. j av a 2s . com // if(countdownLayout.getParent() != null) // ((ViewGroup) countdownLayout.getParent()).removeView(countdownLayout); // ApplicationScreen.getGUIManager().removeViews(countdownLayout, R.id.specialPluginsLayout); // ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout).invalidate(); // ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout).requestLayout(); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT); ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout)) .addView(this.countdownLayout, params); this.countdownLayout.setLayoutParams(params); this.countdownLayout.requestLayout(); this.countdownLayout.setVisibility(View.INVISIBLE); // if(photoTimeLapseLayout.getParent() != null) // ((ViewGroup) photoTimeLapseLayout.getParent()).removeView(photoTimeLapseLayout); // ApplicationScreen.getGUIManager().removeViews(photoTimeLapseLayout, R.id.specialPluginsLayout); params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout)) .addView(this.photoTimeLapseLayout, params); this.photoTimeLapseLayout.setLayoutParams(params); this.photoTimeLapseLayout.requestLayout(); this.photoTimeLapseLayout.setVisibility(View.INVISIBLE); }
From source file:com.cricketkorner.cricket.VitamioListActivity.java
/** * Part of the activity's life cycle, StartAppAd should be integrated here * for the back button exit ad integration. */// w w w . ja v a2s.co m @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myData = new ArrayList<Map<String, Object>>(); StartAppSDK.init(this, "106556515", "206801872"); startAppAd = new StartAppAd(this); // relativeLayout = (RelativeLayout)findViewById(R.id.channelLayout); /** Create Splash Ad **/ StartAppAd.showSplash(this, savedInstanceState, new SplashConfig().setTheme(Theme.OCEAN) .setLogo(R.drawable.ic_launcher).setAppName("Cricket Korner!")); setContentView(R.layout.channel_list); StartAppAd.showSlider(this); title = new ArrayList<String>(); desc = new ArrayList<String>(); thumb = new ArrayList<Integer>(); RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.channelLayout); // Create new StartApp banner Banner startAppBanner = new Banner(this); RelativeLayout.LayoutParams bannerParameters = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL); bannerParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); // Add the banner to the main layout mainLayout.addView(startAppBanner, bannerParameters); if (!LibsChecker.checkVitamioLibs(this)) return; if (isNetworkAvailable()) { new ServerHitLinks().execute("http://ahmadshahwaiz.com/LiveStreaming/getLinks.php"); } else { Toast.makeText(getApplicationContext(), "Please Connect With Internet", Toast.LENGTH_LONG).show(); finish(); finish(); } }