diff options
author | Takeshi Hagikura <thagikura@google.com> | 2017-05-10 17:09:57 +0900 |
---|---|---|
committer | Takeshi Hagikura <thagikura@google.com> | 2017-05-13 09:26:53 +0900 |
commit | 881eab6a6c90a13e586bcf841ca4eae6ede4c1c2 (patch) | |
tree | c8c053ae83244e1870b2880dcd4caf3edde2a9e1 /ui/fonts | |
parent | 72aa39e2037d60b40c83376dcfc110a5ca0e8d31 (diff) | |
download | android-881eab6a6c90a13e586bcf841ca4eae6ede4c1c2.tar.gz |
Downloadable Font sample.
This sample demonstrates how to request to download a font:
- From Java code
- By declarating it in the XML in advance of the usage
This sample uses a GmsCore as the font pvovider, to run the sample app,
the device needs to install at least V11 of GmsCore.
Test: Manual
Change-Id: I3c3a10f08d4f65f943eea8cf406a20d89d1318df
Diffstat (limited to 'ui/fonts')
37 files changed, 2193 insertions, 0 deletions
diff --git a/ui/fonts/DownloadableFonts/app/build.gradle b/ui/fonts/DownloadableFonts/app/build.gradle new file mode 100644 index 00000000..203427e2 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 'android-O' + buildToolsVersion "26.0.0 rc2" + + defaultConfig { + applicationId "com.example.android.downloadablefonts" + // Once API level 26 SDK is launched, lower the minSdkVersion. + // At this moment, an app targeting the preview version of the SDK only runs on the + // preview device. + minSdkVersion 'O' + targetSdkVersion 'O' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } + + dependencies { + compile 'com.android.support:appcompat-v7:26.0.0-beta1' + compile 'com.android.support:design:26.0.0-beta1' + compile 'com.android.support:cardview-v7:26.0.0-beta1' + } +} diff --git a/ui/fonts/DownloadableFonts/app/src/main/AndroidManifest.xml b/ui/fonts/DownloadableFonts/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..68ed0a2f --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/AndroidManifest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.downloadablefonts"> + + <application + android:label="@string/app_name" + android:icon="@mipmap/ic_launcher" + android:roundIcon="@mipmap/ic_launcher_round" + android:theme="@style/AppTheme" + android:allowBackup="true"> + + <meta-data android:name="preloaded_fonts" android:resource="@array/preloaded_fonts" /> + + <activity android:name="com.example.android.downloadablefonts.MainActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + </application> +</manifest> diff --git a/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/Constants.java b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/Constants.java new file mode 100644 index 00000000..ca59c9ca --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/Constants.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 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.example.android.downloadablefonts; + +/** + * Constants class + */ +class Constants { + + static final int WIDTH_DEFAULT = 100; + static final int WIDTH_MAX = 1000; + static final int WIDTH_MIN = 0; + + static final int WEIGHT_DEFAULT = 400; + static final int WEIGHT_MAX = 1000; + static final int WEIGHT_MIN = 0; + + static final float ITALIC_DEFAULT = 0f; + static final float ITALIC_MAX = 1f; + static final float ITALIC_MIN = 0f; +} diff --git a/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/MainActivity.java b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/MainActivity.java new file mode 100644 index 00000000..4d9fdd34 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/MainActivity.java @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2017 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.example.android.downloadablefonts; + +import android.graphics.Typeface; +import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.support.design.widget.TextInputLayout; +import android.support.v4.provider.FontRequest; +import android.support.v4.provider.FontsContractCompat; +import android.support.v4.util.ArraySet; +import android.support.v7.app.AppCompatActivity; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.ProgressBar; +import android.widget.SeekBar; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.Arrays; + +import static com.example.android.downloadablefonts.Constants.ITALIC_DEFAULT; +import static com.example.android.downloadablefonts.Constants.WEIGHT_DEFAULT; +import static com.example.android.downloadablefonts.Constants.WEIGHT_MAX; +import static com.example.android.downloadablefonts.Constants.WIDTH_DEFAULT; +import static com.example.android.downloadablefonts.Constants.WIDTH_MAX; + +public class MainActivity extends AppCompatActivity { + + private static final String TAG = "MainActivity"; + + private Handler mHandler = null; + + private TextView mDownloadableFontTextView; + private SeekBar mWidthSeekBar; + private SeekBar mWeightSeekBar; + private SeekBar mItalicSeekBar; + private CheckBox mBestEffort; + private Button mRequestDownloadButton; + + private ArraySet<String> mFamilyNameSet; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + initializeSeekBars(); + mFamilyNameSet = new ArraySet<>(); + mFamilyNameSet.addAll(Arrays.asList(getResources().getStringArray(R.array.family_names))); + + mDownloadableFontTextView = findViewById(R.id.textview); + ArrayAdapter<String> adapter = new ArrayAdapter<>(this, + android.R.layout.simple_dropdown_item_1line, + getResources().getStringArray(R.array.family_names)); + final TextInputLayout familyNameInput = findViewById(R.id.auto_complete_family_name_input); + final AutoCompleteTextView autoCompleteFamilyName = findViewById( + R.id.auto_complete_family_name); + autoCompleteFamilyName.setAdapter(adapter); + autoCompleteFamilyName.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int start, int count, + int after) { + // No op + } + + @Override + public void onTextChanged(CharSequence charSequence, int start, int count, int after) { + if (isValidFamilyName(charSequence.toString())) { + familyNameInput.setErrorEnabled(false); + familyNameInput.setError(""); + } else { + familyNameInput.setErrorEnabled(true); + familyNameInput.setError(getString(R.string.invalid_family_name)); + } + } + + @Override + public void afterTextChanged(Editable editable) { + // No op + } + }); + + mRequestDownloadButton = findViewById(R.id.button_request); + mRequestDownloadButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String familyName = autoCompleteFamilyName.getText().toString(); + if (!isValidFamilyName(familyName)) { + familyNameInput.setErrorEnabled(true); + familyNameInput.setError(getString(R.string.invalid_family_name)); + Toast.makeText( + MainActivity.this, + R.string.invalid_input, + Toast.LENGTH_SHORT).show(); + return; + } + requestDownload(familyName); + mRequestDownloadButton.setEnabled(false); + } + }); + mBestEffort = findViewById(R.id.checkbox_best_effort); + } + + private void requestDownload(String familyName) { + QueryBuilder queryBuilder = new QueryBuilder(familyName) + .withWidth(progressToWidth(mWidthSeekBar.getProgress())) + .withWeight(progressToWeight(mWeightSeekBar.getProgress())) + .withItalic(progressToItalic(mItalicSeekBar.getProgress())) + .withBestEffort(mBestEffort.isChecked()); + String query = queryBuilder.build(); + + Log.d(TAG, "Requesting a font. Query: " + query); + FontRequest request = new FontRequest( + "com.google.android.gms.fonts", + "com.google.android.gms", + query, + R.array.com_google_android_gms_fonts_certs); + + final ProgressBar progressBar = findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + FontsContractCompat.FontRequestCallback callback = new FontsContractCompat + .FontRequestCallback() { + @Override + public void onTypefaceRetrieved(Typeface typeface) { + mDownloadableFontTextView.setTypeface(typeface); + progressBar.setVisibility(View.GONE); + mRequestDownloadButton.setEnabled(true); + } + + @Override + public void onTypefaceRequestFailed(int reason) { + Toast.makeText(MainActivity.this, + getString(R.string.request_failed, reason), Toast.LENGTH_LONG) + .show(); + progressBar.setVisibility(View.GONE); + mRequestDownloadButton.setEnabled(true); + } + }; + FontsContractCompat + .requestFont(MainActivity.this, request, callback, + getHandlerThreadHandler()); + } + + private void initializeSeekBars() { + mWidthSeekBar = findViewById(R.id.seek_bar_width); + int widthValue = (int) (100 * (float) WIDTH_DEFAULT / (float) WIDTH_MAX); + mWidthSeekBar.setProgress(widthValue); + final TextView widthTextView = findViewById(R.id.textview_width); + widthTextView.setText(String.valueOf(widthValue)); + mWidthSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + widthTextView + .setText(String.valueOf(progressToWidth(progress))); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + + mWeightSeekBar = findViewById(R.id.seek_bar_weight); + float weightValue = (float) WEIGHT_DEFAULT / (float) WEIGHT_MAX * 100; + mWeightSeekBar.setProgress((int) weightValue); + final TextView weightTextView = findViewById(R.id.textview_weight); + weightTextView.setText(String.valueOf(WEIGHT_DEFAULT)); + mWeightSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + weightTextView + .setText(String.valueOf(progressToWeight(progress))); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + + mItalicSeekBar = findViewById(R.id.seek_bar_italic); + mItalicSeekBar.setProgress((int) ITALIC_DEFAULT); + final TextView italicTextView = findViewById(R.id.textview_italic); + italicTextView.setText(String.valueOf(ITALIC_DEFAULT)); + mItalicSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromuser) { + italicTextView + .setText(String.valueOf(progressToItalic(progress))); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + } + + private boolean isValidFamilyName(String familyName) { + return familyName != null && mFamilyNameSet.contains(familyName); + } + + private Handler getHandlerThreadHandler() { + if (mHandler == null) { + HandlerThread handlerThread = new HandlerThread("fonts"); + handlerThread.start(); + mHandler = new Handler(handlerThread.getLooper()); + } + return mHandler; + } + + /** + * Converts progress from a SeekBar to the value of width. + * @param progress is passed from 0 to 100 inclusive + * @return the converted width + */ + private float progressToWidth(int progress) { + return progress == 0 ? 1 : progress * WIDTH_MAX / 100; + } + + /** + * Converts progress from a SeekBar to the value of weight. + * @param progress is passed from 0 to 100 inclusive + * @return the converted weight + */ + private int progressToWeight(int progress) { + if (progress == 0) { + return 1; // The range of the weight is between (0, 1000) (exclusive) + } else if (progress == 100) { + return WEIGHT_MAX - 1; // The range of the weight is between (0, 1000) (exclusive) + } else { + return WEIGHT_MAX * progress / 100; + } + } + + /** + * Converts progress from a SeekBar to the value of italic. + * @param progress is passed from 0 to 100 inclusive. + * @return the converted italic + */ + private float progressToItalic(int progress) { + return (float) progress / 100f; + } +} diff --git a/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/QueryBuilder.java b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/QueryBuilder.java new file mode 100644 index 00000000..1a2596c9 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/java/com/example/android/downloadablefonts/QueryBuilder.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2017 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.example.android.downloadablefonts; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +/** + * Builder class for constructing a query for downloading a font. + */ +class QueryBuilder { + + @NonNull + private String mFamilyName; + + @Nullable + private Float mWidth = null; + + @Nullable + private Integer mWeight = null; + + @Nullable + private Float mItalic = null; + + @Nullable + private Boolean mBesteffort = null; + + QueryBuilder(@NonNull String familyName) { + mFamilyName = familyName; + } + + QueryBuilder withFamilyName(@NonNull String familyName) { + mFamilyName = familyName; + return this; + } + + QueryBuilder withWidth(float width) { + if (width <= Constants.WIDTH_MIN) { + throw new IllegalArgumentException("Width must be more than 0"); + } + mWidth = width; + return this; + } + + QueryBuilder withWeight(int weight) { + if (weight <= Constants.WEIGHT_MIN || weight >= Constants.WEIGHT_MAX) { + throw new IllegalArgumentException( + "Weight must be between 0 and 1000 (exclusive)"); + } + mWeight = weight; + return this; + } + + QueryBuilder withItalic(float italic) { + if (italic < Constants.ITALIC_MIN || italic > Constants.ITALIC_MAX) { + throw new IllegalArgumentException("Italic must be between 0 and 1 (inclusive)"); + } + mItalic = italic; + return this; + } + + QueryBuilder withBestEffort(boolean bestEffort) { + mBesteffort = bestEffort; + return this; + } + + String build() { + if (mWeight == null && mWidth == null && mItalic == null && mBesteffort == null) { + return mFamilyName; + } + StringBuilder builder = new StringBuilder(); + builder.append("name=").append(mFamilyName); + if (mWeight != null) { + builder.append("&weight=").append(mWeight); + } + if (mWidth != null) { + builder.append("&width=").append(mWidth); + } + if (mItalic != null) { + builder.append("&italic=").append(mItalic); + } + if (mBesteffort != null) { + builder.append("&besteffort=").append(mBesteffort); + } + return builder.toString(); + } +} diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/font/lobster_two.xml b/ui/fonts/DownloadableFonts/app/src/main/res/font/lobster_two.xml new file mode 100644 index 00000000..28794824 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/font/lobster_two.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Copyright 2017 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. +--> +<font-family xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + app:fontProviderAuthority="com.google.android.gms.fonts" + app:fontProviderPackage="com.google.android.gms" + app:fontProviderQuery="Lobster Two" + app:fontProviderCerts="@array/com_google_android_gms_fonts_certs" + android:fontProviderAuthority="com.google.android.gms.fonts" + android:fontProviderPackage="com.google.android.gms" + android:fontProviderQuery="Lobster Two" + android:fontProviderCerts="@array/com_google_android_gms_fonts_certs" /> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/layout/activity_main.xml b/ui/fonts/DownloadableFonts/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..e0ca1d51 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2017 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. +--> +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/bottom_sheet_font_query" /> + + <LinearLayout + android:id="@+id/textview_area" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="@dimen/margin_medium" > + + <TextView + android:id="@+id/textview" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/downloadable_font_applied_text" + android:textSize="20sp" /> + </LinearLayout> + + <ProgressBar + android:id="@+id/progressBar" + style="?android:attr/progressBarStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="top|center_horizontal" + android:visibility="gone" /> +</android.support.design.widget.CoordinatorLayout> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/layout/bottom_sheet_font_query.xml b/ui/fonts/DownloadableFonts/app/src/main/res/layout/bottom_sheet_font_query.xml new file mode 100644 index 00000000..c30193c9 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/layout/bottom_sheet_font_query.xml @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Copyright 2017 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. +--> + +<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/bottom_sheet_font_query" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:behavior_peekHeight="120dp" + app:layout_behavior="android.support.design.widget.BottomSheetBehavior" + app:cardElevation="8dp"> + + <android.support.v4.widget.NestedScrollView + android:id="@+id/nested_scrollview" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:id="@+id/download_font_inputs_area" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/margin_medium" + android:orientation="vertical"> + + <LinearLayout + android:id="@+id/family_name_input_area" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/bottom_sheet_top_margin" + android:layout_marginStart="@dimen/margin_large" + android:layout_marginEnd="@dimen/margin_large" + android:layout_marginBottom="@dimen/margin_large"> + + <android.support.design.widget.TextInputLayout + android:id="@+id/auto_complete_family_name_input" + android:layout_width="240dp" + android:layout_height="wrap_content"> + + <AutoCompleteTextView + android:id="@+id/auto_complete_family_name" + android:completionThreshold="1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/family_name" + android:singleLine="true" /> + </android.support.design.widget.TextInputLayout> + + <android.support.v4.widget.Space + android:layout_weight="1" + android:layout_width="0dp" + android:layout_height="wrap_content" /> + + <Button + android:id="@+id/button_request" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/request" /> + </LinearLayout> + + + <LinearLayout + android:id="@+id/width_input_area" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_medium" + android:layout_marginBottom="@dimen/margin_medium" + android:layout_marginStart="@dimen/margin_large" + android:layout_marginEnd="@dimen/margin_large"> + + <TextView + android:id="@+id/width_seekbar_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/margin_small" + android:text="@string/width" + android:textColor="@color/accent" + android:textSize="12sp" /> + + <LinearLayout + android:id="@+id/width_seekbar_area" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <SeekBar + android:id="@+id/seek_bar_width" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + <TextView + android:id="@+id/textview_width" + android:layout_height="wrap_content" + android:layout_width="80dp" + android:layout_marginStart="@dimen/margin_small" + android:textSize="16sp" + android:gravity="end" /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:id="@+id/weight_input_area" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_medium" + android:layout_marginBottom="@dimen/margin_medium" + android:layout_marginStart="@dimen/margin_large" + android:layout_marginEnd="@dimen/margin_large"> + + <TextView + android:id="@+id/weight_seekbar_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/margin_small" + android:text="@string/weight" + android:textColor="@color/accent" + android:textSize="12sp" /> + + <LinearLayout + android:id="@+id/weight_seekbar_area" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <SeekBar + android:id="@+id/seek_bar_weight" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + <TextView + android:id="@+id/textview_weight" + android:layout_height="wrap_content" + android:layout_width="80dp" + android:layout_marginStart="@dimen/margin_small" + android:textSize="16sp" + android:gravity="end" /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:id="@+id/italic_input_area" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_medium" + android:layout_marginBottom="@dimen/margin_medium" + android:layout_marginStart="@dimen/margin_large" + android:layout_marginEnd="@dimen/margin_large"> + + <TextView + android:id="@+id/italic_seekbar_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/margin_small" + android:text="@string/italic" + android:textColor="@color/accent" + android:textSize="12sp" /> + + <LinearLayout + android:id="@+id/italic_seekbar_area" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <SeekBar + android:id="@+id/seek_bar_italic" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + <TextView + android:id="@+id/textview_italic" + android:layout_height="wrap_content" + android:layout_width="80dp" + android:layout_marginStart="@dimen/margin_small" + android:textSize="16sp" + android:gravity="end" /> + </LinearLayout> + </LinearLayout> + + <CheckBox + android:id="@+id/checkbox_best_effort" + android:text="@string/best_effort" + android:checked="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_medium" + android:layout_marginBottom="@dimen/margin_medium" + android:layout_marginStart="@dimen/margin_large" + android:layout_marginEnd="@dimen/margin_large" /> + </LinearLayout> + </android.support.v4.widget.NestedScrollView> +</android.support.v7.widget.CardView> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..cb86b974 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..7502f5d6 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..bfeec7a3 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..13ca6d75 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..358442e0 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..ff93f4d1 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..c99a1a00 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..8b642db8 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..3bcda818 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..a49362e3 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/colors.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..4f03db6e --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/colors.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2017 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. +--> +<resources> + <color name="primary">#3F51B5</color> + <color name="primary_dark">#303F9F</color> + <color name="accent">#FF4081</color> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/dimens.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..7d51aa89 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/dimens.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<resources> + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">4dp</dimen> + <dimen name="activity_vertical_margin">4dp</dimen> + <dimen name="margin_small">8dp</dimen> + <dimen name="margin_medium">16dp</dimen> + <dimen name="margin_large">32dp</dimen> + + <dimen name="bottom_sheet_top_margin">48dp</dimen> + <dimen name="bottom_sheet_initial_height">96dp</dimen> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/family_names.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/family_names.xml new file mode 100644 index 00000000..9aa96d01 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/family_names.xml @@ -0,0 +1,838 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2017 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. +--> +<resources> + <string-array name="family_names"> + <item>ABeeZee</item> + <item>Abel</item> + <item>Abhaya Libre</item> + <item>Abril Fatface</item> + <item>Aclonica</item> + <item>Acme</item> + <item>Actor</item> + <item>Adamina</item> + <item>Advent Pro</item> + <item>Aguafina Script</item> + <item>Akronim</item> + <item>Aladin</item> + <item>Aldrich</item> + <item>Alef</item> + <item>Alegreya</item> + <item>Alegreya SC</item> + <item>Alegreya Sans</item> + <item>Alegreya Sans SC</item> + <item>Alex Brush</item> + <item>Alfa Slab One</item> + <item>Alice</item> + <item>Alike</item> + <item>Alike Angular</item> + <item>Allan</item> + <item>Allerta</item> + <item>Allerta Stencil</item> + <item>Allura</item> + <item>Almendra</item> + <item>Almendra Display</item> + <item>Almendra SC</item> + <item>Amarante</item> + <item>Amaranth</item> + <item>Amatic SC</item> + <item>Amatica SC</item> + <item>Amethysta</item> + <item>Amiko</item> + <item>Amiri</item> + <item>Amita</item> + <item>Anaheim</item> + <item>Andada</item> + <item>Andika</item> + <item>Angkor</item> + <item>Annie Use Your Telescope</item> + <item>Anonymous Pro</item> + <item>Antic</item> + <item>Antic Didone</item> + <item>Antic Slab</item> + <item>Anton</item> + <item>Arapey</item> + <item>Arbutus</item> + <item>Arbutus Slab</item> + <item>Architects Daughter</item> + <item>Archivo Black</item> + <item>Archivo Narrow</item> + <item>Aref Ruqaa</item> + <item>Arima Madurai</item> + <item>Arimo</item> + <item>Arizonia</item> + <item>Armata</item> + <item>Arsenal</item> + <item>Artifika</item> + <item>Arvo</item> + <item>Arya</item> + <item>Asap</item> + <item>Asar</item> + <item>Asset</item> + <item>Assistant</item> + <item>Astloch</item> + <item>Asul</item> + <item>Athiti</item> + <item>Atma</item> + <item>Atomic Age</item> + <item>Aubrey</item> + <item>Audiowide</item> + <item>Autour One</item> + <item>Average</item> + <item>Average Sans</item> + <item>Averia Gruesa Libre</item> + <item>Averia Libre</item> + <item>Averia Sans Libre</item> + <item>Averia Serif Libre</item> + <item>Bad Script</item> + <item>Bahiana</item> + <item>Baloo</item> + <item>Baloo Bhai</item> + <item>Baloo Bhaina</item> + <item>Baloo Chettan</item> + <item>Baloo Da</item> + <item>Baloo Paaji</item> + <item>Baloo Tamma</item> + <item>Baloo Thambi</item> + <item>Balthazar</item> + <item>Bangers</item> + <item>Barrio</item> + <item>Basic</item> + <item>Battambang</item> + <item>Baumans</item> + <item>Bayon</item> + <item>Belgrano</item> + <item>Belleza</item> + <item>BenchNine</item> + <item>Bentham</item> + <item>Berkshire Swash</item> + <item>Bevan</item> + <item>Bigelow Rules</item> + <item>Bigshot One</item> + <item>Bilbo</item> + <item>Bilbo Swash Caps</item> + <item>BioRhyme</item> + <item>BioRhyme Expanded</item> + <item>Biryani</item> + <item>Bitter</item> + <item>Black Ops One</item> + <item>Bokor</item> + <item>Bonbon</item> + <item>Boogaloo</item> + <item>Bowlby One</item> + <item>Bowlby One SC</item> + <item>Brawler</item> + <item>Bree Serif</item> + <item>Bubblegum Sans</item> + <item>Bubbler One</item> + <item>Buda</item> + <item>Buenard</item> + <item>Bungee</item> + <item>Bungee Hairline</item> + <item>Bungee Inline</item> + <item>Bungee Outline</item> + <item>Bungee Shade</item> + <item>Butcherman</item> + <item>Butterfly Kids</item> + <item>Cabin</item> + <item>Cabin Condensed</item> + <item>Cabin Sketch</item> + <item>Caesar Dressing</item> + <item>Cagliostro</item> + <item>Cairo</item> + <item>Calligraffitti</item> + <item>Cambay</item> + <item>Cambo</item> + <item>Candal</item> + <item>Cantarell</item> + <item>Cantata One</item> + <item>Cantora One</item> + <item>Capriola</item> + <item>Cardo</item> + <item>Carme</item> + <item>Carrois Gothic</item> + <item>Carrois Gothic SC</item> + <item>Carter One</item> + <item>Catamaran</item> + <item>Caudex</item> + <item>Caveat</item> + <item>Caveat Brush</item> + <item>Cedarville Cursive</item> + <item>Ceviche One</item> + <item>Changa</item> + <item>Changa One</item> + <item>Chango</item> + <item>Chathura</item> + <item>Chau Philomene One</item> + <item>Chela One</item> + <item>Chelsea Market</item> + <item>Chenla</item> + <item>Cherry Cream Soda</item> + <item>Cherry Swash</item> + <item>Chewy</item> + <item>Chicle</item> + <item>Chivo</item> + <item>Chonburi</item> + <item>Cinzel</item> + <item>Cinzel Decorative</item> + <item>Clicker Script</item> + <item>Coda</item> + <item>Coda Caption</item> + <item>Codystar</item> + <item>Coiny</item> + <item>Combo</item> + <item>Comfortaa</item> + <item>Coming Soon</item> + <item>Concert One</item> + <item>Condiment</item> + <item>Content</item> + <item>Contrail One</item> + <item>Convergence</item> + <item>Cookie</item> + <item>Copse</item> + <item>Corben</item> + <item>Cormorant</item> + <item>Cormorant Garamond</item> + <item>Cormorant Infant</item> + <item>Cormorant SC</item> + <item>Cormorant Unicase</item> + <item>Cormorant Upright</item> + <item>Courgette</item> + <item>Cousine</item> + <item>Coustard</item> + <item>Covered By Your Grace</item> + <item>Crafty Girls</item> + <item>Creepster</item> + <item>Crete Round</item> + <item>Crimson Text</item> + <item>Croissant One</item> + <item>Crushed</item> + <item>Cuprum</item> + <item>Cutive</item> + <item>Cutive Mono</item> + <item>Damion</item> + <item>Dancing Script</item> + <item>Dangrek</item> + <item>David Libre</item> + <item>Dawning of a New Day</item> + <item>Days One</item> + <item>Dekko</item> + <item>Delius</item> + <item>Delius Swash Caps</item> + <item>Delius Unicase</item> + <item>Della Respira</item> + <item>Denk One</item> + <item>Devonshire</item> + <item>Dhurjati</item> + <item>Didact Gothic</item> + <item>Diplomata</item> + <item>Diplomata SC</item> + <item>Domine</item> + <item>Donegal One</item> + <item>Doppio One</item> + <item>Dorsa</item> + <item>Dosis</item> + <item>Dr Sugiyama</item> + <item>Droid Sans</item> + <item>Droid Sans Mono</item> + <item>Droid Serif</item> + <item>Duru Sans</item> + <item>Dynalight</item> + <item>EB Garamond</item> + <item>Eagle Lake</item> + <item>Eater</item> + <item>Economica</item> + <item>Eczar</item> + <item>Ek Mukta</item> + <item>El Messiri</item> + <item>Electrolize</item> + <item>Elsie</item> + <item>Elsie Swash Caps</item> + <item>Emblema One</item> + <item>Emilys Candy</item> + <item>Engagement</item> + <item>Englebert</item> + <item>Enriqueta</item> + <item>Erica One</item> + <item>Esteban</item> + <item>Euphoria Script</item> + <item>Ewert</item> + <item>Exo</item> + <item>Exo 2</item> + <item>Expletus Sans</item> + <item>Fanwood Text</item> + <item>Farsan</item> + <item>Fascinate</item> + <item>Fascinate Inline</item> + <item>Faster One</item> + <item>Fasthand</item> + <item>Fauna One</item> + <item>Federant</item> + <item>Federo</item> + <item>Felipa</item> + <item>Fenix</item> + <item>Finger Paint</item> + <item>Fira Mono</item> + <item>Fira Sans</item> + <item>Fira Sans Condensed</item> + <item>Fira Sans Extra Condensed</item> + <item>Fjalla One</item> + <item>Fjord One</item> + <item>Flamenco</item> + <item>Flavors</item> + <item>Fondamento</item> + <item>Fontdiner Swanky</item> + <item>Forum</item> + <item>Francois One</item> + <item>Frank Ruhl Libre</item> + <item>Freckle Face</item> + <item>Fredericka the Great</item> + <item>Fredoka One</item> + <item>Freehand</item> + <item>Fresca</item> + <item>Frijole</item> + <item>Fruktur</item> + <item>Fugaz One</item> + <item>GFS Didot</item> + <item>GFS Neohellenic</item> + <item>Gabriela</item> + <item>Gafata</item> + <item>Galada</item> + <item>Galdeano</item> + <item>Galindo</item> + <item>Gentium Basic</item> + <item>Gentium Book Basic</item> + <item>Geo</item> + <item>Geostar</item> + <item>Geostar Fill</item> + <item>Germania One</item> + <item>Gidugu</item> + <item>Gilda Display</item> + <item>Give You Glory</item> + <item>Glass Antiqua</item> + <item>Glegoo</item> + <item>Gloria Hallelujah</item> + <item>Goblin One</item> + <item>Gochi Hand</item> + <item>Gorditas</item> + <item>Goudy Bookletter 1911</item> + <item>Graduate</item> + <item>Grand Hotel</item> + <item>Gravitas One</item> + <item>Great Vibes</item> + <item>Griffy</item> + <item>Gruppo</item> + <item>Gudea</item> + <item>Gurajada</item> + <item>Habibi</item> + <item>Halant</item> + <item>Hammersmith One</item> + <item>Hanalei</item> + <item>Hanalei Fill</item> + <item>Handlee</item> + <item>Hanuman</item> + <item>Happy Monkey</item> + <item>Harmattan</item> + <item>Headland One</item> + <item>Heebo</item> + <item>Henny Penny</item> + <item>Herr Von Muellerhoff</item> + <item>Hind</item> + <item>Hind Guntur</item> + <item>Hind Madurai</item> + <item>Hind Siliguri</item> + <item>Hind Vadodara</item> + <item>Holtwood One SC</item> + <item>Homemade Apple</item> + <item>Homenaje</item> + <item>IM Fell DW Pica</item> + <item>IM Fell DW Pica SC</item> + <item>IM Fell Double Pica</item> + <item>IM Fell Double Pica SC</item> + <item>IM Fell English</item> + <item>IM Fell English SC</item> + <item>IM Fell French Canon</item> + <item>IM Fell French Canon SC</item> + <item>IM Fell Great Primer</item> + <item>IM Fell Great Primer SC</item> + <item>Iceberg</item> + <item>Iceland</item> + <item>Imprima</item> + <item>Inconsolata</item> + <item>Inder</item> + <item>Indie Flower</item> + <item>Inika</item> + <item>Inknut Antiqua</item> + <item>Irish Grover</item> + <item>Istok Web</item> + <item>Italiana</item> + <item>Italianno</item> + <item>Itim</item> + <item>Jacques Francois</item> + <item>Jacques Francois Shadow</item> + <item>Jaldi</item> + <item>Jim Nightshade</item> + <item>Jockey One</item> + <item>Jolly Lodger</item> + <item>Jomhuria</item> + <item>Josefin Sans</item> + <item>Josefin Slab</item> + <item>Joti One</item> + <item>Judson</item> + <item>Julee</item> + <item>Julius Sans One</item> + <item>Junge</item> + <item>Jura</item> + <item>Just Another Hand</item> + <item>Just Me Again Down Here</item> + <item>Kadwa</item> + <item>Kalam</item> + <item>Kameron</item> + <item>Kanit</item> + <item>Kantumruy</item> + <item>Karla</item> + <item>Karma</item> + <item>Katibeh</item> + <item>Kaushan Script</item> + <item>Kavivanar</item> + <item>Kavoon</item> + <item>Kdam Thmor</item> + <item>Keania One</item> + <item>Kelly Slab</item> + <item>Kenia</item> + <item>Khand</item> + <item>Khmer</item> + <item>Khula</item> + <item>Kite One</item> + <item>Knewave</item> + <item>Kotta One</item> + <item>Koulen</item> + <item>Kranky</item> + <item>Kreon</item> + <item>Kristi</item> + <item>Krona One</item> + <item>Kumar One</item> + <item>Kumar One Outline</item> + <item>Kurale</item> + <item>La Belle Aurore</item> + <item>Laila</item> + <item>Lakki Reddy</item> + <item>Lalezar</item> + <item>Lancelot</item> + <item>Lateef</item> + <item>Lato</item> + <item>League Script</item> + <item>Leckerli One</item> + <item>Ledger</item> + <item>Lekton</item> + <item>Lemon</item> + <item>Lemonada</item> + <item>Libre Baskerville</item> + <item>Libre Franklin</item> + <item>Life Savers</item> + <item>Lilita One</item> + <item>Lily Script One</item> + <item>Limelight</item> + <item>Linden Hill</item> + <item>Lobster</item> + <item>Lobster Two</item> + <item>Londrina Outline</item> + <item>Londrina Shadow</item> + <item>Londrina Sketch</item> + <item>Londrina Solid</item> + <item>Lora</item> + <item>Love Ya Like A Sister</item> + <item>Loved by the King</item> + <item>Lovers Quarrel</item> + <item>Luckiest Guy</item> + <item>Lusitana</item> + <item>Lustria</item> + <item>Macondo</item> + <item>Macondo Swash Caps</item> + <item>Mada</item> + <item>Magra</item> + <item>Maiden Orange</item> + <item>Maitree</item> + <item>Mako</item> + <item>Mallanna</item> + <item>Mandali</item> + <item>Marcellus</item> + <item>Marcellus SC</item> + <item>Marck Script</item> + <item>Margarine</item> + <item>Marko One</item> + <item>Marmelad</item> + <item>Martel</item> + <item>Martel Sans</item> + <item>Marvel</item> + <item>Mate</item> + <item>Mate SC</item> + <item>Maven Pro</item> + <item>McLaren</item> + <item>Meddon</item> + <item>MedievalSharp</item> + <item>Medula One</item> + <item>Meera Inimai</item> + <item>Megrim</item> + <item>Meie Script</item> + <item>Merienda</item> + <item>Merienda One</item> + <item>Merriweather</item> + <item>Merriweather Sans</item> + <item>Metal</item> + <item>Metal Mania</item> + <item>Metamorphous</item> + <item>Metrophobic</item> + <item>Michroma</item> + <item>Milonga</item> + <item>Miltonian</item> + <item>Miltonian Tattoo</item> + <item>Miniver</item> + <item>Miriam Libre</item> + <item>Mirza</item> + <item>Miss Fajardose</item> + <item>Mitr</item> + <item>Modak</item> + <item>Modern Antiqua</item> + <item>Mogra</item> + <item>Molengo</item> + <item>Molle</item> + <item>Monda</item> + <item>Monofett</item> + <item>Monoton</item> + <item>Monsieur La Doulaise</item> + <item>Montaga</item> + <item>Montez</item> + <item>Montserrat</item> + <item>Montserrat Alternates</item> + <item>Montserrat Subrayada</item> + <item>Moul</item> + <item>Moulpali</item> + <item>Mountains of Christmas</item> + <item>Mouse Memoirs</item> + <item>Mr Bedfort</item> + <item>Mr Dafoe</item> + <item>Mr De Haviland</item> + <item>Mrs Saint Delafield</item> + <item>Mrs Sheppards</item> + <item>Mukta Vaani</item> + <item>Muli</item> + <item>Mystery Quest</item> + <item>NTR</item> + <item>Neucha</item> + <item>Neuton</item> + <item>New Rocker</item> + <item>News Cycle</item> + <item>Niconne</item> + <item>Nixie One</item> + <item>Nobile</item> + <item>Nokora</item> + <item>Norican</item> + <item>Nosifer</item> + <item>Nothing You Could Do</item> + <item>Noticia Text</item> + <item>Noto Sans</item> + <item>Noto Serif</item> + <item>Nova Cut</item> + <item>Nova Flat</item> + <item>Nova Mono</item> + <item>Nova Oval</item> + <item>Nova Round</item> + <item>Nova Script</item> + <item>Nova Slim</item> + <item>Nova Square</item> + <item>Numans</item> + <item>Nunito</item> + <item>Nunito Sans</item> + <item>Odor Mean Chey</item> + <item>Offside</item> + <item>Old Standard TT</item> + <item>Oldenburg</item> + <item>Oleo Script</item> + <item>Oleo Script Swash Caps</item> + <item>Open Sans</item> + <item>Open Sans Condensed</item> + <item>Oranienbaum</item> + <item>Orbitron</item> + <item>Oregano</item> + <item>Orienta</item> + <item>Original Surfer</item> + <item>Oswald</item> + <item>Over the Rainbow</item> + <item>Overlock</item> + <item>Overlock SC</item> + <item>Overpass</item> + <item>Overpass Mono</item> + <item>Ovo</item> + <item>Oxygen</item> + <item>Oxygen Mono</item> + <item>PT Mono</item> + <item>PT Sans</item> + <item>PT Sans Caption</item> + <item>PT Sans Narrow</item> + <item>PT Serif</item> + <item>PT Serif Caption</item> + <item>Pacifico</item> + <item>Padauk</item> + <item>Palanquin</item> + <item>Palanquin Dark</item> + <item>Pangolin</item> + <item>Paprika</item> + <item>Parisienne</item> + <item>Passero One</item> + <item>Passion One</item> + <item>Pathway Gothic One</item> + <item>Patrick Hand</item> + <item>Patrick Hand SC</item> + <item>Pattaya</item> + <item>Patua One</item> + <item>Pavanam</item> + <item>Paytone One</item> + <item>Peddana</item> + <item>Peralta</item> + <item>Permanent Marker</item> + <item>Petit Formal Script</item> + <item>Petrona</item> + <item>Philosopher</item> + <item>Piedra</item> + <item>Pinyon Script</item> + <item>Pirata One</item> + <item>Plaster</item> + <item>Play</item> + <item>Playball</item> + <item>Playfair Display</item> + <item>Playfair Display SC</item> + <item>Podkova</item> + <item>Poiret One</item> + <item>Poller One</item> + <item>Poly</item> + <item>Pompiere</item> + <item>Pontano Sans</item> + <item>Poppins</item> + <item>Port Lligat Sans</item> + <item>Port Lligat Slab</item> + <item>Pragati Narrow</item> + <item>Prata</item> + <item>Preahvihear</item> + <item>Press Start 2P</item> + <item>Pridi</item> + <item>Princess Sofia</item> + <item>Prociono</item> + <item>Prompt</item> + <item>Prosto One</item> + <item>Proza Libre</item> + <item>Puritan</item> + <item>Purple Purse</item> + <item>Quando</item> + <item>Quantico</item> + <item>Quattrocento</item> + <item>Quattrocento Sans</item> + <item>Questrial</item> + <item>Quicksand</item> + <item>Quintessential</item> + <item>Qwigley</item> + <item>Racing Sans One</item> + <item>Radley</item> + <item>Rajdhani</item> + <item>Rakkas</item> + <item>Raleway</item> + <item>Raleway Dots</item> + <item>Ramabhadra</item> + <item>Ramaraja</item> + <item>Rambla</item> + <item>Rammetto One</item> + <item>Ranchers</item> + <item>Rancho</item> + <item>Ranga</item> + <item>Rasa</item> + <item>Rationale</item> + <item>Ravi Prakash</item> + <item>Redressed</item> + <item>Reem Kufi</item> + <item>Reenie Beanie</item> + <item>Revalia</item> + <item>Rhodium Libre</item> + <item>Ribeye</item> + <item>Ribeye Marrow</item> + <item>Righteous</item> + <item>Risque</item> + <item>Roboto</item> + <item>Roboto Condensed</item> + <item>Roboto Mono</item> + <item>Roboto Slab</item> + <item>Rochester</item> + <item>Rock Salt</item> + <item>Rokkitt</item> + <item>Romanesco</item> + <item>Ropa Sans</item> + <item>Rosario</item> + <item>Rosarivo</item> + <item>Rouge Script</item> + <item>Rozha One</item> + <item>Rubik</item> + <item>Rubik Mono One</item> + <item>Ruda</item> + <item>Rufina</item> + <item>Ruge Boogie</item> + <item>Ruluko</item> + <item>Rum Raisin</item> + <item>Ruslan Display</item> + <item>Russo One</item> + <item>Ruthie</item> + <item>Rye</item> + <item>Sacramento</item> + <item>Sahitya</item> + <item>Sail</item> + <item>Salsa</item> + <item>Sanchez</item> + <item>Sancreek</item> + <item>Sansita</item> + <item>Sarala</item> + <item>Sarina</item> + <item>Sarpanch</item> + <item>Satisfy</item> + <item>Scada</item> + <item>Scheherazade</item> + <item>Schoolbell</item> + <item>Scope One</item> + <item>Seaweed Script</item> + <item>Secular One</item> + <item>Sevillana</item> + <item>Seymour One</item> + <item>Shadows Into Light</item> + <item>Shadows Into Light Two</item> + <item>Shanti</item> + <item>Share</item> + <item>Share Tech</item> + <item>Share Tech Mono</item> + <item>Shojumaru</item> + <item>Short Stack</item> + <item>Shrikhand</item> + <item>Siemreap</item> + <item>Sigmar One</item> + <item>Signika</item> + <item>Signika Negative</item> + <item>Simonetta</item> + <item>Sintony</item> + <item>Sirin Stencil</item> + <item>Six Caps</item> + <item>Skranji</item> + <item>Slabo 13px</item> + <item>Slabo 27px</item> + <item>Slackey</item> + <item>Smokum</item> + <item>Smythe</item> + <item>Sniglet</item> + <item>Snippet</item> + <item>Snowburst One</item> + <item>Sofadi One</item> + <item>Sofia</item> + <item>Sonsie One</item> + <item>Sorts Mill Goudy</item> + <item>Source Code Pro</item> + <item>Source Sans Pro</item> + <item>Source Serif Pro</item> + <item>Space Mono</item> + <item>Special Elite</item> + <item>Spicy Rice</item> + <item>Spinnaker</item> + <item>Spirax</item> + <item>Squada One</item> + <item>Sree Krushnadevaraya</item> + <item>Sriracha</item> + <item>Stalemate</item> + <item>Stalinist One</item> + <item>Stardos Stencil</item> + <item>Stint Ultra Condensed</item> + <item>Stint Ultra Expanded</item> + <item>Stoke</item> + <item>Strait</item> + <item>Sue Ellen Francisco</item> + <item>Suez One</item> + <item>Sumana</item> + <item>Sunshiney</item> + <item>Supermercado One</item> + <item>Sura</item> + <item>Suranna</item> + <item>Suravaram</item> + <item>Suwannaphum</item> + <item>Swanky and Moo Moo</item> + <item>Syncopate</item> + <item>Tangerine</item> + <item>Taprom</item> + <item>Tauri</item> + <item>Taviraj</item> + <item>Teko</item> + <item>Telex</item> + <item>Tenali Ramakrishna</item> + <item>Tenor Sans</item> + <item>Text Me One</item> + <item>The Girl Next Door</item> + <item>Tienne</item> + <item>Tillana</item> + <item>Timmana</item> + <item>Tinos</item> + <item>Titan One</item> + <item>Titillium Web</item> + <item>Trade Winds</item> + <item>Trirong</item> + <item>Trocchi</item> + <item>Trochut</item> + <item>Trykker</item> + <item>Tulpen One</item> + <item>Ubuntu</item> + <item>Ubuntu Condensed</item> + <item>Ubuntu Mono</item> + <item>Ultra</item> + <item>Uncial Antiqua</item> + <item>Underdog</item> + <item>Unica One</item> + <item>UnifrakturCook</item> + <item>UnifrakturMaguntia</item> + <item>Unkempt</item> + <item>Unlock</item> + <item>Unna</item> + <item>VT323</item> + <item>Vampiro One</item> + <item>Varela</item> + <item>Varela Round</item> + <item>Vast Shadow</item> + <item>Vesper Libre</item> + <item>Vibur</item> + <item>Vidaloka</item> + <item>Viga</item> + <item>Voces</item> + <item>Volkhov</item> + <item>Vollkorn</item> + <item>Voltaire</item> + <item>Waiting for the Sunrise</item> + <item>Wallpoet</item> + <item>Walter Turncoat</item> + <item>Warnes</item> + <item>Wellfleet</item> + <item>Wendy One</item> + <item>Wire One</item> + <item>Work Sans</item> + <item>Yanone Kaffeesatz</item> + <item>Yantramanav</item> + <item>Yatra One</item> + <item>Yellowtail</item> + <item>Yeseva One</item> + <item>Yesteryear</item> + <item>Yrsa</item> + <item>Zeyada</item> + </string-array> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/font_certs.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/font_certs.xml new file mode 100644 index 00000000..a09ad32f --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/font_certs.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2017 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. +--> +<resources> + <array name="com_google_android_gms_fonts_certs"> + <item>@array/com_google_android_gms_fonts_certs_dev</item> + <item>@array/com_google_android_gms_fonts_certs_prod</item> + </array> + <string-array name="com_google_android_gms_fonts_certs_dev"> + <item> + MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs= + </item> + </string-array> + <string-array name="com_google_android_gms_fonts_certs_prod"> + <item> + MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK + </item> + </string-array> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/preloaded_fonts.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/preloaded_fonts.xml new file mode 100644 index 00000000..df301f60 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/preloaded_fonts.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2017 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. +--> +<resources> + <array name="preloaded_fonts" translatable="false"> + <item>@font/lobster_two</item> + </array> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/strings.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..1eed5534 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/strings.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<resources> + <string name="app_name">Downloadable fonts sample</string> + <string name="request">request</string> + <string name="invalid_family_name">Not a valid Family Name</string> + <string name="invalid_input">Invalid inputs exist</string> + <string name="family_name">Family Name</string> + <string name="weight">Weight</string> + <string name="width">Width</string> + <string name="italic">Italic</string> + <string name="best_effort">Best Effort (Nearest match)</string> + <string name="predefined_font">The pre-downloaded font is used for this part to avoid the overhead of the time until the requested font is downloaded. See "src/main/res/font" directory for usage.</string> + <string name="downloadable_font_applied_text">Typeface of this part is going to be changed when a new font is downloaded. To request a new font, fill the \"Family Name\" (and optionally change other attributes such as width, weight, italic), then tap the \"Request\" button</string> + <string name="request_failed">Font request failed with reason code: %1$d</string> +</resources> diff --git a/ui/fonts/DownloadableFonts/app/src/main/res/values/styles.xml b/ui/fonts/DownloadableFonts/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..9ba54f26 --- /dev/null +++ b/ui/fonts/DownloadableFonts/app/src/main/res/values/styles.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2017 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. +--> +<resources> + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primary_dark</item> + <item name="colorAccent">@color/accent</item> + </style> +</resources> diff --git a/ui/fonts/DownloadableFonts/build.gradle b/ui/fonts/DownloadableFonts/build.gradle new file mode 100644 index 00000000..5c0aed84 --- /dev/null +++ b/ui/fonts/DownloadableFonts/build.gradle @@ -0,0 +1,26 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.4.0-dev' + } +} + +allprojects { + repositories { + jcenter() + } +} + +// BEGIN_EXCLUDE +import com.example.android.samples.build.SampleGenPlugin +apply plugin: SampleGenPlugin + +samplegen { + pathToBuild "../../../../../build" + pathToSamplesCommon "../../../common" +} +apply from: "../../../../../build/build.gradle" +// END_EXCLUDE diff --git a/ui/fonts/DownloadableFonts/buildSrc/build.gradle b/ui/fonts/DownloadableFonts/buildSrc/build.gradle new file mode 100644 index 00000000..7cebf71c --- /dev/null +++ b/ui/fonts/DownloadableFonts/buildSrc/build.gradle @@ -0,0 +1,15 @@ +repositories { + mavenCentral() +} +dependencies { + compile 'org.freemarker:freemarker:2.3.20' +} + +sourceSets { + main { + groovy { + srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy") + } + } +} + diff --git a/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.jar b/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 00000000..13372aef --- /dev/null +++ b/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.jar diff --git a/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.properties b/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..9eaab7c2 --- /dev/null +++ b/ui/fonts/DownloadableFonts/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed May 10 17:45:17 JST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.0-20170406000015+0000-all.zip diff --git a/ui/fonts/DownloadableFonts/gradlew b/ui/fonts/DownloadableFonts/gradlew new file mode 100755 index 00000000..9d82f789 --- /dev/null +++ b/ui/fonts/DownloadableFonts/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/ui/fonts/DownloadableFonts/gradlew.bat b/ui/fonts/DownloadableFonts/gradlew.bat new file mode 100644 index 00000000..aec99730 --- /dev/null +++ b/ui/fonts/DownloadableFonts/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/ui/fonts/DownloadableFonts/screenshots/icon-web.png b/ui/fonts/DownloadableFonts/screenshots/icon-web.png Binary files differnew file mode 100644 index 00000000..31629a96 --- /dev/null +++ b/ui/fonts/DownloadableFonts/screenshots/icon-web.png diff --git a/ui/fonts/DownloadableFonts/screenshots/screenshot-1.png b/ui/fonts/DownloadableFonts/screenshots/screenshot-1.png Binary files differnew file mode 100644 index 00000000..05649a5c --- /dev/null +++ b/ui/fonts/DownloadableFonts/screenshots/screenshot-1.png diff --git a/ui/fonts/DownloadableFonts/screenshots/screenshot-2.png b/ui/fonts/DownloadableFonts/screenshots/screenshot-2.png Binary files differnew file mode 100644 index 00000000..ed423814 --- /dev/null +++ b/ui/fonts/DownloadableFonts/screenshots/screenshot-2.png diff --git a/ui/fonts/DownloadableFonts/screenshots/screenshot-3.png b/ui/fonts/DownloadableFonts/screenshots/screenshot-3.png Binary files differnew file mode 100644 index 00000000..31629a96 --- /dev/null +++ b/ui/fonts/DownloadableFonts/screenshots/screenshot-3.png diff --git a/ui/fonts/DownloadableFonts/settings.gradle b/ui/fonts/DownloadableFonts/settings.gradle new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ b/ui/fonts/DownloadableFonts/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/ui/fonts/DownloadableFonts/template-params.xml b/ui/fonts/DownloadableFonts/template-params.xml new file mode 100644 index 00000000..8215ce04 --- /dev/null +++ b/ui/fonts/DownloadableFonts/template-params.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2017 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. +--> +<sample> + <name>DownloadableFonts</name> + <group>UI</group> + <package>com.example.android.downloadablefonts</package> + + <!-- + Lower the minSdk once the API level for O is changed to 26. + At this moment, an app targeting "O" only runs on O preview devices. + --> + <minSdk>"O"</minSdk> + + <strings> + <intro> +<![CDATA[ +This sample demonstrates how to use the Downloadable Fonts feature introduced in Android O. +Downloadable Fonts is a feature that allows apps to request a certain font from a provider +instead of bundling it or downloading it themselves. This means, there is no need to bundle the +font as an asset. + +Note that the sample uses Google Play Services as a font provider, which requires pre-released +version of Google Play Services. +You can sign up for the beta program so that the beta version of Google Play Services is +downloaded to your device. https://developers.google.com/android/guides/beta-program +If you have Google Play Services whose version number is equal or above 11.x.x, that means you +have the compatible version installed. (You can confirm by navigating to +Settings -> Apps -> Google Play Services) +]]> + </intro> + </strings> + + <template src="base-build" /> + + <metadata> + <status>DRAFTED</status> + <categories>UI, Android O Preview</categories> + <technologies>Android</technologies> + <languages>Java</languages> + <solutions>Mobile</solutions> + <level>INTERMEDIATE</level> + <icon>screenshots/icon-web.png</icon> + <screenshots> + <img>screenshots/screenshot-1.png</img> + </screenshots> + <api_refs> + <android>android.provider.FontRequest</android> + <android>android.support.v4.provider.FontRequest</android> + <android>android.provider.FontsContractCompat</android> + <android>android.support.v4.provider.FontsContractCompat</android> + </api_refs> + + <description> +<![CDATA[ +This sample demonstrates how to use the Downloadable Fonts feature introduced in Android O. +Downloadable Fonts is a feature that allows apps to request a certain font from a provider +instead of bundling it or downloading it themselves. This means, there is no need to bundle the +font as an asset. +]]> + </description> + + <intro> +<![CDATA[ +There are two ways of requesting a font to download. +To request a font to download from Java code, you need to create a [FontRequest][1] class first like +this: +```java +FontRequest request = new FontRequest( + "com.google.android.gms.fonts", // ProviderAuthority + "com.google.android.gms", // ProviderPackage + query, // Query + R.array.com_google_android_gms_fonts_certs); // Certificates +``` +The parameters `ProviderAuthority`, `ProviderPackage` are given by a font provider, in the case +above uses Google Play Services as a font provider. +The third parameter is a query string about the requested font. The syntax of the query is defined +by the font provider. + +Then pass the request instance to the `requestFont` method in the [FontsContractCompat][2]. +```java +FontsContractCompat.requestFont(context, request, callback, handler); +``` +The downloaded font or an error code if the request failed will be passed to the callback. +The example above assumes you are using the classes from the support library. There are +corresponding classes in the framework, but the feature is available back to API level 14 if you +use the support library. + +You can declare a downloaded font in an XML file and let the system download it for you and use it +in layouts. +```xml +<font-family xmlns:app="http://schemas.android.com/apk/res-auto" + app:fontProviderAuthority="com.google.android.gms.fonts" + app:fontProviderPackage="com.google.android.gms" + app:fontProviderQuery="Lobster Two" + app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> +</font-family> +``` +By defining the requested font in an XML file and putting the `preloaded_fonts` array and the +meta-data tag in the AndroidManifest, you can avoid the delay until the font is downloaded by the +first attempt. +```xml +<resources> + <array name="preloaded_fonts" translatable="false"> + <item>@font/lobster_two</item> + </array> +</resources> +``` + +```xml +<application > + ... + <meta-data android:name="preloaded_fonts" android:resource="@array/preloaded_fonts" /> + ... +</application> +``` + +Note that the sample uses Google Play Services as a font provider, which requires pre-released +version of Google Play Services. +You can sign up for the beta program so that the beta version of Google Play Services is +downloaded to your device. https://developers.google.com/android/guides/beta-program +If you have Google Play Services whose version number is equal or above 11.x.x, that means you +have the compatible version installed. (You can confirm by navigating to +Settings -> Apps -> Google Play Services) + +[1]: https://developer.android.com/reference/android/support/v4/provider/FontRequest.html +[2]: https://developer.android.com/reference/android/support/v4/provider/FontsContractCompat.html +]]> + </intro> + </metadata> +</sample> |