mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 09:31:11 +01:00
Added setup help
This commit is contained in:
@@ -45,6 +45,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
@@ -74,6 +75,8 @@ import static android.app.Activity.RESULT_OK;
|
||||
public class FragmentSetup extends FragmentEx {
|
||||
private ViewGroup view;
|
||||
|
||||
private ImageButton ibHelp;
|
||||
|
||||
private Button btnAccount;
|
||||
private TextView tvAccountDone;
|
||||
|
||||
@@ -116,6 +119,8 @@ public class FragmentSetup extends FragmentEx {
|
||||
view = (ViewGroup) inflater.inflate(R.layout.fragment_setup, container, false);
|
||||
|
||||
// Get controls
|
||||
ibHelp = view.findViewById(R.id.ibHelp);
|
||||
|
||||
btnAccount = view.findViewById(R.id.btnAccount);
|
||||
tvAccountDone = view.findViewById(R.id.tvAccountDone);
|
||||
|
||||
@@ -135,6 +140,13 @@ public class FragmentSetup extends FragmentEx {
|
||||
|
||||
// Wire controls
|
||||
|
||||
ibHelp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(getIntentHelp());
|
||||
}
|
||||
});
|
||||
|
||||
btnAccount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -230,6 +242,7 @@ public class FragmentSetup extends FragmentEx {
|
||||
});
|
||||
|
||||
// Initialize
|
||||
ibHelp.setVisibility(View.GONE);
|
||||
|
||||
tvAccountDone.setText(null);
|
||||
tvAccountDone.setCompoundDrawables(null, null, null, null);
|
||||
@@ -292,6 +305,9 @@ public class FragmentSetup extends FragmentEx {
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
ibHelp.setVisibility(getIntentHelp().resolveActivity(pm) == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
DB db = DB.getInstance(getContext());
|
||||
|
||||
db.account().liveAccounts(true).observe(getViewLifecycleOwner(), new Observer<List<EntityAccount>>() {
|
||||
@@ -395,6 +411,12 @@ public class FragmentSetup extends FragmentEx {
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getIntentHelp() {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/SETUP.md"));
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static Intent getIntentExport() {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
|
||||
Reference in New Issue
Block a user