Detail-Navigation eingebaut, Sprung auf aktualisierte List nach Bilder download
This commit is contained in:
parent
93431210f4
commit
a8a9b07b3f
@ -35,7 +35,7 @@ window.globalVariable = {
|
||||
instagram: "your_api_key",//Use for Instagram API clientID.
|
||||
googlePlus: "your_api_key",//Use for Google API clientID.
|
||||
},
|
||||
adMob: "your_api_key" //Use for AdMob API clientID.
|
||||
adMob: "ca-app-pub-3940256099942544/6300978111" //Use for AdMob API clientID.
|
||||
};// End Global variable
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
// http://ngcordova.com/docs/plugins/sqlite/
|
||||
//
|
||||
// Controller of Contract List Page.
|
||||
appControllers.controller('imageDownloadCtrl', function ($scope, $stateParams, $mdBottomSheet, $timeout, $mdDialog, $cordovaFileTransfer, $cordovaFile, $state, pokedexDB) {
|
||||
appControllers.controller('imageDownloadCtrl', function ($scope, $stateParams, $mdBottomSheet, $timeout, $mdDialog, $cordovaFileTransfer, $ionicViewSwitcher, $ionicHistory, $cordovaFile, $state, pokedexDB, dataShare) {
|
||||
|
||||
$scope.progressval = 0;
|
||||
$scope.currentfile = '';
|
||||
@ -100,6 +100,9 @@ appControllers.controller('imageDownloadCtrl', function ($scope, $stateParams, $
|
||||
$scope.progressprozent = 'Download abgeschlossen! ' + $scope.progressprozent;
|
||||
$scope.DownloadisVisible=true;
|
||||
$scope.AbbrechenisVisible=false;
|
||||
$timeout(function(){
|
||||
$scope.refreshData();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
if ( $scope.startdownloadtimer==false){
|
||||
@ -129,6 +132,31 @@ appControllers.controller('imageDownloadCtrl', function ($scope, $stateParams, $
|
||||
downloadtimer();
|
||||
};
|
||||
|
||||
$scope.refreshData=function(){
|
||||
var data='refresh';
|
||||
dataShare.sendData(data);
|
||||
$scope.navigateTo('app.pokemonlist', {isAnimated:false});
|
||||
};
|
||||
|
||||
// navigateTo is for navigate to other page
|
||||
// by using targetPage to be the destination state.
|
||||
// Parameter :
|
||||
// stateNames = target state to go.
|
||||
// objectData = Object data will send to destination state.
|
||||
$scope.navigateTo = function (stateName,objectData) {
|
||||
if ($ionicHistory.currentStateName() != stateName) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: false,
|
||||
disableBack: true
|
||||
});
|
||||
|
||||
//Next view animate will display in back direction
|
||||
$ionicViewSwitcher.nextDirection('back');
|
||||
$state.go(stateName, {
|
||||
isAnimated: objectData.isAnimated
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.downloadabbrechen = function() {
|
||||
$scope.DownloadisVisible=true;
|
||||
|
||||
@ -89,21 +89,21 @@
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 2">
|
||||
<i ng-if="pokemonentwicklung.pokemonlistentyp == 2" class="ion-arrow-down-a center-screen" style="font-size:18px;color:#333333;"></i>
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 2">
|
||||
<img ng-if="pokemonentwicklung.pokemonlistentyp == 1" src="{{pokemonentwicklung.pokemonimage}}" width="64" height="64" alig="center">
|
||||
<img ng-if="pokemonentwicklung.pokemonlistentyp == 1" src="{{pokemonentwicklung.pokemonimage}}" width="64" height="64" alig="center" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)">
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 1">
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1">{{ pokemonentwicklung.pokemonname }}</span>
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" style="font-size: 8px;"> <i>(engl. {{ pokemonentwicklung.pokemonnameeng }})</i></span>
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)">{{ pokemonentwicklung.pokemonname }}</span>
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" style="font-size: 8px;" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)"> <i>(engl. {{ pokemonentwicklung.pokemonnameeng }})</i></span>
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div ng-repeat="pokemonentwicklung in pokemonentwicklunglisteonestep" style="text-align: center;" class="col">
|
||||
<img ng-if="pokemonentwicklung.pokemonlistentyp == 1" src="{{pokemonentwicklung.pokemonimage}}" width="64" height="64">
|
||||
<img ng-if="pokemonentwicklung.pokemonlistentyp == 1" src="{{pokemonentwicklung.pokemonimage}}" width="64" height="64" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)">
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 1">
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1">{{ pokemonentwicklung.pokemonname }}</span>
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)">{{ pokemonentwicklung.pokemonname }}</span>
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 1">
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" style="font-size: 8px;"> <i>(engl. {{ pokemonentwicklung.pokemonnameeng }})</i></span>
|
||||
<span ng-if="pokemonentwicklung.pokemonlistentyp == 1" style="font-size: 8px;" ng-click="loadpokemondetail(pokemonentwicklung.pokemonpokedexid)"> <i>(engl. {{ pokemonentwicklung.pokemonnameeng }})</i></span>
|
||||
<br ng-if="pokemonentwicklung.pokemonlistentyp == 1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -52,6 +52,11 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$ion
|
||||
$scope.isLoading = false;
|
||||
}, 1000);// End loading progress.
|
||||
|
||||
$scope.admob_key = window.globalVariable.adMob;
|
||||
|
||||
// Calling to initial AdMob.
|
||||
$scope.initAdMob();
|
||||
|
||||
};// End initialForm.
|
||||
|
||||
|
||||
@ -102,13 +107,32 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$ion
|
||||
}
|
||||
});
|
||||
|
||||
// initAdMob for initial AdMob
|
||||
$scope.initAdMob = function () {
|
||||
|
||||
if (! AdMob ) { alert( 'admob plugin not ready' ); return; }
|
||||
$scope.createAdMobBanner();
|
||||
|
||||
};//End initAdMob.
|
||||
|
||||
//createAdMobBanner is for create new adMob banner.
|
||||
$scope.createAdMobBanner = function () {
|
||||
AdMob.createBanner( {
|
||||
adId: $scope.admob_key,
|
||||
isTesting: true,
|
||||
position: AdMob.AD_POSITION.BOTTOM_CENTER // Set AdMob.AD_POSITION.TOP_CENTER for show banner at top section
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
|
||||
});// End of Pokemon List Page Controller.
|
||||
|
||||
// Controller of pokemon Detail Page.
|
||||
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $filter, $mdDialog, $ionicHistory,$timeout, pokedexDB) {
|
||||
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $state, $filter, $mdDialog, $ionicHistory,$timeout, pokedexDB) {
|
||||
|
||||
|
||||
var dummypokemon=[];
|
||||
// initialForm is the first activity in the controller.
|
||||
// It will initial all variable data and let the function works when page load.
|
||||
$scope.initialForm = function () {
|
||||
@ -259,6 +283,30 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
|
||||
});
|
||||
};// End showing the bottom sheet.
|
||||
|
||||
$scope.loadpokemondetail=function(pokedexid){
|
||||
var dummypokemon = pokedexDB.getPokemon(pokedexid);
|
||||
$timeout(function(){
|
||||
|
||||
var index;
|
||||
for (index = 0; index < dummypokemon.length; ++index) {
|
||||
$scope.navigateTo('app.pokemondetail',dummypokemon[index]);
|
||||
}//for2
|
||||
|
||||
|
||||
},400);
|
||||
|
||||
}
|
||||
|
||||
$scope.navigateTo = function (targetPage, objectData) {
|
||||
$timeout(function(){
|
||||
console.log('Controller Ausgabe');
|
||||
console.debug(objectData);
|
||||
$state.go(targetPage, {
|
||||
pokemondetail: objectData
|
||||
});
|
||||
},100);
|
||||
};// End navigateTo.
|
||||
|
||||
$scope.initialForm();
|
||||
|
||||
});// End Contract Detail page Controller.
|
||||
|
||||
@ -46,6 +46,7 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
||||
var pokemonentladeattackenliste = [];
|
||||
var pokemonname = [];
|
||||
var pokemonnameeng = [];
|
||||
pokemondata=[];
|
||||
|
||||
|
||||
return {
|
||||
@ -159,7 +160,76 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
||||
});
|
||||
return pokemonList;
|
||||
},// End select all data.
|
||||
getPokemon: function (pokedexid)
|
||||
{
|
||||
|
||||
pokemondata=[];
|
||||
// Variable for prepare query statement to select all contracts.
|
||||
var query = "SELECT * FROM tblPokemon WHERE POKEDEXID=?";
|
||||
|
||||
// Execute query statement from query variable.
|
||||
$cordovaSQLite.execute(db, query,[pokedexid]).then(function (res)
|
||||
{
|
||||
if (res.rows.length > 0)
|
||||
{
|
||||
|
||||
for (var i = 0; i < res.rows.length; i++)
|
||||
{
|
||||
var dummypokedexid='';
|
||||
var dummyfundort='';
|
||||
|
||||
dummypokedexid=res.rows.item(i).POKEDEXID.toString();
|
||||
|
||||
if (dummypokedexid.length==1){
|
||||
dummypokedexid='00' + dummypokedexid;
|
||||
}
|
||||
|
||||
if (dummypokedexid.length==2){
|
||||
dummypokedexid='0' + dummypokedexid;
|
||||
}
|
||||
|
||||
if (res.rows.item(i).POKEMONTYPA > 0 ){
|
||||
dummyfundort=dummyfundort + pokemonfundorte[res.rows.item(i).POKEMONTYPA];
|
||||
}
|
||||
|
||||
if (res.rows.item(i).POKEMONTYPB > 0 ){
|
||||
dummyfundort=dummyfundort + " " + pokemonfundorte[res.rows.item(i).POKEMONTYPB];
|
||||
}
|
||||
|
||||
var dataItem = {
|
||||
id : res.rows.item(i).ID ,
|
||||
pokedexid : res.rows.item(i).POKEDEXID ,
|
||||
pokedexidString : dummypokedexid ,
|
||||
pokemonname : res.rows.item(i).POKEMONNAME ,
|
||||
pokemonnameeng : res.rows.item(i).POKEMONNAMEENG ,
|
||||
pokemontypa : res.rows.item(i).POKEMONTYPA ,
|
||||
pokemontypb : res.rows.item(i).POKEMONTYPB ,
|
||||
pokemontypaString : pokemontypen[res.rows.item(i).POKEMONTYPA] ,
|
||||
pokemontypbString : pokemontypen[res.rows.item(i).POKEMONTYPB] ,
|
||||
pokemonfangchance : res.rows.item(i).POKEMONFANGCHANCE ,
|
||||
pokemonfluchtchance : res.rows.item(i).POKEMONFLUCHTCHANCE ,
|
||||
pokemonfundort : dummyfundort ,
|
||||
pokemoneidistanz : res.rows.item(i).POKEMONEIDISTANZ ,
|
||||
pokemonentwicklungtext : res.rows.item(i).POKEMONENTWICKLUNGTEXT ,
|
||||
pokemonentwicklung : res.rows.item(i).POKEMONENTWICKLUNG ,
|
||||
pokemonentwicklungkosten : res.rows.item(i).POKEMONENTWICKLUNGKOSTEN ,
|
||||
pokemonkp : res.rows.item(i).POKEMONKP ,
|
||||
pokemonattack : res.rows.item(i).POKEMONATTACK ,
|
||||
pokemondefense : res.rows.item(i).POKEMONDEFENSE ,
|
||||
pokemonsumme : res.rows.item(i).POKEMONKP + res.rows.item(i).POKEMONATTACK + res.rows.item(i).POKEMONDEFENSE ,
|
||||
pokemontext : res.rows.item(i).POKEMONTEXT ,
|
||||
pokemonnote : res.rows.item(i).POKEMONNOTE ,
|
||||
pokemonimage : res.rows.item(i).POKEMONIMAGE
|
||||
};
|
||||
pokemondata.push(dataItem);
|
||||
//pokemondata=dataItem;
|
||||
console.log('Service ausgabe');
|
||||
console.debug(pokemondata);
|
||||
}
|
||||
}
|
||||
});
|
||||
return pokemondata;
|
||||
},// End select all data.
|
||||
getTypenEffekte: function (pokedexid)
|
||||
{
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user