Search in sources :

Example 41 with Activity

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();
            }
        });
    }
}
Also used : PopupWindow(android.widget.PopupWindow) Window(android.view.Window) PopupWindow(android.widget.PopupWindow) Activity(android.app.Activity) TextView(android.widget.TextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View)

Example 42 with Activity

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;
}
Also used : Context(android.content.Context) Activity(android.app.Activity) ComponentName(android.content.ComponentName)

Example 43 with Activity

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;
}
Also used : LocalActivity(android.app.activity.LocalActivity) Activity(android.app.Activity)

Example 44 with Activity

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);
}
Also used : Activity(android.app.Activity)

Example 45 with Activity

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);
}
Also used : Activity(android.app.Activity)

Aggregations

Activity (android.app.Activity)1215 View (android.view.View)206 Test (org.junit.Test)187 Intent (android.content.Intent)184 TextView (android.widget.TextView)88 ArrayList (java.util.ArrayList)62 Bundle (android.os.Bundle)58 Context (android.content.Context)57 ViewGroup (android.view.ViewGroup)50 DialogInterface (android.content.DialogInterface)47 AlertDialog (android.app.AlertDialog)45 Robolectric.buildActivity (org.robolectric.Robolectric.buildActivity)40 LayoutInflater (android.view.LayoutInflater)38 ImageView (android.widget.ImageView)38 Twitter (twitter4j.Twitter)35 AppCompatActivity (android.support.v7.app.AppCompatActivity)34 DisplayMetrics (android.util.DisplayMetrics)32 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)29 Robolectric.setupActivity (org.robolectric.Robolectric.setupActivity)28 Uri (android.net.Uri)27