diff --git a/AccessRobot/app/build.gradle b/AccessRobot/app/build.gradle index 5f22a22..c18cdba 100644 --- a/AccessRobot/app/build.gradle +++ b/AccessRobot/app/build.gradle @@ -58,4 +58,5 @@ dependencies { compile fileTree(dir: 'libs', include: 'Parse-*.jar') compile(name: 'MaterialDesign-md_ready-release', ext:'aar') compile 'com.ogaclejapan.smarttablayout:library:1.2.1@aar' + compile files('libs/YouTubeAndroidPlayerApi.jar') } diff --git a/AccessRobot/app/libs/YouTubeAndroidPlayerApi.jar b/AccessRobot/app/libs/YouTubeAndroidPlayerApi.jar new file mode 100644 index 0000000..c7825a7 Binary files /dev/null and b/AccessRobot/app/libs/YouTubeAndroidPlayerApi.jar differ diff --git a/AccessRobot/app/src/main/AndroidManifest.xml b/AccessRobot/app/src/main/AndroidManifest.xml index c28b487..f178d05 100644 --- a/AccessRobot/app/src/main/AndroidManifest.xml +++ b/AccessRobot/app/src/main/AndroidManifest.xml @@ -1,14 +1,14 @@ + package="ksmaragh.c4q.nyc.accessrobot" > - + @@ -22,10 +22,10 @@ android:icon="@mipmap/ic_launcher" android:label="Mozi" android:theme="@style/AppTheme" - tools:replace="android:label"> + tools:replace="android:label" > + android:label="@string/app_name" /> + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" > @@ -63,7 +63,7 @@ + android:screenOrientation="portrait" /> @@ -78,14 +78,14 @@ + android:screenOrientation="portrait" /> + android:screenOrientation="portrait" /> + android:label="@string/app_name" > @@ -94,7 +94,11 @@ + android:label="" /> + + diff --git a/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/LearnActivity.java b/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/LearnActivity.java index 908a2cb..8ece5ed 100644 --- a/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/LearnActivity.java +++ b/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/LearnActivity.java @@ -1,7 +1,6 @@ package ksmaragh.c4q.nyc.accessrobot; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBar; @@ -109,9 +108,8 @@ private void startPartsActivity() { } private void playMoziAssemblyVideo() { - String videoId = "DXpl0H1tLcU"; - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + videoId)); - intent.putExtra("force_fullscreen", true); + Intent intent = new Intent(this, VideoPlayerActivity.class); + //intent.putExtra("force_fullscreen", true); startActivity(intent); } diff --git a/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/VideoPlayerActivity.java b/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/VideoPlayerActivity.java new file mode 100644 index 0000000..b055604 --- /dev/null +++ b/AccessRobot/app/src/main/java/ksmaragh/c4q/nyc/accessrobot/VideoPlayerActivity.java @@ -0,0 +1,42 @@ +package ksmaragh.c4q.nyc.accessrobot; + +import android.os.Bundle; +import android.widget.Toast; + +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.YouTubePlayer.Provider; +import com.google.android.youtube.player.YouTubePlayerView; + +public class VideoPlayerActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener{ + + public static final String API_KEY = "AIzaSyCe6tORd9Ch4lx-9Ku5SQ476uS9OtZYsWA"; + public static final String VIDEO_ID = "DXpl0H1tLcU"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_video_player); + + YouTubePlayerView youTubePlayerView = (YouTubePlayerView)findViewById(R.id.youtubeplayerview); + youTubePlayerView.initialize(API_KEY, this); + } + + @Override + public void onInitializationFailure(Provider provider, + YouTubeInitializationResult result) { + Toast.makeText(getApplicationContext(), + "onInitializationFailure()", + Toast.LENGTH_LONG).show(); + } + + @Override + public void onInitializationSuccess(Provider provider, YouTubePlayer player, + boolean wasRestored) { + if (!wasRestored) { + player.cueVideo(VIDEO_ID); + } + } + +} diff --git a/AccessRobot/app/src/main/res/layout/activity_video_player.xml b/AccessRobot/app/src/main/res/layout/activity_video_player.xml new file mode 100644 index 0000000..129b1e4 --- /dev/null +++ b/AccessRobot/app/src/main/res/layout/activity_video_player.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AccessRobot/app/src/main/res/menu/menu_video_player.xml b/AccessRobot/app/src/main/res/menu/menu_video_player.xml new file mode 100644 index 0000000..8a739b3 --- /dev/null +++ b/AccessRobot/app/src/main/res/menu/menu_video_player.xml @@ -0,0 +1,7 @@ + + + diff --git a/AccessRobot/app/src/main/res/values/strings.xml b/AccessRobot/app/src/main/res/values/strings.xml index 0c306de..aa0acf1 100644 --- a/AccessRobot/app/src/main/res/values/strings.xml +++ b/AccessRobot/app/src/main/res/values/strings.xml @@ -80,5 +80,6 @@ Serial cable Hello world! + VideoPlayerActivity