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;
}
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);
}
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();
}
}
});
}
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;
}
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();
}
Aggregations