List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:com.ayuget.redface.ui.activity.ReplyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutResource()); Intent intent = getIntent(); if (intent != null) { currentTopic = intent.getParcelableExtra(ARG_TOPIC); initialReplyContent = intent.getStringExtra(UIConstants.ARG_REPLY_CONTENT); if (initialReplyContent != null) { replyEditText.setText(initialReplyContent); replyEditText.setSelection(replyEditText.getText().length()); }// w ww .ja va 2 s . c o m } DisplayMetrics metrics = getResources().getDisplayMetrics(); screenHeight = metrics.heightPixels; smileySelectorTopOffset = (int) (metrics.heightPixels * 0.75); replyWindowMaxHeight = (int) (metrics.heightPixels * 0.70); toolbarHeight = getToolbarHeight(); setupSmileySelector(); actionsToolbar.inflateMenu(R.menu.menu_reply); actionsToolbar.setOnMenuItemClickListener(this); setupUserSwitcher(getLayoutInflater(), userManager.getRealUsers()); // Dirty hack to set a maximum height on the reply window frame. Should leave enough room for the smiley // picker when the soft keyboard is hidden, and hide the smiley picker otherwise. Activity is resized thanks // to the adjustResize windowSoftInputMode set in the manifest, and the extra bottom toolbar stays visible // and usable. // // As any hack, this method is probably very buggy... replyWindowRoot.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { Rect r = new Rect(); replyWindowRoot.getWindowVisibleDisplayFrame(r); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mainReplyFrame.getLayoutParams(); boolean keyboardIsOpen = r.height() < replyWindowMaxHeight; if (keyboardIsOpen) { if (lp.height != ViewGroup.LayoutParams.MATCH_PARENT) { lp.height = ViewGroup.LayoutParams.MATCH_PARENT; mainReplyFrame.setLayoutParams(lp); } } else { if (lp.height != replyWindowMaxHeight) { lp.height = replyWindowMaxHeight; mainReplyFrame.setLayoutParams(lp); } } } }); styleToolbarButtons(extrasToolbar); styleToolbarMenu(actionsToolbar); smileysSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { if (s.trim().length() > 0) { smileyList.reset(); smileysLoadingIndicator.setVisibility(View.VISIBLE); subscribe(dataService.searchForSmileys(s.trim(), new EndlessObserver<List<Smiley>>() { @Override public void onNext(List<Smiley> smileys) { smileysLoadingIndicator.setVisibility(View.GONE); smileyList.setSmileys(smileys); } })); } return false; } @Override public boolean onQueryTextChange(String s) { return false; } }); // Load default smileys loadDefaultSmileys(); }
From source file:com.androidquery.simplefeed.activity.PostActivity.java
private void handleCheckin(Intent data) { Location loc = (Location) data.getParcelableExtra("location"); Place place = (Place) data.getSerializableExtra("place"); AQUtility.debug(loc, item);/* w ww. j a v a 2s. c om*/ if (loc != null && place != null) { clear(); this.location = loc; this.place = place; attachPlace(place); refreshButtons(); } }
From source file:com.nikhilnayak.games.octoshootar.HomeActivity.java
@Override protected void onActivityResult(int request, int response, Intent data) { super.onActivityResult(request, response, data); if (REQUEST_GAME_ACTIVITY_REPLAY == request) { getSupportFragmentManager().popBackStackImmediate(); }/*from w w w . ja v a 2s . c o m*/ if (RESULT_OK == response) { if (REQUEST_GAME_ACTIVITY_REPLAY == request || REQUEST_GAME_ACTIVITY_FRESH_START == request) { getSupportFragmentManager().beginTransaction() .replace(R.id.game_home_fragment_container, GameScoreFragment.newInstance((GameInformation) data .getParcelableExtra(GameScoreFragment.EXTRA_GAME_INFORMATION)), GameScoreFragment.FRAGMENT_TAG) .addToBackStack(null).commitAllowingStateLoss(); } } if (ARActivity.RESULT_SENSOR_NOT_SUPPORTED == response) { makeToast(getString(R.string.home_device_not_compatible) + " (rotation sensor)"); } }
From source file:com.facebook.login.LoginManager.java
boolean onActivityResult(int resultCode, Intent data, FacebookCallback<LoginResult> callback) { FacebookException exception = null;/*from w ww.j a va 2 s .co m*/ AccessToken newToken = null; LoginClient.Result.Code code = LoginClient.Result.Code.ERROR; Map<String, String> loggingExtras = null; LoginClient.Request originalRequest = null; boolean isCanceled = false; if (data != null) { LoginClient.Result result = (LoginClient.Result) data.getParcelableExtra(LoginFragment.RESULT_KEY); if (result != null) { originalRequest = result.request; code = result.code; if (resultCode == Activity.RESULT_OK) { if (result.code == LoginClient.Result.Code.SUCCESS) { newToken = result.token; } else { exception = new FacebookAuthorizationException(result.errorMessage); } } else if (resultCode == Activity.RESULT_CANCELED) { isCanceled = true; } loggingExtras = result.loggingExtras; } } else if (resultCode == Activity.RESULT_CANCELED) { isCanceled = true; code = LoginClient.Result.Code.CANCEL; } if (exception == null && newToken == null && !isCanceled) { exception = new FacebookException("Unexpected call to LoginManager.onActivityResult"); } boolean wasLoginActivityTried = true; Context context = null; //Sadly, there is no way to get activity context at this point.S logCompleteLogin(context, code, loggingExtras, exception, wasLoginActivityTried, originalRequest); finishLogin(newToken, originalRequest, exception, isCanceled, callback); return true; }
From source file:com.gmail.taneza.ronald.carbs.main.MainActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { FoodItem foodItem;/*from ww w. j a v a 2 s. c om*/ switch (requestCode) { case REQUEST_CODE_ADD_FOOD_TO_MEAL: switch (resultCode) { case FoodDetailsActivity.FOOD_DETAILS_RESULT_OK: foodItem = data.getParcelableExtra(FoodDetailsActivity.FOOD_ITEM_RESULT); addFoodItemToMeal(foodItem); clearSearchText(); break; case FoodDetailsActivity.FOOD_DETAILS_RESULT_DELETE: foodItem = data.getParcelableExtra(FoodDetailsActivity.FOOD_ITEM_RESULT); deleteFoodItemFromRecentFoods(foodItem); break; } break; case REQUEST_CODE_EDIT_FOOD_IN_MEAL: // The food item list in the meal is not filterable, and can contain duplicate foodItems, // so we need the index to delete the correct foodItem. switch (resultCode) { case FoodDetailsActivity.FOOD_DETAILS_RESULT_OK: foodItem = data.getParcelableExtra(FoodDetailsActivity.FOOD_ITEM_RESULT); replaceFoodItemInMeal(mEditFoodItemIndex, foodItem); clearSearchText(); break; case FoodDetailsActivity.FOOD_DETAILS_RESULT_DELETE: foodItem = data.getParcelableExtra(FoodDetailsActivity.FOOD_ITEM_RESULT); deleteFoodItemFromMeal(mEditFoodItemIndex); break; } mEditFoodItemIndex = -1; break; case REQUEST_CODE_SHOW_MY_FOODS: switch (resultCode) { case MyFoodsActivity.MY_FOODS_RESULT_ITEM_CHANGED: refreshAllTabsAndMealTotal(); break; case MyFoodsActivity.MY_FOODS_RESULT_ITEM_DELETED: pruneRecentAndFoodLists(); refreshAllTabsAndMealTotal(); break; } break; } }
From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); acquireCpuWakeLock();//from w w w .ja v a 2 s .c om KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); km.inKeyguardRestrictedInputMode(); if (km.inKeyguardRestrictedInputMode()) { Log.i(TAG, " ??"); isKeyguardRestrictedInputMode = true; } else { Log.i(TAG, " ??"); } mLastNetworkStatus = NetworkUtils.isConnected(this); Intent intent = getIntent(); if (intent == null || !PushConstants.ACTION_PUSH_MESSAGE_RECEIVED.equals(intent.getAction())) { Log.d(TAG, "empty or none broadcast intent value ..."); finishActivity(); return; } mBroadcastData = intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA); if (mBroadcastData == null) { Log.d(TAG, ">> payload data is null"); finishActivity(); return; } mBroadcastPayloadIdx = intent.getLongExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, -1); Log.d(TAG, ">> onCreate() mBroadcastPayloadIdx= " + mBroadcastPayloadIdx); // ? ms ? ?? ? ? ? ???? // broadcast ? . // ?? ?? ??. Intent i = new Intent(this, RealtimeBroadcastActivity.class); i.setAction(intent.getAction()); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA, mBroadcastData); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, mBroadcastPayloadIdx); LocalBroadcastManager.getInstance(this).sendBroadcast(i); IntentFilter filter = new IntentFilter(); filter.addAction(PushConstants.ACTION_PUSH_MESSAGE_RECEIVED); filter.addAction(Constants.ACTION_BROWSER_ACTIVITY_CLOSE); LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(mBroadcastReceiver, intentFilter); hideSystemUI(); /* final Window win = getWindow(); win.setFlags( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON); */ if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) { setContentView(R.layout.fragment_text_broadcast); } else { setContentView(R.layout.fragment_audio_broadcast); } getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) { mcheckText2SpeechLister = this; // ? mTextView = (TextView) findViewById(R.id.broadcast_text); mTextView.setText(mBroadcastData.getMessage()); mTextView.setVerticalScrollBarEnabled(true); mTextView.setHorizontalScrollBarEnabled(false); mTextView.setMovementMethod(new ScrollingMovementMethod()); mHandler.sendEmptyMessageDelayed(HANDLER_MESSAGE_SETUP_CURRENT_PLAYING, 800); Log.d(TAG, "text broadcast = " + mBroadcastData.getMessage()); mText2SpeechHandler = new TextToSpeechHandler(this, this); checkText2SpeechAvailable(); mIsTTS = true; } else { // , ?? mWebView = (WebView) findViewById(R.id.webview); mWebViewClient = new RealtimeBroadcastWebViewClient(this, mWebView, this); mWebViewClient.setBackgroundTransparent(); String url = mBroadcastData.getMessage(); if (url.indexOf("?") > 0) { if (!url.contains("UUID=")) { url += ("&UUID=" + LauncherSettings.getInstance(this).getDeviceID()); } if (!url.contains("APPID=")) { url += ("&APPID=" + getApplicationContext().getPackageName()); } } else { if (!url.contains("UUID=")) { url += ("?UUID=" + LauncherSettings.getInstance(this).getDeviceID()); } if (!url.contains("APPID=")) { if (!url.contains("UUID=")) { url += ("?APPID=" + getApplicationContext().getPackageName()); } else { url += ("&APPID=" + getApplicationContext().getPackageName()); } } } mWebViewClient.loadUrl(url); mIsTTS = false; } AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mStreamMusicVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC); audio.setStreamVolume(AudioManager.STREAM_MUSIC, audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC), AudioManager.FLAG_PLAY_SOUND); if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) { StateListener phoneStateListener = new StateListener(); TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); } }
From source file:com.raspi.chatapp.ui.chatting.ChatActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The namespace I am using in the UploadService is the app id UploadService.NAMESPACE = BuildConfig.APPLICATION_ID; // the layout contains just the toolbar and the FrameLayout which // contains every fragment setContentView(R.layout.activity_chat); // manage the backstack, therefore, I got a function that checks whether I // can go back and sets the back button in the actionbar accordingly getSupportFragmentManager().addOnBackStackChangedListener(this); shouldDisplayHomeUp();// w w w . j av a 2s .c o m // in case this is the first time the app launches or in case the user // deleted all application data set my buddyId and pwd I use to log into // the XMPP server setUserPwd(); // if there is a calling intent and this contains a buddyId and chatName // do not open the chatFragmet instantly but only set the current // variables in order to be able to ask for a password if necessary, see // onResume. Intent callingIntent = getIntent(); Bundle extras = callingIntent.getExtras(); String type = callingIntent.getType(); if (Intent.ACTION_SEND.equals(callingIntent.getAction()) && type != null) { if (type.startsWith("image/")) { imageUri = callingIntent.getParcelableExtra(Intent.EXTRA_STREAM); } } if (extras != null && extras.containsKey(Constants.BUDDY_ID) && extras.containsKey(Constants.CHAT_NAME)) { currentBuddyId = extras.getString(Constants.BUDDY_ID); currentChatName = extras.getString(Constants.CHAT_NAME); } }
From source file:com.odoo.base.ir.Attachment.java
public ODataRow handleResult(int requestCode, Intent data) { Uri uri = null;/* w w w .j a v a 2s . c o m*/ Bitmap bitmap = null; switch (requestCode) { case REQUEST_AUDIO: uri = data.getData(); break; case REQUEST_CAMERA: bitmap = (Bitmap) data.getExtras().get("data"); uri = data.getData(); break; case REQUEST_IMAGE: uri = data.getData(); break; case REQUEST_FILE: uri = data.getData(); break; default: // Single Attachment (share) uri = data.getParcelableExtra(Intent.EXTRA_STREAM); break; } return uriToDataRow(uri, bitmap); }
From source file:org.quantumbadger.redreader.activities.ImageViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences); if (solidblack) getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK)); final Intent intent = getIntent(); mUrl = General.uriFromString(intent.getDataString()); final RedditPost src_post = intent.getParcelableExtra("post"); if (mUrl == null) { General.quickToast(this, "Invalid URL. Trying web browser."); revertToWeb();//from w w w. j av a2 s .co m return; } Log.i("ImageViewActivity", "Loading URL " + mUrl.toString()); final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal); final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(progressBar); CacheManager.getInstance(this) .makeRequest(mRequest = new CacheRequest(mUrl, RedditAccountManager.getAnon(), null, Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY, Constants.FileType.IMAGE, false, false, false, this) { private void setContentView(View v) { layout.removeAllViews(); layout.addView(v); v.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; v.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; } @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(context.getApplicationContext(), new RRError(null, null, t)); } @Override protected void onDownloadNecessary() { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(true); } }); } @Override protected void onDownloadStarted() { } @Override protected void onFailure(final RequestFailureType type, Throwable t, StatusLine status, final String readableMessage) { final RRError error = General.getGeneralErrorForFailure(context, type, t, status, url.toString()); AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { // TODO handle properly mRequest = null; progressBar.setVisibility(View.GONE); layout.addView(new ErrorView(ImageViewActivity.this, error)); } }); } @Override protected void onProgress(final boolean authorizationInProgress, final long bytesRead, final long totalBytes) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(authorizationInProgress); progressBar.setProgress((int) ((100 * bytesRead) / totalBytes)); } }); } @Override protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp, UUID session, boolean fromCache, final String mimetype) { if (mimetype == null || (!Constants.Mime.isImage(mimetype) && !Constants.Mime.isVideo(mimetype))) { revertToWeb(); return; } final InputStream cacheFileInputStream; try { cacheFileInputStream = cacheFile.getInputStream(); } catch (IOException e) { notifyFailure(RequestFailureType.PARSE, e, null, "Could not read existing cached image."); return; } if (cacheFileInputStream == null) { notifyFailure(RequestFailureType.CACHE_MISS, null, null, "Could not find cached image"); return; } if (Constants.Mime.isVideo(mimetype)) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; try { final RelativeLayout layout = new RelativeLayout(context); layout.setGravity(Gravity.CENTER); final VideoView videoView = new VideoView(ImageViewActivity.this); videoView.setVideoURI(cacheFile.getUri()); layout.addView(videoView); setContentView(layout); layout.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; layout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; videoView.setLayoutParams( new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setLooping(true); videoView.start(); } }); videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(final MediaPlayer mediaPlayer, final int i, final int i1) { revertToWeb(); return true; } }); videoView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(final View view, final MotionEvent motionEvent) { finish(); return true; } }); } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } catch (Throwable e) { General.quickToast(context, R.string.imageview_invalid_video); revertToWeb(); } } }); } else if (Constants.Mime.isImageGif(mimetype)) { final PrefsUtility.GifViewMode gifViewMode = PrefsUtility .pref_behaviour_gifview_mode(context, sharedPreferences); if (gifViewMode == PrefsUtility.GifViewMode.INTERNAL_BROWSER) { revertToWeb(); return; } else if (gifViewMode == PrefsUtility.GifViewMode.EXTERNAL_BROWSER) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { LinkHandler.openWebBrowser(ImageViewActivity.this, Uri.parse(mUrl.toString())); finish(); } }); return; } if (AndroidApi.isIceCreamSandwichOrLater() && gifViewMode == PrefsUtility.GifViewMode.INTERNAL_MOVIE) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; try { final GIFView gifView = new GIFView(ImageViewActivity.this, cacheFileInputStream); setContentView(gifView); gifView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } catch (Throwable e) { General.quickToast(context, R.string.imageview_invalid_gif); revertToWeb(); } } }); } else { gifThread = new GifDecoderThread(cacheFileInputStream, new GifDecoderThread.OnGifLoadedListener() { public void onGifLoaded() { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); setContentView(imageView); gifThread.setView(imageView); imageView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); } }); } public void onOutOfMemory() { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } public void onGifInvalid() { General.quickToast(context, R.string.imageview_invalid_gif); revertToWeb(); } }); gifThread.start(); } } else { final ImageTileSource imageTileSource; try { final long bytes = cacheFile.getSize(); final byte[] buf = new byte[(int) bytes]; try { new DataInputStream(cacheFileInputStream).readFully(buf); } catch (IOException e) { throw new RuntimeException(e); } try { imageTileSource = new ImageTileSourceWholeBitmap(buf); } catch (Throwable t) { Log.e("ImageViewActivity", "Exception when creating ImageTileSource", t); General.quickToast(context, R.string.imageview_decode_failed); revertToWeb(); return; } } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); return; } AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; mImageViewDisplayerManager = new ImageViewDisplayListManager(imageTileSource, ImageViewActivity.this); surfaceView = new RRGLSurfaceView(ImageViewActivity.this, mImageViewDisplayerManager); setContentView(surfaceView); surfaceView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); if (mIsPaused) { surfaceView.onPause(); } else { surfaceView.onResume(); } } }); } } }); final RedditPreparedPost post = src_post == null ? null : new RedditPreparedPost(this, CacheManager.getInstance(this), 0, src_post, -1, false, false, false, false, RedditAccountManager.getInstance(this).getDefaultAccount(), false); final FrameLayout outerFrame = new FrameLayout(this); outerFrame.addView(layout); if (post != null) { final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(this); final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(this, new BezelSwipeOverlay.BezelSwipeListener() { public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) { toolbarOverlay.setContents( post.generateToolbar(ImageViewActivity.this, false, toolbarOverlay)); toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT); return true; } public boolean onTap() { if (toolbarOverlay.isShown()) { toolbarOverlay.hide(); return true; } return false; } }); outerFrame.addView(bezelOverlay); outerFrame.addView(toolbarOverlay); bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; } setContentView(outerFrame); }
From source file:com.psiphon3.psiphonlibrary.TunnelManager.java
private void getTunnelConfig(Intent intent) { m_tunnelConfig.handshakePendingIntent = intent .getParcelableExtra(TunnelManager.DATA_TUNNEL_CONFIG_HANDSHAKE_PENDING_INTENT); m_tunnelConfig.notificationPendingIntent = intent .getParcelableExtra(TunnelManager.DATA_TUNNEL_CONFIG_NOTIFICATION_PENDING_INTENT); m_tunnelConfig.wholeDevice = intent.getBooleanExtra(TunnelManager.DATA_TUNNEL_CONFIG_WHOLE_DEVICE, false); m_tunnelConfig.egressRegion = intent.getStringExtra(TunnelManager.DATA_TUNNEL_CONFIG_EGRESS_REGION); m_tunnelConfig.disableTimeouts = intent.getBooleanExtra(TunnelManager.DATA_TUNNEL_CONFIG_DISABLE_TIMEOUTS, false);/*from ww w. j a v a 2 s.com*/ }