package co.tenton.admin.autoshkolla.Ilustrimet; import android.os.Build; import android.support.v4.content.ContextCompat; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import co.tenton.admin.autoshkolla.Models.Sign; import co.tenton.admin.autoshkolla.Models.This; import co.tenton.admin.autoshkolla.R; import com.google.android.youtube.player.YouTubeBaseActivity; import com.google.android.youtube.player.YouTubeInitializationResult; import com.google.android.youtube.player.YouTubePlayer; import com.google.android.youtube.player.YouTubePlayerView; public class Ilustrimet_Webview extends YouTubeBaseActivity { Button back; private YouTubePlayerView youTubePlayerView; private YouTubePlayer.OnInitializedListener onInitializedListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ilustrimet__webview); if (Build.VERSION.SDK_INT >= 21) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(ContextCompat.getColor(this, R.color.blackColor)); } int index = getIntent().getIntExtra("index", 0); final Sign s = This.shared.illustraions.get(index); youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_view); onInitializedListener = new YouTubePlayer.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) { youTubePlayer.loadVideo(s.description); } @Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { } }; youTubePlayerView.initialize("AIzaSyAejeo4T9MkERtCYC5q63Fs4Pev8-p5Czk",onInitializedListener); } }