summaryrefslogtreecommitdiff
path: root/org.fox.ttrss/src/main
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-04 16:13:06 +0300
committerAndrew Dolgov <[email protected]>2015-06-04 16:13:06 +0300
commit0dd21425bddc39279ccf741f4c9ae76b3b9fae90 (patch)
tree2dbdfbc3f70816e4b1b46ada30d4ff1aa763e416 /org.fox.ttrss/src/main
parent0112c0cc4f6f23f6fcb693cbae6edebcac701219 (diff)
show drawer behind translucent statusbar, jesus fuck (2)
now with scriminsetwhatsitsface
Diffstat (limited to 'org.fox.ttrss/src/main')
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java7
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/util/ScrimInsetsFrameLayout.java141
-rwxr-xr-xorg.fox.ttrss/src/main/res/layout/headlines.xml29
-rwxr-xr-x[-rw-r--r--]org.fox.ttrss/src/main/res/layout/login.xml2
-rwxr-xr-xorg.fox.ttrss/src/main/res/values-v21/style.xml6
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/attrs.xml5
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/colors.xml4
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/style.xml5
8 files changed, 176 insertions, 23 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
index edc9ecef..1b6eede2 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
@@ -67,8 +67,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (m_drawerLayout != null) {
- View drawerList = findViewById(R.id.feeds_fragment);
-
+ /*View drawerList = findViewById(R.id.feeds_fragment);
int minWidth = dpToPx(240);
int maxWidth = dpToPx(320);
@@ -80,9 +79,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
DrawerLayout.LayoutParams params = (android.support.v4.widget.DrawerLayout.LayoutParams) drawerList.getLayoutParams();
params.width = width;
- drawerList.setLayoutParams(params);
+ drawerList.setLayoutParams(params); */
- m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.blank, R.string.blank) {
+ m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.blank, R.string.blank) {
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ScrimInsetsFrameLayout.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ScrimInsetsFrameLayout.java
new file mode 100755
index 00000000..d25ebc6c
--- /dev/null
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ScrimInsetsFrameLayout.java
@@ -0,0 +1,141 @@
+package org.fox.ttrss.util;
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.support.v4.view.ViewCompat;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+
+import org.fox.ttrss.R;
+
+/**
+ * A layout that draws something in the insets passed to {@link #fitSystemWindows(Rect)}, i.e. the area above UI chrome
+ * (status and navigation bars, overlay action bars).
+ */
+public class ScrimInsetsFrameLayout extends FrameLayout {
+ private Drawable mInsetForeground;
+
+ private Rect mInsets;
+ private Rect mTempRect = new Rect();
+ private OnInsetsCallback mOnInsetsCallback;
+
+ public ScrimInsetsFrameLayout(Context context) {
+ super(context);
+ init(context, null, 0);
+ }
+
+ public ScrimInsetsFrameLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(context, attrs, 0);
+ }
+
+ public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init(context, attrs, defStyle);
+ }
+
+ private void init(Context context, AttributeSet attrs, int defStyle) {
+ final TypedArray a = context.obtainStyledAttributes(attrs,
+ R.styleable.ScrimInsetsView, defStyle, 0);
+ if (a == null) {
+ return;
+ }
+ mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground);
+ a.recycle();
+
+ setWillNotDraw(true);
+ }
+
+ @Override
+ protected boolean fitSystemWindows(Rect insets) {
+ mInsets = new Rect(insets);
+ setWillNotDraw(mInsetForeground == null);
+ ViewCompat.postInvalidateOnAnimation(this);
+ if (mOnInsetsCallback != null) {
+ mOnInsetsCallback.onInsetsChanged(insets);
+ }
+ return true; // consume insets
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ super.draw(canvas);
+
+ int width = getWidth();
+ int height = getHeight();
+ if (mInsets != null && mInsetForeground != null) {
+ int sc = canvas.save();
+ canvas.translate(getScrollX(), getScrollY());
+
+ // Top
+ mTempRect.set(0, 0, width, mInsets.top);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Bottom
+ mTempRect.set(0, height - mInsets.bottom, width, height);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Left
+ mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Right
+ mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ canvas.restoreToCount(sc);
+ }
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (mInsetForeground != null) {
+ mInsetForeground.setCallback(this);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ if (mInsetForeground != null) {
+ mInsetForeground.setCallback(null);
+ }
+ }
+
+ /**
+ * Allows the calling container to specify a callback for custom processing when insets change (i.e. when
+ * {@link #fitSystemWindows(Rect)} is called. This is useful for setting padding on UI elements based on
+ * UI chrome insets (e.g. a Google Map or a ListView). When using with ListView or GridView, remember to set
+ * clipToPadding to false.
+ */
+ public void setOnInsetsCallback(OnInsetsCallback onInsetsCallback) {
+ mOnInsetsCallback = onInsetsCallback;
+ }
+
+ public static interface OnInsetsCallback {
+ public void onInsetsChanged(Rect insets);
+ }
+} \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/layout/headlines.xml b/org.fox.ttrss/src/main/res/layout/headlines.xml
index fefced8c..233a6a69 100755
--- a/org.fox.ttrss/src/main/res/layout/headlines.xml
+++ b/org.fox.ttrss/src/main/res/layout/headlines.xml
@@ -1,11 +1,9 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-
<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fitsSystemWindows="true"
android:id="@+id/headlines_drawer"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
<FrameLayout
android:fitsSystemWindows="true"
@@ -23,17 +21,24 @@
</FrameLayout>
+ <org.fox.ttrss.util.ScrimInsetsFrameLayout
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/scrimInsetsFrameLayout"
+ android:layout_width="300dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:background="@android:color/white"
+ android:elevation="10dp"
+ android:fitsSystemWindows="true"
+ app:insetForeground="#4000">
<FrameLayout
android:id="@+id/feeds_fragment"
- android:layout_width="240dp"
- android:layout_gravity="start"
+ android:layout_width="match_parent"
android:background="?feedlistBackground"
- android:elevation="4dp"
android:layout_height="match_parent" >
</FrameLayout>
- </android.support.v4.widget.DrawerLayout>
-
+ </org.fox.ttrss.util.ScrimInsetsFrameLayout>
-</FrameLayout> \ No newline at end of file
+ </android.support.v4.widget.DrawerLayout>
diff --git a/org.fox.ttrss/src/main/res/layout/login.xml b/org.fox.ttrss/src/main/res/layout/login.xml
index f64a14f1..a81faa56 100644..100755
--- a/org.fox.ttrss/src/main/res/layout/login.xml
+++ b/org.fox.ttrss/src/main/res/layout/login.xml
@@ -1,11 +1,13 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loading_container"
+ android:fitsSystemWindows="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<TextView
+ android:background="?android:colorBackground"
android:id="@+id/loading_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/org.fox.ttrss/src/main/res/values-v21/style.xml b/org.fox.ttrss/src/main/res/values-v21/style.xml
index 8cbb25d7..0fd29784 100755
--- a/org.fox.ttrss/src/main/res/values-v21/style.xml
+++ b/org.fox.ttrss/src/main/res/values-v21/style.xml
@@ -1,11 +1,13 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="LightTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
- <item name="android:windowTranslucentStatus">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowBackground">@color/window_background</item>
</style>
<style name="DarkTheme.Base" parent="Theme.AppCompat.NoActionBar">
- <item name="android:windowTranslucentStatus">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowBackground">@color/window_background_dark</item>
</style>
diff --git a/org.fox.ttrss/src/main/res/values/attrs.xml b/org.fox.ttrss/src/main/res/values/attrs.xml
index 83b06774..e6c661f6 100755
--- a/org.fox.ttrss/src/main/res/values/attrs.xml
+++ b/org.fox.ttrss/src/main/res/values/attrs.xml
@@ -22,7 +22,7 @@
<attr name="loadingBackground" format="reference|color" />
<attr name="articleNoteBackground" format="reference|color" />
<attr name="articleNoteTextColor" format="reference|color" />
- <attr name="statusBarHintColor" format="reference|color" />
+ <!-- <attr name="statusBarHintColor" format="reference|color" /> -->
<attr name="parentBtnBackground" format="reference|color" />
<attr name="articleHeader" format="reference|color" />
<attr name="articleHeaderTextColor" format="reference|color" />
@@ -38,4 +38,7 @@
<attr name="ic_keyboard_backspace" format="reference" />
<attr name="ic_settings" format="reference" />
<attr name="ic_filter_variant" format="reference" />
+ <declare-styleable name="ScrimInsetsView">
+ <attr format="reference|color" name="insetForeground">
+ </attr></declare-styleable>
</resources> \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/values/colors.xml b/org.fox.ttrss/src/main/res/values/colors.xml
index 79f6fa96..478e24ac 100755
--- a/org.fox.ttrss/src/main/res/values/colors.xml
+++ b/org.fox.ttrss/src/main/res/values/colors.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <item name="window_background" type="color">#526A8E</item>
- <item name="window_background_dark" type="color">#455A64</item>
+ <item name="window_background" type="color">#FF526A8E</item>
+ <item name="window_background_dark" type="color">#FF455A64</item>
</resources> \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/values/style.xml b/org.fox.ttrss/src/main/res/values/style.xml
index 5368daa4..396a71bc 100755
--- a/org.fox.ttrss/src/main/res/values/style.xml
+++ b/org.fox.ttrss/src/main/res/values/style.xml
@@ -1,13 +1,14 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="LightTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
+ <item name="android:windowNoTitle">true</item>
</style>
<style name="LightTheme" parent="LightTheme.Base">
<item name="windowActionModeOverlay">true</item>
- <item name="statusBarHintColor">?colorPrimary</item>
+ <!-- <item name="statusBarHintColor">?colorPrimary</item> -->
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item>
<item name="feedlistBackground">#e0e0e0</item>
<item name="unreadCounterColor">#909090</item>
@@ -59,7 +60,7 @@
<style name="DarkTheme" parent="DarkTheme.Base">
<item name="windowActionModeOverlay">true</item>
- <item name="statusBarHintColor">?colorPrimary</item>
+ <!-- <item name="statusBarHintColor">?colorPrimary</item> -->
<item name="unreadCounterColor">#909090</item>
<item name="feedlistTextColor">@android:color/primary_text_dark</item>
<item name="headlineUnreadTextColor">@android:color/primary_text_dark</item>