Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e3a35eb authored by Sid Soundararajan's avatar Sid Soundararajan
Browse files

Add Rounded corners to cards.

BUG: 27953508
Change-Id: Id911ad10d318d1fb3ea174869f96fec4b38b4c69
parent 7f5b3e59
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project

     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.
-->

<shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">

    <solid
            android:color="@color/recents_tv_card_background_color"/>
    <corners
            android:radius="@dimen/recents_tv_card_corner_radius" />
</shape>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
            android:layout_height="@dimen/recents_tv_screenshot_height"
            android:gravity="center"
            android:orientation="vertical"
            android:background="@color/recents_tv_card_background_color"
            android:background="@drawable/recents_tv_card_thumbnail_background"
            android:layout_centerHorizontal="true" >

        <ImageView
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
    <dimen name="recents_tv_icon_padding_bottom">8dip</dimen>
    <dimen name="recents_tv_text_padding_start">12dip</dimen>
    <dimen name="recents_tv_text_padding_bottom">12dip</dimen>
    <dimen name="recents_tv_card_corner_radius">2dip</dimen>

    <!-- Padding for grid view in recents view on tv -->
    <dimen name="recents_tv_gird_row_top_margin">215dip</dimen>
+14 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Outline;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -30,6 +31,7 @@ import android.util.TypedValue;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -49,6 +51,7 @@ public class TaskCardView extends LinearLayout {
    private ImageView mBadgeView;
    private Task mTask;
    private boolean mDismissState;
    private int mCornerRadius;

    private ViewFocusAnimator mViewFocusAnimator;
    private DismissAnimationsHolder mDismissAnimationsHolder;
@@ -77,6 +80,8 @@ public class TaskCardView extends LinearLayout {
        mBadgeView = (ImageView) findViewById(R.id.card_extra_badge);
        mDismissAnimationsHolder = new DismissAnimationsHolder(this);
        View title = findViewById(R.id.card_info_field);
        mCornerRadius = getResources().getDimensionPixelSize(
                R.dimen.recents_task_view_rounded_corners_radius);
        mRecentsRowFocusAnimationHolder = new RecentsRowFocusAnimationHolder(this, title);
        mViewFocusAnimator = new ViewFocusAnimator(this);
    }
@@ -272,13 +277,18 @@ public class TaskCardView extends LinearLayout {

    private void setAsScreenShotView(Bitmap screenshot, ImageView screenshotView) {
        LayoutParams lp = (LayoutParams) screenshotView.getLayoutParams();
        lp.width = getResources()
                .getDimensionPixelSize(R.dimen.recents_tv_card_width);
        lp.height = getResources()
                .getDimensionPixelSize(R.dimen.recents_tv_screenshot_height);
        lp.width = LayoutParams.MATCH_PARENT;
        lp.height = LayoutParams.MATCH_PARENT;

        screenshotView.setLayoutParams(lp);
        screenshotView.setImageBitmap(screenshot);
        screenshotView.setClipToOutline(true);
        screenshotView.setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mCornerRadius);
            }
        });
    }

    private void setAsBannerView(Drawable banner, ImageView bannerView) {