When offline show a list of countries with phone support.
Bug: 29105266 TODO: - Support phones UI for international travel - Selecting default country - Show operation hours for selected country Change-Id: I08a6780497dfcb9b9dc8670f2705d01df021c57b
This commit is contained in:
52
src/com/android/settings/support/SupportPhone.java
Normal file
52
src/com/android/settings/support/SupportPhone.java
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.support;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* Data model for a support phone number.
|
||||
*/
|
||||
public final class SupportPhone {
|
||||
|
||||
public final String language;
|
||||
public final String number;
|
||||
public final boolean isTollFree;
|
||||
|
||||
public SupportPhone(String config) throws ParseException {
|
||||
// Config follows this format: language:[tollfree|tolled]:number
|
||||
final String[] tokens = config.split(":");
|
||||
if (tokens.length != 3) {
|
||||
throw new ParseException("Phone config is invalid " + config, 0);
|
||||
}
|
||||
language = tokens[0];
|
||||
isTollFree = TextUtils.equals(tokens[1], "tollfree");
|
||||
number = tokens[2];
|
||||
}
|
||||
|
||||
public Intent getDialIntent() {
|
||||
return new Intent(Intent.ACTION_DIAL)
|
||||
.setData(new Uri.Builder()
|
||||
.scheme("tel")
|
||||
.appendPath(number)
|
||||
.build());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user