From 77beb6722748af5824e71f3d437917e8e59aae64 Mon Sep 17 00:00:00 2001 From: Tobias Trumm Date: Fri, 23 Oct 2015 22:33:53 +0200 Subject: [PATCH] Remove posibility to add own SSIDs. --- CHANGELOG.md | 3 + app/src/main/AndroidManifest.xml | 1 - .../AddRemoveNetworksFragment.java | 70 ------------------- .../NotificationService.java | 20 ------ 4 files changed, 3 insertions(+), 91 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b53447..e2f0383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ ### Fixed - Fixed a problem where new SSIDs weren't shown when the filter function was used right after the list of SSIDs was updated. +### Removed +- The feature to add own SSIDs was removed. There should be a folder named "freifunkautoconnect" containing the file "user_ssids.csv" on your SD card if version <= 0.5 was installed on your device. You can remove this folder, it is no longer needed. + ## [0.5] 2015-08-31 ### Added - The app will check on start up, if an updated list of SSIDs is available. If the check didn't fail, the next check will not be started until 24 hours have passed. diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b58d74c..6276c57 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,7 +4,6 @@ - diff --git a/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/AddRemoveNetworksFragment.java b/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/AddRemoveNetworksFragment.java index 35ddf56..cffb913 100644 --- a/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/AddRemoveNetworksFragment.java +++ b/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/AddRemoveNetworksFragment.java @@ -8,12 +8,9 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.media.MediaScannerConnection; -import android.net.Uri; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.Bundle; -import android.os.Environment; import android.support.v4.content.LocalBroadcastManager; import android.support.v4.view.MenuItemCompat; import android.util.Log; @@ -60,9 +57,6 @@ public class AddRemoveNetworksFragment extends Fragment implements AdapterView.O private static final String TAG = AddRemoveNetworksFragment.class.getSimpleName(); - public static String DIRECTORY = "freifunkautoconnect"; - public static String USER_SSIDS_FILE = "user_ssids.csv"; - private OnFragmentInteractionListener mListener; // ListView stuff @@ -365,73 +359,9 @@ private void getSSIDs() throws IOException { e.printStackTrace(); } - - // Read user defined ssids - // Check if external storage is available - String state = Environment.getExternalStorageState(); - if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { - File user_ssids = new File(Environment.getExternalStorageDirectory() + File.separator + DIRECTORY + File.separator + USER_SSIDS_FILE ); - // Check if file exists - if(!user_ssids.exists()){ - // If not, create the file - Log.i(TAG, "Start creation of user_ssids.csv file"); - user_ssids = createUserSSIDFile(); - } - else{ - Log.i(TAG, "user_ssids.csv already exists"); - } - // If the file was found/created: - if(user_ssids != null){ - is = new InputStreamReader(new FileInputStream(user_ssids)); - reader = new BufferedReader(is); - while ((line = reader.readLine()) != null) { - allNetworks.add(new Network(line)); - } - } - else{ - Log.w(TAG, "Could not find or create user_ssids file."); - } - } Collections.sort(allNetworks); } - private File createUserSSIDFile(){ - String state = Environment.getExternalStorageState(); - if (Environment.MEDIA_MOUNTED.equals(state)) { - File directory = new File(Environment.getExternalStorageDirectory() + File.separator + DIRECTORY); - if(!directory.exists()){ - // Create directory - Log.i(TAG, "Create freifunkautoconnect directory"); - directory.mkdir(); - } - File user_ssids = new File(directory, USER_SSIDS_FILE); - try { - // Create empty file - Log.i(TAG, "Create empty user_ssids.csv file"); - user_ssids.createNewFile(); - } - catch (IOException e) { - Log.w(TAG, "Could not create user_ssids.csv file."); - return null; - } - - // Make sure that the new file will be visible if the device is connected to a pc over USB cable. - Log.i(TAG, "Scan for user_ssids.csv file"); - MediaScannerConnection.scanFile( - getActivity(), - new String[]{directory.getAbsolutePath(), user_ssids.getAbsolutePath(),}, - null, - new MediaScannerConnection.OnScanCompletedListener() { - public void onScanCompleted(String path, Uri uri) { - Log.i(TAG, "Scanned " + path + ":"); - Log.i(TAG, "-> uri=" + uri); - } - } - ); - } - return null; - } - private void checkActiveNetworks(){ // Check which Network is already added to the network configuration List wifiConf = wm.getConfiguredNetworks(); diff --git a/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/NotificationService.java b/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/NotificationService.java index b4e2769..89997be 100644 --- a/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/NotificationService.java +++ b/app/src/main/java/com/example/tobiastrumm/freifunkautoconnect/NotificationService.java @@ -13,7 +13,6 @@ import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; -import android.os.Environment; import android.os.IBinder; import android.preference.PreferenceManager; import android.provider.Settings; @@ -237,25 +236,6 @@ private void getSSIDs() throws IOException { e.printStackTrace(); } - - // Read user defined ssids - // Check if external storage is available - String state = Environment.getExternalStorageState(); - if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { - File user_ssids = new File(Environment.getExternalStorageDirectory() + File.separator + AddRemoveNetworksFragment.DIRECTORY + File.separator + AddRemoveNetworksFragment.USER_SSIDS_FILE ); - // Check if file exists - // If the file was found/created: - if(user_ssids.exists()){ - is = new InputStreamReader(new FileInputStream(user_ssids)); - reader = new BufferedReader(is); - while ((line = reader.readLine()) != null) { - networks.add(new Network(line)); - } - } - else{ - Log.w(TAG, "Could not find."); - } - } Collections.sort(networks); } }