Skip to content

Commit

Permalink
Update out most interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin20150405 committed Apr 12, 2017
1 parent 03d48b8 commit cb0e0c3
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 681 deletions.
Binary file modified pano360demo/pano360demo-release.apk
Binary file not shown.
2 changes: 0 additions & 2 deletions pano360demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<activity
android:name=".DemoWithGLSurfaceView"
android:screenOrientation="landscape"/>
<activity android:name=".PlanePlayerActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import android.view.View;
import android.view.WindowManager;

import com.martin.ads.vrlib.PanoPlayerActivity;
import com.martin.ads.vrlib.ui.Pano360ConfigBundle;
import com.martin.ads.vrlib.ui.PanoPlayerActivity;
import com.martin.ads.vrlib.PanoViewWrapper;

/**
Expand All @@ -34,16 +35,16 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void init(){

String filePath=getIntent().getStringExtra(PanoPlayerActivity.FILE_PATH);
Pano360ConfigBundle configBundle= (Pano360ConfigBundle) getIntent().getSerializableExtra(PanoPlayerActivity.CONFIG_BUNDLE);
if(configBundle==null){
configBundle=Pano360ConfigBundle.newInstance();
}
configBundle.setRemoveHotspot(true);
GLSurfaceView glSurfaceView=(GLSurfaceView) findViewById(R.id.surface_view);
panoViewWrapper =PanoViewWrapper.with(this)
.setFilePath(filePath)
.setConfig(configBundle)
.setGlSurfaceView(glSurfaceView)
.setImageMode(false)
.setPlaneMode(false)
.init()
.removeDefaultHotSpot();
.init();
glSurfaceView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import com.github.rubensousa.viewpagercards.CardItem;
import com.github.rubensousa.viewpagercards.CardPagerAdapter;
import com.github.rubensousa.viewpagercards.ShadowTransformer;
import com.martin.ads.vrlib.PanoPlayerActivity;
import com.martin.ads.vrlib.ui.Pano360ConfigBundle;
import com.martin.ads.vrlib.ui.PanoPlayerActivity;
import com.martin.ads.vrlib.ext.GirlFriendNotFoundException;
import com.nbsp.materialfilepicker.ui.FilePickerActivity;

Expand All @@ -25,10 +26,13 @@ public class HomeActivity extends AppCompatActivity {
private ShadowTransformer mCardShadowTransformer;

private CheckBox planeMode;
private CheckBox windowMode;
private String filePath="~(~ ̄▽ ̄)~";
private boolean flag;

private String filePath="~(~ ̄▽ ̄)~";
private String videoHotspotPath;
private boolean imageModeEnabled;
private boolean planeModeEnabled;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -44,38 +48,32 @@ protected void onCreate(Bundle savedInstanceState) {
mCardAdapter.addCardItem(new CardItem(R.string.title_6, R.string.content_text_6));

planeMode= (CheckBox) findViewById(R.id.plane_mode);
windowMode = (CheckBox) findViewById(R.id.window_mode);

mCardAdapter.setOnClickCallback(new CardPagerAdapter.OnClickCallback() {
@Override
public void onClick(int position) {
boolean imageMode=false;
Intent intent=new Intent();
intent.setClass(HomeActivity.this, PanoPlayerActivity.class);
Log.d(TAG, "onClick: "+position);
imageModeEnabled=false;
videoHotspotPath=null;
switch (position){
case 0:
filePath= "android.resource://" + getPackageName() + "/" + R.raw.demo_video;
break;
case 1:
intent.setClass(HomeActivity.this, FilePickerActivity.class);
Intent intent=new Intent(HomeActivity.this, FilePickerActivity.class);
intent.putExtra(FilePickerActivity.ARG_FILTER, Pattern.compile("(.*\\.mp4$)||(.*\\.avi$)||(.*\\.wmv$)"));
startActivityForResult(intent, 1);
return;
case 2:
filePath="images/vr_cinema.jpg";
intent.putExtra(PanoPlayerActivity.VIDEO_HOTSPOT_PATH, "android.resource://" + getPackageName() + "/" + R.raw.demo_video);
imageMode=true;
videoHotspotPath="android.resource://" + getPackageName() + "/" + R.raw.demo_video;
imageModeEnabled=true;
break;
case 3:
filePath="images/texture_360_n.jpg";
imageMode=true;
imageModeEnabled=true;
break;
case 4:
filePath="http://cache.utovr.com/201508270528174780.m3u8";
if(windowMode.isChecked()){
intent.setClass(HomeActivity.this, PlanePlayerActivity.class);
}
break;
case 5:
if(flag) throw new GirlFriendNotFoundException();
Expand All @@ -85,12 +83,8 @@ public void onClick(int position) {
}
return;
}
intent.putExtra(PanoPlayerActivity.FILE_PATH, filePath);
intent.putExtra(PanoPlayerActivity.IMAGE_MODE, imageMode);
intent.putExtra(PanoPlayerActivity.PLANE_MODE, planeMode.isChecked());
intent.putExtra(PanoPlayerActivity.WINDOW_MODE, windowMode.isChecked());
intent.putExtra("removeHotspot", false);
startActivity(intent);
planeModeEnabled=planeMode.isChecked();
start(true);
}
});
mCardShadowTransformer = new ShadowTransformer(mViewPager, mCardAdapter);
Expand All @@ -103,18 +97,30 @@ public void onClick(int position) {
mCardShadowTransformer.enableScaling(true);
}

private void start(boolean usingDefaultActivity){
Pano360ConfigBundle configBundle=Pano360ConfigBundle
.newInstance()
.setFilePath(filePath)
.setImageModeEnabled(imageModeEnabled)
.setPlaneModeEnabled(planeModeEnabled)
.setRemoveHotspot(false)
.setVideoHotspotPath(videoHotspotPath);
if(usingDefaultActivity)
configBundle.startEmbeddedActivity(this);
else {
Intent intent=new Intent(this,DemoWithGLSurfaceView.class);
intent.putExtra(PanoPlayerActivity.CONFIG_BUNDLE,configBundle);
startActivity(intent);
}
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK) {
String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
Intent intent=new Intent(HomeActivity.this,PanoPlayerActivity.class);
//Intent intent=new Intent(HomeActivity.this,DemoWithGLSurfaceView.class);
intent.putExtra(PanoPlayerActivity.FILE_PATH, filePath);
intent.putExtra(PanoPlayerActivity.IMAGE_MODE, false);
intent.putExtra(PanoPlayerActivity.PLANE_MODE, planeMode.isChecked());
intent.putExtra("removeHotspot", true);
startActivity(intent);
filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
planeModeEnabled=planeMode.isChecked();
start(true);
}
}

Expand Down
138 changes: 0 additions & 138 deletions pano360demo/src/main/java/com/martin/ads/pano360demo/MainActivity.java

This file was deleted.

Loading

0 comments on commit cb0e0c3

Please sign in to comment.