List of usage examples for android.widget FrameLayout getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:org.dronix.android.unisannio.activity.GBNewsActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int tabnumber = -1; if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras == null) { tabnumber = -1;//from w ww . ja v a 2 s.c o m } else { tabnumber = extras.getInt("TABNUMBER"); } } Fragment myFragment = null; switch (tabnumber) { case 0: myFragment = new TabOne(); break; case 1: myFragment = new AvvisiIngFragment(); break; case 2: myFragment = new TabThree(); break; } if (tabnumber != -1) { // Create a frame layout, so we can add fragments to it. FrameLayout layout = new FrameLayout(this); layout.setId(0x1234); // Set the frame layout as the view container for this activity. setContentView(layout); // Create and add a fragment to frame layout created above. FragmentTransaction t = getSupportFragmentManager().beginTransaction(); t.add(layout.getId(), myFragment, "myFirstFragment"); t.commit(); } }
From source file:com.xamoom.android.xamoomcontentblocks.ViewHolders.ContentBlock2ViewHolder.java
private void setupYoutube(final ContentBlock contentBlock) { final String youtubeVideoId = getYoutubeVideoId(contentBlock.getVideoUrl()); Bitmap savedBitmap = mBitmapCache.get(youtubeVideoId); if (savedBitmap != null) { mProgressBar.setVisibility(View.GONE); mYouTubeThumbnailView.setImageBitmap(savedBitmap); } else {/* w ww . jav a 2 s . co m*/ mYouTubeThumbnailView.initialize(mYoutubeApiKey, new YouTubeThumbnailView.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubeThumbnailView youTubeThumbnailView, final YouTubeThumbnailLoader youTubeThumbnailLoader) { youTubeThumbnailLoader.setVideo(youtubeVideoId); youTubeThumbnailLoader .setOnThumbnailLoadedListener(new YouTubeThumbnailLoader.OnThumbnailLoadedListener() { @Override public void onThumbnailLoaded(YouTubeThumbnailView youTubeThumbnailView, String s) { mProgressBar.setVisibility(View.GONE); Drawable drawable = mYouTubeThumbnailView.getDrawable(); if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; mBitmapCache.put(youtubeVideoId, bitmapDrawable.getBitmap()); } youTubeThumbnailLoader.release(); } @Override public void onThumbnailError(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader.ErrorReason errorReason) { youTubeThumbnailView.setBackgroundColor(Color.BLACK); mProgressBar.setVisibility(View.GONE); youtubeFallback(contentBlock.getVideoUrl()); youTubeThumbnailLoader.release(); } }); } @Override public void onInitializationFailure(YouTubeThumbnailView youTubeThumbnailView, YouTubeInitializationResult youTubeInitializationResult) { mProgressBar.setVisibility(View.GONE); mVideoPlayImageView.setVisibility(View.GONE); youtubeFallback(contentBlock.getVideoUrl()); } }); } mYouTubeThumbnailView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendResetYoutubeBroadcast(); LocalBroadcastManager.getInstance(mContext).registerReceiver(mResetYoutubeBroadCastReciever, new IntentFilter(RESET_YOUTUBE)); mVideoPlayImageView.setVisibility(View.GONE); final FrameLayout frame = new FrameLayout(mContext); frame.setId(R.id.youtube_fragment_id); FrameLayout.LayoutParams layoutParams = layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); frame.setLayoutParams(layoutParams); mFramelayout.addView(frame); final YouTubePlayerSupportFragment youTubePlayerSupportFragment = YouTubePlayerSupportFragment .newInstance(); mFragment.getChildFragmentManager().beginTransaction() .add(frame.getId(), youTubePlayerSupportFragment).commit(); youTubePlayerSupportFragment.initialize(mYoutubeApiKey, new YouTubePlayer.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer youTubePlayer, boolean b) { youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT); youTubePlayer.loadVideo(youtubeVideoId); mProgressBar.setVisibility(View.GONE); youTubePlayer.setOnFullscreenListener(new YouTubePlayer.OnFullscreenListener() { @Override public void onFullscreen(boolean enterFullscreen) { if (enterFullscreen) { Intent intent = YouTubeStandalonePlayer.createVideoIntent( mFragment.getActivity(), mYoutubeApiKey, youtubeVideoId, youTubePlayer.getCurrentTimeMillis(), true, false); mFragment.getActivity().startActivity(intent); } } }); } @Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { mProgressBar.setVisibility(View.GONE); youtubeFallback(contentBlock.getVideoUrl()); Log.e("tag", youTubeInitializationResult.toString()); } }); } }); }
From source file:org.protocoderrunner.apprunner.api.PUI.java
@ProtocoderScript @APIMethod(description = "Adds a processing view", example = "") @APIParam(params = { "x", "y", "w", "h", "mode={'p2d', 'p3d'" }) public PApplet addProcessing(int x, int y, int w, int h, String mode) { initializeLayout();/*from w w w . j ava2 s . co m*/ // Create the main layout. This is where all the items actually go FrameLayout fl = new FrameLayout(a.get()); fl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); fl.setId(200 + (int) (200 * Math.random())); fl.setBackgroundResource(R.color.transparent); // Add the view addViewAbsolute(fl, x, y, w, h); PProcessing p = new PProcessing(); Bundle bundle = new Bundle(); bundle.putString("mode", mode); p.setArguments(bundle); FragmentTransaction ft = appRunnerActivity.get().getSupportFragmentManager().beginTransaction(); ft.add(fl.getId(), p, String.valueOf(fl.getId())); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); // ft.setCustomAnimations(android.R.anim.fade_in, // android.R.anim.fade_out); ft.addToBackStack(null); ft.commit(); return p; }
From source file:org.protocoderrunner.apprunner.AppRunnerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_apprunner_host); if (!AndroidUtils.isWear(this)) { mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar);/*from w ww. java 2 s . com*/ mActionbar = getSupportActionBar(); mActionbar.setTitle("hola"); } FrameLayout fl = (FrameLayout) findViewById(R.id.apprunner_fragment); // Read in the script given in the intent. Intent intent = getIntent(); if (null != intent) { boolean isService = intent.getBooleanExtra("isService", false); if (isService) { Intent i = new Intent(this, AppRunnerService.class); i.putExtras(intent); // potentially add data to the intent // i.putExtra("KEY1", "Value to be used by the service"); this.startService(i); finish(); } // NOTE: // if mProject == null , Protocoder is running in "standard" mode // if mProject != null , Protocoder is running in "standalone" mode boolean settingScreenAlwaysOn = false; boolean settingWakeUpScreen = false; if (mProject == null) { mProject = new Project(); // get projects intent //settings settingScreenAlwaysOn = intent.getBooleanExtra(Project.SETTINGS_SCREEN_ALWAYS_ON, false); settingWakeUpScreen = intent.getBooleanExtra(Project.SETTINGS_SCREEN_WAKEUP, false); //project info mProject.name = intent.getStringExtra(Project.NAME); mProject.folder = intent.getStringExtra(Project.FOLDER); mProject.prefix = intent.getStringExtra(Project.PREFIX); mProject.code = intent.getStringExtra(Project.CODE); mProject.postfix = intent.getStringExtra(Project.POSTFIX); } Bundle bundle = new Bundle(); bundle.putString(Project.NAME, mProject.name); bundle.putString(Project.FOLDER, mProject.folder); //bundle.putInt(Project.COLOR, intent.getIntExtra("color", 0)); bundle.putString(Project.PREFIX, mProject.prefix); bundle.putString(Project.CODE, mProject.code); bundle.putString(Project.POSTFIX, mProject.postfix); //MLog.d(TAG, "load " + projectName + " in " + projectFolder); // wake up if intent says so if (settingWakeUpScreen) { final Window win = getWindow(); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); } //set screen always on if so setScreenAlwaysOn(settingScreenAlwaysOn); mAppRunnerFragment = AppRunnerFragment.newInstance(bundle); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(fl.getId(), mAppRunnerFragment, String.valueOf(fl.getId())); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); // ft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out); // ft.addToBackStack(null); ft.commit(); IDEcommunication.getInstance(this).ready(true); } }