2017-02-06 4 views
2

Я пытаюсь изменить свой SystemUI, чтобы статус сотового сигнала больше напоминал AOSP. Я заменил необходимые изображения, но теперь макет неправильный.Редактирование SystemUI Layout XMLs

Прямо сейчас, это выглядит следующим образом: enter image description here На AOSP, это выглядит следующим образом: enter image description here

Цель состоит в том, чтобы иметь значок E и стрелки данных фактически перекрываются с барным сигналом треугольником.

Я нашел правильный XML (/res/layout/mobile_signal_group.xml) в SystemUI APK. Это оригинал:

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout android:id="@id/mobile_slot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="@dimen/signal_cluster_padding" 
    xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto"> 
    <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <ImageView android:id="@id/slot_no_sims" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/accessibility_no_sims" /> 
     <LinearLayout android:orientation="horizontal" android:id="@id/data_combo" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> 
       <ImageView android:id="@id/data_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
       <ImageView android:id="@id/data_inout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      </FrameLayout> 
     </LinearLayout> 
     <FrameLayout android:id="@id/mobile_combo" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <ImageView android:id="@id/mobile_sim_icon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneLightTheme" android:id="@id/mobile_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" systemui:hasOverlappingRendering="false" /> 
      <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneDarkTheme" android:id="@id/mobile_signal_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.0" systemui:hasOverlappingRendering="false" /> 
      <ImageView android:id="@id/mobile_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      <ImageView android:layout_gravity="end|bottom|center" android:id="@id/mobile_inout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
     </FrameLayout> 
     <FrameLayout android:id="@id/mobile_combo_2stage" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <ImageView android:layout_gravity="bottom|center" android:id="@id/data_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      <ImageView android:id="@id/data_rat_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      <ImageView android:id="@id/voice_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
      <ImageView android:id="@id/voice_rat_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
     </FrameLayout> 
    </LinearLayout> 
</FrameLayout> 

Я изменил его, принимая @id/data_type и @id/data_inout и перемещение их быть прямо под @id/mobile_sim_icon:

<FrameLayout android:id="@id/mobile_combo" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
    <ImageView android:id="@id/mobile_sim_icon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
    <ImageView android:id="@id/data_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
    <ImageView android:id="@id/data_inout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
    <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneLightTheme" android:id="@id/mobile_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" systemui:hasOverlappingRendering="false" /> 
    <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneDarkTheme" android:id="@id/mobile_signal_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.0" systemui:hasOverlappingRendering="false" /> 
    <ImageView android:id="@id/mobile_type" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
    <ImageView android:layout_gravity="end|bottom|center" android:id="@id/mobile_inout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
</FrameLayout> 

(Сокращенный фрагмент кода)

Но когда я это делаю и flash с измененным XML, SystemUI переходит в цикл запуска при сбое. Кажется, что любое изменение, которое я делаю в XML, вызывает это. Я довольно новичок в этом, так что, возможно, я пропустил шаг.

До сих пор я пытался:

  • Перемещение data-type, data-inout в другой FrameLayout
  • Перемещение весь LinearLayout в FrameLayout
  • Обертывание data_combo LinearLayout вокруг mobile_combo FrameLayout

Все результаты в SystemUI застревают в цикле аварий.

Есть ли что-нибудь еще, что я могу попробовать?

Прибор:

  • LG V20 T-Mobile (H918)
  • Android 7,0
+0

Я предполагаю, что вы случайно удалили представление, которое использует SignalClusterView или его эквивалент AOSP 7. Является ли '@ id/mobile_combo_2stage' еще внизу? Можете ли вы разместить логарифм? –

+0

@MichaelDodd Я должен был указать; второй фрагмент кода - это только соответствующий раздел, а не весь XML. Я не могу публиковать logcat, досадно, потому что ADB не работает, когда SystemUI находится в цикле. – TheWanderer

+0

Является ли '@ id/data_combo' ссылкой в ​​любом месте кода? Если вы переместили '@ id/data_inout' и' @ id/data_type' в '@ id/mobile_combo', может быть, что .java-файл все еще ищет эти представления в качестве дочернего элемента' data_combo'. Попробуйте повторно установить '@ id/data_combo' как пустой' LinearLayout' и посмотреть, не исправляет ли это что-то. –

ответ

1

Как обсуждалось in the chat, то SystemUI происходит сбой из-за NullPointerException при перемещении @id/data_type и @id/data_inout снаружи от @id/data_combo. Это связано с тем, что findViewbyId() вызывается против R.id.data_combo, и поэтому ищет прямого потомка @id/data_combo.

Как вы не имеете доступа к источникам Java, один обходной путь, чтобы обернуть вокруг @id/data_combo@id/mobile_combo так что @id/data_type и @id/data_inout остаются прямыми потомками @id/data_combo. Например:

<LinearLayout android:id="@id/data_combo" ... > 
    <FrameLayout android:id="@id/mobile_combo" ... > 
     ... 
    </FrameLayout> 
</LinearLayout>