diff --git a/F-Droid/res/drawable-hdpi/hotspot.png b/F-Droid/res/drawable-hdpi/hotspot.png new file mode 100644 index 000000000..9b829e462 Binary files /dev/null and b/F-Droid/res/drawable-hdpi/hotspot.png differ diff --git a/F-Droid/res/drawable-ldpi/hotspot.png b/F-Droid/res/drawable-ldpi/hotspot.png new file mode 100644 index 000000000..2e4202f40 Binary files /dev/null and b/F-Droid/res/drawable-ldpi/hotspot.png differ diff --git a/F-Droid/res/drawable-mdpi/hotspot.png b/F-Droid/res/drawable-mdpi/hotspot.png new file mode 100644 index 000000000..e6ea8cfa2 Binary files /dev/null and b/F-Droid/res/drawable-mdpi/hotspot.png differ diff --git a/F-Droid/res/drawable/hotspot.png b/F-Droid/res/drawable/hotspot.png new file mode 100644 index 000000000..88953cea6 Binary files /dev/null and b/F-Droid/res/drawable/hotspot.png differ diff --git a/F-Droid/res/values/strings.xml b/F-Droid/res/values/strings.xml index 7730fc03f..f8f199c57 100644 --- a/F-Droid/res/values/strings.xml +++ b/F-Droid/res/values/strings.xml @@ -299,6 +299,7 @@ F-Droid is an installable catalogue of FOSS (Free and Open Source Software) applications for the Android platform. The client makes it easy to browse, install, and keep track of updates on your device. If your friend has F-Droid and NFC turned on touch your phones together. Join the same Wifi as your friend + Help your friend join your hotspot Use Bluetooth instead Learn more about Wifi Swap apps @@ -306,7 +307,9 @@ Swap Swap success! No network yet + Your hotspot is active (Tap to open available networks) + (Tap to switch to a WiFi network) It\'s not working Open QR Code Scanner Welcome to F-Droid! diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/JoinWifiFragment.java b/F-Droid/src/org/fdroid/fdroid/views/swap/JoinWifiFragment.java index 7bbc461d7..9723945b9 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/JoinWifiFragment.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/JoinWifiFragment.java @@ -17,6 +17,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import org.fdroid.fdroid.FDroidApp; @@ -74,10 +75,31 @@ public class JoinWifiFragment extends Fragment { } private void refreshWifiState() { - if (getView() != null) { - TextView ssidView = (TextView) getView().findViewById(R.id.wifi_ssid); - String text = TextUtils.isEmpty(FDroidApp.ssid) ? getString(R.string.swap_no_wifi_network) : FDroidApp.ssid; - ssidView.setText(text); + View view = getView(); + if (view != null) { + TextView descriptionView = (TextView) view.findViewById(R.id.text_description); + ImageView wifiIcon = (ImageView) view.findViewById(R.id.wifi_icon); + TextView ssidView = (TextView) view.findViewById(R.id.wifi_ssid); + TextView tapView = (TextView) view.findViewById(R.id.wifi_available_networks_prompt); + if (TextUtils.isEmpty(FDroidApp.bssid) && !TextUtils.isEmpty(FDroidApp.ipAddressString)) { + // empty bssid with an ipAddress means hotspot mode + descriptionView.setText(R.string.swap_join_this_hotspot); + wifiIcon.setImageDrawable(getResources().getDrawable(R.drawable.hotspot)); + ssidView.setText(R.string.swap_active_hotspot); + tapView.setText(R.string.swap_switch_to_wifi); + } else if (TextUtils.isEmpty(FDroidApp.ssid)) { + // not connected to or setup with any wifi network + descriptionView.setText(R.string.swap_join_same_wifi); + wifiIcon.setImageDrawable(getResources().getDrawable(R.drawable.wifi)); + ssidView.setText(R.string.swap_no_wifi_network); + tapView.setText(R.string.swap_view_available_networks); + } else { + // connected to a regular wifi network + descriptionView.setText(R.string.swap_join_same_wifi); + wifiIcon.setImageDrawable(getResources().getDrawable(R.drawable.wifi)); + ssidView.setText(FDroidApp.ssid); + tapView.setText(R.string.swap_view_available_networks); + } } }