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

Commit 106ff4ff authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Show tolled support number when click travel abroad." into nyc-mr1-dev

parents d65b27a0 3737fabd
Loading
Loading
Loading
Loading
+29 −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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?android:attr/colorAccent">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36
        1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0
         -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57
         0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
</vector>
+37 −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.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="24dp">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="16dp"
        android:text="@string/support_international_phone_summary"/>
    <TextView
        android:id="@+id/phone_number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:attr/selectableItemBackground"
        android:drawableLeft="@drawable/ic_call_24dp"
        android:drawablePadding="16dp"
        android:gravity="center_vertical"
        android:minHeight="48dp"
        android:textAppearance="@style/TextAppearance.TileTitle"/>
</LinearLayout>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -7530,6 +7530,11 @@
    <!-- Template for formatting country and language. eg Canada - French [CHAR LIMIT=NONE]-->
    <string name="support_country_format"><xliff:g id="country" example="Canada">%s</xliff:g> - <xliff:g id="language" example="French">%s</xliff:g></string>
    <!-- Template for formatting phone number and language. eg English (800-000-0000) [CHAR LIMIT=NONE]-->
    <string name ="support_phone_international_format">
        <xliff:g id="language" example="English">%s</xliff:g> (<xliff:g id="phone" example="800-000-0000">%s</xliff:g>)
    </string>
    <!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]-->
    <string name="support_offline_title">You\'re offline</string>
+11 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.settings.R;
import com.android.settings.overlay.SupportFeatureProvider;
import com.android.settings.support.SupportDisclaimerDialogFragment;
import com.android.settings.support.SupportPhone;
import com.android.settings.support.SupportPhoneDialogFragment;

import java.util.ArrayList;
import java.util.List;
@@ -376,19 +377,27 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
                }
            } else {
                switch (v.getId()) {
                    case android.R.id.text1:
                    case android.R.id.text1: {
                        final SupportPhone phone = mSupportFeatureProvider
                                .getSupportPhones(mSelectedCountry, true /* isTollFree */);
                        if (phone != null) {
                            mActivity.startActivity(phone.getDialIntent());
                        }
                        break;
                    case android.R.id.text2:
                    }
                    case android.R.id.text2: {
                        final SupportPhone phone = mSupportFeatureProvider
                                .getSupportPhones(mSelectedCountry, false /* isTollFree */);
                        final SupportPhoneDialogFragment fragment =
                                SupportPhoneDialogFragment.newInstance(phone);
                        fragment.show(mActivity.getFragmentManager(),
                                SupportPhoneDialogFragment.TAG);
                        break;
                    }
                }
            }
        }
    }

    private final class SpinnerItemSelectListener implements AdapterView.OnItemSelectedListener {

+33 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.settings.support;

import android.content.Intent;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.text.ParseException;
@@ -25,7 +27,7 @@ import java.text.ParseException;
/**
 * Data model for a support phone number.
 */
public final class SupportPhone {
public final class SupportPhone implements Parcelable {

    public final String language;
    public final String number;
@@ -42,6 +44,12 @@ public final class SupportPhone {
        number = tokens[2];
    }

    protected SupportPhone(Parcel in) {
        language = in.readString();
        number = in.readString();
        isTollFree = in.readInt() != 0;
    }

    public Intent getDialIntent() {
        return new Intent(Intent.ACTION_DIAL)
                .setData(new Uri.Builder()
@@ -49,4 +57,28 @@ public final class SupportPhone {
                        .appendPath(number)
                        .build());
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(language);
        dest.writeString(number);
        dest.writeInt(isTollFree ? 1 : 0);
    }

    public static final Creator<SupportPhone> CREATOR = new Creator<SupportPhone>() {
        @Override
        public SupportPhone createFromParcel(Parcel in) {
            return new SupportPhone(in);
        }

        @Override
        public SupportPhone[] newArray(int size) {
            return new SupportPhone[size];
        }
    };
}
Loading