Showing the changes to interface/src/java (1 of 2 files). Show all
Unified · Split
| @@ -0,0 +1,41 @@ | |||
| 1 | // | ||
| 2 | // InterfaceActivity.java | ||
| 3 | // gvr-interface/java | ||
| 4 | // | ||
| 5 | // Created by Stephen Birarda on 1/26/15. | ||
| 6 | // Copyright 2015 High Fidelity, Inc. | ||
| 7 | // | ||
| 8 | // Distributed under the Apache License, Version 2.0. | ||
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
| 10 | // | ||
| 11 | |||
| 12 | package io.highfidelity.gvrinterface; | ||
| 13 | |||
| 14 | import android.content.Intent; | ||
| 15 | import android.net.Uri; | ||
| 16 | import android.os.Bundle; | ||
| 17 | import android.view.WindowManager; | ||
| 18 | import android.util.Log; | ||
| 19 | import org.qtproject.qt5.android.bindings.QtActivity; | ||
| 20 | |||
| 21 | public class InterfaceActivity extends QtActivity { | ||
| 22 | |||
| 23 | public static native void handleHifiURL(String hifiURLString); | ||
| 24 | |||
| 25 | @Override | ||
| 26 | public void onCreate(Bundle savedInstanceState) { | ||
| 27 | super.onCreate(savedInstanceState); | ||
| 28 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | ||
| 29 | |||
| 30 | // Get the intent that started this activity in case we have a hifi:// URL to parse | ||
| 31 | Intent intent = getIntent(); | ||
| 32 | if (intent.getAction() == Intent.ACTION_VIEW) { | ||
| 33 | Uri data = intent.getData(); | ||
| 34 | |||
| 35 | if (data.getScheme().equals("hifi")) { | ||
| 36 | handleHifiURL(data.toString()); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | } | ||
| 41 | } | ||