Skip to content

Commit

Permalink
Commented all Log.d
Browse files Browse the repository at this point in the history
  • Loading branch information
toffeegryphon committed Sep 20, 2019
1 parent e762adf commit e52ac61
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
9 changes: 2 additions & 7 deletions app/src/main/java/com/toffeegryphon/solartime/Subsolar.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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));
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -219,7 +206,7 @@ private void draw() {
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
try {
List<Address> 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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -327,14 +314,14 @@ protected ArrayList<String> doInBackground(Subsolar.Coordinate... coordinates) {
ArrayList<String> 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();
Expand Down

0 comments on commit e52ac61

Please sign in to comment.