mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 03:06:20 +02:00
Merge branch 'android_goto_splash' of https://github.com/gcalero/hifi into android_goto_splash
This commit is contained in:
commit
aaaa17be7b
12 changed files with 51 additions and 25 deletions
|
@ -39,7 +39,7 @@
|
|||
</activity>
|
||||
-->
|
||||
<activity
|
||||
android:name=".GotoActivity"
|
||||
android:name=".HomeActivity"
|
||||
android:label="@string/go_to"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
|
|
@ -23,7 +23,7 @@ import android.widget.TextView;
|
|||
import io.highfidelity.hifiinterface.QtPreloader.QtPreloader;
|
||||
import io.highfidelity.hifiinterface.view.DomainAdapter;
|
||||
|
||||
public class GotoActivity extends AppCompatActivity {
|
||||
public class HomeActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* Set this intent extra param to NOT start a new InterfaceActivity after a domain is selected"
|
||||
|
@ -36,9 +36,9 @@ public class GotoActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_goto);
|
||||
setContentView(R.layout.activity_home);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitleTextAppearance(this, R.style.GotoActionBarTitleStyle);
|
||||
toolbar.setTitleTextAppearance(this, R.style.HomeActionBarTitleStyle);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar actionbar = getSupportActionBar();
|
||||
|
@ -83,9 +83,9 @@ public class GotoActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onItemClick(View view, int position, DomainAdapter.Domain domain) {
|
||||
Intent intent = new Intent(GotoActivity.this, InterfaceActivity.class);
|
||||
Intent intent = new Intent(HomeActivity.this, InterfaceActivity.class);
|
||||
intent.putExtra(InterfaceActivity.DOMAIN_URL, domain.url);
|
||||
GotoActivity.this.finish();
|
||||
HomeActivity.this.finish();
|
||||
if (getIntent() != null &&
|
||||
getIntent().hasExtra(PARAM_NOT_START_INTERFACE_ACTIVITY) &&
|
||||
getIntent().getBooleanExtra(PARAM_NOT_START_INTERFACE_ACTIVITY, false)) {
|
||||
|
@ -137,7 +137,7 @@ public class GotoActivity extends AppCompatActivity {
|
|||
preloadTask = new AsyncTask() {
|
||||
@Override
|
||||
protected Object doInBackground(Object[] objects) {
|
||||
new QtPreloader(GotoActivity.this).initQt();
|
||||
new QtPreloader(HomeActivity.this).initQt();
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -154,7 +154,7 @@ public class GotoActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
//getMenuInflater().inflate(R.menu.menu_goto, menu);
|
||||
//getMenuInflater().inflate(R.menu.menu_home, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -174,4 +174,10 @@ public class GotoActivity extends AppCompatActivity {
|
|||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
cancelActivityIndicator();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
|
@ -200,8 +200,8 @@ public class InterfaceActivity extends QtActivity {
|
|||
public void openGotoActivity(String activityName) {
|
||||
switch (activityName) {
|
||||
case "Goto": {
|
||||
Intent intent = new Intent(this, GotoActivity.class);
|
||||
intent.putExtra(GotoActivity.PARAM_NOT_START_INTERFACE_ACTIVITY, true);
|
||||
Intent intent = new Intent(this, HomeActivity.class);
|
||||
intent.putExtra(HomeActivity.PARAM_NOT_START_INTERFACE_ACTIVITY, true);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.app.AlertDialog;
|
|||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -64,7 +64,7 @@ public class PermissionChecker extends Activity {
|
|||
|
||||
private void launchActivityWithPermissions(){
|
||||
finish();
|
||||
Intent i = new Intent(this, GotoActivity.class);
|
||||
Intent i = new Intent(this, HomeActivity.class);
|
||||
startActivity(i);
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<include layout="@layout/content_goto" />
|
||||
<include layout="@layout/content_home" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:menu="@menu/menu_goto"
|
||||
app:menu="@menu/menu_home"
|
||||
/>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -5,8 +5,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="io.highfidelity.hifiinterface.GotoActivity"
|
||||
tools:showIn="@layout/activity_goto">
|
||||
tools:context="io.highfidelity.hifiinterface.HomeActivity"
|
||||
tools:showIn="@layout/activity_home">
|
||||
|
||||
<TabHost
|
||||
android:id="@+id/tabhost"
|
|
@ -1,7 +1,12 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.highfidelity.agoto.GotoActivity">
|
||||
tools:context="io.highfidelity.hifiinterface.HomeActivity">
|
||||
<item
|
||||
android:id="@+id/action_goto"
|
||||
android:orderInCategory="90"
|
||||
android:title="@string/action_goto"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
|
@ -9,5 +9,6 @@
|
|||
<string name="popular">POPULAR</string>
|
||||
<string name="bookmarks">BOOKMARKS</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_goto">Go to</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<!-- Customizing GoTo ActionBar -->
|
||||
<style name="GotoActionBarTitleStyle"
|
||||
<style name="HomeActionBarTitleStyle"
|
||||
parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title">
|
||||
<item name="android:textSize">18dp</item>
|
||||
<item name="android:paddingLeft">0dp</item>
|
||||
|
|
|
@ -51,7 +51,7 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
|||
}
|
||||
});
|
||||
|
||||
connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::geometryChanged);
|
||||
connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::onWindowGeometryChanged);
|
||||
}
|
||||
|
||||
WindowScriptingInterface::~WindowScriptingInterface() {
|
||||
|
@ -390,11 +390,22 @@ glm::vec2 WindowScriptingInterface::getDeviceSize() const {
|
|||
}
|
||||
|
||||
int WindowScriptingInterface::getX() {
|
||||
return qApp->getWindow()->x();
|
||||
return qApp->getWindow()->geometry().x();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getY() {
|
||||
return qApp->getWindow()->y();
|
||||
auto menu = qApp->getPrimaryMenu();
|
||||
int menuHeight = menu ? menu->geometry().height() : 0;
|
||||
return qApp->getWindow()->geometry().y() + menuHeight;
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::onWindowGeometryChanged(const QRect& windowGeometry) {
|
||||
auto geometry = windowGeometry;
|
||||
auto menu = qApp->getPrimaryMenu();
|
||||
if (menu) {
|
||||
geometry.setY(geometry.y() + menu->geometry().height());
|
||||
}
|
||||
emit geometryChanged(geometry);
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::copyToClipboard(const QString& text) {
|
||||
|
|
|
@ -33,8 +33,10 @@
|
|||
* @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other
|
||||
* chrome), in pixels. <em>Read-only.</em>
|
||||
* @property {object} location - Provides facilities for working with your current metaverse location. See {@link location}.
|
||||
* @property {number} x - The x coordinate of the top left corner of the Interface window on the display. <em>Read-only.</em>
|
||||
* @property {number} y - The y coordinate of the top left corner of the Interface window on the display. <em>Read-only.</em>
|
||||
* @property {number} x - The x display coordinate of the top left corner of the drawable area of the Interface window.
|
||||
* <em>Read-only.</em>
|
||||
* @property {number} y - The y display coordinate of the top left corner of the drawable area of the Interface window.
|
||||
* <em>Read-only.</em>
|
||||
*/
|
||||
|
||||
class WindowScriptingInterface : public QObject, public Dependency {
|
||||
|
@ -522,6 +524,7 @@ public slots:
|
|||
void closeMessageBox(int id);
|
||||
|
||||
private slots:
|
||||
void onWindowGeometryChanged(const QRect& geometry);
|
||||
void onMessageBoxSelected(int button);
|
||||
void disconnectedFromDomain();
|
||||
|
||||
|
|
|
@ -79,12 +79,12 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||
}
|
||||
|
||||
void MainWindow::moveEvent(QMoveEvent* event) {
|
||||
emit windowGeometryChanged(QRect(event->pos(), size()));
|
||||
emit windowGeometryChanged(QRect(QPoint(geometry().x(), geometry().y()), size())); // Geometry excluding the window frame.
|
||||
QMainWindow::moveEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent* event) {
|
||||
emit windowGeometryChanged(QRect(QPoint(x(), y()), event->size()));
|
||||
emit windowGeometryChanged(QRect(QPoint(geometry().x(), geometry().y()), size())); // Geometry excluding the window frame.
|
||||
QMainWindow::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue