Skip to content

Commit 2dc32b4

Browse files
update
1 parent c68ba3d commit 2dc32b4

13 files changed

+72
-11
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ Hackfoldr mobile version
55

66
The actual content of the app is under hackfoldr/www
77

8-
To build and run the app:
8+
##To run the app with ionic
9+
under `hackfoldr/`, run `ionic serve`
10+
It will run the app on browser using gulp with auto page refresh.
11+
12+
`ionic emulate android` will build the apk and start emulator for android. With settings properly setup.
13+
14+
##To build and run the app with cordova:
915

1016
0. Add android SDK to your PATH variable
1117

@@ -25,3 +31,11 @@ e.g. $ echo $PATH
2531

2632
Start an emulator in Genymotion, dray the apk file to the emulator
2733

34+
Stack
35+
===========
36+
37+
Cordova (installed by NPM)
38+
Ionic (AngularJS)
39+
Gulp
40+
Apache Ant/ Gradle (TODO)
41+
Android SDK (Android studio)

hackfoldr/platforms/android/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.ionicframework.myapp460341" xmlns:android="http://schemas.android.com/apk/res/android">
33
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
44
<uses-permission android:name="android.permission.INTERNET" />
5-
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
5+
<application android:debuggable="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
66
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="HackfoldrMobile" android:theme="@android:style/Theme.Black.NoTitleBar">
77
<intent-filter>
88
<action android:name="android.intent.action.MAIN" />

hackfoldr/platforms/android/CordovaLib/ant-build/build.prop

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Last build type
2-
#Sat, 16 Aug 2014 23:58:34 +0800
2+
#Sun, 17 Aug 2014 12:15:18 +0800
33

44
build.last.target=debug
55

Binary file not shown.

hackfoldr/platforms/android/ant-build/AndroidManifest.cordova.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.ionicframework.myapp460341" xmlns:android="http://schemas.android.com/apk/res/android">
33
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
44
<uses-permission android:name="android.permission.INTERNET" />
5-
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
5+
<application android:debuggable="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
66
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="HackfoldrMobile" android:theme="@android:style/Theme.Black.NoTitleBar">
77
<intent-filter>
88
<action android:name="android.intent.action.MAIN" />
Binary file not shown.
Binary file not shown.
Binary file not shown.

hackfoldr/platforms/android/ant-build/build.prop

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Last build type
2-
#Sat, 16 Aug 2014 23:58:43 +0800
2+
#Sun, 17 Aug 2014 12:15:25 +0800
33

44
build.last.target=debug
55

hackfoldr/www/js/app.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ angular.module('starter', ['ionic', 'starter.controllers'])
3838
}
3939
});
4040
})
41-
4241
.config(function($stateProvider, $urlRouterProvider) {
4342
$stateProvider
4443

@@ -82,6 +81,20 @@ angular.module('starter', ['ionic', 'starter.controllers'])
8281
}
8382
}
8483
})
84+
85+
.state('app.image', {
86+
url: "/file/:fileId/image/",
87+
views: {
88+
'menuContent' :{
89+
templateUrl: "templates/files.html",
90+
controller: 'FileListsCtrl'
91+
},
92+
'mainContent' :{
93+
templateUrl: "templates/image.html",
94+
controller: 'FileCtrl'
95+
}
96+
}
97+
})
8598
.state('app.single', {
8699
url: "/file/:fileId",
87100
views: {
@@ -97,4 +110,10 @@ angular.module('starter', ['ionic', 'starter.controllers'])
97110
});
98111
// if none of the above states are matched, use this as the fallback
99112
$urlRouterProvider.otherwise('/app/files');
100-
});
113+
})
114+
// .run(["$templateCache",
115+
// function ($templateCache) {
116+
// $templateCache.put("template/iframe.html",
117+
// "<div>iframe testing</div>");
118+
// }
119+
// ]);;

hackfoldr/www/js/controllers.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ console.log($scope.livestreamQuery);
148148

149149
console.log('update')
150150
$state.go("app.livestream", {fileId:$stateParams.fileId, livestreamQuery:foldrService.getFile().livestreamQuery}, {inherit:false,location:false});
151-
}else{
151+
} else if(type==="image"){
152+
console.log('its images');
153+
$state.go("app.image", {fileId:$stateParams.fileId, imageName:null}, {inherit:false,location:false});
154+
}
155+
else{
152156
$scope.inputUrl = foldrService.getFile().url;
153157
$scope.url = $sce.trustAsResourceUrl($scope.inputUrl);
154158
}

hackfoldr/www/js/services.js

+26-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ angular.module('starter.services', [])
22
.factory('snsConfig',['appConfig',function(appConfig) {
33
return appConfig.sns;
44
}])
5-
.service('foldrService',function($http){
5+
.service('foldrService',function($http,CacheService){
66

77
//Now we just support hackfoldr with Gspreadsheet. Better get a meta API
88
//od6 for default sheet
@@ -32,7 +32,6 @@ angular.module('starter.services', [])
3232
var entries = Lazy(feed.entry);
3333
entries.each(function(entry,i){
3434
var url = entry.title.$t;
35-
console.log(entry);
3635
var file = {};
3736
var type = "normal";
3837
var content =null;
@@ -58,6 +57,10 @@ angular.module('starter.services', [])
5857
}
5958
}
6059

60+
if(url.match(/(.*)(.png|jpg|jpeg|gif$)/)){
61+
type="image";
62+
}
63+
6164
file= {
6265
id:i,
6366
url:url,
@@ -76,14 +79,34 @@ angular.module('starter.services', [])
7679
var url = getSpreadsheetUrl(id);
7780
return Q($http.jsonp(url+"&callback=JSON_CALLBACK"))
7881
.then(function(res) {
79-
console.log(res);
8082
return _parseFeed(res.data.feed);
8183
})
84+
.then(function(feed){
85+
//cache feed
86+
console.log('cache');
87+
Lazy(feed).each(function(item){
88+
if(item.type==='image'){
89+
CacheService.cacheImage('1',item.url);
90+
}
91+
});
92+
return feed;
93+
})
8294

8395
}
8496
return _service;
8597

8698
})
99+
.service('CacheService',['DbService','$http',function(DbService,$http){
100+
var _service = {};
101+
_service.cacheImage = function(id,url){
102+
$http.get(url).then(function(data){
103+
var imageData = data.data;
104+
})
105+
}
106+
107+
return _service;
108+
109+
}])
87110
.service('DbService',function() {
88111
var _service = {};
89112
var db = null;

hackfoldr/www/templates/file.html

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<ion-view title="{{fileTitle}}">
33
<ion-content scroll="true" overflow-scroll="true" class="has-header padding" >
44
<iframe ng-src="{{url}}" style="width:100%;height:100%"></iframe>
5+
<!-- <div ng-include="'templates/iframe.html'"></div> -->
56
</ion-content>
67
</ion-view>

0 commit comments

Comments
 (0)