Merged PR 2427: Merge library to master

This commit is contained in:
Nick Romano 2020-01-24 17:56:51 +00:00
Родитель 398dbda02f
Коммит 441d0ec5a1
6154 изменённых файлов: 35293 добавлений и 65 удалений

82
.gitignore поставляемый
Просмотреть файл

@ -1,69 +1,21 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
<<<<<<< HEAD
node_modules
npm-debug.log
*.sublime-workspace
tmp
dev_tests/automatic/screenshots
importer/dist/*
!importer/dist/.keep
tests
*.DS_Store
## Build generated
build/
DerivedData/
.project
.classpath
.settings
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
.idea
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
.vscode/
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
**/.DS_Store
android/library/src/main/res/drawable/
xcuserdata

1
FluentIcons.podspec Symbolic link
Просмотреть файл

@ -0,0 +1 @@
ios/FluentIcons.podspec

1
LICENSE Normal file
Просмотреть файл

@ -0,0 +1 @@
Copyright (c) Microsoft Corp. All rights reserved.

Двоичные данные
Location Not Found/.DS_Store поставляемый

Двоичный файл не отображается.

85
README.md Normal file
Просмотреть файл

@ -0,0 +1,85 @@
# Fluent design icons
Fluent design icons is a set of mobile platform icons from Microsoft.
![fluent design icons](art/readme-asset.png)
## Installation
### Android
Add the `microsoftdesign` repository to your project's top level `build.gradle`:
```groovy
repositories {
maven {
name 'vsts-maven-microsoftdesign'
url 'https://pkgs.dev.azure.com/microsoftdesign/951975d5-69cc-4771-9d98-92a4b1a82b2b/_packaging/fluent-icons/maven/v1'
credentials {
username = [Your VSTS username]
password = [Your VSTS access token]
}
}
...
}
```
Include the following dependency in your project's `build.gradle`
```groovy
implementation 'com.microsoft.design:fluent-icons:1.0.160'
```
For library docs, see [android/README.md](android/README.md).
### iOS
#### Cocoapods
```ruby
pod "FluentIcons", git: "https://microsoftdesign@dev.azure.com/microsoftdesign/Design%20System/_git/fluent-mobile-icons", tag: "1.0.160"
```
#### Carthage
```bash
git "git@ssh.dev.azure.com:v3/microsoftdesign/Design%20System/fluent-mobile-icons" "1.0.160"
```
For library docs, see [ios/README.md](ios/README.md).
## Contributing
### Importer
The importer generates the Android and iOS libraries from the icons in the `assets` directory.
Jump into the directory
```
cd importer
```
Install npm dependencies
```
npm install
npm run clean
```
List all the available commands
```
npm run
```
### Build Pipeline
Our [build pipeline](https://dev.azure.com/microsoftdesign/Design%20System/_build?definitionId=94&_a=summary) runs `deploy:android` and `deploy:ios` to create the libraries. The build definitions are in `azure-pipelines.yml` and `pipelines`.
## Run the demo apps
### Android
1. Open the [android](android) directory in Android Studio
2. Select the `sample-showcase` in the build configuration dropdown
3. Click run
### iOS
1. `open ios/FluentIcons.xcworkspace/`
2. Product > Run
## Contact
Please feel free to reach out to the following points of contact with questions or requests.
* [Joe Woodward](joe.woodward@microsoft.com) / [Janet Longhurst](jalonghu@microsoft.com) - Design
* [Nick Romano](nick.romano@microsoft.com) - iOS
* [Will Hou](wih@microsoft.com) - Android

14
android/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,14 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

126
android/README.md Normal file
Просмотреть файл

@ -0,0 +1,126 @@
# Documentation
## Usage
The library offers icons in the form of Android `VectorDrawable`, the icon names are structured as:
> `R.drawable.ic_fluent_[name]_[size]_[style]`
* `name` - Name of the icon from [assets](../assets) that is all lowercased and underscore separated.
* `size` - Size of the icon that is one of 16/20/24/28/48. Note that some icons do not have all sizes available yet. Our designers are working to add missing ones to complete the collection.
* `style` - Style of the icon that is one of `regular`, `filled` or `selector`. See the section below for details.
### Icon styles
The library offers icons in two styles, `regular` and `filled`
regular | filled
--------|-------
![ic_fluent_mail_regular](../art/ic_fluent_mail_regular.png)|![ic_fluent_mail_filled](../art/ic_fluent_mail_filled.png)
### Stateful icon selectors
Per the Fluent mobile design language, icons are by default in `regular` style and switched to `filled` style when active. An example is the icons in the bottom tab bar:
![Outlook bottom tab](../art/bottom_tab.png)
For convenience, the library offers drawable selectors of each icon to help achieve the above effect. The three active states supported are `state_activated`, `state_checked` and `state_selected`.
`ic_fluent_mail_24_selector.xml`
```xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_mail_24_filled" android:state_activated="true"/>
<item android:drawable="@drawable/ic_fluent_mail_24_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_fluent_mail_24_filled" android:state_selected="true"/>
<item android:drawable="@drawable/ic_fluent_mail_24_regular"/>
</selector>
```
## Default color
The library assigns `#212121` as the default icon color. You can however, override it by adding a `fluent_default_icon_tint.xml` color selector to the `res/color` folder of your project and replacing the color value with a desired one. For example:
```xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#8E8E8E"/>
</selector>
```
## Right-to-left(RTL) support
When the device locale is set to a RTL language(e.g. Hebrew or Arabic), some direction-based icons, such as a left arrow, needs to be flipped. The library automatically inserts `android:autoMirrored="true"` to these icons, which allows the system to handle RTL layout mirroring for you. The list of icons that supports mirroring can be found in the [rtl.txt](../importer/rtl.txt) file.
## Tinting
With Android 5.0 (API level 21) and above, you can tint drawables with color resources or theme attributes that resolve to color resources. See the following sections to know how to apply a tint to different UI components that can host icons.
### ImageView
Use the `tint` attribute to apply color tint to an ImageView's drawable. Since the Android framework support for `tint` starts from **API21+**, the custom attribute namespace could be used for backwards compatibility.
```xml
<ImageView
...
android:src="@drawable/ic_fluent_checkmark_24_regular"
app:tint="@android:color/white"
android:tint="@android:color/white"/> // OK to use just the framework one too since most MSFT apps are API21+
```
By code, use `ImageViewCompat` from the [AndroidX core library](https://developer.android.com/jetpack/androidx/releases/core):
```java
ImageViewCompat.setImageTintList(imageView, ColorStateList.valueOf(Color.WHITE));
// OK to use just the framework one too since most MSFT apps are API21+
imageView.setImageTintList(ColorStateList.valueOf(Color.WHITE));
```
### TextView compound drawable
Use the `drawableTint` attribute to apply color tint to a TextView's compound drawable icon. Since the Android framework support for `drawableTint` starts from **API24+**, the custom attribute namespace could be used for backwards compatibility.
```xml
<TextView
...
android:text="Done"
android:drawableStart="@drawable/ic_fluent_checkmark_24_regular"
app:drawableTint="@android:color/white"/>
```
By code, use `TextViewCompat` from the [AndroidX core library](https://developer.android.com/jetpack/androidx/releases/core):
```java
TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(Color.WHITE));
```
### Menu item icon
Use the `iconTint` attribute to apply color tint to a MenuItem's icon. Since the Android framework support for `iconTint` starts from **API26+**, the custom attribute namespace could be used for backwards compatibility.
```xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_done"
android:icon="@drawable/ic_fluent_checkmark_24_regular"
android:title="Done"
app:iconTint="@android:color/white"
app:showAsAction="always"/>
</menu>
```
By code, use `MenutItemCompat` from the [AndroidX core library](https://developer.android.com/jetpack/androidx/releases/core):
```java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
...
MenuItem doneItem = menu.findItem(R.id.menu_done);
MenuItemCompat.setIconTintList(doneItem, ColorStateList.valueOf(Color.WHITE));
...
}
```
### Drawable
Drawables can be tinted by using `DrawableCompat` from the [AndroidX core library](https://developer.android.com/jetpack/androidx/releases/core):
```java
Drawable icon = ContextCompat.getDrawable(this, R.drawable.ic_fluent_checkmark_24_regular);
// Tint drawable with a single color
DrawableCompat.setTint(icon, Color.WHITE);
// Tint drawable with a color state list
DrawableCompat.setTintList(icon, ContextCompat.getColorStateList(this, R.color.white_selector));
```
## Shrink resources (Not working yet)
To maintain a lean app size by excluding any unused icons in build time, set the `shrinkResources` to `true` in your `build.gradle` file, as follows:
```groovy
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles ...
}
}
```
If you prefer to only exclude the Fluent icons, please save the [keep.xml](android/sample-shrinkresources/src/main/res/raw/keep.xml) file at your project's `res/raw` directory. Please see this [Android developer guide](https://developer.android.com/studio/build/shrink-code#shrink-resources) for details about shrinking resources

28
android/build.gradle Normal file
Просмотреть файл

@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

21
android/gradle.properties Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

Двоичные данные
android/gradle/wrapper/gradle-wrapper.jar поставляемый Normal file

Двоичный файл не отображается.

6
android/gradle/wrapper/gradle-wrapper.properties поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
#Mon Nov 18 15:35:55 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

172
android/gradlew поставляемый Executable file
Просмотреть файл

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# 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
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# 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
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
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" -a "$nonstop" = "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
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
android/gradlew.bat поставляемый Normal file
Просмотреть файл

@ -0,0 +1,84 @@
@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
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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=
@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 Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_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=%*
: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

1
android/library/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/build

Просмотреть файл

@ -0,0 +1,27 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
apply from: './publish.gradle'

Просмотреть файл

@ -0,0 +1,3 @@
POM_GROUP_ID=com.microsoft.design
POM_ARTIFACT_ID=fluent-icons
VERSION_NAME=1.0.0

21
android/library/proguard-rules.pro поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

Просмотреть файл

@ -0,0 +1,25 @@
apply plugin: 'maven-publish'
project.afterEvaluate {
publishing {
publications {
fluenticons(MavenPublication) {
groupId project.POM_GROUP_ID
artifactId project.POM_ARTIFACT_ID
version System.getProperty("versionName", project.VERSION_NAME + "-SNAPSHOT")
artifact bundleReleaseAar
}
}
repositories {
maven {
url 'https://pkgs.dev.azure.com/microsoftdesign/951975d5-69cc-4771-9d98-92a4b1a82b2b/_packaging/fluent-icons/maven/v1'
credentials {
username "microsoftdesign"
password System.getProperty("vstsAccessToken", "")
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.fluent.mobile.icons">
</manifest>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<!-- Default color for icons -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#212121"/>
</selector>

1
android/sample-showcase/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/build

Просмотреть файл

@ -0,0 +1,38 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.microsoft.fluent.mobile.icons.sample"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'com.google.android.material:material:1.1.0-beta02'
implementation project(':library')
}

21
android/sample-showcase/proguard-rules.pro поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

Просмотреть файл

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.fluent.mobile.icons.sample">
<application
android:name=".FluentApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Fluent">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Просмотреть файл

@ -0,0 +1,12 @@
package com.microsoft.fluent.mobile.icons.sample
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
class FluentApplication : Application() {
override fun onCreate() {
super.onCreate()
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}
}

Просмотреть файл

@ -0,0 +1,10 @@
/*
* Copyright (c) 2019.
* Microsoft Corporation. All rights reserved.
*/
package com.microsoft.fluent.mobile.icons.sample
import androidx.annotation.DrawableRes
data class IconInfo(@DrawableRes val iconResId: Int, val iconName: String)

Просмотреть файл

@ -0,0 +1,267 @@
/*
* Copyright (c) 2019.
* Microsoft Corporation. All rights reserved.
*/
package com.microsoft.fluent.mobile.icons.sample
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
import android.os.AsyncTask
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.lifecycle.*
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
class MainActivity : AppCompatActivity(), TextWatcher, Observer<List<IconInfo>>, View.OnClickListener {
private val COLUMN_NUMBER_LIST_MODE = 1
private val COLUMN_NUMBER_GRID_MODE = 4
private var mIsListMode = true
private var mAdapter: IconEntryAdapter? = null
private var mGridLayoutManager: GridLayoutManager? = null
private var mClearSearchButton: ImageButton? = null
private var mSearchModeButton: ImageButton? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val viewModel = ViewModelProviders.of(this).get(IconsViewModel::class.java)
viewModel.getIconInfos().observe(this, this)
mGridLayoutManager = GridLayoutManager(this, COLUMN_NUMBER_LIST_MODE)
mAdapter = IconEntryAdapter(this)
val recyclerView = findViewById<RecyclerView>(R.id.recycler_view)
recyclerView.layoutManager = mGridLayoutManager
recyclerView.adapter = mAdapter
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
hideKeyboard(recyclerView)
}
}
})
val editText = findViewById<EditText>(R.id.search_field)
editText.addTextChangedListener(this)
mClearSearchButton = findViewById(R.id.search_clear_button)
mClearSearchButton?.setOnClickListener {
editText.setText(null)
}
mSearchModeButton = findViewById(R.id.search_mode_button)
mSearchModeButton?.setOnClickListener {
mIsListMode = mSearchModeButton?.isActivated!!
mSearchModeButton?.isActivated = !mIsListMode
ensureUi()
}
}
override fun afterTextChanged(s: Editable?) {
if (TextUtils.isEmpty(s)) {
mClearSearchButton?.visibility = View.GONE
} else {
mClearSearchButton?.visibility = View.VISIBLE
}
mAdapter?.filter?.filter(s)
}
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun onChanged(iconInfos: List<IconInfo>) {
mAdapter?.setIcons(iconInfos)
}
override fun onClick(p0: View?) {
}
private fun ensureUi() {
if (mIsListMode) {
mGridLayoutManager?.spanCount = COLUMN_NUMBER_LIST_MODE
} else {
mGridLayoutManager?.spanCount = COLUMN_NUMBER_GRID_MODE
}
mAdapter?.notifyItemRangeChanged(0, mAdapter?.itemCount ?: 0)
}
private fun hideKeyboard(view: View) {
val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
private inner class IconEntryAdapter internal constructor(context: Context) :
RecyclerView.Adapter<RecyclerView.ViewHolder>(), Filterable {
private val mInflater: LayoutInflater = LayoutInflater.from(context)
private var mOriginalIcons: List<IconInfo>? = null
private var mDisplayIcons: List<IconInfo>? = null
private val mListIconSize: Int = context.resources.getDimensionPixelSize(R.dimen.list_item_icon_size)
private val mListVerticalPadding: Int = context.resources.getDimensionPixelSize(R.dimen.list_item_row_padding_top)
private val mGridVerticalPadding: Int = context.resources.getDimensionPixelSize(R.dimen.outlook_content_inset)
private val mFilter = object : Filter() {
override fun performFiltering(charSequence: CharSequence): FilterResults {
val results = FilterResults()
if (TextUtils.isEmpty(charSequence)) {
results.count = mOriginalIcons!!.size
results.values = mOriginalIcons
return results
}
val filteredResults = arrayListOf<IconInfo>()
for (info in mOriginalIcons!!) {
if (info.iconName.contains(charSequence)) {
filteredResults.add(info)
}
}
results.count = filteredResults.size
results.values = filteredResults
return results
}
override fun publishResults(charSequence: CharSequence, filterResults: FilterResults) {
if (filterResults.count > 0) {
mDisplayIcons = filterResults.values as List<IconInfo>?
notifyDataSetChanged()
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val itemView = mInflater.inflate(R.layout.row_icon_entry, parent, false)
itemView.setOnClickListener(this@MainActivity)
return ContentViewHolder(itemView)
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val icon = mDisplayIcons!![position]
val contentHolder = holder as ContentViewHolder
contentHolder.title.text = icon.iconName
contentHolder.icon.setImageResource(icon.iconResId)
if (mIsListMode) {
contentHolder.title.visibility = View.VISIBLE
contentHolder.icon.layoutParams.width = mListIconSize
contentHolder.icon.layoutParams.height = mListIconSize
contentHolder.container.setSquareMode(false)
ViewCompat.setPaddingRelative(
contentHolder.container,
ViewCompat.getPaddingStart(contentHolder.container),
mListVerticalPadding,
ViewCompat.getPaddingEnd(contentHolder.container),
mListVerticalPadding
)
} else {
contentHolder.title.visibility = View.GONE
contentHolder.icon.layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
contentHolder.icon.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
contentHolder.container.setSquareMode(true)
ViewCompat.setPaddingRelative(
contentHolder.container,
ViewCompat.getPaddingStart(contentHolder.container),
mGridVerticalPadding,
ViewCompat.getPaddingEnd(contentHolder.container),
mGridVerticalPadding
)
}
}
override fun getItemCount(): Int {
return if (mDisplayIcons == null) 0 else mDisplayIcons!!.size
}
override fun getFilter(): Filter {
return mFilter
}
fun setIcons(iconInfos: List<IconInfo>) {
mOriginalIcons = iconInfos
mDisplayIcons = mOriginalIcons
notifyDataSetChanged()
}
}
class ContentViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val container: SquareLinearLayout = itemView.findViewById(R.id.container)
val title: TextView = itemView.findViewById(R.id.settings_title)
val icon: ImageView = itemView.findViewById(R.id.settings_icon)
}
class IconsViewModel(application: Application) : AndroidViewModel(application) {
private var mIconInfos: MutableLiveData<List<IconInfo>>? = null
fun getIconInfos() : LiveData<List<IconInfo>> {
if (mIconInfos == null) {
mIconInfos = MutableLiveData()
loadIconInfo()
}
return mIconInfos!!
}
@SuppressLint("StaticFieldLeak")
private fun loadIconInfo() {
object : AsyncTask<Void, Void, List<IconInfo>>() {
override fun doInBackground(vararg voids: Void): List<IconInfo> {
val result = arrayListOf<IconInfo>()
val drawables = getDrawables()
val fields = drawables::class.java.fields
for (field in fields) {
try {
if (field.name.endsWith("_selector")) {
continue
}
result.add(IconInfo(field.getInt(null), field.name))
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
return result
}
override fun onPostExecute(iconInfos: List<IconInfo>) {
mIconInfos!!.value = iconInfos
}
}.execute()
}
private fun getDrawables() : com.microsoft.fluent.mobile.icons.R.drawable {
try {
val constructor =
com.microsoft.fluent.mobile.icons.R.drawable::class.java.getDeclaredConstructor()
constructor.isAccessible = true
return constructor.newInstance()
} catch (e: Exception) {
throw RuntimeException(e)
}
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) 2019.
* Microsoft Corporation. All rights reserved.
*/
package com.microsoft.fluent.mobile.icons.sample;
import android.content.Context;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class SquareLinearLayout extends LinearLayout {
private boolean mIsSquareMode;
public SquareLinearLayout(Context context) {
super(context);
}
public SquareLinearLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public SquareLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mIsSquareMode) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setBackgroundResource(R.drawable.item_background_circular);
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setBackgroundResource(R.drawable.item_background);
}
}
public void setSquareMode(boolean isSquareMode) {
mIsSquareMode = isSquareMode;
requestLayout();
}
}

Просмотреть файл

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M-1.5,15L110.5,78M-1.5,-2L110.5,61"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M112,13L0,76M112,-4L0,59"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M39,109.5L39,-2.5"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M-1.5,32L110.5,95M-1.5,49L110.5,112"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M112,30L0,93M112,48L0,111"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M54,109.5L54,-2.5"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M69,109.5L69,-2.5"
android:strokeAlpha=".533"
android:strokeWidth=".5"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:pathData="M54,54m-75,0a75,75 0,1 1,150 0a75,75 0,1 1,-150 0"
android:fillType="evenOdd">
<aapt:attr name="android:fillColor">
<gradient
android:gradientRadius="63.8985"
android:centerX="54"
android:centerY="53.7975"
android:type="radial">
<item android:offset="4E-4" android:color="#00000000"/>
<item android:offset="0.99991995" android:color="#B8000000"/>
</gradient>
</aapt:attr>
</path>
<path
android:strokeWidth="1"
android:pathData="M39,54.673L53.969,46.115M54.009,46.115L54.009,29M39,54.673L53.969,63.23M39,37.558L53.969,46.115M54.009,63.23L54.009,46.115"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
<path
android:strokeWidth="1"
android:pathData="M53.98,80.31l-14.98,-8.54l0,-34.23l14.98,-8.54l14.98,8.54l-14.98,8.54l14.98,8.54l-14.98,8.61z"
android:fillColor="#00000000"
android:strokeColor="#FFF"
android:fillType="evenOdd"/>
</vector>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<color xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@android:color/black"/>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_list_24_regular" android:state_activated="true" />
<item android:drawable="@drawable/ic_fluent_grid_24_regular" />
</selector>

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<color android:color="@android:color/white" />
</item>
<item>
<selector>
<item
android:state_selected="true"
android:drawable="@color/item_highlight_color" />
</selector>
</item>
</ripple>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2017.
~ Microsoft Corporation. All rights reserved.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/item_highlight_color"
android:radius="48dp" />

Просмотреть файл

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/window_background"
app:liftOnScroll="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<EditText
android:id="@+id/search_field"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:background="@null"
android:drawableStart="@drawable/ic_fluent_search_24_regular"
android:drawablePadding="32dp"
android:hint="Search icons"
android:maxLines="1"
android:paddingStart="16dp"
android:singleLine="true"
app:drawableTint="@color/grey400" />
<ImageButton
android:id="@+id/search_clear_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:src="@drawable/ic_fluent_dismiss_circle_24_filled"
android:tint="@color/grey400"
android:visibility="gone"
tools:visibility="visible" />
<ImageButton
android:id="@+id/search_mode_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:src="@drawable/ic_search_mode_selector"
android:tint="@color/grey400" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/row_icon_entry" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Просмотреть файл

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<com.microsoft.fluent.mobile.icons.sample.SquareLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
style="@style/ListItem.Row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/settings_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:importantForAccessibility="no"
android:scaleType="centerInside"
android:tint="?android:textColorPrimary"
tools:src="@drawable/ic_fluent_delete_24_regular"/>
<TextView
android:id="@+id/settings_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_weight="1"
android:ellipsize="end"
android:importantForAccessibility="no"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:textColorPrimary"
android:textDirection="locale"
tools:text="ic_delete"/>
</com.microsoft.fluent.mobile.icons.sample.SquareLinearLayout>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Двоичные данные
android/sample-showcase/src/main/res/mipmap-hdpi/ic_launcher.webp Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
android/sample-showcase/src/main/res/mipmap-mdpi/ic_launcher.webp Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 992 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичные данные
android/sample-showcase/src/main/res/mipmap-xhdpi/ic_launcher.webp Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.6 KiB

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<bool name="outlook_app_is_light_nav_bar">false</bool>
</resources>

Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<color name="window_background">@android:color/black</color>
<color name="text_primary">@color/grey400</color>
<color name="divider">#FF292929</color>
<color name="item_highlight_color">#1AFFFFFF</color>
</resources>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Fluent" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowLightStatusBar">@bool/outlook_app_is_light_nav_bar</item>
</style>
</resources>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Fluent" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:navigationBarColor">?android:windowBackground</item>
<item name="android:windowLightNavigationBar">@bool/outlook_app_is_light_nav_bar</item>
<item name="android:windowLightStatusBar">@bool/outlook_app_is_light_nav_bar</item>
</style>
</resources>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<bool name="outlook_app_is_light_nav_bar">true</bool>
</resources>

Просмотреть файл

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<color name="window_background">@android:color/white</color>
<color name="colorPrimary">@android:color/white</color>
<color name="colorPrimaryDark">@android:color/white</color>
<color name="colorAccent">#2F80ED</color>
<color name="text_primary">@color/grey900</color>
<color name="grey900">#FF212121</color>
<color name="grey400">#FF919191</color>
<color name="divider">#FFE1E1E1</color>
<color name="item_highlight_color">#0E000000</color>
</resources>

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<dimen name="outlook_content_inset">16dp</dimen>
<dimen name="list_item_icon_size">24dp</dimen>
<dimen name="list_item_row_padding_top">12dp</dimen>
<dimen name="list_item_row_padding_bottom">12dp</dimen>
<dimen name="list_item_row_min_height">56dp</dimen>
</resources>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<string name="app_name">Fluent icons</string>
</resources>

Просмотреть файл

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Base.Theme.Fluent" parent="Theme.AppCompat.DayNight.NoActionBar">
</style>
<style name="Theme.Fluent" parent="Base.Theme.Fluent">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:statusBarColor">?android:windowBackground</item>
<item name="android:windowBackground">@color/window_background</item>
<item name="homeAsUpIndicator">@drawable/ic_fluent_arrow_left_24_regular</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.AppTheme.Toolbar.Button.Navigation</item>
</style>
<style name="Widget.AppTheme.Toolbar.Button.Navigation" parent="@style/Widget.AppCompat.Toolbar.Button.Navigation">
<item name="android:tint">@android:color/white</item>
</style>
<!-- List Item -->
<style name="ListItem"/>
<style name="ListItem.Row">
<item name="android:minHeight">@dimen/list_item_row_min_height</item>
<item name="android:paddingBottom">@dimen/list_item_row_padding_bottom</item>
<item name="android:paddingStart">@dimen/outlook_content_inset</item>
<item name="android:paddingEnd">@dimen/outlook_content_inset</item>
<item name="android:paddingTop">@dimen/list_item_row_padding_top</item>
</style>
</resources>

1
android/sample-shrinkresources/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/build

Просмотреть файл

@ -0,0 +1,37 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.microsoft.fluent.mobile.sample_shrinkresources"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.1.0'
implementation project(':library')
}

21
android/sample-shrinkresources/proguard-rules.pro поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

Просмотреть файл

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.fluent.mobile.sample_shrinkresources">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Просмотреть файл

@ -0,0 +1,17 @@
/*
* Copyright (c) 2019.
* Microsoft Corporation. All rights reserved.
*/
package com.microsoft.fluent.mobile.sample_shrinkresources
import android.app.Activity
import android.os.Bundle
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#00FF00" />
</shape>

Просмотреть файл

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#FF0000" />
</shape>

Просмотреть файл

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

Просмотреть файл

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_fluent_checkmark_24_regular" />
</FrameLayout>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 15 KiB

Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*,@color/*,@layout/*,@xml/*,@dimen/*,@integer/*,@bool/*,@anim/*,@menu/*,@string/*,@array/*,@plurals/*,@style/*,@font/*"
tools:discard="@drawable/ic_fluent_*" />
<!--
Save this file at your project's res/raw directory to exclude unused icons in build time.
-->

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
<string name="app_name">sample-shrinkresources</string>
</resources>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019.
~ Microsoft Corporation. All rights reserved.
-->
<resources>
</resources>

2
android/settings.gradle Normal file
Просмотреть файл

@ -0,0 +1,2 @@
include ':library', ':sample-showcase', ':sample-shrinkresources'
rootProject.name='Fluent Mobile Icons'

Двоичные данные
art/bottom_tab.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
art/ic_fluent_mail_filled.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.8 KiB

Двоичные данные
art/ic_fluent_mail_regular.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.6 KiB

Двоичные данные
art/readme-asset.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 56 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.8 KiB

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше