Add hotspot troubleshooting info

This commit is contained in:
Torsten Grote
2021-05-10 13:42:54 -03:00
committed by Sebastian Kürten
parent 85433611a5
commit d0bc17e634
6 changed files with 186 additions and 15 deletions

View File

@@ -3,6 +3,9 @@ package org.briarproject.briar.android.hotspot;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@@ -52,6 +55,7 @@ public abstract class AbstractTabsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
setHasOptionsMenu(true);
return inflater
.inflate(R.layout.fragment_hotspot_tabs, container, false);
}
@@ -83,6 +87,29 @@ public abstract class AbstractTabsFragment extends Fragment {
connectedButton = view.findViewById(R.id.connectedButton);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.hotspot_help_action, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_help) {
getParentFragmentManager().beginTransaction()
.setCustomAnimations(R.anim.step_next_in,
R.anim.step_previous_out,
R.anim.step_previous_in,
R.anim.step_next_out)
.replace(R.id.fragmentContainer, new HotspotHelpFragment(),
HotspotHelpFragment.TAG)
.addToBackStack(HotspotHelpFragment.TAG)
.commit();
return true;
}
return super.onOptionsItemSelected(item);
}
protected abstract Fragment getFirstFragment();
protected abstract Fragment getSecondFragment();

View File

@@ -1,10 +1,7 @@
package org.briarproject.briar.android.hotspot;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
@@ -19,8 +16,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.lifecycle.ViewModelProvider;
import static android.widget.Toast.LENGTH_SHORT;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
public class HotspotActivity extends BriarActivity {
@@ -57,21 +52,11 @@ public class HotspotActivity extends BriarActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.hotspot_help_action, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
} else if (item.getItemId() == R.id.action_help) {
Toast.makeText(this, "Not yet implemented", LENGTH_SHORT).show();
return true;
}
return super.onOptionsItemSelected(item);
}

View File

@@ -0,0 +1,28 @@
package org.briarproject.briar.android.hotspot;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
import org.briarproject.briar.R;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
public class HotspotHelpFragment extends Fragment {
public final static String TAG = HotspotHelpFragment.class.getName();
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater
.inflate(R.layout.fragment_hotspot_help, container, false);
}
}

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z" />
</vector>

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/wifiTitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/hotspot_help_wifi_title"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/wifi1View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_wifi_1"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wifiTitleView" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/wifi2View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_wifi_2"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wifi1View" />
<TextView
android:id="@+id/siteTitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/hotspot_help_site_title"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wifi2View" />
<TextView
android:id="@+id/site1View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_site_1"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/siteTitleView" />
<TextView
android:id="@+id/site2View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_site_2"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/site1View" />
<TextView
android:id="@+id/site3View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_site_3"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/site2View" />
<TextView
android:id="@+id/site4View"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawablePadding="6dp"
android:text="@string/hotspot_help_site_4"
app:drawableLeftCompat="@drawable/ic_circle_small"
app:drawableStartCompat="@drawable/ic_circle_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/site3View" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@@ -708,6 +708,14 @@
<string name="hotspot_manual_site_alt">Instead of typing the address manually, you can also scan a QR code.</string>
<string name="hotspot_qr_wifi">To download the app on another phone, please scan this QR code to connect to this Wi-Fi network:</string>
<string name="hotspot_qr_site">After you are connected to the Wi-Fi, scan this QR code to download the app.</string>
<string name="hotspot_help_wifi_title">Problems with connecting to Wi-Fi:</string>
<string name="hotspot_help_wifi_1">Try disabling and re-enabling Wi-Fi on both phones and try again.</string>
<string name="hotspot_help_wifi_2">If your phone complains that the Wi-Fi has no internet, tell it that you want to stay connected anyway.</string>
<string name="hotspot_help_site_title">Problems visiting the local website:</string>
<string name="hotspot_help_site_1">Double check that you entered the address exactly as shown. A small error can make it fail.</string>
<string name="hotspot_help_site_2">Ensure that your phone is still connected to the correct Wi-Fi (see above) when you try to access the site.</string>
<string name="hotspot_help_site_3">Check that you don\'t have any active firewall apps that may block the access.</string>
<string name="hotspot_help_site_4">If you can visit the site, but not download the Briar app, try it with a different web browser app.</string>
<!-- Screenshots -->