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

Commit 7eace292 authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov
Browse files

Clean up unused Views in AudioRecordingDisclosureBar

Bug: 166459250
Test: make, flash
Test: atest CtsSystemUiTestCases:MicIndicatorTest
Change-Id: I249cc29597d3c2891c23ccb2ed979bd46d5e4a78
parent c61053fb
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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">

  <corners
      android:bottomLeftRadius="8dp"
      android:topLeftRadius="8dp" />
  <solid android:color="@color/tv_audio_recording_indicator_background" />

</shape>
 No newline at end of file
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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">

  <corners
      android:bottomRightRadius="8dp"
      android:topRightRadius="8dp" />
  <solid android:color="@color/tv_audio_recording_indicator_background" />

</shape>
 No newline at end of file
+9 −72
Original line number Diff line number Diff line
@@ -22,27 +22,6 @@
              android:padding="12dp">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/icon_texts_container"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent">

                <View
                    android:id="@+id/icon_container_bg"
                    android:layout_width="50dp"
                    android:layout_height="match_parent"
                    android:background="@drawable/tv_rect_dark_left_rounded"/>

                <FrameLayout
                    android:id="@+id/icon_mic"
        android:layout_width="34dp"
        android:layout_height="24dp"
        android:layout_gravity="center"
@@ -52,50 +31,8 @@
            android:layout_width="13dp"
            android:layout_height="13dp"
            android:layout_gravity="center"
                        android:background="@drawable/tv_ic_mic_white"/>
                </FrameLayout>

            </FrameLayout>

            <LinearLayout
                android:id="@+id/texts_container"
                android:layout_width="wrap_content"
                android:layout_height="47dp"
                android:background="@color/tv_audio_recording_indicator_background"
                android:orientation="vertical"
                android:visibility="visible">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="14dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="1dp"
                    android:text="@string/mic_active"
                    android:textColor="@android:color/white"
                    android:fontFamily="sans-serif"
                    android:textSize="10dp"/>

                <TextView
                    android:id="@+id/text"
                    android:layout_width="wrap_content"
                    android:layout_height="14dp"
                    android:singleLine="true"
                    android:text="SomeApplication accessed your microphone"
                    android:textColor="@android:color/white"
                    android:fontFamily="sans-serif"
                    android:textSize="8dp"/>

            </LinearLayout>

        </LinearLayout>
            android:src="@drawable/tv_ic_mic_white"/>

    </FrameLayout>

    <View
        android:id="@+id/bg_end"
        android:layout_width="12dp"
        android:layout_height="47dp"
        android:background="@drawable/tv_rect_dark_right_rounded"
        android:visibility="visible"/>

</LinearLayout>
+0 −2
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@
    <color name="recents_tv_dismiss_text_color">#7FEEEEEE</color>
    <color name="recents_tv_text_shadow_color">#7F000000</color>

    <!-- Background color for audio recording indicator (G800) -->
    <color name="tv_audio_recording_indicator_background">#FF3C4043</color>
    <color name="tv_audio_recording_indicator_icon_background">#CC000000</color>
    <color name="tv_audio_recording_indicator_stroke">#33FFFFFF</color>

+2 −31
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.TextView;

import com.android.systemui.R;
import com.android.systemui.statusbar.tv.TvStatusBar;
@@ -89,12 +88,6 @@ public class AudioRecordingDisclosureBar implements
    private boolean mIsEnabled;

    private View mIndicatorView;
    private View mIconTextsContainer;
    private View mIconContainerBg;
    private View mIcon;
    private View mBgEnd;
    private View mTextsContainers;
    private TextView mTextView;
    private boolean mIsLtr;

    @State private int mState = STATE_STOPPED;
@@ -221,21 +214,6 @@ public class AudioRecordingDisclosureBar implements
        mIndicatorView = LayoutInflater.from(mContext).inflate(
                R.layout.tv_audio_recording_indicator,
                null);
        mIconTextsContainer = mIndicatorView.findViewById(R.id.icon_texts_container);
        mIconContainerBg = mIconTextsContainer.findViewById(R.id.icon_container_bg);
        mIcon = mIconTextsContainer.findViewById(R.id.icon_mic);
        mTextsContainers = mIconTextsContainer.findViewById(R.id.texts_container);
        mTextView = mTextsContainers.findViewById(R.id.text);
        mBgEnd = mIndicatorView.findViewById(R.id.bg_end);

        mTextsContainers.setVisibility(View.GONE);
        mIconContainerBg.setVisibility(View.GONE);
        mTextView.setVisibility(View.GONE);
        mBgEnd.setVisibility(View.GONE);
        mTextsContainers = null;
        mIconContainerBg = null;
        mTextView = null;
        mBgEnd = null;

        // Initially change the visibility to INVISIBLE, wait until and receives the size and
        // then animate it moving from "off" the screen correctly
@@ -305,12 +283,11 @@ public class AudioRecordingDisclosureBar implements
    private void hide() {
        if (DEBUG) Log.d(TAG, "Hide indicator");

        final int targetOffset = (mIsLtr ? 1 : -1) * (mIndicatorView.getWidth()
                - (int) mIconTextsContainer.getTranslationX());
        final int targetOffset = (mIsLtr ? 1 : -1) * mIndicatorView.getWidth();
        final AnimatorSet set = new AnimatorSet();
        set.playTogether(
                ObjectAnimator.ofFloat(mIndicatorView, View.TRANSLATION_X, targetOffset),
                ObjectAnimator.ofFloat(mIcon, View.ALPHA, 0f));
                ObjectAnimator.ofFloat(mIndicatorView, View.ALPHA, 0f));
        set.setDuration(ANIMATION_DURATION);
        set.addListener(
                new AnimatorListenerAdapter() {
@@ -363,12 +340,6 @@ public class AudioRecordingDisclosureBar implements
        windowManager.removeView(mIndicatorView);

        mIndicatorView = null;
        mIconTextsContainer = null;
        mIconContainerBg = null;
        mIcon = null;
        mTextsContainers = null;
        mTextView = null;
        mBgEnd = null;
    }

    private static List<String> splitByComma(String string) {