From e52ac6127d9b205201a12bbeb95d8a490775ae0c Mon Sep 17 00:00:00 2001 From: toffegryphon Date: Fri, 20 Sep 2019 18:26:08 +0800 Subject: [PATCH] Commented all Log.d --- .../com/toffeegryphon/solartime/Subsolar.java | 9 ++---- .../solartime/SubsolarWallpaperService.java | 31 ++++++------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/com/toffeegryphon/solartime/Subsolar.java b/app/src/main/java/com/toffeegryphon/solartime/Subsolar.java index 1766678..995aa6c 100644 --- a/app/src/main/java/com/toffeegryphon/solartime/Subsolar.java +++ b/app/src/main/java/com/toffeegryphon/solartime/Subsolar.java @@ -1,11 +1,6 @@ package com.toffeegryphon.solartime; -import android.util.Log; - import java.util.Calendar; -import java.lang.Math; -import java.util.Date; -import java.util.GregorianCalendar; import java.util.TimeZone; import static java.lang.Math.PI; @@ -34,7 +29,7 @@ static Coordinate equationOfTime() { // Accurate version calendar.setTimeZone(TimeZone.getTimeZone("GMT")); double D = calendar.get(Calendar.DAY_OF_YEAR) - 0.16; // Day of year, -0.16 is minor adjustment double t = calendar.get(Calendar.HOUR_OF_DAY) + calendar.get(Calendar.MINUTE) / 60.0 + calendar.get(Calendar.SECOND) / 3600.0; - Log.d("T", String.valueOf(t)); +// Log.d("T", String.valueOf(t)); double W = 360.0 / 365.24; double A = W * (D + 10.0); @@ -57,7 +52,7 @@ static Coordinate equationOfTime() { // Accurate version double lon = ((60 * (12 - t)) - EOT) / 4.0; // Log.d("LONG", String.valueOf(lon)); - Log.d("LONG_LAT", lon + ", " + lat); +// Log.d("LONG_LAT", lon + ", " + lat); return new Coordinate(lat, lon); } diff --git a/app/src/main/java/com/toffeegryphon/solartime/SubsolarWallpaperService.java b/app/src/main/java/com/toffeegryphon/solartime/SubsolarWallpaperService.java index 6c1a1a7..6dac725 100644 --- a/app/src/main/java/com/toffeegryphon/solartime/SubsolarWallpaperService.java +++ b/app/src/main/java/com/toffeegryphon/solartime/SubsolarWallpaperService.java @@ -14,7 +14,6 @@ import android.location.Address; import android.location.Geocoder; import android.os.AsyncTask; -import android.os.Build; import android.os.Handler; import android.preference.PreferenceManager; import android.service.wallpaper.WallpaperService; @@ -23,20 +22,9 @@ import android.util.JsonReader; import android.util.Log; import android.util.SparseArray; -import android.util.SparseIntArray; import android.view.SurfaceHolder; import android.view.WindowManager; -import androidx.core.content.res.ResourcesCompat; - -import org.json.JSONObject; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlPullParserFactory; - import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -45,7 +33,6 @@ import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Objects; @@ -61,7 +48,7 @@ public SubsolarEngine onCreateEngine() { manager.getDefaultDisplay().getMetrics(metrics); int width = metrics.widthPixels; int height = metrics.heightPixels; - Log.d("METRICS", width + ", " + height); +// Log.d("METRICS", width + ", " + height); return new SubsolarEngine(new Point(width, height)); } @@ -122,13 +109,13 @@ private void draw() { Point tile = new Point((int) x, (int) y); double dX = x - tile.x; double dY = y - tile.y; - Log.d("TILE", x + ", " + y); - Log.d("DELTA", dX + ", " + dY); +// Log.d("TILE", x + ", " + y); +// Log.d("DELTA", dX + ", " + dY); String tileUrl = String.format(Locale.US,"tile_%d_%d", tile.x, tile.y); - Log.d("URL", tileUrl); +// Log.d("URL", tileUrl); int pX = (int) (metrics.x / 2 - dX * bitmapLength); int pY = (int) (metrics.y / 2 - dY * bitmapLength); - Log.d("POS", pX + ", " + pY); +// Log.d("POS", pX + ", " + pY); int nV = metrics.y / bitmapLength + 2; int firstY = (int) (y - nV / 2); @@ -219,7 +206,7 @@ private void draw() { Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault()); try { List
addresses = geocoder.getFromLocation(coordinate.latitude, coordinate.longitude, 1); - Log.d("ADDRESSES", addresses.toString()); +// Log.d("ADDRESSES", addresses.toString()); String city = addresses.get(0).getLocality(); String country = addresses.get(0).getCountryName(); if (country.length() >= 15) { @@ -271,7 +258,7 @@ Bitmap generateColumn(int nV, int firstY, int tileX) { Canvas columnCanvas = new Canvas(column); for (int j = firstY; j <= firstY + nV; j++) { String tileId = String.format(Locale.US,"tile_%d_%d", tileX, j); - Log.d("ID", tileId); +// Log.d("ID", tileId); int resId = getResources().getIdentifier(tileId, "drawable", getPackageName()); Bitmap tileBitmap = ((BitmapDrawable) Objects.requireNonNull(getDrawable(resId))).getBitmap(); columnCanvas.drawBitmap(tileBitmap, null, new Rect(0, (j - firstY) * bitmapLength, bitmapLength, (j - firstY) * bitmapLength + bitmapLength), null); @@ -327,14 +314,14 @@ protected ArrayList doInBackground(Subsolar.Coordinate... coordinates) { ArrayList result = new ArrayList<>(); try { URL url = new URL(String.format("https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=%s&lon=%s&zoom=10&addressdetails=1", coordinates[0].latitude, coordinates[0].longitude)); - Log.d("URL", String.valueOf(url)); +// Log.d("URL", String.valueOf(url)); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); JsonReader reader = new JsonReader(new InputStreamReader(input, StandardCharsets.UTF_8)); while (reader.hasNext()) { - Log.d("JSON", reader.nextName()); +// Log.d("JSON", reader.nextName()); } } catch (IOException e) { e.printStackTrace();