use of android.widget.RelativeLayout in project android_packages_apps_Gallery2 by LineageOS.
the class AlbumSetPage method showEmptyAlbumToast.
private void showEmptyAlbumToast(int toastLength) {
// CRs-Fixed:951767 java.lang.NullPointerException: Attempt to invoke virtual method
// 'void android.widget.RelativeLayout.addView(android.view.View
RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity).findViewById(R.id.gallery_root);
if (galleryRoot == null)
return;
if (tvEmptyAlbum == null) {
tvEmptyAlbum = new TextView(mActivity);
tvEmptyAlbum.setText(R.string.tvEmptyAlbum);
tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000"));
tvEmptyAlbum.setGravity(Gravity.CENTER);
tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
tvEmptyAlbum.setId(R.id.empty_album);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
galleryRoot.addView(tvEmptyAlbum, lp);
}
tvEmptyAlbum.setVisibility(View.VISIBLE);
}
use of android.widget.RelativeLayout in project Collar by CodeZsx.
the class BaseFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_base, null);
mBinding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), setContent(), null, false);
mBinding.getRoot().setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
((RelativeLayout) root.findViewById(R.id.container)).addView(mBinding.getRoot());
initView(root);
return root;
}
use of android.widget.RelativeLayout in project Precisely by Pankaj-Baranwal.
the class SavedActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Constants.toolbar_title = "Saved Opportunities";
setContentView(R.layout.activity_profile);
RecyclerView recyclerView = findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
DBHandler db = new DBHandler(this);
mItems = db.getAllSavedEvents();
if (mItems.size() == 0) {
RelativeLayout empty_layout = findViewById(R.id.empty_layout);
empty_layout.setVisibility(View.VISIBLE);
recyclerView.setVisibility(View.GONE);
} else {
adapter = new SavedEventsAdapter(mItems, this);
recyclerView.setAdapter(adapter);
SwipeableRecyclerViewTouchListener swipeTouchListener = new SwipeableRecyclerViewTouchListener(recyclerView, new SwipeableRecyclerViewTouchListener.SwipeListener() {
@Override
public boolean canSwipeLeft(int position) {
return true;
}
@Override
public boolean canSwipeRight(int position) {
return true;
}
@Override
public void onDismissedBySwipeLeft(RecyclerView recyclerView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
deleteData(position);
adapter.notifyItemRemoved(position);
}
adapter.notifyDataSetChanged();
Toast.makeText(SavedActivity.this, "Deleted!", Toast.LENGTH_SHORT).show();
}
@Override
public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
deleteData(position);
adapter.notifyItemRemoved(position);
}
adapter.notifyDataSetChanged();
Toast.makeText(SavedActivity.this, "Deleted!", Toast.LENGTH_SHORT).show();
}
});
recyclerView.addOnItemTouchListener(swipeTouchListener);
}
}
use of android.widget.RelativeLayout in project vlc-android by GeoffreyMetais.
the class VideoPlayerActivity method onCreate.
@Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!VLCInstance.testCompatibleCPU(this)) {
exit(RESULT_CANCELED);
return;
}
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
if (!VLCApplication.showTvUi()) {
mTouchControls = (mSettings.getBoolean("enable_volume_gesture", true) ? TOUCH_FLAG_AUDIO_VOLUME : 0) + (mSettings.getBoolean("enable_brightness_gesture", true) ? TOUCH_FLAG_BRIGHTNESS : 0) + (mSettings.getBoolean("enable_double_tap_seek", true) ? TOUCH_FLAG_SEEK : 0);
}
/* Services and miscellaneous */
mAudioManager = (AudioManager) getApplicationContext().getSystemService(AUDIO_SERVICE);
mAudioMax = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
audioBoostEnabled = mSettings.getBoolean("audio_boost", false);
mEnableCloneMode = mSettings.getBoolean("enable_clone_mode", false);
mDisplayManager = new DisplayManager(this, mEnableCloneMode);
setContentView(mDisplayManager.isPrimary() ? R.layout.player : R.layout.player_remote_control);
/**
* initialize Views an their Events
*/
mActionBar = getSupportActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.setBackgroundDrawable(null);
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setCustomView(R.layout.player_action_bar);
mRootView = findViewById(R.id.player_root);
mActionBarView = (ViewGroup) mActionBar.getCustomView();
mTitle = mActionBarView.findViewById(R.id.player_overlay_title);
if (!AndroidUtil.isJellyBeanOrLater) {
View v = findViewById(R.id.player_overlay_systime);
if (v instanceof TextView)
mSysTime = (TextView) v;
v = findViewById(R.id.player_overlay_battery);
if (v instanceof TextView)
mBattery = (TextView) v;
}
mPlaylistToggle = (ImageView) findViewById(R.id.playlist_toggle);
mPlaylist = (RecyclerView) findViewById(R.id.video_playlist);
mScreenOrientation = Integer.valueOf(mSettings.getString("screen_orientation", "99"));
mSurfaceView = (SurfaceView) findViewById(R.id.player_surface);
mSubtitlesSurfaceView = (SurfaceView) findViewById(R.id.subtitles_surface);
mSubtitlesSurfaceView.setZOrderMediaOverlay(true);
mSubtitlesSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mSurfaceFrame = (FrameLayout) findViewById(R.id.player_surface_frame);
/* Loading view */
mLoading = (ImageView) findViewById(R.id.player_overlay_loading);
dimStatusBar(true);
mHandler.sendEmptyMessageDelayed(LOADING_ANIMATION, LOADING_ANIMATION_DELAY);
mSwitchingView = false;
mAskResume = mSettings.getBoolean("dialog_confirm_resume", false);
sDisplayRemainingTime = mSettings.getBoolean(KEY_REMAINING_TIME_DISPLAY, false);
// Clear the resume time, since it is only used for resumes in external
// videos.
final SharedPreferences.Editor editor = mSettings.edit();
editor.putLong(PreferencesActivity.VIDEO_RESUME_TIME, -1);
// Also clear the subs list, because it is supposed to be per session
// only (like desktop VLC). We don't want the custom subtitle files
// to persist forever with this video.
editor.putString(PreferencesActivity.VIDEO_SUBTITLE_FILES, null);
// Paused flag - per session too, like the subs list.
editor.remove(PreferencesActivity.VIDEO_PAUSED);
editor.apply();
final IntentFilter filter = new IntentFilter();
if (mBattery != null)
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.addAction(VLCApplication.SLEEP_INTENT);
registerReceiver(mReceiver, filter);
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
// 100 is the value for screen_orientation_start_lock
setRequestedOrientation(getScreenOrientation(mScreenOrientation));
// Extra initialization when no secondary display is detected
if (mDisplayManager.isPrimary()) {
// Tips
if (!BuildConfig.DEBUG && !VLCApplication.showTvUi() && !mSettings.getBoolean(PREF_TIPS_SHOWN, false)) {
((ViewStubCompat) findViewById(R.id.player_overlay_tips)).inflate();
mOverlayTips = findViewById(R.id.overlay_tips_layout);
}
// Set margins for TV overscan
if (VLCApplication.showTvUi()) {
int hm = getResources().getDimensionPixelSize(R.dimen.tv_overscan_horizontal);
int vm = getResources().getDimensionPixelSize(R.dimen.tv_overscan_vertical);
final RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.player_ui_container);
final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) uiContainer.getLayoutParams();
lp.setMargins(hm, 0, hm, vm);
uiContainer.setLayoutParams(lp);
final LinearLayout.LayoutParams titleParams = (LinearLayout.LayoutParams) mTitle.getLayoutParams();
titleParams.setMargins(0, vm, 0, 0);
mTitle.setLayoutParams(titleParams);
}
}
getWindowManager().getDefaultDisplay().getMetrics(mScreen);
mSurfaceYDisplayRange = Math.min(mScreen.widthPixels, mScreen.heightPixels);
mSurfaceXDisplayRange = Math.max(mScreen.widthPixels, mScreen.heightPixels);
mCurrentScreenOrientation = getResources().getConfiguration().orientation;
if (mIsBenchmark) {
mCurrentSize = SURFACE_FIT_SCREEN;
} else {
mCurrentSize = mSettings.getInt(PreferencesActivity.VIDEO_RATIO, SURFACE_BEST_FIT);
}
mMedialibrary = VLCApplication.getMLInstance();
mIsRtl = AndroidUtil.isJellyBeanMR1OrLater && TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
}
use of android.widget.RelativeLayout in project remusic by aa112901.
the class SplashActivity method setupSplashAd.
/**
* 设置开屏广告
*/
private void setupSplashAd() {
// 创建开屏容器
final RelativeLayout splashLayout = (RelativeLayout) findViewById(R.id.rl_splash);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ABOVE, R.id.view_divider);
// 对开屏进行设置
SplashViewSettings splashViewSettings = new SplashViewSettings();
// // 设置是否展示失败自动跳转,默认自动跳转
// splashViewSettings.setAutoJumpToTargetWhenShowFailed(false);
// 设置跳转的窗口类
splashViewSettings.setTargetClass(MainActivity.class);
// 设置开屏的容器
splashViewSettings.setSplashViewContainer(splashLayout);
// 展示开屏广告
SpotManager.getInstance(mContext).showSplash(mContext, splashViewSettings, mStopListener);
}
Aggregations