Set Wi-Fi DPP fragment icons.
1. set fragment icon for WifiDppChooseSavedWifiNetworkFragment 2. set fragment icon of success for WifiDppAddDeviceFragment All Wi-Fi DPP fragment icons are VectorDrawable of instinct size 24dp draw on a 48dp canvas. Except for ic_devices_check_circle_green, it's a LayerDrawable of different size. I dynamically change ImageView layout width & height between these 2 different kind of drawable. Bug: 122982132 Test: manual test Change-Id: Idab8cd8b0798363e447da00dc6bc68a86498b8be
This commit is contained in:
30
res/drawable/ic_devices_check_circle_green.xml
Normal file
30
res/drawable/ic_devices_check_circle_green.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_devices_other_opaque_black"
|
||||
android:width="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:height="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:gravity="center"/>
|
||||
|
||||
<item
|
||||
android:drawable="@drawable/ic_check_circle_green"
|
||||
android:top="28dp"
|
||||
android:left="44dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
</layer-list>
|
@@ -28,8 +28,16 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_width="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:layout_height="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<!-- Special header icon only for ic_devices_check_circle_green -->
|
||||
<ImageView
|
||||
android:id="@+id/devices_check_circle_green_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_devices_check_circle_green"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<TextView
|
||||
|
@@ -385,6 +385,9 @@
|
||||
<dimen name="qrcode_size">264dp</dimen>
|
||||
<dimen name="qrcode_preview_size">360dp</dimen>
|
||||
|
||||
<!-- Wi-Fi DPP fragment icon size -->
|
||||
<dimen name="wifi_dpp_fragment_icon_width_height">48dp</dimen>
|
||||
|
||||
<!-- Height for slice preference, which contains 6 items at most -->
|
||||
<dimen name="slice_preference_group_height">360dp</dimen>
|
||||
</resources>
|
||||
|
@@ -55,7 +55,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
@Override
|
||||
public void onConfiguratorSuccess(int code) {
|
||||
// Update success UI.
|
||||
mHeaderIcon.setImageResource(R.drawable.ic_check_circle_green);
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
|
||||
mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
|
||||
mSummary.setVisibility(View.INVISIBLE);
|
||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
|
||||
@@ -110,7 +110,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mHeaderIcon.setImageResource(R.drawable.ic_devices_other_opaque_black);
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_other_opaque_black);
|
||||
|
||||
final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
|
||||
.getWifiDppQrCode();
|
||||
|
@@ -82,6 +82,8 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
setHeaderIconImageResource(R.drawable.ic_wifi_signal_4);
|
||||
|
||||
mTitle.setText(R.string.wifi_dpp_choose_network);
|
||||
mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
|
||||
|
||||
|
@@ -21,6 +21,7 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,8 @@ import com.android.settings.core.InstrumentedFragment;
|
||||
* {@code WifiDppAddDeviceFragment}
|
||||
*/
|
||||
public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
|
||||
protected ImageView mHeaderIcon;
|
||||
private ImageView mHeaderIcon;
|
||||
private ImageView mDevicesCheckCircleGreenHeaderIcon;
|
||||
protected TextView mTitle;
|
||||
protected TextView mSummary;
|
||||
|
||||
@@ -42,7 +44,22 @@ public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mHeaderIcon = view.findViewById(android.R.id.icon);
|
||||
mDevicesCheckCircleGreenHeaderIcon =
|
||||
view.findViewById(R.id.devices_check_circle_green_icon);
|
||||
mTitle = view.findViewById(android.R.id.title);
|
||||
mSummary = view.findViewById(android.R.id.summary);
|
||||
}
|
||||
|
||||
protected void setHeaderIconImageResource(int resId) {
|
||||
// ic_devices_check_circle_green is a LayerDrawable,
|
||||
// it has different size from other VectorDrawable icons
|
||||
if (resId == R.drawable.ic_devices_check_circle_green) {
|
||||
mHeaderIcon.setVisibility(View.GONE);
|
||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.GONE);
|
||||
mHeaderIcon.setImageResource(resId);
|
||||
mHeaderIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -124,7 +124,8 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
||||
|
||||
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
||||
|
||||
mHeaderIcon.setImageResource(R.drawable.ic_qrcode_24dp);
|
||||
setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
|
||||
|
||||
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
||||
mTitle.setText(R.string.wifi_dpp_share_wifi);
|
||||
mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
|
||||
|
@@ -171,7 +171,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
|
||||
mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
|
||||
|
||||
mHeaderIcon.setImageResource(R.drawable.ic_scan_24dp);
|
||||
setHeaderIconImageResource(R.drawable.ic_scan_24dp);
|
||||
if (mIsConfiguratorMode) {
|
||||
mTitle.setText(R.string.wifi_dpp_add_device_to_network);
|
||||
|
||||
|
Reference in New Issue
Block a user