List of usage examples for android.widget RelativeLayout ABOVE
int ABOVE
To view the source code for android.widget RelativeLayout ABOVE.
Click Source Link
From source file:com.spoiledmilk.ibikecph.navigation.SMRouteNavigationActivity.java
public void setInstructionViewState(InstrcutionViewState newState) { // if (mapFragment != null && !mapFragment.currentlyRouting // && instructionsViewState == // SMRouteNavigationActivity.InstrcutionViewState.Invisible // && newState == SMRouteNavigationActivity.InstrcutionViewState.Normal) // return;// w w w . j a va 2 s . co m // if (instructionsViewState == newState) { // return; // } instructionList.smoothScrollToPosition(0); if (newState == InstrcutionViewState.Maximized) { pullTouchMax.setVisibility(View.VISIBLE); pullTouchNormal.setVisibility(View.GONE); mapTopDisabledView.setVisibility(View.VISIBLE); instructionsViewMax.setLayoutParams(paramsInstructionsMaxMaximized); instructionsView.setVisibility(View.VISIBLE); instructionsViewMax.setVisibility(View.VISIBLE); if (hasDarkImage()) { btnClose.setImageResource(R.drawable.btn_close_dark_selector); viewDistance.setBackgroundResource(R.drawable.distance_black); textTime.setTextColor(Color.WHITE); } darkenedView.getBackground().setAlpha(200); } else if (newState == InstrcutionViewState.Normal) { pullTouchMax.setVisibility(View.GONE); pullTouchNormal.setVisibility(View.VISIBLE); mapTopDisabledView.setVisibility(View.GONE); instructionsViewMax.setLayoutParams(paramsInstructionsMaxNormal); instructionsView.setVisibility(View.VISIBLE); instructionsViewMax.setVisibility(View.GONE); darkenedView.setVisibility(View.GONE); if (hasDarkImage()) { btnClose.setImageResource(R.drawable.btn_close_selector); viewDistance.setBackgroundResource(R.drawable.distance_white); textTime.setTextColor(Color.BLACK); } 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); } else if (newState == InstrcutionViewState.Minimized) { pullTouchMax.setVisibility(View.GONE); pullTouchNormal.setVisibility(View.GONE); mapTopDisabledView.setVisibility(View.GONE); instructionsViewMax.setLayoutParams(paramsInstructionsMaxMinimized); darkenedView.setVisibility(View.GONE); if (hasDarkImage()) { btnClose.setImageResource(R.drawable.btn_close_selector); viewDistance.setBackgroundResource(R.drawable.distance_white); textTime.setTextColor(Color.BLACK); } instructionsView.setVisibility(View.GONE); instructionsViewMax.setVisibility(View.GONE); instructionsViewMin.setVisibility(View.VISIBLE); 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.ALIGN_PARENT_BOTTOM); btnTrack.setLayoutParams(paramsBtnTrack); } else if (newState == InstrcutionViewState.Invisible) { pullTouchMax.setVisibility(View.GONE); pullTouchNormal.setVisibility(View.GONE); mapTopDisabledView.setVisibility(View.GONE); instructionsViewMax.setLayoutParams(paramsInstructionsMaxNormal); darkenedView.setVisibility(View.GONE); if (hasDarkImage()) { btnClose.setImageResource(R.drawable.btn_close_selector); viewDistance.setBackgroundResource(R.drawable.distance_white); textTime.setTextColor(Color.BLACK); } instructionsView.setVisibility(View.GONE); instructionsViewMax.setVisibility(View.GONE); instructionsViewMin.setVisibility(View.GONE); } if (newState != InstrcutionViewState.Maximized && mapFragment != null && mapFragment.locationOverlay != null) { mapFragment.locationOverlay.enableMyLocation(mapFragment.locationProvider == null ? mapFragment.locationProvider = new GpsMyLocationProvider(this) : mapFragment.locationProvider); } // enter state actions // switch (newState) { // case Invisible: // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE); // break; // case Normal: // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE); // findViewById(R.id.pullTouchNormal).setVisibility(View.VISIBLE); // findViewById(R.id.pullTouchMax).setVisibility(View.GONE); // instructionsView.setVisibility(View.VISIBLE); // View mapContainer = findViewById(R.id.map_container); // RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) // mapContainer.getLayoutParams(); // lParams.addRule(RelativeLayout.ABOVE, R.id.instructionsView); // lParams.alignWithParent = true; // mapContainer.setLayoutParams(lParams); // isMaximized = false; // break; // case Maximized: // findViewById(R.id.mapTopDisabledView).setVisibility(View.VISIBLE); // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE); // findViewById(R.id.pullTouchMax).setVisibility(View.VISIBLE); // isMaximized = false; // instructionsViewMax.setClickable(true); // instructionsViewMax.setVisibility(View.VISIBLE); // break; // case Minimized: // findViewById(R.id.mapTopDisabledView).setVisibility(View.GONE); // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE); // findViewById(R.id.pullTouchMax).setVisibility(View.GONE); // isMaximized = false; // instructionsViewMin.setVisibility(View.VISIBLE); // break; // } // // if (newState != InstrcutionViewState.Maximized) { // if (hasDarkImage()) { // btnClose.setImageResource(R.drawable.btn_close); // viewDistance.setBackgroundResource(R.drawable.distance_white); // textTime.setTextColor(Color.BLACK); // } // darkenedView.setVisibility(View.GONE); // instructionsViewMax.clearAnimation(); // // // paramsInstructionsMax.bottomMargin = -(int) // (Util.getScreenHeight()); // // paramsInstructionsMax.topMargin = (int) (Util.getScreenHeight() - // instructionsView.getHeight() - // // Util.dp2px(10)); // // instructionsViewMax.setLayoutParams(paramsInstructionsMax); // mapFragment.locationOverlay.enableMyLocation(new // GpsMyLocationProvider(this)); // } // if (newState == InstrcutionViewState.Normal) { // findViewById(R.id.pullTouchNormal).setVisibility(View.VISIBLE); // } else { // findViewById(R.id.pullTouchNormal).setVisibility(View.GONE); // } instructionsViewState = newState; }
From source file:com.haibison.android.anhuu.FragmentFiles.java
/** * Shows footer view./*from w ww. j a v a 2 s . co m*/ * * @param show * {@code true} or {@code false}. * @param text * the message you want to set. * @param center * {@code true} or {@code false}. */ @SuppressLint("InlinedApi") private void showFooterView(boolean show, String text, boolean center) { if (show) { mFooterView.setText(text); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); if (!center) lp.addRule(RelativeLayout.ABOVE, R.id.anhuu_f5be488d_view_files_footer_view); mViewFilesContainer.setLayoutParams(lp); lp = (RelativeLayout.LayoutParams) mFooterView.getLayoutParams(); lp.addRule(RelativeLayout.CENTER_IN_PARENT, center ? 1 : 0); lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, center ? 0 : 1); mFooterView.setLayoutParams(lp); mFooterView.setVisibility(View.VISIBLE); } else mFooterView.setVisibility(View.GONE); }
From source file:com.hotstar.player.adplayer.player.PlayerFragment.java
/** * Set the player view size with givent width and height * /*w w w. j av a 2s.co m*/ * @param movieWidth * the width of the player view to be set to * @param movieHeight * the height of the player view to be set to */ private void setPlayerViewSize(long movieWidth, long movieHeight) { if (mediaPlayer == null || mediaPlayer.getView() == null) { AdVideoApplication.logger.w(LOG_TAG + "#setPlayerViewSize", "Unable to find player view."); return; } AdVideoApplication.logger.i(LOG_TAG + "#setPlayerViewSize", "Original movie size: " + movieWidth + "x" + movieHeight); FrameLayout layout = (FrameLayout) playerFragmentView.findViewById(R.id.playerFrame); int layoutWidth = layout.getWidth(); int layoutHeight = layout.getHeight(); float screenAspectRatio = (float) layoutWidth / layoutHeight; if (movieWidth == 0 || movieHeight == 0) { // If movie size is not available, fill the screen. movieWidth = layoutWidth; movieHeight = layoutHeight; } float movieAspectRatio = (float) movieWidth / movieHeight; int width, height; if (movieAspectRatio <= screenAspectRatio) { // Resize to fill height. width = (int) (layoutHeight * movieAspectRatio); height = layoutHeight; } else { // Resize to fill width. width = layoutWidth; height = (int) (layoutWidth * (1 / movieAspectRatio)); } AdVideoApplication.logger.i(LOG_TAG + "#setPlayerViewSize", "Movie width x height: " + movieWidth + "x" + movieHeight); AdVideoApplication.logger.i(LOG_TAG + "#setPlayerViewSize", "Setting player view size to: " + width + "x" + height); mediaPlayer.getView().setLayoutParams( new FrameLayout.LayoutParams(width, height, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL)); RelativeLayout overlayAdLayout = (RelativeLayout) playerFragmentView.findViewById(R.id.OverlayAdLayout); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(width, height); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); layoutParams.addRule(RelativeLayout.ABOVE, controlBar.getView().getId()); overlayAdLayout.setLayoutParams(layoutParams); }
From source file:com.aimfire.demo.CameraActivity.java
private void adjustUIControls(int rotation) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mCaptureButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mCaptureButton.setLayoutParams(layoutParams); mCaptureButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mPvButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, 0); layoutParams.addRule(RelativeLayout.BELOW, R.id.capture_button); mPvButton.setLayoutParams(layoutParams); mPvButton.setRotation(rotation);/* w w w. j a va2s .c o m*/ /* layoutParams = (RelativeLayout.LayoutParams)mFbButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, R.id.capture_button); layoutParams.addRule(RelativeLayout.BELOW, 0); mFbButton.setLayoutParams(layoutParams); mFbButton.setRotation(rotation); */ layoutParams = (RelativeLayout.LayoutParams) mExitButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); mExitButton.setLayoutParams(layoutParams); mExitButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mView3DButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mView3DButton.setLayoutParams(layoutParams); mView3DButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mModeButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, 0); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); mModeButton.setLayoutParams(layoutParams); mModeButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mLevelButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); mLevelButton.setLayoutParams(layoutParams); mLevelButton.setRotation(rotation); CustomToast.setRotation(rotation); }
From source file:de.sourcestream.movieDB.controller.CastDetails.java
/** * Updates the icons position in the movie info tap when called. *//*w w w. j a v a2 s.co m*/ public void updateIconDownPosInInfoTab() { RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) castDetailsInfo.getGalleryIcon() .getLayoutParams(); p.removeRule(RelativeLayout.ABOVE); p.removeRule(RelativeLayout.BELOW); p.addRule(RelativeLayout.ABOVE, R.id.moreIcon); p.setMargins(0, 0, (int) (23 * scale), (int) (-20 * scale)); castDetailsInfo.getGalleryIcon().setLayoutParams(p); castDetailsInfo.getHomeIcon().setLayoutParams(p); }
From source file:de.sourcestream.movieDB.controller.CastDetails.java
/** * Updates the icons position in the movie info tap when called. *///w w w .ja v a 2 s. c om public void updateIconUpPosInInfoTab() { RelativeLayout.LayoutParams p3 = new RelativeLayout.LayoutParams(homeIcon.getWidth(), homeIcon.getHeight()); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(galleryIcon.getWidth(), galleryIcon.getHeight()); p3.addRule(RelativeLayout.ALIGN_PARENT_END); p.addRule(RelativeLayout.ALIGN_PARENT_END); if (iconDirection == 1) { p3.addRule(RelativeLayout.ABOVE, R.id.moreIcon); p3.setMargins(0, 0, (int) (23 * scale), (int) (44 * scale)); p.addRule(RelativeLayout.ABOVE, R.id.homeIcon); p.setMargins(0, 0, (int) (23 * scale), (int) (15.5f * scale)); } else { p3.addRule(RelativeLayout.BELOW, R.id.moreIcon); p3.setMargins(0, (int) (16 * scale), (int) (23 * scale), 0); p.addRule(RelativeLayout.BELOW, R.id.homeIcon); p.setMargins(0, (int) (15.5f * scale), (int) (23 * scale), 0); } castDetailsInfo.getHomeIcon().setLayoutParams(p3); castDetailsInfo.getGalleryIcon().setLayoutParams(p); }
From source file:com.xmobileapp.rockplayer.RockPlayer.java
/******************************************* * /* w w w .ja va 2s . c om*/ * initializeUiVariables * *******************************************/ private void initializeUiVariables() { /* * Retrieve components from layout */ this.currentAlbumPlayingImageView = (ImageView) findViewById(R.id.current_album_image); this.currentAlbumPlayingOverlayImageView = (ImageView) findViewById(R.id.current_album_image_overlay); this.mainUIContainer = (ViewGroup) findViewById(R.id.songfest_main_ui_container); this.containerLayout = (ViewGroup) findViewById(R.id.songfest_container); this.currentPlayingLayout = (ViewGroup) findViewById(R.id.songfest_current_playing_container); this.currentAlbumPlayingLayout = (ViewGroup) findViewById(R.id.songfest_current_album_playing_container); this.currentAlbumPlayingLayoutOuter = (ViewGroup) findViewById( R.id.songfest_current_album_playing_container_global); this.albumNavigatorLayout = (ViewGroup) findViewById(R.id.songfest_navigator_container); this.albumNavigatorLayoutOuter = (ViewGroup) findViewById(R.id.songfest_navigator_container_outer); this.albumNavigatorList = (ListView) findViewById(R.id.navigator_listview); // this.albumNavigatorTextContainer = (ViewGroup) // findViewById(R.id.navigator_album_text_container); // this.navigatorInitialTextView = (TextView) // findViewById(R.id.navigator_initial); this.currentPlayingSongContainer = (ViewGroup) findViewById(R.id.current_playing_song_container); this.artistNameText = (TextView) findViewById(R.id.songfest_current_playing_artist); this.albumNameText = (TextView) findViewById(R.id.songfest_current_playing_album_name); this.songNameText = (TextView) findViewById(R.id.songfest_current_playing_song_name); this.songDurationText = (TextView) findViewById(R.id.songfest_current_playing_song_progress); this.songDurationOngoingText = (TextView) findViewById(R.id.songfest_current_playing_song_progress_ongoing); // this.songListContainer = (ViewGroup) // findViewById(R.id.song_listview_container); // this.songListHint = (TextView) // findViewById(R.id.song_listhint); // this.songListView = (ListView) // findViewById(R.id.song_listview); this.eventListViewContainer = (ViewGroup) findViewById(R.id.event_listview_container); this.eventListDecreaseRadius = (ImageButton) findViewById(R.id.event_decrease_radius); this.eventListIncreaseRadius = (ImageButton) findViewById(R.id.event_increase_radius); this.eventListRadius = (EditText) findViewById(R.id.event_radius); this.eventListRadiusMetric = (TextView) findViewById(R.id.event_radius_metric); this.eventListView = (ListView) findViewById(R.id.event_listview); this.songProgressBar = (ProgressBar) findViewById(R.id.songfest_current_playing_song_progressbar); // this.webView = (WebView) // findViewById(R.id.web_view); this.songSearchContainer = (ViewGroup) findViewById(R.id.songsearch_container); this.songSearchTextView = (AutoCompleteTextView) findViewById(R.id.songsearch_textview); this.helpImageView = (ImageView) findViewById(R.id.help_image); this.helpView = (ViewGroup) findViewById(R.id.help_view); /* * Control buttons and button overlays */ this.playPauseImage = (ImageView) findViewById(R.id.current_album_image_play_pause); //playPauseImage.setImageResource(android.R.drawable.ic_media_play); // this.playPauseImageOverlay = (ImageView) // findViewById(R.id.current_album_image_play_pause_overlay); // playPauseImageOverlay.setVisibility(View.GONE); // playPauseImageOverlay.setImageResource(R.drawable.button_big_highlight_gradient); // // this.rewindImage = (ImageView) // findViewById(R.id.rewind_image); // rewindImage.setImageResource(android.R.drawable.ic_media_rew); // this.rewindImageOverlay = (ImageView) // findViewById(R.id.rewind_image_overlay); // rewindImageOverlay.setVisibility(View.GONE); // rewindImageOverlay.setImageResource(R.drawable.button_small_highlight_gradient); // // this.forwardImage = (ImageView) // findViewById(R.id.forward_image); // forwardImage.setImageResource(android.R.drawable.ic_media_ff); // this.forwardImageOverlay = (ImageView) // findViewById(R.id.forward_image_overlay); // forwardImageOverlay.setVisibility(View.GONE); // forwardImageOverlay.setImageResource(R.drawable.button_small_highlight_gradient); // // this.nextImage = (ImageView) // findViewById(R.id.next_image); // nextImage.setImageResource(android.R.drawable.ic_media_next); //this.nextImageOverlay = (ImageView) // findViewById(R.id.skipsong_image_overlay); //nextImageOverlay.setImageResource(android.R.drawable.ic_media_next); // this.songSearchButton = (Button) // findViewById(R.id.songsearch_button); // this.songProgressTotalView = (ImageView) // findViewById(R.id.songfest_current_playing_song_progress_total); // this.songProgressView = (ImageView) // findViewById(R.id.songfest_current_playing_song_progress_current); // this.preferenceScreen = (PreferenceScreen) // findViewById(R.id.preference_screen); /* * Put views in perspective */ //this.currentAlbumPlayingLayout.startAnimation(perspectiveLeft); this.currentPlayingLayout.startAnimation(perspectiveLeft); this.albumNavigatorList.startAnimation(perspectiveRight); /* * Setup interaction listeners */ this.albumNavigatorList.setOnItemClickListener(this.albumNavigatorListItemClickListener); this.albumNavigatorList.setOnItemLongClickListener(this.albumNavigatorListItemLongClickListener); this.albumNavigatorList.setOnScrollListener(this.albumNavigatorScrollListener); this.albumNavigatorList.setOnTouchListener(this.mainUIContainerTouchListener); this.currentAlbumPlayingImageView.setOnTouchListener(this.mainUIContainerTouchListener); this.currentAlbumPlayingImageView.setOnClickListener(currentAlbumClickListener); this.currentPlayingSongContainer.setOnClickListener(this.songNameClickListener); this.currentPlayingSongContainer.setOnTouchListener(this.songTouchListener); // this.songNameText.setOnClickListener(this.songNameClickListener); // this.songNameText.setOnTouchListener(this.songTouchListener); // this.songDurationText.setOnClickListener(this.songNameClickListener); // this.songDurationText.setOnTouchL istener(this.songTouchListener); // this.songProgressBar.setOnClickListener(this.songNameClickListener); // this.songProgressBar.setOnTouchListener(this.songTouchListener); //this.songListView.setOnKeyListener(this.songListKeyListener); //this.songListContainer.setOnKeyListener(this.songListKeyListener); //this.containerLayout.setOnKeyListener(this.songListKeyListener); // this.songListView.setOnItemClickListener(this.songListItemClickListener); // this.songListView.setOnItemLongClickListener(this.songListItemLongClickListener); // Temporary change - for now //this.currentAlbumPlayingImageView.setOnLongClickListener(this.songNameLongClickListener); //this.songNameText.setOnLongClickListener(this.songNameLongClickListener); //this.songDurationText.setOnLongClickListener(this.songNameLongClickListener); this.artistNameText.setOnClickListener(this.artistNameClickListener); this.albumNameText.setOnClickListener(this.artistNameClickListener); //this.webView.setOnKeyListener(this.webViewKeyListener); this.songSearchTextView.setOnItemClickListener(this.songSearchTextItemClickListener); this.eventListIncreaseRadius.setOnClickListener(this.eventListIncreaseRadiusClickListener); this.eventListDecreaseRadius.setOnClickListener(this.eventListDecreaseRadiusClickListener); this.helpImageView.setOnClickListener(this.helpImageClickListener); /* * Fix layout stuff */ // TODO: // set the height of the top panel to be ~66% of the screen height (LANDSCAPE) // set the width of the left panel to be ~66% of the screen width (PORTRAIT) RelativeLayout.LayoutParams params = null; /* Don't know the code of Portrait */ if (this.display.getOrientation() == 0) { params = new RelativeLayout.LayoutParams( (int) Math.round(this.display.getWidth() * CURRENT_PLAY_SCREEN_FRACTION), LayoutParams.FILL_PARENT); this.currentPlayingLayout.setLayoutParams(params); } else { params = new RelativeLayout.LayoutParams( (int) Math.round(this.display.getWidth() * CURRENT_PLAY_SCREEN_FRACTION_LANDSCAPE), LayoutParams.FILL_PARENT); this.currentPlayingLayout.setLayoutParams(params); /* * Special Positioning in Landscape Mode * ------- can go into a different function * ------- or maybe into the XML... */ //getWindow().setBackgroundDrawableResource(R.drawable.bg_landscape); RelativeLayout.LayoutParams p = null; /* album image */ p = new RelativeLayout.LayoutParams( (int) Math.round(this.display.getWidth() * CURRENT_PLAY_SCREEN_FRACTION_LANDSCAPE / 2), (int) Math.round(this.display.getWidth() * CURRENT_PLAY_SCREEN_FRACTION_LANDSCAPE / 2)); p.topMargin = 12; p.leftMargin = 12; this.currentAlbumPlayingLayoutOuter.setLayoutParams(p); /* * Current Artist&Album container to the right of the album */ p = (LayoutParams) findViewById(R.id.current_playing_artist_album_container).getLayoutParams(); p.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_album_playing_container_global); p.addRule(RelativeLayout.ABOVE, R.id.current_playing_song_container); findViewById(R.id.current_playing_artist_album_container).setLayoutParams(p); /* artist name */ // p = (LayoutParams) this.artistNameText.getLayoutParams(); // p.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_album_playing_container_global); // this.artistNameText.setLayoutParams(p); /* album name */ // p = (LayoutParams) this.albumNameText.getLayoutParams(); // p.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_album_playing_container_global); // this.albumNameText.setLayoutParams(p); /* song name */ // p = (LayoutParams) this.songNameText.getLayoutParams(); // p.addRule(RelativeLayout.BELOW, R.id.songfest_current_album_playing_container_global); // this.songNameText.setLayoutParams(p); this.songNameText.setSingleLine(); /* song progress */ //p = (LayoutParams) this.songProgressBar.getLayoutParams(); //p.addRule(RelativeLayout.RIGHT_OF, R.id.songfest_current_album_playing_container_global); //this.songProgressBar.setLayoutParams(p); } /* RelativeLayout.LayoutParams rParams = new RelativeLayout.LayoutParams( (int) Math.round( this.display.getWidth()*CURRENT_PLAY_SCREEN_FRACTION), LayoutParams.FILL_PARENT); this.currentAlbumPlayingLayout.setLayoutParams(rParams);*/ /* * Create Album Labels (TextViews) */ /* int listHeight = this.display.getHeight()-20; int numberOfVisibleAlbums = (int) Math.floor(listHeight/(this.display.getWidth()*NAVIGATOR_SCREEN_FRACTION))+1; for(int i = 0; i < numberOfVisibleAlbums; i++){ TextView albumLabel = new TextView(this); LinearLayout.LayoutParams tParams = new LinearLayout.LayoutParams( (int) (this.display.getWidth()*NAVIGATOR_SCREEN_FRACTION*1.75), (int) (this.display.getWidth()*NAVIGATOR_SCREEN_FRACTION*0.5)); tParams.bottomMargin = (int) (this.display.getWidth()*NAVIGATOR_SCREEN_FRACTION*0.25); tParams.topMargin = (int) (this.display.getWidth()*NAVIGATOR_SCREEN_FRACTION*0.25); albumLabel.setLayoutParams(tParams); albumLabel.setTextColor(Color.argb(200, 255, 255, 255)); albumLabel.setTextSize(20); albumLabel.setMaxLines(4); albumLabel.setBackgroundResource(R.drawable.album_text_bg); this.albumNavigatorTextContainer.addView(albumLabel); } this.albumNavigatorTextContainer.setVisibility(View.GONE); */ }
From source file:de.sourcestream.movieDB.controller.TVDetails.java
/** * Updates the icons position in the movie info tap when called. *///w w w . j a v a 2 s .c om public void updateIconDownPosInInfoTab() { RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) tvDetailsInfo.getGalleryIcon() .getLayoutParams(); p.removeRule(RelativeLayout.ABOVE); p.removeRule(RelativeLayout.BELOW); p.addRule(RelativeLayout.ABOVE, R.id.moreIcon); p.setMargins(0, 0, (int) (23 * scale), (int) (-20 * scale)); tvDetailsInfo.getGalleryIcon().setLayoutParams(p); tvDetailsInfo.getHomeIcon().setLayoutParams(p); }
From source file:de.sourcestream.movieDB.controller.TVDetails.java
/** * Updates the icons position in the movie info tap when called. */// ww w. j a v a 2s .co m public void updateIconUpPosInInfoTab() { RelativeLayout.LayoutParams p3 = new RelativeLayout.LayoutParams(homeIcon.getWidth(), homeIcon.getHeight()); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(galleryIcon.getWidth(), galleryIcon.getHeight()); p3.addRule(RelativeLayout.ALIGN_PARENT_END); p.addRule(RelativeLayout.ALIGN_PARENT_END); if (iconDirection == 1) { p3.addRule(RelativeLayout.ABOVE, R.id.moreIcon); p3.setMargins(0, 0, (int) (23 * scale), (int) (44 * scale)); p.addRule(RelativeLayout.ABOVE, R.id.homeIcon); p.setMargins(0, 0, (int) (23 * scale), (int) (15.5f * scale)); } else { p3.addRule(RelativeLayout.BELOW, R.id.moreIcon); p3.setMargins(0, (int) (16 * scale), (int) (23 * scale), 0); p.addRule(RelativeLayout.BELOW, R.id.homeIcon); p.setMargins(0, (int) (15.5f * scale), (int) (23 * scale), 0); } tvDetailsInfo.getHomeIcon().setLayoutParams(p3); tvDetailsInfo.getGalleryIcon().setLayoutParams(p); }
From source file:de.sourcestream.movieDB.controller.MovieDetails.java
/** * Updates the icons position in the movie info tap when called. *///from w w w.java 2s . co m public void updateIconDownPosInInfoTab() { RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) movieDetailsInfo.getGalleryIcon() .getLayoutParams(); p.removeRule(RelativeLayout.ABOVE); p.removeRule(RelativeLayout.BELOW); p.addRule(RelativeLayout.ABOVE, R.id.moreIcon); p.setMargins(0, 0, (int) (23 * scale), (int) (-20 * scale)); movieDetailsInfo.getGalleryIcon().setLayoutParams(p); movieDetailsInfo.getTrailerIcon().setLayoutParams(p); movieDetailsInfo.getHomeIcon().setLayoutParams(p); }