History log of /frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
11e831738feba2bb6c5338358812a373bda9991a 07-Jun-2017 Clara Bayarri <clarabayarri@google.com> Introduce API 26 implementation to work with app: prefix.

There is no public API to create family even on API 26, so need
to use private API. We can't use API 24 implementation for API
26 since the private API signatrue has changed.

With this CL, developer no longer need to specify both android:
and app: prefix attribute to XML elemetns.

Bug: 37493261
Test: ./gradlew support-compat:connectedDebugAndroidTest
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26
Test: ./gradlew support-emoji:connectedDebugAndroidTest
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26
Test: ./gradlew support-appcompat-v7:connectedDebugAndroidTest
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26
Test: Locally verified with test app
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26

Change-Id: I103dedccec0b6ec588aa273f2b93a6ac227ab621
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
645e5c8aa6b31961c5f73f3d30bb5261d5e04aeb 13-Jun-2017 Kirill Grouchnikov <kirillg@google.com> Clean up language around compat APIs

Test: not relevant
Bug: 38346134
Change-Id: Ia1898b8ed58da3f74ad99955aece16fc31564e7c
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
2afabd060e15342c0ba622cb08f5be61a328e566 17-May-2017 Seigo Nonaka <nona@google.com> Introduce fetch strategy and timeout attribute.

This CL makes developer to be able to choose the fetching strategy.
Since the font inflation happens on UI thread, it is not a good idea
to block until the font fetch finishes. On the other hand, it may be
also bad if the fetch happens asynchronously and refresh the display
once it finishes. This blinks the contents.

Blocking fetching and timeout works as follows:
- First, check the local cache and use it if it is available.
- Request the font to the font provider and wait until it finishes or
timeout happens.
- If timeout happens, use default typeface instead.

Asynchronous fetching works as follows:
- First, check the local cache and use it if it is available.
- Request the font to the font provider and use default typeface
during initial inflation.
- When the fetch finishes, refresh the TextView.

We can't add automated tests for resources xml for provider fonts since
it requires the static certificates.

Bug: 38340183
Test: ./gradlew support-compat:connectedAndroidTest
on API 16, 17, 18, 19, 21, 23, 25, 26
Test: ./gradlew support-appcompat-v7:connectedAndroidTest
on API 16, 17, 18, 19, 21, 23, 25, 26
Test: ./gradlew support-emoji:connectedDebugAndroidTest
on API 16, 17, 18, 19, 21, 23, 25, 26

Change-Id: Iec9d953f1a762a020f3556055f0eda868e6f2641
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
9e254febe0073697724578809c222658e0f47d96 23-May-2017 Clara Bayarri <clarabayarri@google.com> Make TextViewCompat#setTextAppearance work with fonts

Make sure the fontFamily and textStyle attributes are read
correctly when using an AppCompatTextView.

To do so, refactored the code that reads the attributes into one
method so it can be reused by its 3 usages.

Bug: 38111412
Test: AppCompatTextViewTest#testFontResources_setTextAppearance
Change-Id: Iba4eef6670eb067845d491b94d79398089a8f77c
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
f2b8aa644529539d113e87cbaf0e21e49a70fac3 16-May-2017 Seigo Nonaka <nona@google.com> Introduce early exit path for non resource path case.

This CL does some improvements:
- Uses cached TypedValue for taking string from resource.
- Introduce the early exit path if the given string is not likely the
path in resource file.

Bug: 38232467
Test: ./gradlew support-appcompat-v7:connectedDebugAndroidTest
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, O
Test: ./gradlew support-compat:connectedDebugAndroidTest
on API 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, O
Change-Id: I03beca271ee3980cd3b7de28fbab74dd8027a1b0
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
a55160adc4ac7481c48512c7c146e7875a380021 02-May-2017 Seigo Nonaka <nona@google.com> Remove TypefaceHolder and use TextView.setTypeface(Typeface, int)

Looks like TextView.setTypeface(Typeface, int) does a good job for
fake bold/italic. No need to propagate weight/italic information
and call TextView.setTypeface(Typeface, int) instead.

This CL fixes invalid skew angle happens on API 21 or later.

Known Issues:
- FakeItalic is not working even if the text view style has italic bit.
(Happens on API 15, 16, 17, 18, 19)
- FakeBold/FakeItalic is used for StyleSpan.
(Happens on all API level)
- Still not working on API 15.

Bug: 37783900
Test:./gradlew support-compat:connectedDebugAndroidTest
Test: ./gradlew support-emoji:connectedDebugAndroidTest
Test: Saw manually the rendered text. (Screenshot attached in issue)

Change-Id: Icf496a8d44e37e344262a52ca2936583d768a220
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
f69ef36b9ff270c87e41177551ef4692f9aff965 28-Apr-2017 Seigo Nonaka <nona@google.com> Make Font Resources XML working on Android N or before device.

This addresses several issues:

- API 16 to API 25
There are two main issues.
-- AssetManager failed to open file by path name.
Fixed by using Resources.openRawResource instead of
AssetManager.openNonAssetFd.

-- TextView's style is ignored.
Before API 26, there is no way to create Typeface from multiple font
files. If Typeface is created from multiple font files, TextView will
select correct font based on style information of them.
However, this is impossible on API 25 or before. So select best match
font from given list and create Typeface with it.

At the same time, there is a concept "fakeBold" and "fakeItalic" on
Android. If even the best matched Typeface is not usable for requested
style, TextView makes bold/italic glyph with transforming available
glyph. Since we does font selection by ourselves, needs to set fake
bold/italic by manual too.

- API 16 - API 19
Styled typeface can be created from another Typeface like as follows.
Typeface boldTypeface = Typeface.create(baseTypeface, Typeface.BOLD);
The passed style information can be retrieved by Typeface.getStyle()
but this doesn't return real value on API 19 or before. Thus, introduce
TypefaceHolder to hold actually using weight/italic information.

Known Issues:

- API 15 or before
Still not working even after this patch. TypedArray returns false for
hasValue with R.styleable.TextAppearance_android_fontFamily.

- API 21 - API 25
The skew angle is sharper.

Bug: 37754362
Test: ./gradlew support-compat:connectedDebugAndroidTest passes on
API 15,16,17,18,19,21,23,25,26
Test: Test App attached issue 37754362 show the same result on
API 16,17,18,19,21,23,25
except for fake italic angle.
Screenshots is available on issue tracker.

Change-Id: I6bd615774be55981289f5f3b88f3d71fa1b39014
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
543fd2946ded1593b28553879e74ca4393eddd2e 24-Mar-2017 Clara Bayarri <clarabayarri@google.com> Supportlib Fonts in XML

This change adds support for the new font resources type in
support library, making its use possible pre-O.

Test: ./gradlew support-compat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v4.content.res.FontResourcesParserCompatTest
./gradlew support-compat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v4.content.res.ResourcesCompatTest
./gradlew support-appcompat-v7:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.AppCompatTextViewTest
Bug: 35382184

Change-Id: Ide32ae4e914b3dc73756016d24059ead25ca7e68
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
d679cb8cd83198de9d1fd67b5058d834d2daaae4 19-Apr-2017 Clara Bayarri <clarabayarri@google.com> Revert "Supportlib Fonts in XML"

This reverts commit 617be7af1f752cfaaf566e627ff6ea797623f2c3.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Iacaef0423aa43cc5473042b6d61f2664afaf9cf6
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
617be7af1f752cfaaf566e627ff6ea797623f2c3 24-Mar-2017 Clara Bayarri <clarabayarri@google.com> Supportlib Fonts in XML

This change adds support for the new font resources type in
support library, making its use possible pre-O.

Test: ./gradlew support-compat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v4.content.res.FontResourcesParserCompatTest
./gradlew support-compat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v4.content.res.ResourcesCompatTest
./gradlew support-appcompat-v7:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.AppCompatTextViewTest
Bug: 35382184

Change-Id: If67cf830c8c2d8875da73318d02db391421dfdfa
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
4f325fb24a6ce5d8cca56460db12c24ec7ec5491 22-Feb-2017 Aurimas Liutikas <aurimas@google.com> Cleanup ContextCompat and ResourcesCompat after minSdk 14 bump.

Bug: 32794064
Test: ./gradlew assemble
Change-Id: I14ae4f615602563cd59d8f8f14d97fb6c67e1cbc
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java
3ac77bf186f87ecad4bf0063b2f6c4384efbd56a 27-Apr-2016 Kirill Grouchnikov <kirillg@google.com> Support module refactoring

* Splitting support-v4 into two modules, support-compat and support-core
* Adding a new library module named support-v4 that combines the two
together for backward compatibility support of existing projects
* support-compat has all Compat classes, their few direct dependencies
and all data structures in the .util package

Change-Id: Icd1b0ab3a5b61a8a2bf85bc274098f0a828963e0
/frameworks/support/compat/java/android/support/v4/content/res/ResourcesCompat.java