use of android.widget.FrameLayout.LayoutParams in project SystemBarTint by jgilfelt.
the class SystemBarTintManager method setupStatusBarView.
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
}
use of android.widget.FrameLayout.LayoutParams in project QLibrary by DragonsQC.
the class SystemBarTintManager method setupNavBarView.
private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
mNavBarTintView = new View(context);
LayoutParams params;
if (mConfig.isNavigationAtBottom()) {
params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());
params.gravity = Gravity.BOTTOM;
} else {
params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT);
params.gravity = Gravity.RIGHT;
}
mNavBarTintView.setLayoutParams(params);
mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mNavBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mNavBarTintView);
}
use of android.widget.FrameLayout.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class RecentsTvActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFinishedOnStartup = false;
// In the case that the activity starts up before the Recents component has initialized
// (usually when debugging/pushing the SysUI apk), just finish this activity.
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp == null) {
mFinishedOnStartup = true;
finish();
return;
}
mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
// Register this activity with the event bus
EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
mPackageMonitor = new RecentsPackageMonitor();
mPackageMonitor.register(this);
// Set the Recents layout
setContentView(R.layout.recents_on_tv);
mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mPipView = findViewById(R.id.pip);
mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
// Place mPipView at the PIP bounds for fine tuned focus handling.
Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
lp.width = pipBounds.width();
lp.height = pipBounds.height();
lp.leftMargin = pipBounds.left;
lp.topMargin = pipBounds.top;
mPipView.setLayoutParams(lp);
mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
// Create the home intent runnable
Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
mPipManager.addListener(mPipListener);
}
use of android.widget.FrameLayout.LayoutParams in project weex-example by KalicyZhou.
the class WXScroller method initComponentHostView.
@Override
protected ViewGroup initComponentHostView(@NonNull Context context) {
String scroll;
if (getDomObject() == null || getDomObject().getAttrs().isEmpty()) {
scroll = "vertical";
} else {
scroll = getDomObject().getAttrs().getScrollDirection();
}
ViewGroup host;
if (("horizontal").equals(scroll)) {
mOrientation = Constants.Orientation.HORIZONTAL;
WXHorizontalScrollView scrollView = new WXHorizontalScrollView(context);
mRealView = new FrameLayout(context);
scrollView.setScrollViewListener(new WXHorizontalScrollView.ScrollViewListener() {
@Override
public void onScrollChanged(WXHorizontalScrollView scrollView, int x, int y, int oldx, int oldy) {
procAppear(x, y, oldx, oldy);
}
});
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
scrollView.addView(mRealView, layoutParams);
scrollView.setHorizontalScrollBarEnabled(false);
host = scrollView;
} else {
mOrientation = Constants.Orientation.VERTICAL;
BounceScrollerView scrollerView = new BounceScrollerView(context, mOrientation, this);
mRealView = new FrameLayout(context);
WXScrollView innerView = scrollerView.getInnerView();
innerView.addScrollViewListener(this);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
innerView.addView(mRealView, layoutParams);
innerView.setVerticalScrollBarEnabled(true);
innerView.addScrollViewListener(new WXScrollViewListener() {
@Override
public void onScrollChanged(WXScrollView scrollView, int x, int y, int oldx, int oldy) {
}
@Override
public void onScrollToBottom(WXScrollView scrollView, int x, int y) {
}
@Override
public void onScrollStopped(WXScrollView scrollView, int x, int y) {
List<OnWXScrollListener> listeners = getInstance().getWXScrollListeners();
if (listeners != null && listeners.size() > 0) {
for (OnWXScrollListener listener : listeners) {
if (listener != null) {
listener.onScrollStateChanged(scrollView, x, y, OnWXScrollListener.IDLE);
}
}
}
}
@Override
public void onScroll(WXScrollView scrollView, int x, int y) {
List<OnWXScrollListener> listeners = getInstance().getWXScrollListeners();
if (listeners != null && listeners.size() > 0) {
for (OnWXScrollListener listener : listeners) {
if (listener != null) {
listener.onScrolled(scrollView, x, y);
}
}
}
}
});
host = scrollerView;
}
host.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onGlobalLayout() {
procAppear(0, 0, 0, 0);
View view;
if ((view = getHostView()) == null) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
});
return host;
}
use of android.widget.FrameLayout.LayoutParams in project android_frameworks_base by AOSPA.
the class RecentsTvActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFinishedOnStartup = false;
// In the case that the activity starts up before the Recents component has initialized
// (usually when debugging/pushing the SysUI apk), just finish this activity.
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp == null) {
mFinishedOnStartup = true;
finish();
return;
}
mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
// Register this activity with the event bus
EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
mPackageMonitor = new RecentsPackageMonitor();
mPackageMonitor.register(this);
// Set the Recents layout
setContentView(R.layout.recents_on_tv);
mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mPipView = findViewById(R.id.pip);
mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
// Place mPipView at the PIP bounds for fine tuned focus handling.
Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
lp.width = pipBounds.width();
lp.height = pipBounds.height();
lp.leftMargin = pipBounds.left;
lp.topMargin = pipBounds.top;
mPipView.setLayoutParams(lp);
mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
// Create the home intent runnable
Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
mPipManager.addListener(mPipListener);
}
Aggregations