mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 22:55:46 +03:00
Merge pull request #5634 from nextcloud/previewGradient
Add gradient to preview images in toolbar
This commit is contained in:
commit
6df2d58de5
3 changed files with 34 additions and 7 deletions
|
@ -27,6 +27,7 @@ import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
@ -49,6 +50,7 @@ import androidx.core.content.ContextCompat;
|
||||||
public abstract class ToolbarActivity extends BaseActivity {
|
public abstract class ToolbarActivity extends BaseActivity {
|
||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private ImageView mPreviewImage;
|
private ImageView mPreviewImage;
|
||||||
|
private FrameLayout mPreviewImageContainer;
|
||||||
private LinearLayout mInfoBox;
|
private LinearLayout mInfoBox;
|
||||||
private TextView mInfoBoxMessage;
|
private TextView mInfoBoxMessage;
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ public abstract class ToolbarActivity extends BaseActivity {
|
||||||
mInfoBoxMessage = findViewById(R.id.info_box_message);
|
mInfoBoxMessage = findViewById(R.id.info_box_message);
|
||||||
|
|
||||||
mPreviewImage = findViewById(R.id.preview_image);
|
mPreviewImage = findViewById(R.id.preview_image);
|
||||||
|
mPreviewImageContainer = findViewById(R.id.preview_image_frame);
|
||||||
|
|
||||||
ThemeUtils.colorStatusBar(this, primaryColor);
|
ThemeUtils.colorStatusBar(this, primaryColor);
|
||||||
|
|
||||||
|
@ -191,8 +194,8 @@ public abstract class ToolbarActivity extends BaseActivity {
|
||||||
* @param visibility visibility of the preview image
|
* @param visibility visibility of the preview image
|
||||||
*/
|
*/
|
||||||
public void setPreviewImageVisibility(int visibility) {
|
public void setPreviewImageVisibility(int visibility) {
|
||||||
if (mPreviewImage != null) {
|
if (mPreviewImage != null && mPreviewImageContainer != null) {
|
||||||
mPreviewImage.setVisibility(visibility);
|
mPreviewImageContainer.setVisibility(visibility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
src/main/res/drawable/preview_image_gradient_shape.xml
Normal file
13
src/main/res/drawable/preview_image_gradient_shape.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:endColor="#00000000"
|
||||||
|
android:startColor="#00000000"
|
||||||
|
android:centerColor="#00000000" />
|
||||||
|
|
||||||
|
<corners android:radius="0dp" />
|
||||||
|
|
||||||
|
</shape>
|
|
@ -32,13 +32,24 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/preview_image_frame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/nav_drawer_header_height"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/preview_image"
|
android:id="@+id/preview_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/nav_drawer_header_height"
|
android:layout_height="@dimen/nav_drawer_header_height"
|
||||||
android:contentDescription="@string/preview_image_description"
|
android:contentDescription="@string/preview_image_description"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop" />
|
||||||
android:visibility="gone" />
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/nav_drawer_header_height"
|
||||||
|
android:background="@drawable/preview_image_gradient_shape" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@id/toolbar"
|
android:id="@id/toolbar"
|
||||||
|
|
Loading…
Reference in a new issue