Skip to content

Commit

Permalink
fix(iOS): first phase of replacing MaterialCardView with simpler Mate…
Browse files Browse the repository at this point in the history
…rialCard

nstudio#12
  • Loading branch information
NathanWalker committed Mar 21, 2016
1 parent eea3604 commit d8108be
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ FakesAssemblies/
nativescript-cardview.sln

*.js
*.map
demo/platforms
demo/hooks
demo/app/*.js
Expand Down
34 changes: 15 additions & 19 deletions cardview.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {Property, PropertyMetadataSettings} from "ui/core/dependency-observable"

global.moduleMerge(common, exports);

declare var MaterialCard: any, UIApplication: any, CGRectMake: any;

// var radiusProp = new Property(
// "radius",
// "CardView",
Expand Down Expand Up @@ -33,32 +35,29 @@ export class CardView extends common.CardView {
// public shadowOpacityProp = shadowOpacityProp;
// public shadowRadiusProp = shadowRadiusProp;
// public backgroundColorProp = backgroundColorProp;
private _ios: MaterialCardView;
private _ios: MaterialCard;

constructor() {
super();

this._ios = new MaterialCardView({
x: 10,
y: uiUtils.ios.getStatusBarHeight() + 10,
w: UIApplication.sharedApplication().statusBarFrame.size.width - 20
}, null);

this._ios = new MaterialCard(CGRectMake(10, uiUtils.ios.getStatusBarHeight() + 10, UIApplication.sharedApplication().statusBarFrame.size.width - 20, 0));
// this._ios.cornerRadius = 0;
// this._ios.shadowOffsetWidth = 1;
// this._ios.shadowOffsetHeight = 8;
// this._ios.shadowColor = new Color('#5390E5').ios
// this._ios.shadowOpacity = .8;

// console.log(`CardView constructor ------`);
// console.log(this._ios);

// XML props are set after construction
// update appearance at next VM turn
setTimeout(() => {
this.updateAppearance();
});

console.log(`CardView constructor ------`);
console.log(this._ios);
}

get ios(): MaterialCardView {
get ios(): MaterialCard {
return this._ios;
}

get _nativeView(): MaterialCardView {
get _nativeView(): MaterialCard {
return this._ios;
}

Expand Down Expand Up @@ -112,8 +111,5 @@ export class CardView extends common.CardView {
// // console.log(`backgroundColor: ${this.backgroundColor}`);
// this._ios.backgroundColor = new Color(this.backgroundColor).ios;
// }


this._ios.materialize();
}
}
40 changes: 40 additions & 0 deletions demo/app/App_Resources/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="1"
android:versionName="1.0">

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
</application>
</manifest>
8 changes: 4 additions & 4 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"nativescript": {
"id": "org.nativescript.demo",
"tns-ios": {
"version": "1.6.0"
"version": "1.7.0"
},
"tns-android": {
"version": "1.5.1"
"version": "1.7.0"
}
},
"dependencies": {
"nativescript-cardview": "file:..",
"tns-core-modules": "latest"
"tns-core-modules": "^1.7.0"
},
"devDependencies": {
"nativescript-dev-typescript": "^0.2.3",
"nativescript-dev-typescript": "^0.3.1",
"typescript": "^1.8.2"
}
}
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
"main": "cardview.js",
"nativescript": {
"platforms": {
"android": "1.5.0",
"ios": "1.5.2"
"android": "1.7.0",
"ios": "1.7.0"
}
},
"scripts": {
"build": "tsc"
"build": "tsc",
"demo.ios": "npm run preparedemo; cd demo; tns emulate ios",
"demo.android": "npm run preparedemo; cd demo; tns emulate android",
"preparedemo": "npm run build; cd demo; tns plugin remove nativescript-cardview; tns plugin add ..; tns install",
"setup": "cd demo; npm install; cd ..; npm run build; cd demo; tns plugin add ..; cd .."
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pod 'MaterialCardView', :git => 'https://github.com/cemolcay/MaterialCardView.git'
pod 'MaterialCard', '~> 1.0.4'

0 comments on commit d8108be

Please sign in to comment.