pull/199/head
M66B 4 years ago
parent 30bcd4debd
commit 7a839df0d6

@ -29,10 +29,13 @@ import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
import android.text.style.RelativeSizeSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -461,43 +464,54 @@ public class FragmentOptions extends FragmentBase {
@Override
public CharSequence getPageTitle(int position) {
CharSequence title = getTitle(position);
if (position == 0)
return title;
SpannableStringBuilder ssb = new SpannableStringBuilder(title);
ssb.setSpan(new RelativeSizeSpan(0.85f), 0, ssb.length(), 0);
return ssb;
}
@NonNull
private CharSequence getTitle(int position) {
switch (position) {
case 0:
return getString(R.string.title_advanced_section_main);
return getTitle(R.string.title_advanced_section_main, R.drawable.twotone_home_24, position);
case 1:
return getString(R.string.title_advanced_section_synchronize);
return getTitle(R.string.title_advanced_section_synchronize, R.drawable.twotone_sync_24, position);
case 2:
return getString(R.string.title_advanced_section_send);
return getTitle(R.string.title_advanced_section_send, R.drawable.twotone_send_24, position);
case 3:
return getString(R.string.title_advanced_section_connection);
return getTitle(R.string.title_advanced_section_connection, R.drawable.twotone_cloud_24, position);
case 4:
return getString(R.string.title_advanced_section_display);
return getTitle(R.string.title_advanced_section_display, R.drawable.twotone_monitor_24, position);
case 5:
return getString(R.string.title_advanced_section_behavior);
return getTitle(R.string.title_advanced_section_behavior, R.drawable.twotone_psychology_24, position);
case 6:
return getString(R.string.title_advanced_section_privacy);
return getTitle(R.string.title_advanced_section_privacy, R.drawable.twotone_account_circle_24, position);
case 7:
return getString(R.string.title_advanced_section_encryption);
return getTitle(R.string.title_advanced_section_encryption, R.drawable.twotone_lock_24, position);
case 8:
return getString(R.string.title_advanced_section_notifications);
return getTitle(R.string.title_advanced_section_notifications, R.drawable.twotone_notifications_24, position);
case 9:
return getString(R.string.title_advanced_section_misc);
return getTitle(R.string.title_advanced_section_misc, R.drawable.twotone_more_24, position);
default:
throw new IllegalArgumentException();
}
}
private CharSequence getTitle(int titleid, int iconid, int position) {
Drawable icon = getResources().getDrawable(iconid);
int iconSize = getResources().getDimensionPixelSize(R.dimen.menu_item_icon_size);
if (position > 0)
iconSize = Math.round(iconSize * 0.85f);
icon.setBounds(0, 0, iconSize, iconSize);
int color = Helper.resolveColor(getContext(), R.attr.colorAccent);
icon.setTint(color);
ImageSpan imageSpan = new ImageSpan(icon, DynamicDrawableSpan.ALIGN_BOTTOM);
SpannableStringBuilder ssb = new SpannableStringBuilder(getString(titleid));
if (position > 0)
ssb.setSpan(new RelativeSizeSpan(0.85f), 0, ssb.length(), 0);
ssb.insert(0, "\uFFFC\u2002"); // object replacement character, en space
ssb.setSpan(imageSpan, 0, 1, 0);
return ssb;
}
@Override
public int getItemPosition(@NonNull Object object) {
return POSITION_NONE; // always recreate fragment

@ -0,0 +1,15 @@
<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="M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3zM17,18h-2v-6L9,12v6L7,18v-7.81l5,-4.5 5,4.5L17,18z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,10.19V18h2v-6h6v6h2v-7.81l-5,-4.5z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
</vector>

@ -0,0 +1,15 @@
<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="M20,3H4C2.9,3 2,3.9 2,5v11c0,1.1 0.9,2 2,2h3l-1,1v2h12v-2l-1,-1h3c1.1,0 2,-0.9 2,-2V5C22,3.9 21.1,3 20,3zM20,16H4V5h16V16z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M4,5h16v11h-16z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
</vector>

@ -0,0 +1,25 @@
<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"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M7.06,5L2.4,12l4.67,7L22,19L22,5L7.06,5c0.01,0 0.01,0 0,0zM19,10.5c0.83,0 1.5,0.67 1.5,1.5s-0.67,1.5 -1.5,1.5 -1.5,-0.67 -1.5,-1.5 0.67,-1.5 1.5,-1.5zM14,10.5c0.83,0 1.5,0.67 1.5,1.5s-0.67,1.5 -1.5,1.5 -1.5,-0.67 -1.5,-1.5 0.67,-1.5 1.5,-1.5zM9,10.5c0.83,0 1.5,0.67 1.5,1.5s-0.67,1.5 -1.5,1.5 -1.5,-0.67 -1.5,-1.5 0.67,-1.5 1.5,-1.5z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.97,0.89 1.66,0.89L22,21c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM22,19L7.07,19L2.4,12l4.66,-7L22,5v14z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M9,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="@android:color/white"
android:pathData="M14,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="@android:color/white"
android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
</vector>

@ -0,0 +1,18 @@
<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="M13,5c-2.65,0 -4.79,2.06 -4.97,4.67L6.7,12H8v4h3v3h3v-3.95l0.89,-0.43C16.71,13.88 18,12.09 18,10C18,7.24 15.76,5 13,5zM16.82,8.95l-0.85,0.66C15.99,9.73 16,9.86 16,10c0,0.13 -0.01,0.26 -0.02,0.39l0.83,0.66c0.08,0.06 0.1,0.16 0.05,0.25l-0.8,1.39c-0.05,0.09 -0.16,0.12 -0.24,0.09l-0.99,-0.4c-0.21,0.16 -0.43,0.29 -0.67,0.39L14,13.83c-0.01,0.1 -0.1,0.17 -0.2,0.17h-1.6c-0.1,0 -0.18,-0.07 -0.2,-0.17l-0.15,-1.06c-0.25,-0.1 -0.47,-0.23 -0.68,-0.39l-0.99,0.4c-0.09,0.03 -0.2,0 -0.25,-0.09l-0.8,-1.39c-0.05,-0.08 -0.03,-0.19 0.05,-0.25l0.84,-0.66C10.01,10.26 10,10.13 10,10c0,-0.13 0.02,-0.27 0.04,-0.39L9.19,8.95c-0.08,-0.06 -0.1,-0.16 -0.05,-0.26l0.8,-1.38c0.05,-0.09 0.15,-0.12 0.24,-0.09l1,0.4c0.2,-0.15 0.43,-0.29 0.67,-0.39l0.15,-1.06C12.02,6.07 12.1,6 12.2,6h1.6c0.1,0 0.18,0.07 0.2,0.17l0.15,1.06c0.24,0.1 0.46,0.23 0.67,0.39l1,-0.4c0.09,-0.03 0.2,0 0.24,0.09l0.8,1.38C16.91,8.78 16.89,8.89 16.82,8.95z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M15.82,7.22l-1,0.4c-0.21,-0.16 -0.43,-0.29 -0.67,-0.39L14,6.17C13.98,6.07 13.9,6 13.8,6h-1.6c-0.1,0 -0.18,0.07 -0.19,0.17l-0.15,1.06c-0.24,0.1 -0.47,0.23 -0.67,0.39l-1,-0.4c-0.09,-0.03 -0.2,0 -0.24,0.09l-0.8,1.38c-0.05,0.09 -0.03,0.2 0.05,0.26l0.85,0.66C10.02,9.73 10,9.87 10,10c0,0.13 0.01,0.26 0.03,0.39l-0.84,0.66c-0.08,0.06 -0.1,0.17 -0.05,0.25l0.8,1.39c0.05,0.09 0.15,0.12 0.25,0.09l0.99,-0.4c0.21,0.16 0.43,0.29 0.68,0.39L12,13.83c0.02,0.1 0.1,0.17 0.2,0.17h1.6c0.1,0 0.18,-0.07 0.2,-0.17l0.15,-1.06c0.24,-0.1 0.47,-0.23 0.67,-0.39l0.99,0.4c0.09,0.04 0.2,0 0.24,-0.09l0.8,-1.39c0.05,-0.09 0.03,-0.19 -0.05,-0.25l-0.83,-0.66C15.99,10.26 16,10.13 16,10c0,-0.14 -0.01,-0.27 -0.03,-0.39l0.85,-0.66c0.08,-0.06 0.1,-0.17 0.05,-0.26l-0.8,-1.38C16.02,7.22 15.91,7.19 15.82,7.22zM13,11.43c-0.79,0 -1.43,-0.64 -1.43,-1.43S12.21,8.57 13,8.57s1.43,0.64 1.43,1.43S13.79,11.43 13,11.43z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M19.94,9.06c-0.43,-3.27 -3.23,-5.86 -6.53,-6.05C13.27,3 13.14,3 13,3C9.47,3 6.57,5.61 6.08,9l-1.93,3.48C3.74,13.14 4.22,14 5,14h1v2c0,1.1 0.9,2 2,2h1v3h7v-4.68C18.62,15.07 20.35,12.24 19.94,9.06zM14.89,14.63L14,15.05V19h-3v-3H8v-4H6.7l1.33,-2.33C8.21,7.06 10.35,5 13,5c2.76,0 5,2.24 5,5C18,12.09 16.71,13.88 14.89,14.63z"/>
</vector>
Loading…
Cancel
Save