adds toolbar

This commit is contained in:
arrase 2016-11-21 21:48:45 +01:00
parent d1884c3349
commit 8585466c96
3 changed files with 45 additions and 9 deletions

View File

@ -11,6 +11,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
@ -25,6 +26,7 @@ import org.torproject.android.ui.hs.providers.HSContentProvider;
public class HiddenServicesActivity extends AppCompatActivity { public class HiddenServicesActivity extends AppCompatActivity {
private ContentResolver mCR; private ContentResolver mCR;
private OnionListAdapter mAdapter; private OnionListAdapter mAdapter;
private Toolbar toolbar;
private String[] mProjection = new String[]{ private String[] mProjection = new String[]{
HSContentProvider.HiddenService._ID, HSContentProvider.HiddenService._ID,
@ -37,6 +39,10 @@ public class HiddenServicesActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.layout_hs_list_view); setContentView(R.layout.layout_hs_list_view);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mCR = getContentResolver(); mCR = getContentResolver();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

View File

@ -1,22 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="org.torproject.android.ui.hs.HiddenServicesActivity">
<ListView <android.support.design.widget.AppBarLayout
android:id="@+id/onion_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/layout_hs_list_view_main" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/stat_notify_more" app:srcCompat="@android:drawable/ic_dialog_email" />
app:layout_anchor="@id/onion_list"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="org.torproject.android.ui.hs.HiddenServicesActivity"
tools:showIn="@layout/layout_hs_list_view">
<ListView
android:id="@+id/onion_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>