use of android.app.Activity in project facebook-api-android-maven by avianey.
the class ToolTipPopup method show.
/**
* Display this tool tip to the user
*/
public void show() {
if (mAnchorViewRef.get() != null) {
mPopupContent = new PopupContentView(mContext);
TextView body = (TextView) mPopupContent.findViewById(R.id.com_facebook_tooltip_bubble_view_text_body);
body.setText(mText);
if (mStyle == Style.BLUE) {
mPopupContent.bodyFrame.setBackgroundResource(R.drawable.com_facebook_tooltip_blue_background);
mPopupContent.bottomArrow.setImageResource(R.drawable.com_facebook_tooltip_blue_bottomnub);
mPopupContent.topArrow.setImageResource(R.drawable.com_facebook_tooltip_blue_topnub);
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_blue_xout);
} else {
mPopupContent.bodyFrame.setBackgroundResource(R.drawable.com_facebook_tooltip_black_background);
mPopupContent.bottomArrow.setImageResource(R.drawable.com_facebook_tooltip_black_bottomnub);
mPopupContent.topArrow.setImageResource(R.drawable.com_facebook_tooltip_black_topnub);
mPopupContent.xOut.setImageResource(R.drawable.com_facebook_tooltip_black_xout);
}
final Window window = ((Activity) mContext).getWindow();
final View decorView = window.getDecorView();
final int decorWidth = decorView.getWidth();
final int decorHeight = decorView.getHeight();
registerObserver();
mPopupContent.onMeasure(View.MeasureSpec.makeMeasureSpec(decorWidth, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(decorHeight, View.MeasureSpec.AT_MOST));
mPopupWindow = new PopupWindow(mPopupContent, mPopupContent.getMeasuredWidth(), mPopupContent.getMeasuredHeight());
mPopupWindow.showAsDropDown(mAnchorViewRef.get());
updateArrows();
if (mNuxDisplayTime > 0) {
mPopupContent.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, mNuxDisplayTime);
}
mPopupWindow.setTouchable(true);
mPopupContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
}
use of android.app.Activity in project enroscar by stanfy.
the class SharingHelper method createSharingData.
private SharingData createSharingData(final Intent sharingIntent) {
final SharingData data = TextUtils.isEmpty(sharingIntent.getAction()) ? new PickData() : new SharingData();
data.intent = sharingIntent;
final Context context = this.context.get();
if (context instanceof Activity) {
data.callerInfo = ((Activity) context).getCallingActivity();
} else {
final String pkg = sharingIntent.getStringExtra(ShareCompat.EXTRA_CALLING_PACKAGE);
final String act = sharingIntent.getStringExtra(ShareCompat.EXTRA_CALLING_ACTIVITY);
if (!TextUtils.isEmpty(pkg) && !TextUtils.isEmpty(act)) {
data.callerInfo = new ComponentName(pkg, act);
}
}
return data;
}
use of android.app.Activity in project platform_frameworks_base by android.
the class SearchManagerTest method setUp.
/**
* Setup any common data for the upcoming tests.
*/
@Override
public void setUp() throws Exception {
super.setUp();
Activity testActivity = getActivity();
mContext = testActivity;
}
use of android.app.Activity in project platform_frameworks_base by android.
the class BaselineButtonsTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final Activity activity = getActivity();
mCurrentTime = activity.findViewById(R.id.currenttime);
mTotalTime = activity.findViewById(R.id.totaltime);
mPrev = (ImageButton) activity.findViewById(R.id.prev);
mNext = (ImageButton) activity.findViewById(R.id.next);
mPause = (ImageButton) activity.findViewById(R.id.pause);
mLayout = activity.findViewById(R.id.layout);
}
use of android.app.Activity in project platform_frameworks_base by android.
the class LinearLayoutEditTextsTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final Activity activity = getActivity();
mChild = activity.findViewById(R.id.editText1);
mContainer = activity.findViewById(R.id.layout);
}
Aggregations