-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
136 changed files
with
7,839 additions
and
2 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 @@ | ||
3.0 |
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,14 @@ | ||
# references: | ||
# * http://www.objc.io/issue-6/travis-ci.html | ||
# * https://github.com/supermarin/xcpretty#usage | ||
|
||
osx_image: xcode7.3 | ||
language: objective-c | ||
# cache: cocoapods | ||
# podfile: Example/Podfile | ||
# before_install: | ||
# - gem install cocoapods # Since Travis is not always on latest version | ||
# - pod install --project-directory=Example | ||
script: | ||
- set -o pipefail && xcodebuild test -workspace UniLayoutIOS/Example/UniLayout.xcworkspace -scheme UniLayout-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty | ||
- pod lib lint |
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
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 |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# UniLayout | ||
A uniform layout system for both iOS and Android | ||
|
||
[![CI Status](http://img.shields.io/travis/crescentflare/UniLayout.svg?style=flat)](https://travis-ci.org/crescentflare/UniLayout) | ||
[![License](https://img.shields.io/cocoapods/l/UniLayout.svg?style=flat)](http://cocoapods.org/pods/UniLayout) | ||
[![Version](https://img.shields.io/cocoapods/v/UniLayout.svg?style=flat)](http://cocoapods.org/pods/UniLayout) | ||
[![Version](https://img.shields.io/bintray/v/crescentflare/maven/UniLayoutLib.svg?style=flat)](https://bintray.com/crescentflare/maven/UniLayoutLib) | ||
|
||
UniLayout is a project to make multi-platform development easier for iOS and Android regarding layouts. The goal is to have a uniform layout system to port the flexibility of Android layouts to iOS while adding more features to Android. Based on the layout container system from Android (like LinearLayout and FrameLayout). | ||
|
||
|
||
### Features | ||
|
||
* Ports the Android layout capabilities to iOS, including Linear Layout, Frame Layout and Scroll View | ||
* For iOS, the scroll view automatically updates its content size | ||
* Adds additional capabilities like minimum and maximum sizes and more flexibility in alignment (through gravity) | ||
|
||
|
||
### iOS integration guide | ||
|
||
The library is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile. | ||
|
||
```ruby | ||
pod "UniLayout", '~> 0.1.0' | ||
``` | ||
|
||
|
||
### Android integration guide | ||
|
||
When using gradle, the library can easily be imported into the build.gradle file of your project. Add the following dependency: | ||
|
||
``` | ||
compile 'com.crescentflare.unilayout:UniLayoutLib:0.1.0' | ||
``` | ||
|
||
Make sure that jcenter is added as a repository. | ||
|
||
|
||
### Example | ||
|
||
The provided example shows how to build several layout styles. The layout is written in code on iOS, or xml files on Android. | ||
|
||
|
||
### Status | ||
|
||
The library is in its initial state but has basic functionality which can already be useful. However, code isn't optimized yet and may contain bugs. Code optimizations and more features will be added in the future. |
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,42 @@ | ||
# | ||
# Be sure to run `pod lib lint UniLayout.podspec' to ensure this is a | ||
# valid spec before submitting. | ||
# | ||
# Any lines starting with a # are optional, but their use is encouraged | ||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
s.name = 'UniLayout' | ||
s.version = '0.1.0' | ||
s.summary = 'A uniform layout system for iOS and Android.' | ||
|
||
# This description is used to generate tags and improve search results. | ||
# * Think: What does it do? Why did you write it? What is the focus? | ||
# * Try to keep it short, snappy and to the point. | ||
# * Write the description between the DESC delimiters below. | ||
# * Finally, don't worry about the indent, CocoaPods strips it! | ||
|
||
s.description = <<-DESC | ||
A uniform layout system for both iOS and Android. Based on the layout container system from Android (like LinearLayout and FrameLayout). | ||
DESC | ||
|
||
s.homepage = 'https://github.com/crescentflare/UniLayout' | ||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.author = { 'Crescent Flare' => 'info@crescentflare.com' } | ||
s.source = { :git => 'https://github.com/crescentflare/UniLayout.git', :tag => s.version.to_s } | ||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' | ||
|
||
s.ios.deployment_target = '8.0' | ||
|
||
s.source_files = 'UniLayoutIOS/UniLayout/Classes/**/*' | ||
|
||
# s.resource_bundles = { | ||
# 'UniLayout' => ['UniLayout/Assets/*.png'] | ||
# } | ||
|
||
# s.public_header_files = 'Pod/Classes/**/*.h' | ||
# s.frameworks = 'UIKit', 'MapKit' | ||
# s.dependency 'AFNetworking', '~> 2.3' | ||
end |
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,9 @@ | ||
.gradle | ||
.idea | ||
*.iml | ||
**/*.iml | ||
/build | ||
**/build | ||
/local.properties | ||
/.idea/workspace.xml | ||
.DS_Store |
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,45 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "24.0.1" | ||
|
||
defaultConfig { | ||
minSdkVersion 9 | ||
targetSdkVersion 24 | ||
versionCode 1 | ||
versionName "1.0.0" | ||
applicationId "com.crescentflare.unilayoutexample" | ||
} | ||
|
||
signingConfigs { | ||
release { | ||
storeFile file("./example.jks") | ||
storePassword "example" | ||
keyAlias "Example" | ||
keyPassword "example" | ||
} | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
minifyEnabled false | ||
testCoverageEnabled false | ||
} | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | ||
signingConfig signingConfigs.release | ||
} | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.android.support:appcompat-v7:24.2.0' | ||
compile 'com.android.support:recyclerview-v7:24.2.0' | ||
compile project(':UniLayoutLib') | ||
} |
Binary file not shown.
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,28 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# 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 *; | ||
#} | ||
|
||
# Platform calls Class.forName on types which do not exist on Android to determine platform. | ||
-dontnote retrofit2.Platform | ||
# Platform used when running on RoboVM on iOS. Will not be used at runtime. | ||
-dontnote retrofit2.Platform$IOS$MainThreadExecutor | ||
# Platform used when running on Java 8 VMs. Will not be used at runtime. | ||
-dontwarn retrofit2.Platform$Java8 | ||
# Retain generic type information for use by reflection by converters and adapters. | ||
-keepattributes Signature | ||
# Retain declared checked exceptions for use by a Proxy instance. | ||
-keepattributes Exceptions |
22 changes: 22 additions & 0 deletions
22
UniLayoutAndroid/UniLayoutExample/src/main/AndroidManifest.xml
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.crescentflare.unilayoutexample"> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" | ||
android:name=".ExampleApplication"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".nestedlayouts.NestedLayoutsActivity"/> | ||
<activity android:name=".reusingcontainer.ReusingContainerActivity"/> | ||
</application> | ||
</manifest> |
28 changes: 28 additions & 0 deletions
28
...UniLayoutExample/src/main/java/com/crescentflare/unilayoutexample/ExampleApplication.java
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,28 @@ | ||
package com.crescentflare.unilayoutexample; | ||
|
||
import android.app.Application; | ||
import android.content.Context; | ||
|
||
/** | ||
* The singleton application context (containing the other singletons in the app) | ||
*/ | ||
public class ExampleApplication extends Application | ||
{ | ||
// --- | ||
// Global context member | ||
// --- | ||
|
||
public static Context context = null; | ||
|
||
|
||
// --- | ||
// Initialization | ||
// --- | ||
|
||
@Override | ||
public void onCreate() | ||
{ | ||
super.onCreate(); | ||
context = this; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...droid/UniLayoutExample/src/main/java/com/crescentflare/unilayoutexample/MainActivity.java
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,64 @@ | ||
package com.crescentflare.unilayoutexample; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
|
||
import com.crescentflare.unilayoutexample.nestedlayouts.NestedLayoutsActivity; | ||
import com.crescentflare.unilayoutexample.reusingcontainer.ReusingContainerActivity; | ||
|
||
/** | ||
* The main activity shows a small layout example, explanation and buttons to show other layout examples | ||
*/ | ||
public class MainActivity extends AppCompatActivity | ||
{ | ||
// --- | ||
// Initialization | ||
// --- | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) | ||
{ | ||
// Set view | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
// Button to open nested layouts example | ||
findViewById(R.id.activity_main_nestedlayouts).setOnClickListener(new View.OnClickListener() | ||
{ | ||
@Override | ||
public void onClick(View v) | ||
{ | ||
showNestedLayouts(); | ||
} | ||
}); | ||
|
||
// Button to open reusing container example | ||
findViewById(R.id.activity_main_reusingcontainer).setOnClickListener(new View.OnClickListener() | ||
{ | ||
@Override | ||
public void onClick(View v) | ||
{ | ||
showReusingContainer(); | ||
} | ||
}); | ||
} | ||
|
||
|
||
// --- | ||
// Interaction | ||
// --- | ||
|
||
private void showNestedLayouts() | ||
{ | ||
Intent intent = new Intent(this, NestedLayoutsActivity.class); | ||
startActivity(intent); | ||
} | ||
|
||
private void showReusingContainer() | ||
{ | ||
Intent intent = new Intent(this, ReusingContainerActivity.class); | ||
startActivity(intent); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...src/main/java/com/crescentflare/unilayoutexample/nestedlayouts/NestedLayoutsActivity.java
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,49 @@ | ||
package com.crescentflare.unilayoutexample.nestedlayouts; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.ActionBar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.MenuItem; | ||
|
||
import com.crescentflare.unilayoutexample.R; | ||
|
||
/** | ||
* The nested layouts activity loads a layout file with nested UniLayout containers | ||
*/ | ||
public class NestedLayoutsActivity extends AppCompatActivity | ||
{ | ||
// --- | ||
// Initialization | ||
// --- | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_nested_layouts); | ||
setTitle(getString(R.string.example_nested_layouts)); | ||
|
||
ActionBar actionBar = getSupportActionBar(); | ||
if (actionBar != null) | ||
{ | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
actionBar.setHomeButtonEnabled(true); | ||
} | ||
} | ||
|
||
|
||
// --- | ||
// Menu handling | ||
// --- | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) | ||
{ | ||
if (item.getItemId() == android.R.id.home) | ||
{ | ||
onBackPressed(); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
Oops, something went wrong.