Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Bos authored and Johan Bos committed Nov 8, 2016
2 parents c36bab0 + 641c952 commit 229eb4c
Show file tree
Hide file tree
Showing 136 changed files with 7,839 additions and 2 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
14 changes: 14 additions & 0 deletions .travis.yml
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016
Copyright (c) 2016 Crescent Flare Apps

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
45 changes: 44 additions & 1 deletion README.md
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.
42 changes: 42 additions & 0 deletions UniLayout.podspec
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
9 changes: 9 additions & 0 deletions UniLayoutAndroid/.gitignore
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
45 changes: 45 additions & 0 deletions UniLayoutAndroid/UniLayoutExample/build.gradle
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 added UniLayoutAndroid/UniLayoutExample/example.jks
Binary file not shown.
28 changes: 28 additions & 0 deletions UniLayoutAndroid/UniLayoutExample/proguard-rules.txt
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 UniLayoutAndroid/UniLayoutExample/src/main/AndroidManifest.xml
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>
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;
}
}
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);
}
}
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);
}
}

0 comments on commit 229eb4c

Please sign in to comment.