處理通話(接通/撥打)時,通話信息閃動的問題

      mt8735系統平臺的工業平板,有這樣一個情況:撥打電話時,會出現畫面殘留。以及出現來去電人信息的界面閃動的問題。問題動圖描述如下:
 
      引起上文描述的問題的原因是:撥通電話時,出現的畫面殘留,是因爲電話聯繫人信息欄的橫向寬度不夠;而通話時,會有一個動畫效果,導致聯繫人信息以及其他相關聯的內容在閃動

解決過程:
1. 首先,增大
primary_call_info_container的寬度,也就是電話聯繫人信息欄的橫向寬度,在聯繫人信息很長時,可以顯示更多的內容。
需要修改的代碼位於:packages/apps/InCallUI/res/layout-land/call_card_content.xml 文件夾下,帶“-”號代表修改前的內容,帶“+”號代表修改後的內容。
只需要將android:layout_width=“424dp” ,這裏424dp是根據工業平板使用的7寸1027*600顯示屏而定的。
<LinearLayout
android:id="@+id/primary_call_info_container"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
- android:layout_width="wrap_content"
+ android:layout_width="424dp"
android:layout_height="match_parent"
android: orientation="vertical"
android:elevation="@dimen/primary_call_elevation"

2. 其次,優化來去電信息欄中的聯繫人字體大小、行間距等
在 packages/apps/InCallUI/res_ext/layout-land/primary_call_info.xml 文件下進行修改
(1)增大聯繫人信息顯示的長度、行間距、字體大小
        <!-- Name (or the phone number, if we don't have a name to display). -->
        <com.android.phone.common.widget.ResizingTextTextView android:id="@+id/name"

         xmlns:ex="http://schemas.android.com/apk/res-auto"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:maxWidth="260dp"
+        android:maxWidth="424dp"      <!-- 聯繫人信息顯示的長度 -->
         android:layout_gravity="start"
-        android:layout_marginTop="-5dp"
+        android:layout_marginTop="10dp"  <!-- 聯繫人信息顯示的距離下一信息的寬度 -->
         android:fontFamily="sans-serif-light"
         android:textAppearance="?android:attr/textAppearanceLarge"
-        android:textSize="@dimen/call_name_text_size"
+        android:textSize="26sp"  <!-- 聯繫人信息顯示的字體大小 -->
         android:singleLine="true"
-        ex:resizing_text_min_size="@dimen/call_name_text_min_size" />
-
+        ex:resizing_text_min_size="26sp" />  <!--限定 聯繫人信息顯示的最小字體大小 -->

(2)增大電話號碼顯示寬度
                 <TextView android:id="@+id/phoneNumber"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:maxWidth="130dp"
+                    android:maxWidth="424dp"  <!-- 增大電話號碼顯示寬度 -->
                     android:layout_marginStart="6dp"

3.  最後,處理通話(接通/撥打)時,通話信息閃動的問題
在xml中將佈局文件處理好之後,需要處理Java代碼,去除引起通話(接通/撥打)時,通話信息閃動這個問題的動畫效果。這動畫效果是文字透明度的伽馬值在變化,因此去掉該變化即可。
在 packages/apps/InCallUI/src/com/android/incallui/CallCardFragment.java 文件的 animateForNewOutgoingCall 方法中,註釋掉語句:

  1. /*mCallButtonsContainer.setAlpha(0);
  2.                 mCallStateLabel.setAlpha(0);
  3.                 mPrimaryName.setAlpha(0);
  4.                 mCallTypeLabel.setAlpha(0);
  5.                 mCallNumberAndLabel.setAlpha(0);

  6.                 final Animator animator = getOutgoingCallAnimator(touchPoint,
  7.                         parent.getHeight(), originalHeight, showCircularReveal);

  8.                 animator.addListener(new AnimatorListenerAdapter() {
  9.                     @Override
  10.                     public void onAnimationEnd(Animator animation) {
  11.                         setViewStatePostAnimation(listener);
  12.                     }
  13.                 });
  14.                 animator.start();*/

4. 
處理後的效果:

 
發佈了107 篇原創文章 · 獲贊 31 · 訪問量 22萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章