Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96194b6e authored by cretin45's avatar cretin45
Browse files

FMRadio: Fix station switch from list for certain locales

Issue-id: CYNGNOS-2234

Change-Id: Ic96e770da17753cd72544312a2397507b6279927
parent 96d3e2b0
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -127,20 +127,14 @@ public class FmFavoriteActivity extends Activity {
             */
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // Set the selected frequency to main UI and finish the
                // favorite manager.
                TextView textView = (TextView) view.findViewById(R.id.lv_station_freq);
                float frequency = 0;
                try {
                    frequency = Float.parseFloat(textView.getText().toString());
                } catch (NumberFormatException e) {
                    e.printStackTrace();
                }
                int frequency = mMyAdapter.getStationFreq(position);
                if (frequency != -1) {
                    Intent intentResult = new Intent();
                intentResult.putExtra(ACTIVITY_RESULT, FmUtils.computeStation(frequency));
                    intentResult.putExtra(ACTIVITY_RESULT, frequency);
                    setResult(RESULT_OK, intentResult);
                    finish();
                }
            }
        });

        // Finish favorite when exit FM
@@ -368,6 +362,15 @@ public class FmFavoriteActivity extends Activity {
            }
            return convertView;
        }

        private int getStationFreq(int position) {
            if (mCursor != null && mCursor.moveToPosition(position)) {
                final int stationFreq = mCursor.getInt(mCursor
                        .getColumnIndex(FmStation.Station.FREQUENCY));
                return stationFreq;
            }
            return -1;
        }
    }

    /**