Search in sources :

Example 71 with Activity

use of android.app.Activity in project android_frameworks_base by ResurrectionRemix.

the class MffContext method createDummySurfaceView.

@SuppressWarnings("deprecation")
private SurfaceView createDummySurfaceView(Context context) {
    // This is only called on Gingerbread devices, so deprecation warning is unnecessary.
    SurfaceView dummySurfaceView = new SurfaceView(context);
    dummySurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    // If we have an activity for this context we'll add the SurfaceView to it (as a 1x1 view
    // in the top-left corner). If not, we warn the user that they may need to add one manually.
    Activity activity = findActivityForContext(context);
    if (activity != null) {
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(1, 1);
        activity.addContentView(dummySurfaceView, params);
    } else {
        Log.w("MffContext", "Could not find activity for dummy surface! Consider specifying " + "your own SurfaceView!");
    }
    return dummySurfaceView;
}
Also used : ViewGroup(android.view.ViewGroup) Activity(android.app.Activity) SurfaceView(android.view.SurfaceView)

Example 72 with Activity

use of android.app.Activity in project android_frameworks_base by ResurrectionRemix.

the class EffectsVideoCapture method testBackEffectsVideoCapture.

@LargeTest
public void testBackEffectsVideoCapture() throws Exception {
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent();
    intent.setClass(getInstrumentation().getTargetContext(), CameraEffectsRecordingSample.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra("OUTPUT_FILENAME", Environment.getExternalStorageDirectory().toString() + "/CameraEffectsRecordingTest.mp4");
    Activity act = inst.startActivitySync(intent);
    captureVideos("Back Camera Video Capture\n", inst);
    act.finish();
    // Verification
    File file = new File(Environment.getExternalStorageDirectory(), "CameraEffectsRecordingTest.mp4");
    Uri uri = Uri.fromFile(file);
    verify(getActivity(), uri);
}
Also used : Instrumentation(android.app.Instrumentation) Activity(android.app.Activity) Intent(android.content.Intent) File(java.io.File) Uri(android.net.Uri) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 73 with Activity

use of android.app.Activity in project android_frameworks_base by ResurrectionRemix.

the class PrintErrorFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    CharSequence message = getArguments().getCharSequence(EXTRA_MESSAGE);
    if (!TextUtils.isEmpty(message)) {
        TextView messageView = (TextView) view.findViewById(R.id.message);
        messageView.setText(message);
    }
    Button actionButton = (Button) view.findViewById(R.id.action_button);
    final int action = getArguments().getInt(EXTRA_ACTION);
    switch(action) {
        case ACTION_RETRY:
            {
                actionButton.setVisibility(View.VISIBLE);
                actionButton.setText(R.string.print_error_retry);
            }
            break;
        case ACTION_NONE:
            {
                actionButton.setVisibility(View.GONE);
            }
            break;
    }
    actionButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            Activity activity = getActivity();
            if (activity instanceof OnActionListener) {
                ((OnActionListener) getActivity()).onActionPerformed();
            }
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Activity(android.app.Activity) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 74 with Activity

use of android.app.Activity in project android_frameworks_base by ResurrectionRemix.

the class KeyguardSimPukView method getSimUnlockProgressDialog.

private Dialog getSimUnlockProgressDialog() {
    if (mSimUnlockProgressDialog == null) {
        mSimUnlockProgressDialog = new ProgressDialog(mContext);
        mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.kg_sim_unlock_progress_dialog_message));
        mSimUnlockProgressDialog.setIndeterminate(true);
        mSimUnlockProgressDialog.setCancelable(false);
        if (!(mContext instanceof Activity)) {
            mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
        }
    }
    return mSimUnlockProgressDialog;
}
Also used : Activity(android.app.Activity) ProgressDialog(android.app.ProgressDialog)

Example 75 with Activity

use of android.app.Activity in project android_frameworks_base by ResurrectionRemix.

the class KeyguardSecurityContainer method showDialog.

private void showDialog(String title, String message) {
    final AlertDialog dialog = new AlertDialog.Builder(mContext).setTitle(title).setMessage(message).setCancelable(false).setNeutralButton(R.string.ok, null).create();
    if (!(mContext instanceof Activity)) {
        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    }
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) Activity(android.app.Activity)

Aggregations

Activity (android.app.Activity)3220 Intent (android.content.Intent)612 View (android.view.View)535 Test (org.junit.Test)456 TextView (android.widget.TextView)263 Context (android.content.Context)220 ArrayList (java.util.ArrayList)201 Bundle (android.os.Bundle)197 DialogInterface (android.content.DialogInterface)167 SettingsActivity (com.android.settings.SettingsActivity)167 ViewGroup (android.view.ViewGroup)133 ImageView (android.widget.ImageView)116 AlertDialog (android.app.AlertDialog)109 LayoutInflater (android.view.LayoutInflater)109 Preference (android.support.v7.preference.Preference)83 PackageManager (android.content.pm.PackageManager)76 Uri (android.net.Uri)76 EditText (android.widget.EditText)72 ComponentName (android.content.ComponentName)71 Handler (android.os.Handler)71