Skip to content

Commit

Permalink
Version 1.5.0
Browse files Browse the repository at this point in the history
- More Material Design (FAB, refreshed widget)
- Replaced SQLiteOpenHelper with Content Provider
- Replaced ListView with RecyclerView
- Added ability to remove city by swiping left
  • Loading branch information
revanmj committed Feb 6, 2016
1 parent c6b10ff commit 8b71c9a
Show file tree
Hide file tree
Showing 38 changed files with 805 additions and 462 deletions.
Binary file modified StormMonitor.apk
Binary file not shown.
31 changes: 19 additions & 12 deletions StormMonitor/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pl.revanmj.stormmonitor"
android:versionCode="33"
android:versionName="1.4.10" >
android:versionName="1.4.10">

<uses-sdk
android:minSdkVersion="15"
Expand All @@ -11,57 +11,64 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme">
<activity
android:name="pl.revanmj.stormmonitor.MainActivity"
android:name=".MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" >
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="pl.revanmj.stormmonitor.AboutActivity"
android:name=".AboutActivity"
android:label="@string/menu_about">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="pl.revanmj.stormmonitor.MainActivity" />
</activity>
<activity
android:name="pl.revanmj.stormmonitor.MapActivity"
android:name=".MapActivity"
android:configChanges="orientation"
android:label="@string/title_activity_map"
android:screenOrientation="portrait" >
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="pl.revanmj.stormmonitor.MainActivity" />
</activity>
<activity
android:name="pl.revanmj.stormmonitor.SearchActivity"
android:name=".SearchActivity"
android:label="@string/title_activity_search">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="pl.revanmj.stormmonitor.MainActivity" />
</activity>
<activity
android:name="pl.revanmj.stormmonitor.DetailsActivity"
android:name=".DetailsActivity"
android:label="@string/title_activity_details">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="pl.revanmj.stormmonitor.MainActivity" />
</activity>

<receiver android:name="pl.revanmj.stormmonitor.CitiesWidget" >
<provider
android:name=".data.StormDataProvider"
android:authorities="pl.revanmj.provider.StormData" />

<receiver android:name=".CitiesWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
Expand All @@ -72,7 +79,7 @@
</receiver>

<service
android:name="pl.revanmj.stormmonitor.WidgetService"
android:name=".WidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />

<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.ContentViewEvent;

/**
* Created by revanmj on 14.07.2013.
*/

public class AboutActivity extends AppCompatActivity {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
Expand All @@ -11,19 +12,23 @@
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.ContentViewEvent;

import pl.revanmj.stormmonitor.logic.Downloader;
import pl.revanmj.stormmonitor.data.StormDataProvider;
import pl.revanmj.stormmonitor.logic.Utils;
import pl.revanmj.stormmonitor.model.DownloadResult;
import pl.revanmj.stormmonitor.model.StormData;
import pl.revanmj.stormmonitor.sql.StormOpenHelper;

import java.util.List;

/**
* Created by revanmj on 26.12.2013.
*/

public class CitiesWidget extends AppWidgetProvider {
private Context ctx;
private Context context;

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
ctx = context;
this.context = context;
RefreshData();
final int N = appWidgetIds.length;
for (int i=0; i<N; i++) {
Expand All @@ -48,11 +53,16 @@ static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
private void setData(DownloadResult result)
{
if (result.getResultCode() == 1) {
StormOpenHelper db = new StormOpenHelper(ctx);
for (StormData city : result.getCitiesData()) {
db.updateCity(city);
ContentValues cv = new ContentValues();
cv.put(StormDataProvider.KEY_STORMCHANCE, city.getStormChance());
cv.put(StormDataProvider.KEY_STORMTIME, city.getStormTime());
cv.put(StormDataProvider.KEY_RAINCHANCE, city.getRainChance());
cv.put(StormDataProvider.KEY_RAINTIME, city.getRainTime());
String selection = StormDataProvider.KEY_ID + " = ?";
String[] selArgs = {Integer.toString(city.getCityId())};
context.getContentResolver().update(StormDataProvider.CONTENT_URI, cv, selection, selArgs);
}
db.close();
}
}

Expand All @@ -64,7 +74,7 @@ protected DownloadResult doInBackground(List<StormData>... params) {

if (params[0] != null) {
// We list of the cities so download process can be started
result = Downloader.getStormData(params[0]);
result = Utils.getStormData(params[0]);
Answers.getInstance().logContentView(new ContentViewEvent()
.putContentName("Widget")
.putContentType("Action")
Expand All @@ -87,9 +97,7 @@ protected void onPreExecute(){
}

public void RefreshData() {
StormOpenHelper db = new StormOpenHelper(ctx);
List<StormData> cities = db.getAllCities();
db.close();
List<StormData> cities = Utils.getAllData(context);

JSONStormTask task = new JSONStormTask();
task.execute(cities);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import im.delight.android.webview.AdvancedWebView;

/**
* Created by revanmj on 25.01.2015.
*/

public class DetailsActivity extends AppCompatActivity {

Expand Down
Loading

0 comments on commit 8b71c9a

Please sign in to comment.