keys = days.keys();
202 | Integer numDays = 0;
203 | while (keys.hasNext() && numDays < maxDays) {
204 | numDays++;
205 | String dayName = (String) keys.next();
206 | SimpleDateFormat sdfDate = new SimpleDateFormat("EEEE d MMMM");
207 | SimpleDateFormat keyDate = new SimpleDateFormat("yyyy-MM-dd");
208 |
209 | String dayLabel = sdfDate.format(keyDate.parse(dayName));
210 | JSONArray dayForecasts = days.getJSONArray(dayName);
211 | // add tablerow with just day name
212 | RemoteViews dayLineView = new RemoteViews(gContext.getPackageName(), getLayout("day"));
213 | dayLineView.setTextViewText(R.id.day, dayLabel);
214 | views.addView(R.id.widgetForecasts, dayLineView);
215 |
216 | if (numDays < 2) {
217 | for (int n = 0; n < (8 - dayForecasts.length()); n++) {
218 | // add empty forecast
219 | RemoteViews forecastView = new RemoteViews(gContext.getPackageName(), getLayout("forecast"));
220 | views.addView(R.id.widgetForecasts, forecastView);
221 | }
222 | }
223 |
224 | for (int j = 0; j < dayForecasts.length(); j++) {
225 | JSONObject dayForecast = dayForecasts.getJSONObject(j);
226 | Double temp = Double.valueOf(dayForecast.getJSONObject("main").getString("temp"));
227 | Boolean isFreezing = temp < 273.15;
228 |
229 | String tempSuffix = "" + (char) 0x00B0;
230 | if (prefTempScale.equals("0")) {
231 | // celsius
232 | temp = temp - 273.15;
233 | }
234 | if (prefTempScale.equals("1")) {
235 | // fahrenheit
236 | Double factor = (double)9/(double)5;
237 | temp = factor * (temp - 273.15) + 32;
238 | }
239 | if (prefTempScale.equals("2")) {
240 | // kelvin
241 | tempSuffix = "" + (char) 0x004B;
242 | }
243 |
244 | int tempColor = getLayout(isFreezing ? "color_temp_freezing" : "color_temp");
245 |
246 | RemoteViews forecastView = new RemoteViews(gContext.getPackageName(), getLayout("forecast"));
247 | forecastView.setTextViewText(R.id.forecast_temp, String.valueOf(Math.round(temp)) + tempSuffix);
248 |
249 | forecastView.setTextColor(R.id.forecast_temp, tempColor);
250 | String rain = "";
251 | if (dayForecast.has("rain") && dayForecast.getJSONObject("rain").has("3h")) {
252 | String sRain = dayForecast.getJSONObject("rain").getString("3h");
253 | Float fRain = Float.valueOf(sRain);
254 | String postFix = " ㎜";
255 | if (prefRainScale.equals("1")) {
256 | // inches
257 | postFix = "\"";
258 | fRain = fRain / new Float(2.54);
259 | }
260 | String lessThan = "";
261 | if (fRain < 0.1) {
262 | lessThan = "<";
263 | fRain = new Float(0.1);
264 | }
265 | rain = lessThan + String.format("%.1f", fRain) + postFix;
266 | }
267 |
268 | if (dayForecast.has("snow") && dayForecast.getJSONObject("snow").has("3h")) {
269 | String sSnow = dayForecast.getJSONObject("snow").getString("3h");
270 | Float fSnow = Float.valueOf(sSnow);
271 | String postFix = " ㎜";
272 | if (prefRainScale.equals("1")) {
273 | // inches
274 | postFix = "\"";
275 | fSnow = fSnow / new Float(2.54);
276 | }
277 | String lessThan = "";
278 | if (fSnow < 0.1) {
279 | lessThan = "<";
280 | fSnow = new Float(0.1);
281 | }
282 | rain = lessThan + String.format("%.1f", fSnow) + postFix;
283 | }
284 | forecastView.setTextViewText(R.id.forecast_rain, rain);
285 |
286 | String wind = "";
287 | if (dayForecast.has("wind") && dayForecast.getJSONObject("wind").has("speed") && dayForecast.getJSONObject("wind").has("deg")) {
288 | String speed = dayForecast.getJSONObject("wind").getString("speed");
289 | String deg = dayForecast.getJSONObject("wind").getString("deg");
290 | Float fSpeed = Float.valueOf(speed);
291 | Float fDeg = Float.valueOf(deg);
292 | String bft = "0";
293 | if (fSpeed >= 0.3 && fSpeed < 1.6) { bft = "1"; }
294 | if (fSpeed >= 1.6 && fSpeed < 3.4) { bft = "2"; }
295 | if (fSpeed >= 3.4 && fSpeed < 5.5) { bft = "3"; }
296 | if (fSpeed >= 5.5 && fSpeed < 8.0) { bft = "4"; }
297 | if (fSpeed >= 8.0 && fSpeed < 10.8) { bft = "5"; }
298 | if (fSpeed >= 10.8 && fSpeed < 13.9) { bft = "6"; }
299 | if (fSpeed >= 13.9 && fSpeed < 17.2) { bft = "7"; }
300 | if (fSpeed >= 17.2 && fSpeed < 20.8) { bft = "8"; }
301 | if (fSpeed >= 20.8 && fSpeed < 24.5) { bft = "9"; }
302 | if (fSpeed >= 24.5 && fSpeed < 28.5) { bft = "10"; }
303 | if (fSpeed >= 28.5 && fSpeed < 32.7) { bft = "11"; }
304 | if (fSpeed >= 32.7) { bft = "12"; }
305 |
306 | String dir = "wind_n";
307 | if (fDeg >= 22.5 && fDeg < 67.5) { dir = "wind_ne"; }
308 | if (fDeg >= 67.5 && fDeg < 112.5) { dir = "wind_e"; }
309 | if (fDeg >= 112.5 && fDeg < 157.5) { dir = "wind_se"; }
310 | if (fDeg >= 157.5 && fDeg < 202.5) { dir = "wind_s"; }
311 | if (fDeg >= 202.5 && fDeg < 247.5) { dir = "wind_sw"; }
312 | if (fDeg >= 247.5 && fDeg < 292.5) { dir = "wind_w"; }
313 | if (fDeg >= 292.5 && fDeg < 337.5) { dir = "wind_nw"; }
314 |
315 | wind = (char) 0x2332 + " " + gContext.getResources().getString(gContext.getResources().getIdentifier(dir, "string", gContext.getPackageName())) + " " + bft;
316 |
317 | }
318 | forecastView.setTextViewText(R.id.forecast_wind, wind);
319 |
320 | if (dayForecast.has("weather") && dayForecast.getJSONArray("weather").length()>0) {
321 | JSONArray weather = dayForecast.getJSONArray("weather");
322 | if (weather.getJSONObject(0).has("icon")) {
323 | String iconCode = weather.getJSONObject(0).getString("icon");
324 | String icon = getIconImage(iconCode);
325 | forecastView.setImageViewResource(R.id.forecast_icon, gContext.getResources().getIdentifier(icon, "drawable", gContext.getPackageName()));
326 | }
327 | }
328 |
329 | views.addView(R.id.widgetForecasts, forecastView);
330 | }
331 |
332 | if (numDays > 1) {
333 | for (int n = 0; n < (8 - dayForecasts.length()); n++) {
334 | // add empty forecast
335 | RemoteViews forecastView = new RemoteViews(gContext.getPackageName(), getLayout("forecast"));
336 | views.addView(R.id.widgetForecasts, forecastView);
337 | }
338 | }
339 | }
340 | }
341 |
342 | Intent clickIntent = new Intent(gContext, ForecastWidget.class);
343 | clickIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
344 |
345 | int[] appWidgetIds = new int[] {widgetId};
346 | clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
347 |
348 | PendingIntent pendingIntent = PendingIntent.getBroadcast(gContext,
349 | widgetId, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
350 | views.setOnClickPendingIntent(R.id.widgetForecasts, pendingIntent);
351 |
352 | Class configurationClass = ForecastWidgetConfigureActivity.class;
353 | if (dark) {
354 | configurationClass = ForecastWidgetDarkConfigureActivity.class;
355 | }
356 | Intent configurationIntent = new Intent(gContext, configurationClass);
357 |
358 | // Create a extra giving the App Widget Id
359 | configurationIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
360 |
361 | // Create a pending intent giving configurationIntent as parameter
362 | PendingIntent configurationPendingIntent = PendingIntent.getActivity(gContext,
363 | widgetId, configurationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
364 | // Here we fecth the layout item and give it a action
365 |
366 | // Setting onClick event that will lauch ConfigurationActivity
367 | views.setOnClickPendingIntent(R.id.settings, configurationPendingIntent);
368 |
369 | // Instruct the widget manager to update the widget
370 | appWidgetManager.updateAppWidget(widgetId, views);
371 | }catch(Exception e) {
372 | e.printStackTrace();
373 | } finally {
374 |
375 | }
376 | }
377 |
378 | private void handleStart(Intent intent) {
379 | appWidgetManager = AppWidgetManager.getInstance(this
380 | .getApplicationContext());
381 |
382 | int[] allWidgetIds = intent
383 | .getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
384 | gContext = this.getApplicationContext();
385 |
386 | for (final int widgetId : allWidgetIds) {
387 | final String stationId = ForecastWidgetConfigureActivity.loadPref(gContext, "stationId", widgetId);
388 | new Thread() {
389 | public void run() {
390 | Looper.prepare();
391 | JSONObject forecast = new JSONObject();
392 | WeatherStationsDatabase weatherStationsDatabase = new WeatherStationsDatabase(gContext);
393 | WeatherStation weatherStation = null;
394 | if (!stationId.isEmpty()) {
395 | weatherStation = weatherStationsDatabase.findWeatherStation(Integer.valueOf(stationId));
396 | forecast = weatherStation.get5DayForecast();
397 | }
398 | Bundle bundle = new Bundle();
399 | bundle.putString("forecast", forecast.toString());
400 | bundle.putInt("widgetId", widgetId);
401 | Message msg = new Message();
402 | msg.setData(bundle);
403 |
404 | Handler mHandler = new Handler(new Handler.Callback() {
405 |
406 | @Override
407 | public boolean handleMessage(Message msg) {
408 | Bundle bundle = msg.getData();
409 | String jsonForecast = bundle.getString("forecast");
410 | Integer mWidgetId = bundle.getInt("widgetId");
411 | JSONObject forecast;
412 | try {
413 | forecast = new JSONObject(jsonForecast);
414 | processForecasts(forecast, mWidgetId);
415 | }catch(Exception e) {
416 | Log.d("weer", e.getMessage());
417 | }
418 | return false;
419 | }
420 | });
421 | mHandler.sendMessage(msg);
422 | Looper.loop();
423 | }
424 | }.start();
425 | }
426 | stopSelf();
427 | }
428 | }
429 |
--------------------------------------------------------------------------------
/app/src/main/java/nl/implode/weer/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package nl.implode.weer;
2 |
3 |
4 | import android.annotation.TargetApi;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.SharedPreferences;
8 | import android.content.res.Configuration;
9 | import android.content.res.Resources;
10 | import android.media.Ringtone;
11 | import android.media.RingtoneManager;
12 | import android.net.Uri;
13 | import android.os.Build;
14 | import android.os.Bundle;
15 | import android.preference.ListPreference;
16 | import android.preference.Preference;
17 | import android.preference.PreferenceActivity;
18 | import android.support.v7.app.ActionBar;
19 | import android.preference.PreferenceFragment;
20 | import android.preference.PreferenceManager;
21 | import android.preference.RingtonePreference;
22 | import android.text.TextUtils;
23 | import android.util.Log;
24 | import android.view.MenuItem;
25 |
26 | import java.util.List;
27 |
28 | import static android.preference.PreferenceManager.getDefaultSharedPreferences;
29 |
30 | /**
31 | * A {@link PreferenceActivity} that presents a set of application settings. On
32 | * handset devices, settings are presented as a single list. On tablets,
33 | * settings are split by category, with category headers shown to the left of
34 | * the list of settings.
35 | *
36 | * See
37 | * Android Design: Settings for design guidelines and the Settings
39 | * API Guide for more information on developing a Settings UI.
40 | */
41 | public class SettingsActivity extends AppCompatPreferenceActivity {
42 | /**
43 | * A preference value change listener that updates the preference's summary
44 | * to reflect its new value.
45 | */
46 | private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
47 | @Override
48 | public boolean onPreferenceChange(Preference preference, Object value) {
49 | String stringValue = value.toString();
50 |
51 | if (preference instanceof ListPreference) {
52 | // For list preferences, look up the correct display value in
53 | // the preference's 'entries' list.
54 | ListPreference listPreference = (ListPreference) preference;
55 | int index = listPreference.findIndexOfValue(stringValue);
56 |
57 | // Set the summary to reflect the new value.
58 | preference.setSummary(
59 | index >= 0
60 | ? listPreference.getEntries()[index]
61 | : null);
62 |
63 | } else {
64 | // For all other preferences, set the summary to the value's
65 | // simple string representation.
66 | preference.setSummary(stringValue);
67 | }
68 | return true;
69 | }
70 | };
71 |
72 | /**
73 | * Helper method to determine if the device has an extra-large screen. For
74 | * example, 10" tablets are extra-large.
75 | */
76 | private static boolean isXLargeTablet(Context context) {
77 | return (context.getResources().getConfiguration().screenLayout
78 | & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
79 | }
80 |
81 | /**
82 | * Binds a preference's summary to its value. More specifically, when the
83 | * preference's value is changed, its summary (line of text below the
84 | * preference title) is updated to reflect the value. The summary is also
85 | * immediately updated upon calling this method. The exact display format is
86 | * dependent on the type of preference.
87 | *
88 | * @see #sBindPreferenceSummaryToValueListener
89 | */
90 | private static void bindPreferenceSummaryToValue(Preference preference) {
91 | // Set the listener to watch for value changes.
92 | preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
93 |
94 | // Trigger the listener immediately with the preference's
95 | // current value.
96 | sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
97 | getDefaultSharedPreferences(preference.getContext())
98 | .getString(preference.getKey(), ""));
99 | }
100 |
101 | @Override
102 | protected void onCreate(Bundle savedInstanceState) {
103 | super.onCreate(savedInstanceState);
104 | setupActionBar();
105 | }
106 |
107 | /**
108 | * Set up the {@link android.app.ActionBar}, if the API is available.
109 | */
110 | private void setupActionBar() {
111 | ActionBar actionBar = getSupportActionBar();
112 | if (actionBar != null) {
113 | // Show the Up button in the action bar.
114 | actionBar.setDisplayHomeAsUpEnabled(true);
115 | }
116 | }
117 |
118 | /**
119 | * {@inheritDoc}
120 | */
121 | @Override
122 | public boolean onIsMultiPane() {
123 | return isXLargeTablet(this);
124 | }
125 |
126 | /**
127 | * {@inheritDoc}
128 | */
129 | @Override
130 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
131 | public void onBuildHeaders(List target) {
132 | int headerFile = R.xml.pref_headers;
133 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
134 | Boolean prefDarkTheme = sharedPrefs.getBoolean("use_dark_theme", false);
135 |
136 | if (prefDarkTheme) {
137 | headerFile = R.xml.pref_headers_dark;
138 | }
139 | loadHeadersFromResource(headerFile, target);
140 | }
141 |
142 | /**
143 | * This method stops fragment injection in malicious applications.
144 | * Make sure to deny any unknown fragments here.
145 | */
146 | protected boolean isValidFragment(String fragmentName) {
147 | return PreferenceFragment.class.getName().equals(fragmentName)
148 | || GeneralPreferenceFragment.class.getName().equals(fragmentName);
149 | }
150 |
151 | /**
152 | * This fragment shows general preferences only. It is used when the
153 | * activity is showing a two-pane settings UI.
154 | */
155 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
156 | public static class GeneralPreferenceFragment extends PreferenceFragment {
157 | @Override
158 | public void onCreate(Bundle savedInstanceState) {
159 | super.onCreate(savedInstanceState);
160 | addPreferencesFromResource(R.xml.pref_general);
161 | setHasOptionsMenu(true);
162 |
163 | // Bind the summaries of EditText/List/Dialog/Ringtone preferences
164 | // to their values. When their values change, their summaries are
165 | // updated to reflect the new value, per the Android Design
166 | // guidelines.
167 | bindPreferenceSummaryToValue(findPreference("time"));
168 | bindPreferenceSummaryToValue(findPreference("temp_scale"));
169 | bindPreferenceSummaryToValue(findPreference("rain_scale"));
170 | }
171 |
172 | @Override
173 | public boolean onOptionsItemSelected(MenuItem item) {
174 | int id = item.getItemId();
175 | if (id == android.R.id.home) {
176 | startActivity(new Intent(getActivity(), SettingsActivity.class));
177 | return true;
178 | }
179 | return super.onOptionsItemSelected(item);
180 | }
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/app/src/main/java/nl/implode/weer/WeatherStation.java:
--------------------------------------------------------------------------------
1 | package nl.implode.weer;
2 |
3 | import android.os.StrictMode;
4 | import android.util.Log;
5 |
6 | import org.json.JSONArray;
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | import java.util.ArrayList;
11 |
12 | import okhttp3.OkHttpClient;
13 | import okhttp3.Request;
14 | import okhttp3.Response;
15 |
16 | /**
17 | * Created by sander on 19-1-17.
18 | */
19 | public class WeatherStation {
20 | public Integer _id;
21 | public String name;
22 | public String country;
23 | public String latitude;
24 | public String longitude;
25 |
26 | public WeatherStation(Integer id, String name, String country, String latitude, String longitude) {
27 | this._id = id;
28 | this.name = name;
29 | this.country = country;
30 | this.latitude = latitude;
31 | this.longitude = longitude;
32 | }
33 |
34 | // Constructor to convert JSON object into a Java class instance
35 | public WeatherStation(JSONObject object){
36 | try {
37 | Log.d("nl.implode.weer", object.getString("name"));
38 | this._id = object.getInt("_id");
39 | this.name = object.getString("name");
40 | this.country = object.getString("country");
41 | this.longitude = "0";
42 | this.latitude = "0";
43 | } catch (JSONException e) {
44 | e.printStackTrace();
45 | }
46 | }
47 |
48 | public JSONObject get5DayForecast() {
49 | JSONObject jsonResult = new JSONObject();
50 |
51 | StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
52 | StrictMode.setThreadPolicy(policy);
53 | String apiEntryPoint = "https://api.openweathermap.org/data/2.5/forecast?";
54 | String appId = "fbc3d19917801786e46dbacd55d2ee9c";
55 | Integer maxResults = 10;
56 |
57 | String url = apiEntryPoint + "appid=" + appId + "&id=" + _id;
58 | OkHttpClient client = new OkHttpClient();
59 | Request request = new Request.Builder().url(url).build();
60 | String result = "";
61 | try {
62 | Response response = client.newCall(request).execute();
63 | result = response.body().string();
64 | jsonResult = new JSONObject(result);
65 | } catch(Exception e) {
66 | e.printStackTrace();
67 | }
68 |
69 | return jsonResult;
70 | }
71 |
72 | // Factory method to convert an array of JSON objects into a list of objects
73 | // User.fromJson(jsonArray);
74 | public static ArrayList fromJson(JSONArray jsonObjects) {
75 | ArrayList weatherStations = new ArrayList();
76 | for (int i = 0; i < jsonObjects.length(); i++) {
77 | try {
78 | weatherStations.add(new WeatherStation(jsonObjects.getJSONObject(i)));
79 | } catch (JSONException e) {
80 | e.printStackTrace();
81 | }
82 | }
83 | return weatherStations;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/nl/implode/weer/WeatherStationAutoCompleteAdapter.java:
--------------------------------------------------------------------------------
1 | package nl.implode.weer;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.database.Cursor;
7 | import android.database.sqlite.SQLiteDatabase;
8 | import android.graphics.Paint;
9 | import android.net.Uri;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.BaseAdapter;
14 | import android.widget.Button;
15 | import android.widget.Filter;
16 | import android.widget.Filterable;
17 | import android.widget.TextView;
18 |
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | /**
23 | * Created by sander on 20-1-17.
24 | */
25 | public class WeatherStationAutoCompleteAdapter extends BaseAdapter implements Filterable {
26 |
27 | private static final int MAX_RESULTS = 20;
28 | private Context mContext;
29 | private List resultList = new ArrayList();
30 |
31 | public WeatherStationAutoCompleteAdapter(Context context) {
32 | mContext = context;
33 | }
34 |
35 | @Override
36 | public int getCount() {
37 | return resultList.size();
38 | }
39 |
40 | @Override
41 | public WeatherStation getItem(int index) {
42 | return resultList.get(index);
43 | }
44 |
45 | @Override
46 | public long getItemId(int position) {
47 | return position;
48 | }
49 |
50 | @Override
51 | public View getView(int position, View convertView, ViewGroup parent) {
52 | if (convertView == null) {
53 | LayoutInflater inflater = (LayoutInflater) mContext
54 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
55 | //convertView = inflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
56 | convertView = inflater.inflate(R.layout.autocomplete_line, parent, false);
57 | }
58 | TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
59 | TextView text2 = (TextView) convertView.findViewById(android.R.id.text2);
60 | // Populate the data into the template view using the data object
61 | text1.setText(getItem(position).name + ", "+getItem(position).country);
62 | text2.setText(getItem(position).latitude + ", " + getItem(position).longitude);
63 | text2.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
64 | final String lat = getItem(position).latitude;
65 | final String lon = getItem(position).longitude;
66 | text2.setOnClickListener(new View.OnClickListener() {
67 | @Override
68 | public void onClick(View v) {
69 |
70 | String url = "https://www.openstreetmap.org/#map=11/"+lat+"/"+lon;
71 |
72 | Intent i = new Intent(Intent.ACTION_VIEW);
73 | i.setData(Uri.parse(url));
74 | mContext.startActivity(i);
75 | }
76 | });
77 |
78 | return convertView;
79 | }
80 |
81 | @Override
82 | public Filter getFilter() {
83 | Filter filter = new Filter() {
84 | @Override
85 | protected Filter.FilterResults performFiltering(CharSequence constraint) {
86 | Filter.FilterResults filterResults = new Filter.FilterResults();
87 | if (constraint != null) {
88 | List weatherStations = findWeatherStations(mContext, constraint.toString());
89 |
90 | // Assign the data to the FilterResults
91 | filterResults.values = weatherStations;
92 | filterResults.count = weatherStations.size();
93 | }
94 | return filterResults;
95 | }
96 |
97 | @Override
98 | protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
99 | if (results != null && results.count > 0) {
100 | resultList = (List) results.values;
101 | notifyDataSetChanged();
102 | } else {
103 | notifyDataSetInvalidated();
104 | }
105 | }};
106 | return filter;
107 | }
108 |
109 | /**
110 | * Returns a search result for the given a name.
111 | */
112 | private List findWeatherStations(Context context, String name) {
113 | WeatherStationsDatabase weatherStationsDatabase = new WeatherStationsDatabase(context);
114 | SQLiteDatabase db = weatherStationsDatabase.getReadableDatabase();
115 | String[] parts = name.split(",");
116 | String cityOrLat = parts[0];
117 | String countryOrLon = "";
118 | if (parts.length>1) {
119 | countryOrLon = parts[1].trim();
120 | }
121 | Cursor cursor = db.rawQuery("SELECT * FROM cities" +
122 | " WHERE (name LIKE ? AND country LIKE ?)" +
123 | " OR (lat LIKE ? AND lon LIKE ?) LIMIT 20;",
124 | new String[] {
125 | "%"+cityOrLat+"%",
126 | "%"+countryOrLon+"%",
127 | cityOrLat+"%",
128 | countryOrLon+"%"
129 | });
130 | List searchResults = new ArrayList();
131 | try {
132 | while (cursor.moveToNext()) {
133 | searchResults.add(new WeatherStation(
134 | cursor.getInt(cursor.getColumnIndex("_id")),
135 | cursor.getString(cursor.getColumnIndex("name")),
136 | cursor.getString(cursor.getColumnIndex("country")),
137 | cursor.getString(cursor.getColumnIndex("lat")),
138 | cursor.getString(cursor.getColumnIndex("lon"))
139 | ));
140 | }
141 | } finally {
142 | cursor.close();
143 | db.close();
144 | }
145 | return searchResults;
146 | }
147 | }
148 |
149 |
--------------------------------------------------------------------------------
/app/src/main/java/nl/implode/weer/WeatherStationsDatabase.java:
--------------------------------------------------------------------------------
1 | package nl.implode.weer;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.database.sqlite.SQLiteDatabase;
6 |
7 | import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
8 |
9 | /**
10 | * Created by sander on 23-1-17.
11 | */
12 | public class WeatherStationsDatabase extends SQLiteAssetHelper {
13 |
14 | private static final String DATABASE_NAME = "cities.db";
15 | private static final int DATABASE_VERSION = 1;
16 |
17 | public WeatherStationsDatabase(Context context) {
18 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
19 | }
20 |
21 | public WeatherStation findWeatherStation(int id) {
22 | SQLiteDatabase db = super.getReadableDatabase();
23 | Cursor cursor = db.rawQuery("SELECT * FROM cities WHERE _id="+id+";", null);
24 | WeatherStation weatherStation = null;
25 | try {
26 | while (cursor.moveToNext()) {
27 | weatherStation = new WeatherStation(
28 | cursor.getInt(cursor.getColumnIndex("_id")),
29 | cursor.getString(cursor.getColumnIndex("name")),
30 | cursor.getString(cursor.getColumnIndex("country")),
31 | cursor.getString(cursor.getColumnIndex("lat")),
32 | cursor.getString(cursor.getColumnIndex("lon")
33 | ));
34 | }
35 | } finally {
36 | cursor.close();
37 | db.close();
38 | }
39 | return weatherStation;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-anydpi-v21/ic_settings_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_info_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_map.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_info_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_map.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_12.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_14.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_20.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_23.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_26.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_27.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_28.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_30.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_31.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_33.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_35.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_37.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_39.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_41.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_45.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_45.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_46.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon_47.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-mdpi/icon_47.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/forecastwidget_dark_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-nodpi/forecastwidget_dark_preview.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/forecastwidget_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-nodpi/forecastwidget_preview.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_info_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_map.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_info_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_map.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxxhdpi/ic_info_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxxhdpi/ic_map.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/autocomplete_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/day.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/day_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forecast.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forecast_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forecast_widget.xml:
--------------------------------------------------------------------------------
1 |
8 |
18 |
19 |
28 |
29 |
39 |
40 |
48 |
54 |
61 |
62 |
63 |
64 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forecast_widget_configure.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
16 |
17 |
22 |
29 |
30 |
31 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/forecast_widget_dark.xml:
--------------------------------------------------------------------------------
1 |
8 |
18 |
19 |
28 |
29 |
39 |
40 |
48 |
54 |
61 |
62 |
63 |
64 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_weatherstation.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
25 |
26 |
33 |
34 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/times.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/times_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Wetter
3 |
4 |
5 |
6 |
7 | Allgemeine Einstellungen
8 |
9 | Uhrzeit des Ortes anstatt des Gerätes nutzen
10 | Die Uhrzeit an dem ausgewählten Ort der Wettervorhersage anstelle der des Gerätes nutzen.
11 |
12 |
13 | Zeitdarstellung
14 |
15 | - 24h (13:37)
16 | - am/pm (1:37pm)
17 |
18 |
19 | - 0
20 | - 1
21 |
22 | Temperaturskala
23 |
24 | - Celsius
25 | - Fahrenheit
26 | - Kelvin
27 |
28 |
29 | - 0
30 | - 1
31 | - 2
32 |
33 | Niederschlagseinheit
34 |
35 | - Millimeter
36 | - Zoll
37 |
38 |
39 | - 0
40 | - 1
41 |
42 |
43 | Standort suchen
44 | Widget hinzufügen
45 |
46 | N
47 | NO
48 | NW
49 | S
50 | SO
51 | SW
52 | O
53 | W
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Weer
3 |
4 |
5 |
6 |
7 | Algemene instellingen
8 |
9 | Gebruik lokale tijd in plaats van apparaattijd
10 | Gebruik de tijd van de lokatie van de weerinformatie in plaats van de tijd op het apparaat
11 |
12 |
13 | Gebruik donker thema
14 | Spaar de batterij en gebruik een donker thema
15 |
16 | Tijdweergave
17 |
18 | - 24h (13:37)
19 | - am/pm (1:37pm)
20 |
21 |
22 | - 0
23 | - 1
24 |
25 | Temperatuurschaal
26 |
27 | - Celsius
28 | - Fahrenheit
29 | - Kelvin
30 |
31 |
32 | - 0
33 | - 1
34 | - 2
35 |
36 | Eenheid neerslag
37 |
38 | - Millimeter
39 | - Inch
40 |
41 |
42 | - 0
43 | - 1
44 |
45 |
46 | Locatie zoeken
47 | Widget toevoegen
48 |
49 | N
50 | NO
51 | NW
52 | Z
53 | ZO
54 | ZW
55 | O
56 | W
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 | 0dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Weather
3 |
4 |
5 |
6 |
7 | 常规设置
8 |
9 | 使用本地时间而不是设备时间
10 | 使用天气信息位置的时间而不是设备时间
11 |
12 |
13 | 使用黑暗主题
14 | 使用黑暗主题以节省电量
15 |
16 | 时间偏好
17 |
18 | - 24h (13:37)
19 | - am/pm (1:37pm)
20 |
21 |
22 | - 0
23 | - 1
24 |
25 | 温度单位
26 |
27 | - 摄氏
28 | - 华氏
29 | - 开
30 |
31 |
32 | - 0
33 | - 1
34 | - 2
35 |
36 | 降雨/雪单位
37 |
38 | - 毫米
39 | - 英寸
40 |
41 |
42 | - 0
43 | - 1
44 |
45 |
46 | 设置一个位置
47 | 添加小部件
48 |
49 | 北
50 | 东北
51 | 西北
52 | 南
53 | 东南
54 | 西南
55 | 东
56 | 西
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 | 8dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Weather
3 |
4 |
5 |
6 |
7 | General settings
8 |
9 | Use local time instead of device time
10 | Use the time at the location of weather info instead of the time on the device
11 |
12 |
13 | Use dark theme
14 | Save your battery and use a dark theme
15 |
16 | Time preference
17 |
18 | - 24h (13:37)
19 | - am/pm (1:37pm)
20 |
21 |
22 | - 0
23 | - 1
24 |
25 | Temperature scale
26 |
27 | - Celsius
28 | - Fahrenheit
29 | - Kelvin
30 |
31 |
32 | - 0
33 | - 1
34 | - 2
35 |
36 | Precipitation unit
37 |
38 | - Millimeter
39 | - Inch
40 |
41 |
42 | - 0
43 | - 1
44 |
45 |
46 | Find a location
47 | Add widget
48 |
49 | N
50 | NE
51 | NW
52 | S
53 | SE
54 | SW
55 | E
56 | W
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/forecast_dark_widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/forecast_widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_general.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
11 |
12 |
20 |
21 |
29 |
30 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref_headers_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/test/java/nl/implode/weer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package nl.implode.weer;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.4.2'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | google()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de-DE/full_description.txt:
--------------------------------------------------------------------------------
1 | Diese App enthält ein Widget mit einer Wettervorhersage für die nächsten 4 bis 6 Tage für auswählbare Orte. Jeder Tag
2 | ist in mehreren Blöcken mit einem Abstand von jeweils drei Stunden eingeteilt und die Wettervorhersage informiert über:
3 | - ein Wetter Symbol, welches Sonnenschein, Wolken und Niederschlag anzeigt
4 | - Temperatur (Kelvin, Celcius oder Fahrenheit)
5 | - Windrichtung
6 | - Windgeschwindigkeit (Beaufort)
7 | - Regenmengen (mm oder Zoll)
8 | - Schneemengen (mm or Zoll)
9 |
10 | Widgets sind in einer hellen und dunklen Option verfügbar.
11 |
12 | Die Informationen stammen von OpenWeatherMap und werden entweder jede halbe Stunde oder wenn ein Widget berührt wird
13 | aktualisiert. Die Temperatur kann in drei verschiedenen Skalen angezeigt werden: Kelvin, Celcius oder Fahrenheit und wird entweder blau angezeigt,
14 | wenn die Temperatur unter dem Gefrierpunkt liegt, sonst wird sie rot angezeigt. Regen- und Schneemengen können sowohl in mm als auch in Zoll angegeben werden.
15 |
16 | Die Zeit der Blöcke kann entweder die Uhrzeit des ausgweählten Standorts sein, oder die des Standorts vom Telefon.
17 | Außerdem kann zwischen dem 24-Stunden Format und dem am/pm-Format ausgewählt werden.
18 |
19 | Ein Widget hat die Minimalgröße von 4x3 und kann auch größer sein. Wenn ein Widget größer ist, können mehr Vorhersagen angezeigt werden Es ist möglich den Standort zu wechseln, nachdem das Widget hinzugefügt wurde, indem man das Zahnrad Icon berührt.
20 |
21 | Diese App ist erhältlich in Englisch, Niederländisch und Deutsch.
22 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de-DE/short_description.txt:
--------------------------------------------------------------------------------
1 | Wettervorhersage Widget, 4 bis 6 Tage mit jeweils 3 Stunden Unterschied von einem bestimmten Ort.
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de-DE/title.txt:
--------------------------------------------------------------------------------
1 | Wetter Widget
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/12.txt:
--------------------------------------------------------------------------------
1 | Changes in version 1.2.0
2 |
3 | - add German translation
4 | - add privacy statement
5 | - add more information to README
6 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/13.txt:
--------------------------------------------------------------------------------
1 | Changes in version 1.3.0
2 |
3 | - add dark theme and dark widget option
4 | - add new icons because snow was not visible in old icons
5 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/14.txt:
--------------------------------------------------------------------------------
1 | Changes in version 1.3.1
2 |
3 | - add dark theme and dark widget option (1.3.0)
4 | - add new icons because snow was not visible in old icons (1.3.0)
5 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | - fixed problem where dark widget could not be refreshed
2 | - replaced degrees sign for kelvin temperatures with 'K'
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/16.txt:
--------------------------------------------------------------------------------
1 | - now using https to connect with openweathermap
2 | - added support for older devices
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/17.txt:
--------------------------------------------------------------------------------
1 | - fix updating from version 1.3.2, ignore version 1.3.3
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | - fix 'use local time' switch in settings
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/19.txt:
--------------------------------------------------------------------------------
1 | - fix update problems in Oreo and up
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/20.txt:
--------------------------------------------------------------------------------
1 | - fix bug where dark widget turned light
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/21.txt:
--------------------------------------------------------------------------------
1 | - fix bug where dark widget turned light when changing weather location
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/22.txt:
--------------------------------------------------------------------------------
1 | - added Simplified Chinese
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/23.txt:
--------------------------------------------------------------------------------
1 | Added clickable GPS coordinates to search results. When clicked the location of the search result is shown in Osmand or in a browser.
2 | Added ability to search on country and coordinates
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/24.txt:
--------------------------------------------------------------------------------
1 | Adjust margin between forecasts when resizing widget
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 | Add one or more widgets to your homescreen with 4 to 6 day weather forecasts in selected locations. Each day
2 | is split into blocks of three hours and the information included in each forecast are:
3 | - weather icon indicating sunshine, clouds and precipitation
4 | - temperature (Kelvin, Celcius or Fahrenheit)
5 | - wind direction
6 | - wind speed (Beaufort)
7 | - amount of rain (mm or inch)
8 | - amount of snow (mm or inch)
9 |
10 | Widgets are available in a light and dark option.
11 |
12 | The source of the forecasts is OpenWeatherMap and is refreshed every half hour or when one of the widgets is
13 | tapped. Temperature can be displayed in one of three scales: Kelvin, Celcius or Farenheit and is shown in blue
14 | when temperature is below freezing and red otherwise. Rain and snow forecasts can be displayed in mm or inches.
15 |
16 | The times of the blocks can either be of the forecast location itself or the location of the phone and can be
17 | shown in 24-hour format of am/pm-format.
18 |
19 | A widget has a minimal size of 4 x 3 and can be larger. When a widget is larger, more forecasts will fit. It is
20 | possible to change the location after adding a widget by tapping the gear icon.
21 |
22 | This app is available in English, Dutch and German.
23 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/1-widget-4x4-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/1-widget-4x4-light.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/2-widget-4x4-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/2-widget-4x4-dark.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/3-widget-search-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/3-widget-search-light.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/4-settings-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/4-settings-light.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/5-settings2-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/5-settings2-light.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/6-settings2-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/6-settings2-dark.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/7-widget-5x5-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/7-widget-5x5-light.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/phoneScreenshots/8-widget-5x5-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/fastlane/metadata/android/en-US/phoneScreenshots/8-widget-5x5-dark.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | Weather forecast widget, 4 to 6 days in 3 hour blocks of a location.
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/title.txt:
--------------------------------------------------------------------------------
1 | Weather Widget
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | - probleem gerepareerd waarbij donkere widgets niet ververst konden worden
2 | - het graden symbool bij kelvin temperaturen is vervangen door een 'K'
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/16.txt:
--------------------------------------------------------------------------------
1 | - we gebruiken nu https om naar openweathermap te verbinden
2 | - ondersteuning ingebouwd voor iets oudere apparaten
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/17.txt:
--------------------------------------------------------------------------------
1 | - fix updaten vanaf versie 1.3.2, negeer versie 1.3.3
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | - de instelling 'gebruik lokale tijd' werkt nu
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/19.txt:
--------------------------------------------------------------------------------
1 | - repareer het verversen van widgets in Oreo en verder
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/20.txt:
--------------------------------------------------------------------------------
1 | - bug gerepareerd waar donkere widget licht werd
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/21.txt:
--------------------------------------------------------------------------------
1 | - bug gerepareerd waar donkere widget licht werd bij het wijzigen van de weerlocatie
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/22.txt:
--------------------------------------------------------------------------------
1 | - vertaling versimpeld Chinees toegevoegd
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/23.txt:
--------------------------------------------------------------------------------
1 | Klikbare GPS coördinate toegevoegd aan zoekresultaten. Bij klikken wordt de locatie van het zoekresultaat getoond in Osmand of in een browser.
2 | Mogelijkheid om te zoeken op land en op coördinaten toegevoegd.
3 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/changelogs/24.txt:
--------------------------------------------------------------------------------
1 | De ruimte tussen de dagvooruitzichten wordt beter benut bij resizen
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/full_description.txt:
--------------------------------------------------------------------------------
1 | Voeg een of meer widgets toe aan het homescreen met de weersverwachting voor 4 tot 6 dagen in een gekozen
2 | locatie. Elke dag is verdeeld in blokken van drie uur en de informatie per weersverwachting is als volgt:
3 | - weer icoon met zonneschijn, wolken en neerslag
4 | - temperatuur (Kelvin, Celcius of Fahrenheit)
5 | - windrichting
6 | - windsnelheid (Beaufort)
7 | - hoeveelheid regen (mm of inch)
8 | - hoeveelheid sneeuw (mm of inch)
9 |
10 | Widgets zijn beschikbaar in een licht en donkere variant.
11 |
12 | De bron voor de weersverwachting is OpenWeatherMap en wordt elk half uur ververst of als op een van de widgets
13 | wordt geklikt. De temperatuur kan worden getoond in een van drie schalen: Kelvin, Celcius of Fahrenheit. De
14 | temperatuur wordt blauw weergegeven als het vriest en anders in rood. Regen- en sneeuwverwachting kunnen worden
15 | getoond in millimeters of inches.
16 |
17 | De tijden van de blokken kunnen van de weerlocatie zelf zijn of van de locatie van de telefoon en kunnen worden
18 | getoond in 24-uur formaat of am/om-formaat.
19 |
20 | De minimale grootte van een widget is 4x3 en kan groter zijn. Als de widget groter is kunnen meer verwachtingen
21 | passen. Het is mogelijk de locatie van een widget te wijzigen nadat deze is toegevoegd door of het tandwiel-icoon
22 | te klikken.
23 |
24 | Deze app is beschikbaar in Nederlands en Engels.
25 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/short_description.txt:
--------------------------------------------------------------------------------
1 | Weersverwachting widget, 4 tot 6 dagen in blokken van 3 uur in een bepaalde locatie.
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nl-NL/title.txt:
--------------------------------------------------------------------------------
1 | Weather Widget
2 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanderbaas/WeatherWidget/2d416b597d4722d4a229222642b5eb5af468d5ae/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat May 18 11:01:12 GMT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------