Skip to content

Commit

Permalink
Added prompt to add iCal feed if feed not already loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Mike committed May 30, 2012
1 parent 18170a7 commit fac7548
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
<string name="opt_error_no_url">No URL found.</string>
<string name="opt_barcode_fail">Unable to retrieve barcode data. Please try again.</string>
<string name="opt_ignoressl">Do not verify SSL certificates</string>
<string name="main_no_feed_title">No Schedule Feed Found</string>
<string name="main_no_feed_text">It appears that no schedule feed is loaded. Would you like to load one now?</string>
</resources>
21 changes: 21 additions & 0 deletions src/org/splitbrain/giraffe/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.splitbrain.giraffe;

import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
Expand Down Expand Up @@ -54,6 +57,24 @@ public void onCreate(Bundle savedInstanceState) {
i.setData(intentdata);
startActivity(i);
}

if(prefs.getString("url","") == "") {
AlertDialog.Builder noFeedBuilder = new AlertDialog.Builder(context);
noFeedBuilder.setMessage(R.string.main_no_feed_text)
.setTitle(R.string.main_no_feed_title)
.setPositiveButton(R.string.common_yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(context, OptionsActivity.class);
startActivity(i);
}
})
.setNegativeButton(R.string.common_no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
noFeedBuilder.show();
}
}

/**
Expand Down

0 comments on commit fac7548

Please sign in to comment.