Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41ff925
commit 3667f94
Showing
13 changed files
with
485 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package processing.app; | ||
|
||
import java.lang.reflect.Constructor; | ||
import java.lang.reflect.InvocationTargetException; | ||
|
||
import android.app.Fragment; | ||
import android.content.pm.ActivityInfo; | ||
import android.content.res.Configuration; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import processing.core.PApplet; | ||
import processing.core.PConstants; | ||
|
||
public class PFragment extends Fragment implements PConstants { | ||
|
||
private PApplet sketch; | ||
|
||
public PFragment() { | ||
} | ||
|
||
public PFragment(PApplet sketch) { | ||
System.err.println("-----> PFragment CONSTRUCTOR: " + sketch); | ||
this.sketch = sketch; | ||
} | ||
|
||
public void setSketch(PApplet sketch) { | ||
this.sketch = sketch; | ||
} | ||
|
||
@Override | ||
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
if (sketch != null) { | ||
sketch.initSurface(getActivity()); | ||
return sketch.surface.getRootView(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public void onResume() { | ||
super.onResume(); | ||
sketch.onResume(); | ||
} | ||
|
||
|
||
@Override | ||
public void onPause() { | ||
super.onPause(); | ||
sketch.onPause(); | ||
} | ||
|
||
|
||
@Override | ||
public void onDestroy() { | ||
sketch.onDestroy(); | ||
super.onDestroy(); | ||
} | ||
|
||
|
||
@Override | ||
public void onStart() { | ||
super.onStart(); | ||
System.err.println("----> ON START: " + sketch); | ||
sketch.onStart(); | ||
} | ||
|
||
|
||
@Override | ||
public void onStop() { | ||
sketch.onStop(); | ||
super.onStop(); | ||
} | ||
|
||
|
||
@Override | ||
public void onConfigurationChanged(Configuration newConfig) { | ||
if (PApplet.DEBUG) System.out.println("configuration changed: " + newConfig); | ||
super.onConfigurationChanged(newConfig); | ||
} | ||
|
||
|
||
public void onBackPressed() { | ||
sketch.onBackPressed(); | ||
} | ||
|
||
|
||
public void setOrientation(int which) { | ||
if (which == PORTRAIT) { | ||
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||
} else if (which == LANDSCAPE) { | ||
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package processing.app; | ||
|
||
import com.google.vrtoolkit.cardboard.CardboardActivity; | ||
|
||
public class PStereo extends CardboardActivity{ | ||
|
||
} |
Oops, something went wrong.