Neues Initialrelease mit IonicMaterial
This commit is contained in:
29
www/templates/imagedownload/html/imagedownload.html
Normal file
29
www/templates/imagedownload/html/imagedownload.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<ion-view view-title="Pokedex Helper">
|
||||
<ion-content class="padding font-robo400medium">
|
||||
<h2>Pokemon Bilder Download</h2>
|
||||
<p>
|
||||
Pokedex Helper wird aus rechtlichen Gründen ohne Pokemon ™ Bilder angeboten. Wenn du möchtest kann Pokedex Helper aber versuchen diese für dich von den offiziellen Pokemon ™ Webseiten herunterzuladen. Da diese Bilder urheberrechtlich geschützt sind, lies dir bitte vorher die entsprechenden <a href="http://www.pokemon.com/de/nutzungsbedingungen/" target="_blank">Nutzungsbedingungen</a> von © 2016 Pokémon/Nintendo aufmerksam durch. Nur wenn du mit diesen einverstanden bist, darfst du die Bilder für eigene Zwecke verwenden.
|
||||
</p>
|
||||
<p>
|
||||
Wichtiger Tipp: <b>Bitte bedenke, dass der Download der Bilder einiges an Internet-Traffic verursacht. Um deinen mobilen Datentarif zu schonen solltest du den Download am besten per Wlan durchführen.</b>
|
||||
</p>
|
||||
<p>
|
||||
Mit dem Klick auf den Butten (Bilder herunterladen) akzeptierst du die oben genannten <a href="http://www.pokemon.com/de/nutzungsbedingungen/" target="_blank">Nutzungsbedingungen</a> von © 2016 Pokémon/Nintendo.
|
||||
</p>
|
||||
<button class="button button-full" ng-click="downloadImages()" ng-show="DownloadisVisible">
|
||||
Bilder herunterladen
|
||||
</button>
|
||||
<button class="button button-full" ng-click="downloadabbrechen()" ng-show="AbbrechenisVisible">
|
||||
Download abbrechen
|
||||
</button>
|
||||
<progress id="progressbar" max="721" value="{{ progressval }}"> </progress>
|
||||
<div id="progressbarlabel">{{ progressprozent }} %</div>
|
||||
<div id="currentfile">Aktuelle Datei: {{ currentfile }}</div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p class="font-robo400small">
|
||||
© 2016 Pokémon. © 1995-2015 Nintendo/Creatures Inc./GAME FREAK inc. TM, ® and Pokémon character names are trademarks of Nintendo.
|
||||
</p>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
139
www/templates/imagedownload/js/controllers.js
Normal file
139
www/templates/imagedownload/js/controllers.js
Normal file
@@ -0,0 +1,139 @@
|
||||
// Controller will call pokedexDB Services to present data to html view.
|
||||
//
|
||||
// For using sqlite you have to install $cordovaSQLite by running the following
|
||||
// command in your cmd.exe for windows or terminal for mac:
|
||||
// $ cd your_project_path
|
||||
// $ ionic plugin remove io.litehelpers.cordova.sqlite
|
||||
// $ ionic plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git
|
||||
//
|
||||
// For install $cordovaSQLite plugin you also have to install this following plugin to get $cordovaSQLite work :
|
||||
// $ ionic plugin add com.ionic.keyboard
|
||||
//
|
||||
// Learn more about $cordovaSQLite :
|
||||
// http://ngcordova.com/docs/plugins/sqlite/
|
||||
//
|
||||
// Controller of Contract List Page.
|
||||
appControllers.controller('imageDownloadCtrl', function ($scope, $stateParams, $mdBottomSheet, $timeout, $mdDialog, $cordovaFileTransfer, $cordovaFile, $state, pokedexDB) {
|
||||
|
||||
$scope.progressval = 0;
|
||||
$scope.currentfile = '';
|
||||
$scope.progressprozent = 0;
|
||||
$scope.DownloadisVisible=true;
|
||||
$scope.AbbrechenisVisible=false;
|
||||
$scope.startdownloadtimer=false;
|
||||
|
||||
// Open our new task modal
|
||||
$scope.downloadImages = function() {
|
||||
$scope.startdownloadtimer=true;
|
||||
|
||||
$scope.DownloadisVisible=false;
|
||||
$scope.AbbrechenisVisible=true;
|
||||
|
||||
//$ionicPlatform.ready(function() {
|
||||
//$scope.taskModal.show();
|
||||
var baseurl = "http://assets.pokemon.com/assets/cms2/img/pokedex/full/";
|
||||
var url="";
|
||||
var filename="";
|
||||
var targetPath = "";
|
||||
var downloadprogress = 0;
|
||||
var pokedexid=1;
|
||||
var downloadinprogress=false;
|
||||
|
||||
|
||||
//Ordner erstellen auf SD-Karte
|
||||
$cordovaFile.createDir(cordova.file.externalRootDirectory, "PokedexHelperBilder", false)
|
||||
.then(function (success) {
|
||||
// success
|
||||
console.log('Erfolg bei Ordnererstellung. ' + success);
|
||||
}, function (error) {
|
||||
// error
|
||||
console.log('Error bei Ordnererstellung. ' + error);
|
||||
});
|
||||
|
||||
function downloadimage(){
|
||||
downloadinprogress=true;
|
||||
filename=pokedexid + ".png";
|
||||
|
||||
if (filename.length==5){
|
||||
filename='00' + filename;
|
||||
}
|
||||
|
||||
if (filename.length==6){
|
||||
filename='0' + filename;
|
||||
}
|
||||
|
||||
url=baseurl;
|
||||
url=encodeURI(url + filename);
|
||||
targetPath = cordova.file.externalRootDirectory + "/PokedexHelperBilder/" + filename;
|
||||
var tempPokemon = {
|
||||
pokedexid: null,
|
||||
image: ''
|
||||
}
|
||||
|
||||
//Bild Download
|
||||
$cordovaFileTransfer.download(url, targetPath, {Connection: "close"}, true).then(function (result) {
|
||||
$scope.currentfile=filename;
|
||||
tempPokemon.image=targetPath;
|
||||
tempPokemon.pokedexid=pokedexid;
|
||||
|
||||
console.log(tempPokemon.image + " " + tempPokemon.pokedexid);
|
||||
pokedexDB.setPokemonImage(tempPokemon);
|
||||
|
||||
console.log(filename + ' heruntergeladen.' + result);
|
||||
pokedexid=pokedexid + 1;
|
||||
console.log(result);
|
||||
downloadinprogress=false;
|
||||
}, function (error) {
|
||||
console.log('Error. ' + error.code + ' ' + error.constant);
|
||||
}, function (progress) {
|
||||
//downloadprogress=(progress.loaded / progress.total) * 100;
|
||||
$scope.progressprozent = Math.round(pokedexid / 721 * 100);
|
||||
$scope.progressval = pokedexid;
|
||||
$scope.currentfile=filename; //+ downloadprogress;
|
||||
});
|
||||
console.log(pokedexid);
|
||||
|
||||
if (pokedexid<721){
|
||||
downloadtimer();
|
||||
}
|
||||
else{
|
||||
$scope.progressprozent = 'Download abgeschlossen! ' + $scope.progressprozent;
|
||||
$scope.DownloadisVisible=true;
|
||||
$scope.AbbrechenisVisible=false;
|
||||
}
|
||||
|
||||
if ( $scope.startdownloadtimer==false){
|
||||
$scope.progressprozent = 'Download Abgebrochen! ' + $scope.progressprozent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//});
|
||||
|
||||
function downloadtimer(){
|
||||
if ($scope.startdownloadtimer==true){
|
||||
|
||||
|
||||
$timeout(function(){
|
||||
if (downloadinprogress==false){
|
||||
downloadimage();
|
||||
console.log("downinprogress ist false");
|
||||
}else{
|
||||
console.log("downinprogress ist true");
|
||||
downloadtimer();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
downloadtimer();
|
||||
};
|
||||
|
||||
|
||||
$scope.downloadabbrechen = function() {
|
||||
$scope.DownloadisVisible=true;
|
||||
$scope.AbbrechenisVisible=false;
|
||||
$scope.startdownloadtimer=false;
|
||||
};
|
||||
|
||||
});// End of Contract List Page Controller.
|
||||
Reference in New Issue
Block a user