diff --git a/app/app.iml b/app/app.iml index cc74691..ef9b609 100644 --- a/app/app.iml +++ b/app/app.iml @@ -85,8 +85,8 @@ + - @@ -96,11 +96,11 @@ - - + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9b8949c..53833d7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,7 +23,7 @@ + android:value="AIzaSyBpDIEEPbFGUr7cvXI5_nq04J6i5fou9rY" > 60000){ + //If location is not tracked since last one minute Start updates again + startLocationService(); + } + } + + /** + * Automatically Stop Location Services if needed + */ + private void stopLocationListenerIfNeeded(){ + if(lastKnownLocation != null && googleApiClient.isConnected() && (System.currentTimeMillis() - lastLocationServiceStartTime) > 60000){ + //if we dont have last Known Location and we are not connected yet + stopLocationService(); + } + } + } diff --git a/app/src/main/java/com/eswaraj/app/eswaraj/volley/LoadCategoriesImagesRequest.java b/app/src/main/java/com/eswaraj/app/eswaraj/volley/LoadCategoriesImagesRequest.java index 5af3d8c..41a72d4 100644 --- a/app/src/main/java/com/eswaraj/app/eswaraj/volley/LoadCategoriesImagesRequest.java +++ b/app/src/main/java/com/eswaraj/app/eswaraj/volley/LoadCategoriesImagesRequest.java @@ -46,32 +46,21 @@ public LoadCategoriesImagesRequest () { } public void processRequest(Context context, List categoriesList) { - imageReqCount = categoriesList.size()*2; + imageReqCount = categoriesList.size() * 2;//Double as each Category have one icon image and one header image Boolean icon = null; for(CategoryWithChildCategoryDto categoryDto : categoriesList) { - String url = categoryDto.getImageUrl(); - icon = true; - if(url != "") { - Log.d("LoadCategoriesImages", url); - Long id = categoryDto.getId(); - ImageRequest request = new ImageRequest(url, createSuccessListener(context, id, icon), 0, 0, null, createErrorListener(context)); - this.networkAccessHelper.submitNetworkRequest("GetImage" + id, request); - } - else { - imageResCount.incrementAndGet(); - } - - url = categoryDto.getHeaderImageUrl(); - icon = false; - if(url != "") { - Log.d("LoadCategoriesImages", url); - Long id = categoryDto.getId(); - ImageRequest request = new ImageRequest(url, createSuccessListener(context, id, icon), 0, 0, null, createErrorListener(context)); - this.networkAccessHelper.submitNetworkRequest("GetHeaderImage" + id, request); - } - else { - imageResCount.incrementAndGet(); - } + downloadImage(context, categoryDto.getId(),categoryDto.getImageUrl(), true); + downloadImage(context, categoryDto.getId(),categoryDto.getHeaderImageUrl(), false); + } + } + private void downloadImage(Context context,Long id, String url, boolean icon){ + if(url != null && !"".equals(url.trim())) { + Log.d("LoadCategoriesImages", url); + ImageRequest request = new ImageRequest(url, createSuccessListener(context, id, icon), 0, 0, null, createErrorListener(context)); + this.networkAccessHelper.submitNetworkRequest("GetHeaderImage" + id, request); + } + else { + imageResCount.incrementAndGet(); } } diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index 83d7fe1..2a66b91 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -12,6 +12,10 @@ android:id="@+id/SplashFragmentContainer" android:layout_width="match_parent" android:layout_height="match_parent"> +