Toolbar fixes, Toolbar under status bar on Lollipop

This commit is contained in:
Dominik Schürmann 2015-02-03 16:05:18 +01:00
parent e2a8819385
commit 7914aa5c08
34 changed files with 118 additions and 96 deletions

View File

@ -21,6 +21,7 @@ import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
@ -48,7 +49,6 @@ import java.security.NoSuchAlgorithmException;
public class AppSettingsActivity extends BaseActivity {
private Uri mAppUri;
private AccountsListFragment mAccountsListFragment;
private AppSettingsAllowedKeysListFragment mAllowedKeysFragment;
private TextView mAppNameView;
@ -58,6 +58,11 @@ public class AppSettingsActivity extends BaseActivity {
private FloatingActionButton mStartFab;
// deprecated API
private AccountsListFragment mAccountsListFragment;
private TextView mAccountsLabel;
// model
AppSettings mAppSettings;
@ -65,6 +70,7 @@ public class AppSettingsActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAccountsLabel = (TextView) findViewById(R.id.api_accounts_label);
mAppNameView = (TextView) findViewById(R.id.api_app_settings_app_name);
mAppIconView = (ImageView) findViewById(R.id.api_app_settings_app_icon);
mPackageName = (TextView) findViewById(R.id.api_app_settings_package_name);
@ -199,15 +205,21 @@ public class AppSettingsActivity extends BaseActivity {
return;
}
// Create an instance of the fragment
mAccountsListFragment = AccountsListFragment.newInstance(accountsUri);
mAllowedKeysFragment = AppSettingsAllowedKeysListFragment.newInstance(allowedKeysUri);
// show accounts only if available (deprecated API)
Cursor cursor = getContentResolver().query(accountsUri, null, null, null, null);
if (cursor.moveToFirst()) {
mAccountsLabel.setVisibility(View.VISIBLE);
mAccountsListFragment = AccountsListFragment.newInstance(accountsUri);
// Create an instance of the fragments
getSupportFragmentManager().beginTransaction()
.replace(R.id.api_accounts_list_fragment, mAccountsListFragment)
.commitAllowingStateLoss();
}
// Create an instance of the fragments
mAllowedKeysFragment = AppSettingsAllowedKeysListFragment.newInstance(allowedKeysUri);
// Add the fragment to the 'fragment_container' FrameLayout
// NOTE: We use commitAllowingStateLoss() to prevent weird crashes!
getSupportFragmentManager().beginTransaction()
.replace(R.id.api_accounts_list_fragment, mAccountsListFragment)
.commitAllowingStateLoss();
getSupportFragmentManager().beginTransaction()
.replace(R.id.api_allowed_keys_list_fragment, mAllowedKeysFragment)
.commitAllowingStateLoss();

View File

@ -26,7 +26,6 @@ import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.sufficientlysecure.keychain.R;
@ -127,12 +126,4 @@ public abstract class BaseActivity extends ActionBarActivity {
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
// public void add() {
// LayoutInflater inflater = LayoutInflater.from(mToolbar.getContext());
// View view = inflater.inflate(R.layout.api_app_settings_fragment, null);
// Toolbar.LayoutParams layoutParams = new Toolbar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
//// layoutParams.gravity = Gravity.BOTTOM;
// mToolbar.addView(view, layoutParams);
// }
}

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -30,11 +30,10 @@
<LinearLayout
android:layout_below="@+id/toolbar"
android:paddingLeft="48dp"
android:paddingBottom="8dp"
android:paddingRight="72dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="72dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/api_app_settings_app_icon"
@ -84,9 +83,11 @@
android:orientation="vertical" />
<TextView
android:id="@+id/api_accounts_label"
style="@style/SectionHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/api_settings_accounts" />
<FrameLayout
@ -95,6 +96,12 @@
android:layout_height="match_parent"
android:orientation="vertical" />
<TextView
style="@style/SectionHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/api_settings_advanced" />
<org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,14 +4,13 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<ScrollView
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@ -4,12 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="@id/toolbar_include"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

View File

@ -4,12 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,12 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -5,11 +5,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,12 +4,12 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:orientation="vertical"
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"

View File

@ -4,7 +4,7 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
</LinearLayout>

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<ScrollView
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<RelativeLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true">

View File

@ -1,13 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
<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/toolbar"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimaryDark"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="UnusedAttribute" />
android:layout_height="match_parent">
<ImageView
android:id="@+id/statusBar"
android:layout_width="match_parent"
android:layout_height="@dimen/statusMargin"
android:background="?attr/colorPrimary" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_below="@+id/statusBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="UnusedAttribute" />
</RelativeLayout>

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<ScrollView
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -5,11 +5,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@ -4,11 +4,11 @@
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar"
android:layout_below="@id/toolbar_include"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -2,6 +2,8 @@
<resources>
<style name="KeychainTheme" parent="KeychainTheme.Base">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>

View File

@ -12,12 +12,12 @@
<color name="black_translucent">#80000000</color>
<!-- Palette generated by Material Palette materialpalette.com/green/indigo -->
<color name="colorPrimary">#4CAF50</color>
<color name="colorPrimaryDark">#388E3C</color>
<color name="colorPrimary">#8bc34a</color>
<color name="colorPrimaryDark">#558b2f</color>
<!-- TODO: -->
<color name="primary">#4CAF50</color>
<color name="primary_dark">#388E3C</color>
<color name="primary">#8bc34a</color>
<color name="primary_dark">#558b2f</color>
<color name="primary_light">#C8E6C9</color>
<color name="accent">#00BCD4</color>
<color name="fab">#00BCD4</color>

View File

@ -488,7 +488,8 @@
<string name="api_settings_delete_account">"Delete account"</string>
<string name="api_settings_package_name">"Package Name"</string>
<string name="api_settings_package_signature">"SHA-256 of Package Signature"</string>
<string name="api_settings_accounts">"Accounts"</string>
<string name="api_settings_accounts">"Accounts (deprecated API)"</string>
<string name="api_settings_advanced">"Advanced Information"</string>
<string name="api_settings_allowed_keys">"Allowed Keys"</string>
<string name="api_settings_settings">"Settings"</string>
<string name="api_settings_key">"Account key:"</string>

View File

@ -6,10 +6,11 @@
<!--<style name="KeychainTheme.Base" parent="HoloKeychainTheme">-->
<style name="KeychainTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/accent</item>
<item name="android:windowNoTitle">true</item>
<!-- remove actionbar, we use toolbar! -->
<item name="windowActionBar">false</item>
<item name="searchViewStyle">@style/MySearchViewStyle</item>