Skip to content

Commit

Permalink
Replaced AlertDialog with a Snackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
revanmj committed Jan 31, 2016
1 parent c0585ed commit c6b10ff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
9 changes: 0 additions & 9 deletions .idea/libraries/Android_AdvancedWebView.xml

This file was deleted.

4 changes: 4 additions & 0 deletions StormMonitor/StormMonitor-StormMonitor.iml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.3.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/beta/1.1.3/jars" />
Expand Down Expand Up @@ -107,6 +109,8 @@
<orderEntry type="library" exported="" name="fabric-1.3.6" level="project" />
<orderEntry type="library" exported="" name="crashlytics-core-2.3.5" level="project" />
<orderEntry type="library" exported="" name="play-services-base-8.4.0" level="project" />
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
Expand Down
1 change: 1 addition & 0 deletions StormMonitor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies {
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package pl.revanmj.stormmonitor;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.ContextMenu;
import android.view.Menu;
Expand Down Expand Up @@ -130,9 +129,6 @@ private void setData(DownloadResult result)
sdAdapter.addAll(cityStorm);
sdAdapter.notifyDataSetChanged();
} else {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
alertDialogBuilder.setTitle(R.string.message_error);

String error = getResources().getString(R.string.error_unknown) + result.getResultCode();

Answers.getInstance().logContentView(new ContentViewEvent()
Expand All @@ -143,16 +139,7 @@ private void setData(DownloadResult result)
if (result.getResultCode() == 2)
error = getResources().getString(R.string.error_no_connection);

alertDialogBuilder
.setMessage(error)
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
});

alertDialogBuilder.create().show();
Snackbar.make(mySwipeRefreshLayout, error, Snackbar.LENGTH_LONG).show();
}

mySwipeRefreshLayout.setRefreshing(false);
Expand Down

0 comments on commit c6b10ff

Please sign in to comment.