mirror of https://github.com/M66B/FairEmail.git
Added default apps button
This commit is contained in:
parent
4fbda85dd5
commit
603a049a92
|
@ -30,7 +30,9 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
|
@ -115,6 +117,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
private TextView tvOwner;
|
||||
private Group grpOwner;
|
||||
private Button btnSettings;
|
||||
private Button btnDefault;
|
||||
private TextView tvReset;
|
||||
|
||||
@NonNull
|
||||
|
@ -144,8 +147,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
if ("http".equals(scheme))
|
||||
scheme = "https";
|
||||
uri = Uri.parse(scheme + "://" + _uri.toString());
|
||||
}
|
||||
else
|
||||
} else
|
||||
uri = _uri;
|
||||
} else
|
||||
uri = _uri;
|
||||
|
@ -192,6 +194,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
tvOwner = dview.findViewById(R.id.tvOwner);
|
||||
grpOwner = dview.findViewById(R.id.grpOwner);
|
||||
btnSettings = dview.findViewById(R.id.btnSettings);
|
||||
btnDefault = dview.findViewById(R.id.btnDefault);
|
||||
tvReset = dview.findViewById(R.id.tvReset);
|
||||
|
||||
final Group grpDifferent = dview.findViewById(R.id.grpDifferent);
|
||||
|
@ -410,6 +413,14 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
}
|
||||
});
|
||||
|
||||
final Intent manage = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
|
||||
btnDefault.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
v.getContext().startActivity(manage);
|
||||
}
|
||||
});
|
||||
|
||||
tvReset.setPaintFlags(tvReset.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
tvReset.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -520,12 +531,14 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
}
|
||||
|
||||
private void setMore(boolean show) {
|
||||
boolean n = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N);
|
||||
ibMore.setImageLevel(show ? 0 : 1);
|
||||
btnOwner.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
pbWait.setVisibility(View.GONE);
|
||||
tvOwnerRemark.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
grpOwner.setVisibility(View.GONE);
|
||||
btnSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
btnDefault.setVisibility(show && n ? View.VISIBLE : View.GONE);
|
||||
tvReset.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17.6,9.48l1.84,-3.18c0.16,-0.31 0.04,-0.69 -0.26,-0.85c-0.29,-0.15 -0.65,-0.06 -0.83,0.22l-1.88,3.24c-2.86,-1.21 -6.08,-1.21 -8.94,0L5.65,5.67c-0.19,-0.29 -0.58,-0.38 -0.87,-0.2C4.5,5.65 4.41,6.01 4.56,6.3L6.4,9.48C3.3,11.25 1.28,14.44 1,18h22C22.72,14.44 20.7,11.25 17.6,9.48zM7,15.25c-0.69,0 -1.25,-0.56 -1.25,-1.25c0,-0.69 0.56,-1.25 1.25,-1.25S8.25,13.31 8.25,14C8.25,14.69 7.69,15.25 7,15.25zM17,15.25c-0.69,0 -1.25,-0.56 -1.25,-1.25c0,-0.69 0.56,-1.25 1.25,-1.25s1.25,0.56 1.25,1.25C18.25,14.69 17.69,15.25 17,15.25z"/>
|
||||
</vector>
|
|
@ -299,6 +299,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOwner" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDefault"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_android_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_default_apps"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSettings" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvReset"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -309,11 +321,11 @@
|
|||
android:drawableTint="?android:textColorLink"
|
||||
android:focusable="false"
|
||||
android:text="@string/title_reset_open"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:textColorLink"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSettings" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnDefault" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpDifferent"
|
||||
|
|
|
@ -1565,6 +1565,7 @@
|
|||
<string name="title_check_owner">Check owner</string>
|
||||
<string name="title_remark_owner">Information will be retrieved from <a href="https://ipinfo.io/">ipinfo.io</a></string>
|
||||
<string name="title_ip_owner">Owner IP address</string>
|
||||
<string name="title_default_apps">Default apps</string>
|
||||
<string name="title_reset_open">Set or clear default apps</string>
|
||||
<string name="title_select_app">Select app</string>
|
||||
<string name="title_updated">There is an update to version %1$s available</string>
|
||||
|
|
Loading…
Reference in New Issue