mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 20:42:12 +02:00
Android - new (empty) activity GotoActivity
This commit is contained in:
parent
aaaa17be7b
commit
dc3914d6eb
5 changed files with 85 additions and 6 deletions
|
@ -40,10 +40,15 @@
|
|||
-->
|
||||
<activity
|
||||
android:name=".HomeActivity"
|
||||
android:label="@string/go_to"
|
||||
android:label="@string/home"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".GotoActivity"
|
||||
android:label="@string/go_to"
|
||||
android:theme="@style/AppTheme">
|
||||
</activity>
|
||||
<activity
|
||||
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name=".InterfaceActivity"
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package io.highfidelity.hifiinterface;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class GotoActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_goto);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitleTextAppearance(this, R.style.HomeActionBarTitleStyle);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar actionbar = getSupportActionBar();
|
||||
actionbar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ import android.content.Intent;
|
|||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
|
@ -23,7 +25,7 @@ import android.widget.TextView;
|
|||
import io.highfidelity.hifiinterface.QtPreloader.QtPreloader;
|
||||
import io.highfidelity.hifiinterface.view.DomainAdapter;
|
||||
|
||||
public class HomeActivity extends AppCompatActivity {
|
||||
public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
/**
|
||||
* Set this intent extra param to NOT start a new InterfaceActivity after a domain is selected"
|
||||
|
@ -32,6 +34,7 @@ public class HomeActivity extends AppCompatActivity {
|
|||
private DomainAdapter domainAdapter;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ProgressDialog mDialog;
|
||||
private NavigationView mNavigationView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -47,6 +50,9 @@ public class HomeActivity extends AppCompatActivity {
|
|||
|
||||
mDrawerLayout = findViewById(R.id.drawer_layout);
|
||||
|
||||
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
mNavigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
TabHost tabs=(TabHost)findViewById(R.id.tabhost);
|
||||
tabs.setup();
|
||||
|
||||
|
@ -168,8 +174,6 @@ public class HomeActivity extends AppCompatActivity {
|
|||
case android.R.id.home:
|
||||
mDrawerLayout.openDrawer(GravityCompat.START);
|
||||
return true;
|
||||
case R.id.action_settings:
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
@ -180,4 +184,17 @@ public class HomeActivity extends AppCompatActivity {
|
|||
cancelActivityIndicator();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
case R.id.action_goto:
|
||||
Intent i = new Intent(this, GotoActivity.class);
|
||||
startActivity(i);
|
||||
return true;
|
||||
case R.id.action_settings:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
18
android/app/src/main/res/layout/activity_goto.xml
Normal file
18
android/app/src/main/res/layout/activity_goto.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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"
|
||||
android:id="@+id/root_activity_goto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.highfidelity.hifiinterface.GotoActivity">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_constraintTop_toTopOf="@id/root_activity_goto"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -1,6 +1,7 @@
|
|||
<resources>
|
||||
<string name="app_name" translatable="false">Interface</string>
|
||||
<string name="go_to">Home</string>
|
||||
<string name="home">Home</string>
|
||||
<string name="go_to">Go To</string>
|
||||
<string name="web_view_action_open_in_browser" translatable="false">Open in browser</string>
|
||||
<string name="web_view_action_share" translatable="false">Share link</string>
|
||||
<string name="web_view_action_share_subject" translatable="false">Shared a link</string>
|
||||
|
@ -9,6 +10,6 @@
|
|||
<string name="popular">POPULAR</string>
|
||||
<string name="bookmarks">BOOKMARKS</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_goto">Go to</string>
|
||||
<string name="action_goto">Go To</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue