show hotspot-specific status messages when hotspot is active
This commit is contained in:
		
							parent
							
								
									b11ac7a64a
								
							
						
					
					
						commit
						9db9f32bf1
					
				@ -223,6 +223,10 @@ public class StartSwapView extends SwapView {
 | 
				
			|||||||
        WifiApControl wifiAp = WifiApControl.getInstance(getActivity());
 | 
					        WifiApControl wifiAp = WifiApControl.getInstance(getActivity());
 | 
				
			||||||
        if (wifiAp != null && wifiAp.isWifiApEnabled()) {
 | 
					        if (wifiAp != null && wifiAp.isWifiApEnabled()) {
 | 
				
			||||||
            WifiConfiguration config = wifiAp.getConfiguration();
 | 
					            WifiConfiguration config = wifiAp.getConfiguration();
 | 
				
			||||||
 | 
					            TextView textWifiVisible = findViewById(R.id.wifi_visible);
 | 
				
			||||||
 | 
					            if (textWifiVisible != null) {
 | 
				
			||||||
 | 
					                textWifiVisible.setText(R.string.swap_visible_hotspot);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            viewWifiNetwork.setText(getContext().getString(R.string.swap_active_hotspot, config.SSID));
 | 
					            viewWifiNetwork.setText(getContext().getString(R.string.swap_active_hotspot, config.SSID));
 | 
				
			||||||
        } else if (TextUtils.isEmpty(FDroidApp.ssid)) {
 | 
					        } else if (TextUtils.isEmpty(FDroidApp.ssid)) {
 | 
				
			||||||
            // not connected to or setup with any wifi network
 | 
					            // not connected to or setup with any wifi network
 | 
				
			||||||
 | 
				
			|||||||
@ -117,6 +117,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
    private NewRepoConfig confirmSwapConfig;
 | 
					    private NewRepoConfig confirmSwapConfig;
 | 
				
			||||||
    private LocalBroadcastManager localBroadcastManager;
 | 
					    private LocalBroadcastManager localBroadcastManager;
 | 
				
			||||||
    private WifiManager wifiManager;
 | 
					    private WifiManager wifiManager;
 | 
				
			||||||
 | 
					    private WifiApControl wifiApControl;
 | 
				
			||||||
    private BluetoothAdapter bluetoothAdapter;
 | 
					    private BluetoothAdapter bluetoothAdapter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @LayoutRes
 | 
					    @LayoutRes
 | 
				
			||||||
@ -227,6 +228,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
                new IntentFilter(Downloader.ACTION_INTERRUPTED));
 | 
					                new IntentFilter(Downloader.ACTION_INTERRUPTED));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
 | 
					        wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
 | 
				
			||||||
 | 
					        wifiApControl = WifiApControl.getInstance(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
 | 
					        bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -442,7 +444,6 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void setupWifiAP() {
 | 
					    private void setupWifiAP() {
 | 
				
			||||||
        WifiApControl wifiApControl = WifiApControl.getInstance(this);
 | 
					 | 
				
			||||||
        if (wifiApControl == null) {
 | 
					        if (wifiApControl == null) {
 | 
				
			||||||
            Log.e(TAG, "WiFi AP is null");
 | 
					            Log.e(TAG, "WiFi AP is null");
 | 
				
			||||||
            Toast.makeText(this, R.string.swap_toast_could_not_enable_hotspot, Toast.LENGTH_LONG).show();
 | 
					            Toast.makeText(this, R.string.swap_toast_could_not_enable_hotspot, Toast.LENGTH_LONG).show();
 | 
				
			||||||
@ -1052,7 +1053,11 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
                    peopleNearbyProgress.setVisibility(View.VISIBLE);
 | 
					                    peopleNearbyProgress.setVisibility(View.VISIBLE);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case BonjourManager.STATUS_VISIBLE:
 | 
					                case BonjourManager.STATUS_VISIBLE:
 | 
				
			||||||
                    textWifiVisible.setText(R.string.swap_visible_wifi);
 | 
					                    if (wifiApControl != null && wifiApControl.isEnabled()) {
 | 
				
			||||||
 | 
					                        textWifiVisible.setText(R.string.swap_visible_hotspot);
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        textWifiVisible.setText(R.string.swap_visible_wifi);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    peopleNearbyText.setText(R.string.swap_scanning_for_peers);
 | 
					                    peopleNearbyText.setText(R.string.swap_scanning_for_peers);
 | 
				
			||||||
                    peopleNearbyText.setVisibility(View.VISIBLE);
 | 
					                    peopleNearbyText.setVisibility(View.VISIBLE);
 | 
				
			||||||
                    peopleNearbyProgress.setVisibility(View.VISIBLE);
 | 
					                    peopleNearbyProgress.setVisibility(View.VISIBLE);
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,7 @@
 | 
				
			|||||||
    <TextView
 | 
					    <TextView
 | 
				
			||||||
            android:layout_width="wrap_content"
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
            android:layout_height="wrap_content"
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
            tools:text="No network yet"
 | 
					            tools:text="@string/swap_no_wifi_network"
 | 
				
			||||||
            android:id="@+id/wifi_ssid"
 | 
					            android:id="@+id/wifi_ssid"
 | 
				
			||||||
            style="@style/SwapTheme.Wizard.WifiSSID"
 | 
					            style="@style/SwapTheme.Wizard.WifiSSID"
 | 
				
			||||||
            android:layout_below="@id/wifi_icon"
 | 
					            android:layout_below="@id/wifi_icon"
 | 
				
			||||||
 | 
				
			|||||||
@ -477,6 +477,9 @@ This often occurs with apps installed via Google Play or other sources, if they
 | 
				
			|||||||
    <string name="swap_success">Swap success!</string>
 | 
					    <string name="swap_success">Swap success!</string>
 | 
				
			||||||
    <string name="swap_no_wifi_network">No network yet</string>
 | 
					    <string name="swap_no_wifi_network">No network yet</string>
 | 
				
			||||||
    <string name="swap_active_hotspot">%1$s (your hotspot)</string>
 | 
					    <string name="swap_active_hotspot">%1$s (your hotspot)</string>
 | 
				
			||||||
 | 
					    <string name="swap_visible_hotspot">Visible via hotspot</string>
 | 
				
			||||||
 | 
					    <string name="swap_setting_up_hotspot">Setting up hotspot…</string>
 | 
				
			||||||
 | 
					    <string name="swap_stopping_hotspot">Stopping hotspot…</string>
 | 
				
			||||||
    <string name="swap_view_available_networks">Tap to open available networks</string>
 | 
					    <string name="swap_view_available_networks">Tap to open available networks</string>
 | 
				
			||||||
    <string name="swap_switch_to_wifi">Tap to switch to a Wi-Fi network</string>
 | 
					    <string name="swap_switch_to_wifi">Tap to switch to a Wi-Fi network</string>
 | 
				
			||||||
    <string name="open_qr_code_scanner">Open QR Scanner</string>
 | 
					    <string name="open_qr_code_scanner">Open QR Scanner</string>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user