forked from intuit/ssp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 04e82e7
Showing
46 changed files
with
12,402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Change Log | ||
=============================================================================== | ||
Version 1.0 *(2015-01-28)* | ||
---------------------------- | ||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 - 2015 Intuit Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SSP - a scalable size unit for texts | ||
An android SDK that provides a new size unit - ssp (scalable sp). This size unit scales with the screen size. It can help Android developers with supporting multiple screens. | ||
|
||
# Attention | ||
Use it carefully! for example, in most cases you still need to design a different layout for tablets. | ||
|
||
# Example | ||
[Here](https://github.com/intuit/ssp/blob/master/ssp-android/src/main/res/layout/ssp_example.xml) is a single layout built using ssp: | ||
|
||
![ssp example](https://github.com/intuit/ssp/blob/master/ssp_example.png) | ||
|
||
And [here](https://github.com/intuit/ssp/blob/master/ssp-android/src/main/res/layout/sp_example.xml) is the same layout built using sp: | ||
|
||
![sp example](https://github.com/intuit/ssp/blob/master/sp_example.png) | ||
|
||
You can see that ssp scales with the screen size and the sp stays with the same size on all screen sizes. | ||
|
||
# Getting Started | ||
|
||
To add ssp to your Android Studio project: | ||
|
||
add compile 'com.intuit.ssp:ssp-android:1.0.4’ to your build.gradle dependencies block. | ||
|
||
for example: | ||
|
||
``` | ||
dependencies { | ||
compile 'com.intuit.ssp:ssp-android:1.0.4’ | ||
} | ||
``` | ||
|
||
See the [ssp_example.xml](https://github.com/intuit/ssp/blob/master/ssp-android/src/main/res/layout/ssp_example.xml) to see how to use to the ssp size unit. | ||
|
||
# Note | ||
The ssp size unit calculation includes some approximation due to some performance and usability constraints. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:2.2.2' | ||
} | ||
} | ||
|
||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.1" | ||
|
||
defaultConfig { | ||
minSdkVersion 13 | ||
targetSdkVersion 25 | ||
} | ||
} | ||
|
||
public class SSPFactory extends DefaultTask { | ||
|
||
@Input | ||
String unit = "sp" | ||
@Input | ||
double positiveMax = 600 | ||
@Input | ||
double negativeMax = 60 | ||
|
||
@TaskAction | ||
def create() { | ||
String resFolder = project.getProjectDir().getPath() + "/src/main/res/"; | ||
for(double dimen = 300; dimen <= 800 ; dimen = dimen + 30){ | ||
createPositive(resFolder, dimen) | ||
} | ||
for(double dimen = 300; dimen <= 800; dimen = dimen + 30){ | ||
createNegative(resFolder, dimen) | ||
} | ||
createPositive(resFolder, 1080) | ||
createNegative(resFolder, 1080) | ||
} | ||
|
||
private void createNegative(String resFolder, double dimen) { | ||
String folder = resFolder + "values-sw" + (int) dimen + "dp"; | ||
String fileName = folder + "/negative_ssps.xml"; | ||
new File(folder).mkdir(); | ||
new File(fileName).createNewFile(); | ||
PrintWriter printWriter = new PrintWriter(fileName); | ||
printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); | ||
printWriter.println("<resources>"); | ||
for (int i = 1; i <= negativeMax; i++) { | ||
double ratio = i / 300d; | ||
double ssp = ratio * dimen; | ||
printWriter.printf("\t<dimen name=\"_minus%dssp\">%.2f" + unit + "</dimen>\r\n", i, -ssp); | ||
} | ||
printWriter.println("</resources>"); | ||
printWriter.close(); | ||
} | ||
|
||
private void createPositive(String resFolder, double dimen) { | ||
String folder = resFolder + "values-sw" + (int) dimen + "dp"; | ||
String fileName = folder + "/positive_ssps.xml"; | ||
new File(folder).mkdir(); | ||
new File(fileName).createNewFile(); | ||
PrintWriter printWriter = new PrintWriter(fileName); | ||
printWriter.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); | ||
printWriter.println("<resources>"); | ||
for (int i = 1; i <= positiveMax; i++) { | ||
double ratio = i / 300d; | ||
double ssp = ratio * dimen; | ||
printWriter.printf("\t<dimen name=\"_%dssp\">%.2f" + unit + "</dimen>\r\n", i, ssp); | ||
} | ||
printWriter.println("</resources>"); | ||
printWriter.close(); | ||
} | ||
} | ||
|
||
task createSSP(type: SSPFactory) { | ||
} | ||
|
||
//uncomment next line to edit values | ||
preBuild.dependsOn createSSP | ||
|
||
createSSP{ | ||
unit = "sp"//change to "sp" if needed | ||
positiveMax = 600//change to 600 or any other value if needed | ||
negativeMax = 60//change to 600 or any other value if needed | ||
} | ||
|
||
signing { | ||
required { gradle.taskGraph.hasTask("uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
//uploadArchives { | ||
// configuration = configurations.archives | ||
// repositories.mavenDeployer { | ||
// beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
// | ||
// repository(url: sonatypeRepo) { | ||
// authentication(userName: sonatypeUsername, | ||
// password: sonatypePassword) | ||
// } | ||
// | ||
// pom.groupId = 'com.intuit.ssp' | ||
// pom.artifactId = 'ssp-android' | ||
// pom.version = '1.0.4' | ||
// | ||
// pom.project { | ||
// name 'ssp' | ||
// packaging 'aar' | ||
// description 'A scalable size unit for Andorid' | ||
// url 'https://github.com/intuit/ssp' | ||
// | ||
// scm { | ||
// url 'https://github.com/intuit/ssp' | ||
// connection 'scm:git@github.com:intuit/ssp.git' | ||
// developerConnection 'scm:git@github.com:intuit/ssp.git' | ||
// } | ||
// | ||
// licenses { | ||
// license { | ||
// name 'The MIT License (MIT)' | ||
// url 'https://github.com/intuit/ssp/blob/master/LICENSE' | ||
// distribution 'repo' | ||
// } | ||
// } | ||
// | ||
// developers { | ||
// developer { | ||
// id developerID | ||
// name developerName | ||
// email developerEmail | ||
// } | ||
// } | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.intuit.ssp" | ||
android:versionCode="1" | ||
android:versionName="1.0.4" > | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-10 | ||
android.library=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<RelativeLayout 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" | ||
android:background="@android:color/white" | ||
android:gravity="center"> | ||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
android:id="@+id/give_us_a_review_landmine_main_layout" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
android:paddingBottom="27sp" | ||
android:paddingLeft="43sp" | ||
android:paddingRight="43sp" | ||
android:paddingTop="50sp" > | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Intuit" | ||
android:textColor="@android:color/black" | ||
android:textSize="40sp"/> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="-10sp" | ||
android:paddingBottom="15sp" | ||
android:orientation="horizontal" > | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:includeFontPadding="false" | ||
android:text="♡" | ||
android:textColor="#ED6C27" | ||
android:textSize="70sp" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:includeFontPadding="false" | ||
android:text="U" | ||
android:textColor="@android:color/black" | ||
android:textSize="70sp" /> | ||
</LinearLayout> | ||
|
||
<TextView | ||
android:id="@+id/give_us_a_review_landmine_text_1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:paddingBottom="12sp" | ||
android:text="Rate us so we can grow and help more people get their finances in check" | ||
android:textColor="@android:color/black" | ||
android:textSize="16sp" /> | ||
|
||
<TextView | ||
android:id="@+id/give_us_a_review_landmine_text_2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:text="★★★★★" | ||
android:textColor="#747474" | ||
android:textSize="22sp" | ||
android:textStyle="bold" /> | ||
|
||
<Button | ||
android:id="@+id/give_us_a_review_landmine_button" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:layout_marginTop="25sp" | ||
android:padding="8sp" | ||
android:text="Rate" | ||
android:textSize="15sp" | ||
android:visibility="visible" | ||
android:textColor="@android:color/white" | ||
android:gravity="center" | ||
android:minWidth="120sp" | ||
android:includeFontPadding="false" | ||
android:background="#0ac775" | ||
android:singleLine="true"/> | ||
|
||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
|
||
</RelativeLayout> |
Oops, something went wrong.