Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Bos authored and Johan Bos committed Nov 23, 2016
2 parents 229eb4c + 807d555 commit 987db27
Show file tree
Hide file tree
Showing 16 changed files with 506 additions and 159 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -20,7 +20,7 @@ UniLayout is a project to make multi-platform development easier for iOS and And
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'
pod "UniLayout", '~> 0.1.1'
```


Expand All @@ -29,7 +29,7 @@ pod "UniLayout", '~> 0.1.0'
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'
compile 'com.crescentflare.unilayout:UniLayoutLib:0.1.1'
```

Make sure that jcenter is added as a repository.
Expand Down
8 changes: 4 additions & 4 deletions UniLayout.podspec
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'UniLayout'
s.version = '0.1.0'
s.version = '0.1.1'
s.summary = 'A uniform layout system for iOS and Android.'

# This description is used to generate tags and improve search results.
Expand All @@ -32,9 +32,9 @@ A uniform layout system for both iOS and Android. Based on the layout container

s.source_files = 'UniLayoutIOS/UniLayout/Classes/**/*'

# s.resource_bundles = {
# 'UniLayout' => ['UniLayout/Assets/*.png']
# }
s.resource_bundles = {
'UniLayout' => ['UniLayoutIOS/UniLayout/Assets/**/*']
}

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
Expand Down
4 changes: 2 additions & 2 deletions UniLayoutAndroid/UniLayoutLib/build.gradle
Expand Up @@ -13,7 +13,7 @@ ext {
siteUrl = 'https://github.com/crescentflare/UniLayout'
gitUrl = 'https://github.com/crescentflare/UniLayout.git'

libraryVersion = '0.1.0'
libraryVersion = '0.1.1'

developerId = 'crescentflare'
developerName = 'Johan Bos'
Expand All @@ -32,7 +32,7 @@ android {
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "0.1.0"
versionName "0.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
Expand Up @@ -2,11 +2,14 @@

import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.TextView;

import com.crescentflare.unilayout.helpers.UniLayoutParams;

/**
* UniLayout view: a view with simple text
* Extends TextView, currently it's just an alias to have the same name as the iOS class
* Extends TextView, includes a workaround to get text alignment to work with minimum width
*/
public class UniTextView extends TextView
{
Expand Down Expand Up @@ -38,4 +41,16 @@ public UniTextView(Context context, AttributeSet attrs, int defStyleAttr, int de
private void init(AttributeSet attrs)
{
}


// ---
// Override layout to force re-measure (to get text alignment to work properly)
// ---

@Override
public void layout(int left, int top, int right, int bottom)
{
measure(MeasureSpec.makeMeasureSpec(right - left, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(bottom - top, MeasureSpec.EXACTLY));
super.layout(left, top, right, bottom);
}
}
4 changes: 2 additions & 2 deletions UniLayoutIOS/Example/Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- UniLayout (0.1.0)
- UniLayout (0.1.1)

DEPENDENCIES:
- UniLayout (from `../../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ../../

SPEC CHECKSUMS:
UniLayout: 89449a3174e0d42acea1907cc336c3295e1fc683
UniLayout: 0e83d02500494db9bd8f1ea19b764e02c301a2a5

PODFILE CHECKSUM: c5be050806aea14e5154eac8062c6c6830d64e24

Expand Down
11 changes: 8 additions & 3 deletions UniLayoutIOS/Example/Pods/Local Podspecs/UniLayout.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UniLayoutIOS/Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

387 changes: 276 additions & 111 deletions UniLayoutIOS/Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -109,6 +109,7 @@ class ReusingContainerView: UniFrameContainer, UITableViewDataSource, UITableVie
let item = items[(indexPath as NSIndexPath).row]
let nextType = (indexPath as NSIndexPath).row + 1 < items.count ? items[(indexPath as NSIndexPath).row + 1].type : ReusableItemType.unknown
let cell = tableView.dequeueReusableCell(withIdentifier: item.type.rawValue) as? UniReusableView ?? UniReusableView()
cell.isSimulatingSpacing = false

// Set up an item cell
if item.type == .item {
Expand All @@ -120,7 +121,7 @@ class ReusingContainerView: UniFrameContainer, UITableViewDataSource, UITableVie

// Supply data
cell.selectionStyle = .none
cell.dividerIsHidden = nextType != .item
cell.dividerLine.isHidden = nextType != .item
cell.contentView.backgroundColor = UIColor.white
cellView?.title = item.title
cellView?.additional = item.additional
Expand All @@ -137,7 +138,7 @@ class ReusingContainerView: UniFrameContainer, UITableViewDataSource, UITableVie

// Supply data
cell.selectionStyle = .none
cell.dividerIsHidden = true
cell.dividerLine.isHidden = true
cell.contentView.backgroundColor = tableView.backgroundColor
cellView?.text = item.title
}
Expand All @@ -151,7 +152,7 @@ class ReusingContainerView: UniFrameContainer, UITableViewDataSource, UITableVie

// Supply data
cell.selectionStyle = .none
cell.dividerIsHidden = true
cell.dividerLine.isHidden = true
cell.contentView.backgroundColor = tableView.backgroundColor
}

Expand Down
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "unilayout-chevron.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
Expand Up @@ -64,4 +64,13 @@ public class UniLayoutProperties {
public var weight: CGFloat = 0
public var hiddenTakesSpace = false


// ---
// MARK: Public initializer
// ---

public init() {
// Required to be able to create UniLayoutView implementations outside of the library
}

}
55 changes: 55 additions & 0 deletions UniLayoutIOS/UniLayout/Classes/utility/UniAssets.swift
@@ -0,0 +1,55 @@
//
// UniAssets.swift
// UniLayout Pod
//
// Library utility: obtaining assets
// Obtain assets from the library, mostly used to simulate internal iOS assets
//

import UIKit

public class UniAssets {

// ---
// MARK: Members
// ---

private static var loadedAssets: [String: UIImage] = [:]


// ---
// MARK: Initialization
// ---

private init() {
}


// ---
// MARK: Direct asset access
// ---

public static var chevron: UIImage? {
get { return UniAssets.obtainAsset(name: "chevron") }
}


// ---
// MARK: Generic asset loading
// ---

public static func obtainAsset(name: String) -> UIImage? {
if let loadedAsset = loadedAssets[name] {
return loadedAsset
}
if let bundleUrl = Bundle(for: UniAssets.self).url(forResource: "UniLayout", withExtension: "bundle") {
let bundle = Bundle(url: bundleUrl)
if let image = UIImage(named: "unilayout-" + name, in: bundle, compatibleWith: nil) {
loadedAssets[name] = image
return image
}
}
return nil
}

}

0 comments on commit 987db27

Please sign in to comment.