Skip to content

Commit 360586f

Browse files
committed
reverting cardboard/daydream selection changes
1 parent 2274bfc commit 360586f

File tree

8 files changed

+40
-75
lines changed

8 files changed

+40
-75
lines changed

mode/languages/mode.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ menu.android.app = App
2323
menu.android.wallpaper = Wallpaper
2424
menu.android.watch_face = Watch Face
2525
menu.android.vr = VR
26-
menu.android.vr.cardboard = Cardboard
27-
menu.android.vr.daydream = Daydream
2826
menu.android.ar = AR
2927
menu.android.devices = Devices
3028
menu.android.devices.no_connected_devices = No connected devices

mode/languages/mode_ko.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ menu.android.app = 앱
2323
menu.android.wallpaper = 벽지
2424
menu.android.watch_face = 시계 얼굴
2525
menu.android.vr = VR
26-
menu.android.vr.cardboard = 카드보드
27-
menu.android.vr.daydream = 데이드림
2826
menu.android.ar = AR
2927
menu.android.devices = 장치들
3028
menu.android.devices.no_connected_devices = 연결된 기기 없음
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
mode=Android
12
component=vr
3+
mode.id=processing.mode.android.AndroidMode
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
mode=Android
12
component=vr
3+
mode.id=processing.mode.android.AndroidMode

mode/src/processing/mode/android/AndroidBuild.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ class AndroidBuild extends JavaBuild {
4949
static public final int APP = 0;
5050
static public final int WALLPAPER = 1;
5151
static public final int WATCHFACE = 2;
52-
static public final int VR_CARDBOARD = 3;
53-
static public final int VR_DAYDREAM = 4;
54-
static public final int AR = 5;
52+
static public final int VR = 3;
53+
static public final int AR = 4;
5554

5655
// Minimum SDK's API levels required for each component:
5756
static public final String MIN_SDK_APP = "17"; // Android 4.2
@@ -361,7 +360,7 @@ private void createAppModule(String moduleName)
361360
if (appComponent == AR) {
362361
minSdk = MIN_SDK_AR;
363362
tmplFile = exportProject ? AR_GRADLE_BUILD_TEMPLATE : AR_GRADLE_BUILD_ECJ_TEMPLATE;
364-
} else if (appComponent == VR_CARDBOARD || appComponent == VR_DAYDREAM) {
363+
} else if (appComponent == VR) {
365364
minSdk = MIN_SDK_VR;
366365
tmplFile = exportProject ? VR_GRADLE_BUILD_TEMPLATE : VR_GRADLE_BUILD_ECJ_TEMPLATE;
367366
} else if (appComponent == WATCHFACE) {
@@ -452,7 +451,7 @@ private void writeMainClass(final File srcDirectory,
452451
} else {
453452
writeWatchFaceCanvasService(srcDirectory, permissions, external);
454453
}
455-
} else if (comp == VR_CARDBOARD || comp == VR_DAYDREAM) {
454+
} else if (comp == VR) {
456455
writeVRActivity(srcDirectory, permissions, external);
457456
} else if (comp == AR) {
458457
writeARActivity(srcDirectory, permissions, external);
@@ -634,7 +633,7 @@ private void writeRes(File resFolder) throws SketchException {
634633
} else if (comp == WATCHFACE) {
635634
File xmlFolder = AndroidUtil.createPath(resFolder, "xml");
636635
writeResXMLWatchFace(xmlFolder);
637-
} else if (comp == VR_CARDBOARD || comp == VR_DAYDREAM) {
636+
} else if (comp == VR) {
638637
File valuesFolder = AndroidUtil.createPath(resFolder, "values");
639638
writeResStylesVR(valuesFolder);
640639
} else if (comp == AR) {
@@ -827,7 +826,7 @@ private void copyImportedLibs(final File libsFolder,
827826
String exportName = exportFile.getName();
828827

829828
// Skip the GVR and ARCore jars, because the gradle will resolve the dependencies
830-
if ((appComponent == VR_CARDBOARD || appComponent == VR_DAYDREAM) && exportName.toLowerCase().startsWith("sdk-")) continue;
829+
if (appComponent == VR && exportName.toLowerCase().startsWith("sdk-")) continue;
831830
if (appComponent == AR && exportName.toLowerCase().startsWith("core-")) continue;
832831

833832
if (!exportFile.exists()) {

mode/src/processing/mode/android/AndroidEditor.java

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public class AndroidEditor extends JavaEditor {
7272
private JCheckBoxMenuItem fragmentItem;
7373
private JCheckBoxMenuItem wallpaperItem;
7474
private JCheckBoxMenuItem watchfaceItem;
75-
76-
private JMenu vrMenu;
77-
private JCheckBoxMenuItem cardBoardItem;
78-
private JCheckBoxMenuItem dayDreamItem;
75+
private JCheckBoxMenuItem vrItem;
7976
private JCheckBoxMenuItem arItem;
8077

8178
protected AndroidEditor(Base base, String path, EditorState state,
@@ -192,11 +189,7 @@ public void actionPerformed(ActionEvent e) {
192189
fragmentItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.app"));
193190
wallpaperItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.wallpaper"));
194191
watchfaceItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.watch_face"));
195-
vrMenu = new JMenu(AndroidMode.getTextString("menu.android.vr"));
196-
cardBoardItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.vr.cardboard"));
197-
dayDreamItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.vr.daydream"));
198-
vrMenu.add(cardBoardItem);
199-
vrMenu.add(dayDreamItem);
192+
vrItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.vr"));
200193
arItem = new JCheckBoxMenuItem(AndroidMode.getTextString("menu.android.ar"));
201194

202195
fragmentItem.addActionListener(new ActionListener() {
@@ -205,8 +198,7 @@ public void actionPerformed(ActionEvent e) {
205198
fragmentItem.setState(true);
206199
wallpaperItem.setState(false);
207200
watchfaceItem.setSelected(false);
208-
cardBoardItem.setSelected(false);
209-
dayDreamItem.setSelected(false);
201+
vrItem.setSelected(false);
210202
arItem.setSelected(false);
211203
setAppComponent(AndroidBuild.APP);
212204
}
@@ -217,8 +209,7 @@ public void actionPerformed(ActionEvent e) {
217209
fragmentItem.setState(false);
218210
wallpaperItem.setState(true);
219211
watchfaceItem.setSelected(false);
220-
cardBoardItem.setSelected(false);
221-
dayDreamItem.setSelected(false);
212+
vrItem.setSelected(false);
222213
arItem.setSelected(false);
223214
setAppComponent(AndroidBuild.WALLPAPER);
224215
}
@@ -229,34 +220,20 @@ public void actionPerformed(ActionEvent e) {
229220
fragmentItem.setState(false);
230221
wallpaperItem.setState(false);
231222
watchfaceItem.setSelected(true);
232-
cardBoardItem.setSelected(false);
233-
dayDreamItem.setSelected(false);
223+
vrItem.setSelected(false);
234224
arItem.setSelected(false);
235225
setAppComponent(AndroidBuild.WATCHFACE);
236226
}
237227
});
238-
cardBoardItem.addActionListener(new ActionListener() {
239-
@Override
240-
public void actionPerformed(ActionEvent e) {
241-
fragmentItem.setState(false);
242-
wallpaperItem.setState(false);
243-
watchfaceItem.setSelected(false);
244-
cardBoardItem.setSelected(true);
245-
dayDreamItem.setSelected(false);
246-
arItem.setSelected(false);
247-
setAppComponent(AndroidBuild.VR_CARDBOARD);
248-
}
249-
});
250-
dayDreamItem.addActionListener(new ActionListener() {
228+
vrItem.addActionListener(new ActionListener() {
251229
@Override
252230
public void actionPerformed(ActionEvent e) {
253231
fragmentItem.setState(false);
254232
wallpaperItem.setState(false);
255233
watchfaceItem.setSelected(false);
256-
cardBoardItem.setSelected(false);
257-
dayDreamItem.setSelected(true);
234+
vrItem.setSelected(true);
258235
arItem.setSelected(false);
259-
setAppComponent(AndroidBuild.VR_DAYDREAM);
236+
setAppComponent(AndroidBuild.VR);
260237
}
261238
});
262239
arItem.addActionListener(new ActionListener() {
@@ -265,8 +242,7 @@ public void actionPerformed(ActionEvent e) {
265242
fragmentItem.setState(false);
266243
wallpaperItem.setState(false);
267244
watchfaceItem.setSelected(false);
268-
cardBoardItem.setSelected(false);
269-
dayDreamItem.setSelected(false);
245+
vrItem.setSelected(false);
270246
arItem.setSelected(true);
271247
setAppComponent(AndroidBuild.AR);
272248
}
@@ -275,14 +251,13 @@ public void actionPerformed(ActionEvent e) {
275251
fragmentItem.setState(false);
276252
wallpaperItem.setState(false);
277253
watchfaceItem.setSelected(false);
278-
cardBoardItem.setSelected(false);
279-
dayDreamItem.setSelected(false);
254+
vrItem.setSelected(false);
280255
arItem.setSelected(false);
281256

282257
androidMenu.add(fragmentItem);
283258
androidMenu.add(wallpaperItem);
284259
androidMenu.add(watchfaceItem);
285-
androidMenu.add(vrMenu);
260+
androidMenu.add(vrItem);
286261
androidMenu.add(arItem);
287262

288263
androidMenu.addSeparator();
@@ -333,10 +308,8 @@ private void setAppComponent(int comp) {
333308
settings.set("component", "wallpaper");
334309
} else if (appComponent == AndroidBuild.WATCHFACE) {
335310
settings.set("component", "watchface");
336-
} else if (appComponent == AndroidBuild.VR_CARDBOARD) {
337-
settings.set("component", "cardboard");
338-
} else if (appComponent == AndroidBuild.VR_DAYDREAM) {
339-
settings.set("component", "daydream");
311+
} else if (appComponent == AndroidBuild.VR) {
312+
settings.set("component", "vr");
340313
} else if (appComponent == AndroidBuild.AR) {
341314
settings.set("component", "ar");
342315
}
@@ -606,12 +579,9 @@ private void loadModeSettings() {
606579
} else if (component.equals("watchface")) {
607580
appComponent = AndroidBuild.WATCHFACE;
608581
watchfaceItem.setState(true);
609-
} else if (component.equals("cardboard") || component.equals("vr")) {
610-
appComponent = AndroidBuild.VR_CARDBOARD;
611-
cardBoardItem.setState(true);
612-
} else if (component.equals("daydream")) {
613-
appComponent = AndroidBuild.VR_DAYDREAM;
614-
dayDreamItem.setState(true);
582+
} else if (component.equals("vr")) {
583+
appComponent = AndroidBuild.VR;
584+
vrItem.setState(true);
615585
} else if (component.equals("ar")) {
616586
appComponent = AndroidBuild.AR;
617587
arItem.setState(true);

mode/src/processing/mode/android/Manifest.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class Manifest {
5656
"WallpaperManifest.xml.tmpl",
5757
"WatchFaceManifest.xml.tmpl",
5858
"VRManifest.xml.tmpl",
59-
"VRManifest.xml.tmpl",
6059
"ARManifest.xml.tmpl"
6160
};
6261

@@ -166,11 +165,11 @@ public void setPermissions(String[] names) {
166165
hasWakeLock = true;
167166
continue;
168167
}
169-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals(PERMISSION_PREFIX + "VIBRATE")) {
168+
if (appComp == AndroidBuild.VR && name.equals(PERMISSION_PREFIX + "VIBRATE")) {
170169
hasVibrate = true;
171170
continue;
172171
}
173-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals(PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE")) {
172+
if (appComp == AndroidBuild.VR && name.equals(PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE")) {
174173
hasReadExtStorage = true;
175174
continue;
176175
}
@@ -191,8 +190,8 @@ public void setPermissions(String[] names) {
191190

192191
// Don't add required permissions for watch faces and VR again...
193192
if (appComp == AndroidBuild.WATCHFACE && name.equals("WAKE_LOCK")) continue;
194-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals("VIBRATE")) continue;
195-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals("READ_EXTERNAL_STORAGE")) continue;
193+
if (appComp == AndroidBuild.VR && name.equals("VIBRATE")) continue;
194+
if (appComp == AndroidBuild.VR && name.equals("READ_EXTERNAL_STORAGE")) continue;
196195
if (appComp == AndroidBuild.AR && name.equals(PERMISSION_PREFIX + "CAMERA")) continue;
197196

198197
XML newbie = xml.addChild("uses-permission");
@@ -209,11 +208,11 @@ public void setPermissions(String[] names) {
209208
xml.addChild("uses-permission").
210209
setString("android:name", PERMISSION_PREFIX + "WAKE_LOCK");
211210
}
212-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && !hasVibrate) {
211+
if (appComp == AndroidBuild.VR && !hasVibrate) {
213212
xml.addChild("uses-permission").
214213
setString("android:name", PERMISSION_PREFIX + "VIBRATE");
215214
}
216-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && !hasReadExtStorage) {
215+
if (appComp == AndroidBuild.VR && !hasReadExtStorage) {
217216
xml.addChild("uses-permission").
218217
setString("android:name", PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE");
219218
}
@@ -237,11 +236,11 @@ private void fixPermissions(XML mf) {
237236
hasWakeLock = true;
238237
continue;
239238
}
240-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals(PERMISSION_PREFIX + "VIBRATE")) {
239+
if (appComp == AndroidBuild.VR && name.equals(PERMISSION_PREFIX + "VIBRATE")) {
241240
hasVibrate = true;
242241
continue;
243242
}
244-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && name.equals(PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE")) {
243+
if (appComp == AndroidBuild.VR && name.equals(PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE")) {
245244
hasReadExtStorage = true;
246245
continue;
247246
}
@@ -259,11 +258,11 @@ private void fixPermissions(XML mf) {
259258
mf.addChild("uses-permission").
260259
setString("android:name", PERMISSION_PREFIX + "WAKE_LOCK");
261260
}
262-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && !hasVibrate) {
261+
if (appComp == AndroidBuild.VR && !hasVibrate) {
263262
mf.addChild("uses-permission").
264263
setString("android:name", PERMISSION_PREFIX + "VIBRATE");
265264
}
266-
if ((appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD) && !hasReadExtStorage) {
265+
if (appComp == AndroidBuild.VR && !hasReadExtStorage) {
267266
mf.addChild("uses-permission").
268267
setString("android:name", PERMISSION_PREFIX + "READ_EXTERNAL_STORAGE");
269268
}
@@ -280,12 +279,8 @@ private void writeBlankManifest(final File xmlFile, final int appComp) {
280279
replaceMap.put("@@min_sdk@@", AndroidBuild.MIN_SDK_WALLPAPER);
281280
} else if (appComp == AndroidBuild.WATCHFACE) {
282281
replaceMap.put("@@min_sdk@@", AndroidBuild.MIN_SDK_WATCHFACE);
283-
} else if (appComp == AndroidBuild.VR_CARDBOARD) {
284-
replaceMap.put("@@min_sdk@@", AndroidBuild.MIN_SDK_VR);
285-
replaceMap.put("@@vr_type@@", "com.google.intent.category.CARDBOARD");
286-
} else if (appComp == AndroidBuild.VR_DAYDREAM) {
282+
} else if (appComp == AndroidBuild.VR) {
287283
replaceMap.put("@@min_sdk@@", AndroidBuild.MIN_SDK_VR);
288-
replaceMap.put("@@vr_type@@", "com.google.intent.category.DAYDREAM");
289284
} else if (appComp == AndroidBuild.AR) {
290285
replaceMap.put("@@min_sdk@@", AndroidBuild.MIN_SDK_AR);
291286
}
@@ -331,7 +326,7 @@ protected void writeCopy(File file, String className) throws IOException {
331326

332327
// Make sure that the required permissions for watch faces, AR and VR apps are
333328
// included.
334-
if (appComp == AndroidBuild.WATCHFACE || appComp == AndroidBuild.VR_DAYDREAM || appComp == AndroidBuild.VR_CARDBOARD || appComp == AndroidBuild.AR) {
329+
if (appComp == AndroidBuild.WATCHFACE || appComp == AndroidBuild.VR|| appComp == AndroidBuild.AR) {
335330
fixPermissions(mf);
336331
}
337332

mode/templates/VRManifest.xml.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
<intent-filter>
2222
<action android:name="android.intent.action.MAIN" />
2323
<category android:name="android.intent.category.LAUNCHER" />
24-
<category android:name="@@vr_type@@" />
24+
<category android:name="com.google.intent.category.CARDBOARD" />
25+
<category android:name="com.google.intent.category.DAYDREAM" />
2526
</intent-filter>
2627
</activity>
2728
</application>

0 commit comments

Comments
 (0)