use of android.widget.FrameLayout in project TourGuide by worker8.
the class FrameLayoutWithHole method performOverlayExitAnimation.
private void performOverlayExitAnimation() {
if (!mCleanUpLock) {
final FrameLayout _pointerToFrameLayout = this;
mCleanUpLock = true;
Log.d("tourguide", "Overlay exit animation listener is overwritten...");
mOverlay.mExitAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
((ViewGroup) _pointerToFrameLayout.getParent()).removeView(_pointerToFrameLayout);
}
});
this.startAnimation(mOverlay.mExitAnimation);
}
}
use of android.widget.FrameLayout in project XobotOS by xamarin.
the class AlertController method setupView.
private void setupView() {
LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel);
setupContent(contentPanel);
boolean hasButtons = setupButtons();
LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel);
TypedArray a = mContext.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0);
boolean hasTitle = setupTitle(topPanel);
View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
if (!hasButtons) {
buttonPanel.setVisibility(View.GONE);
mWindow.setCloseOnTouchOutsideIfNotSet(true);
}
FrameLayout customPanel = null;
if (mView != null) {
customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel);
FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
custom.addView(mView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
if (mViewSpacingSpecified) {
custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
}
if (mListView != null) {
((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
}
} else {
mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);
}
/* Only display the divider if we have a title and a
* custom view or a message.
*/
if (hasTitle) {
View divider = null;
if (mMessage != null || mView != null || mListView != null) {
divider = mWindow.findViewById(R.id.titleDivider);
} else {
divider = mWindow.findViewById(R.id.titleDividerTop);
}
if (divider != null) {
divider.setVisibility(View.VISIBLE);
}
}
setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel);
a.recycle();
}
use of android.widget.FrameLayout in project ZI by yixia.
the class Crouton method initializeCroutonViewGroup.
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private FrameLayout initializeCroutonViewGroup(Resources resources) {
FrameLayout croutonView = new FrameLayout(this.activity);
if (null != onClickListener)
croutonView.setOnClickListener(onClickListener);
final int height;
if (this.style.heightDimensionResId > 0) {
height = resources.getDimensionPixelSize(this.style.heightDimensionResId);
} else {
height = this.style.heightInPixels;
}
final int width;
if (this.style.widthDimensionResId > 0) {
width = resources.getDimensionPixelSize(this.style.widthDimensionResId);
} else {
width = this.style.widthInPixels;
}
croutonView.setLayoutParams(new FrameLayout.LayoutParams(width != 0 ? width : FrameLayout.LayoutParams.MATCH_PARENT, height));
// set background
if (this.style.backgroundColorValue != -1) {
croutonView.setBackgroundColor(this.style.backgroundColorValue);
} else {
croutonView.setBackgroundColor(resources.getColor(this.style.backgroundColorResourceId));
}
// color.
if (this.style.backgroundDrawableResourceId != 0) {
Bitmap background = BitmapFactory.decodeResource(resources, this.style.backgroundDrawableResourceId);
BitmapDrawable drawable = new BitmapDrawable(resources, background);
if (this.style.isTileEnabled) {
drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
}
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
croutonView.setBackgroundDrawable(drawable);
} else {
croutonView.setBackground(drawable);
}
}
return croutonView;
}
use of android.widget.FrameLayout in project WordPress-Android by wordpress-mobile.
the class HeaderGridView method addHeaderView.
/**
* Add a fixed view to appear at the top of the grid. If addHeaderView is
* called more than once, the views will appear in the order they were
* added. Views added using this call can take focus if they want.
* <p>
* NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap
* the supplied cursor with one that will also account for header views.
*
* @param v The view to add.
* @param data Data to associate with this view
* @param isSelectable whether the item is selectable
*/
public void addHeaderView(View v, Object data, boolean isSelectable) {
ListAdapter adapter = getAdapter();
if (adapter != null && !(adapter instanceof HeaderViewGridAdapter)) {
throw new IllegalStateException("Cannot add header view to grid -- setAdapter has already been called.");
}
FixedViewInfo info = new FixedViewInfo();
FrameLayout fl = new FullWidthFixedViewLayout(getContext());
fl.addView(v);
info.view = v;
info.viewContainer = fl;
info.data = data;
info.isSelectable = isSelectable;
mHeaderViewInfos.add(info);
// we need to notify the observer
if (adapter != null) {
((HeaderViewGridAdapter) adapter).notifyDataSetChanged();
}
}
use of android.widget.FrameLayout in project platform_frameworks_base by android.
the class MediaRouteControllerDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.media_route_controller_dialog);
mVolumeLayout = (LinearLayout) findViewById(R.id.media_route_volume_layout);
mVolumeSlider = (SeekBar) findViewById(R.id.media_route_volume_slider);
mVolumeSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
private final Runnable mStopTrackingTouch = new Runnable() {
@Override
public void run() {
if (mVolumeSliderTouched) {
mVolumeSliderTouched = false;
updateVolume();
}
}
};
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
if (mVolumeSliderTouched) {
mVolumeSlider.removeCallbacks(mStopTrackingTouch);
} else {
mVolumeSliderTouched = true;
}
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Defer resetting mVolumeSliderTouched to allow the media route provider
// a little time to settle into its new state and publish the final
// volume update.
mVolumeSlider.postDelayed(mStopTrackingTouch, VOLUME_UPDATE_DELAY_MILLIS);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
mRoute.requestSetVolume(progress);
}
}
});
mDisconnectButton = (Button) findViewById(R.id.media_route_disconnect_button);
mDisconnectButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mRoute.isSelected()) {
mRouter.getDefaultRoute().select();
}
dismiss();
}
});
mCreated = true;
if (update()) {
mControlView = onCreateMediaControlView(savedInstanceState);
FrameLayout controlFrame = (FrameLayout) findViewById(R.id.media_route_control_frame);
if (mControlView != null) {
controlFrame.addView(mControlView);
controlFrame.setVisibility(View.VISIBLE);
} else {
controlFrame.setVisibility(View.GONE);
}
}
}
Aggregations