Add scrim to collapsing toolbar layout for better title visibility

This commit is contained in:
Shinokuni 2019-02-09 13:25:39 +00:00
parent 017ce251fa
commit bf2401a337
4 changed files with 20 additions and 1 deletions

View File

@ -32,6 +32,8 @@ import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import okhttp3.internal.Util;
public class ItemActivity extends AppCompatActivity {
private ItemViewModel viewModel;
@ -83,6 +85,8 @@ public class ItemActivity extends AppCompatActivity {
} else {
appBarLayout.setExpanded(true);
toolbarLayout.setTitleEnabled(true);
toolbarLayout.setExpandedTitleColor(Color.WHITE);
toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
GlideApp.with(this)
.load(imageUrl)

View File

@ -32,6 +32,6 @@ public interface ItemDao {
@Insert
void insertAll(List<Item> items);
@Query("Select title, Item.description, content, pub_date, image_link, author, 0 as color, read_time, name from Item Inner Join Feed on Item.feed_id = Feed.id And Item.id = :id")
@Query("Select title, Item.description, content, pub_date, image_link, author, color, read_time, name from Item Inner Join Feed on Item.feed_id = Feed.id And Item.id = :id")
LiveData<ItemWithFeed> getItemById(int id);
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="@android:color/transparent"
android:startColor="#66000000"/>
</shape>

View File

@ -27,11 +27,18 @@
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
<View
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_gravity="bottom"
android:background="@drawable/toolbar_scrim"/>
<android.support.v7.widget.Toolbar
android:id="@+id/collasping_layout_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:theme="@style/AlertDialog.AppCompat.Light"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>