FM: Launch station list automatically after scan

Give status update post scaning for categories
Fix %s showing in stationList

Change-Id: I1845f0cdeb0051bcfb951e2fef791a016fa81ef4
diff --git a/fmapp2/res/values/strings.xml b/fmapp2/res/values/strings.xml
index e55e538..9c4e627 100644
--- a/fmapp2/res/values/strings.xml
+++ b/fmapp2/res/values/strings.xml
@@ -125,7 +125,7 @@
     <string name="default_blank" translatable="false"></string>
     <string name="add_station" translatable="false">+</string>
 
-    <string name="station_name">Station: <xliff:g id="name">%s</xliff:g></string>
+    <string name="station_name">Station:</string>
     <string name="station_exists">This frequency already exists!</string>
     <string name="station_list_delete_station">Delete: <xliff:g id="name">%s</xliff:g></string>
     <string name="station_list_delete_station_prompt">Are you sure you want to delete \'<xliff:g id="name">%s</xliff:g>\'?</string>
@@ -141,4 +141,5 @@
     <string name="set">Set</string>
     <string name="user_defind_band_msg">Enter frequency from 76.0 to 108.0 MHz with minimum 1 channel spacing and 100 KHz space between min and max frequency</string>
     <string name="save_record_file">FM recorded file saved to \'<xliff:g id="record_file">%1$s</xliff:g>\'</string>
+    <string name="fm_search_no_results">No compatible stations found</string>
 </resources>
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index fd44883..2c19f52 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -233,7 +233,7 @@
    private int mStereo = -1;
 
    private static boolean mFMStats = false;
-
+   private boolean mShowStationList = false;
 
    /* Current Status Indicators */
    private static boolean mRecording = false;
@@ -1688,6 +1688,9 @@
       SharedPreferences.Editor editor = sp.edit();
       editor.clear();
       editor.commit();
+      if (mScannedFrequencies != null) {
+         mScannedFrequencies.clear();
+      }
    }
    public boolean fmConfigure() {
       boolean bStatus = true;
@@ -2668,6 +2671,11 @@
          resetFMStationInfoUI();
          invalidateOptionsMenu();
          saveStations();
+         if (mShowStationList) {
+            Intent stationListIntent = new Intent(FMRadio.this, StationListActivity.class);
+            startActivity(stationListIntent);
+         }
+         mShowStationList = false;
       }
    };
 
@@ -3109,6 +3117,20 @@
       }
       public void onSearchComplete() {
          Log.d(LOGTAG, "mServiceCallbacks.onSearchComplete :");
+         if (mIsScaning) {
+             if (mScannedFrequencies != null && mScannedFrequencies.size() > 0) {
+                 mShowStationList = true;
+             } else {
+                 mHandler.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        Toast t = Toast.makeText(FMRadio.this,
+                           getString(R.string.fm_search_no_results), Toast.LENGTH_SHORT);
+                        t.show();
+                    }
+                 });
+             }
+         }
          mScanPty = 0;
          mScanPtyIndex = 0;
          mIsScaning = false;