1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Provide for users with good eyesight to completely take advantage of the

"smaller" (and smaller) fonts by allowing the Accounts and Folder List
items to have a height smaller than the normal Android minimum.  This
option is off by default to maintain existing behavior for
uninterested parties.  The preferences text is not especially
compelling so could certainly be changed if better phrasing is found.
This commit is contained in:
Daniel Applebaum 2011-02-03 03:42:45 +00:00
parent 5fa757bba1
commit 6c03c968ef
8 changed files with 49 additions and 5 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:id="@+id/accounts_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:id="@+id/folder_list_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -903,6 +903,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="gestures_title">Gestures</string> <string name="gestures_title">Gestures</string>
<string name="gestures_summary">Accept gesture control</string> <string name="gestures_summary">Accept gesture control</string>
<string name="high_density_title">High density</string>
<string name="high_density_summary">Adjust layouts to display more on each page</string>
<string name="volume_navigation_title">Volume key navigation</string> <string name="volume_navigation_title">Volume key navigation</string>
<string name="volume_navigation_summary">Flip through items using the volume controls</string> <string name="volume_navigation_summary">Flip through items using the volume controls</string>
<string name="volume_navigation_message">Message view</string> <string name="volume_navigation_message">Message view</string>

View File

@ -67,6 +67,13 @@
android:title="@string/animations_title" android:title="@string/animations_title"
android:summary="@string/animations_summary" /> android:summary="@string/animations_summary" />
<CheckBoxPreference
android:persistent="false"
android:key="high_density"
android:title="@string/high_density_title"
android:summary="@string/high_density_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@ -176,6 +176,9 @@ public class K9 extends Application
private static boolean mQuietTimeEnabled = false; private static boolean mQuietTimeEnabled = false;
private static String mQuietTimeStarts = null; private static String mQuietTimeStarts = null;
private static String mQuietTimeEnds = null; private static String mQuietTimeEnds = null;
private static boolean highDensity = false;
private static boolean useGalleryBugWorkaround = false; private static boolean useGalleryBugWorkaround = false;
private static boolean galleryBuggy; private static boolean galleryBuggy;
@ -452,6 +455,8 @@ public class K9 extends Application
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy); editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
editor.putBoolean("highDensity", highDensity);
fontSizes.save(editor); fontSizes.save(editor);
} }
@ -502,6 +507,8 @@ public class K9 extends Application
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false); mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
highDensity = sprefs.getBoolean("highDensity", false);
fontSizes.load(sprefs); fontSizes.load(sprefs);
try try
@ -1035,6 +1042,16 @@ public class K9 extends Application
mKeyguardPrivacy = state; mKeyguardPrivacy = state;
} }
public static boolean isHighDensity()
{
return highDensity;
}
public static void setHighDensity(boolean highDensity)
{
K9.highDensity = highDensity;
}
/** /**
* Check if this system contains a buggy Gallery 3D package. * Check if this system contains a buggy Gallery 3D package.
* *

View File

@ -974,6 +974,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
holder.chip = view.findViewById(R.id.chip); holder.chip = view.findViewById(R.id.chip);
holder.folders = (ImageButton) view.findViewById(R.id.folders); holder.folders = (ImageButton) view.findViewById(R.id.folders);
holder.accountsItemLayout = (LinearLayout)view.findViewById(R.id.accounts_item_layout);
view.setTag(holder); view.setTag(holder);
} }
@ -1080,8 +1081,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName()); holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription()); holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
if (K9.isHighDensity())
if (account instanceof SearchAccount) {
holder.accountsItemLayout.setMinimumHeight(0);
}
if (account instanceof SearchAccount || K9.isHighDensity())
{ {
holder.folders.setVisibility(View.GONE); holder.folders.setVisibility(View.GONE);
@ -1111,6 +1115,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public RelativeLayout activeIcons; public RelativeLayout activeIcons;
public View chip; public View chip;
public ImageButton folders; public ImageButton folders;
public LinearLayout accountsItemLayout;
} }
} }
private Flag[] combine(Flag[] set1, Flag[] set2) private Flag[] combine(Flag[] set1, Flag[] set2)

View File

@ -1315,17 +1315,15 @@ public class FolderList extends K9ListActivity
{ {
FolderInfoHolder folder = (FolderInfoHolder) getItem(itemPosition); FolderInfoHolder folder = (FolderInfoHolder) getItem(itemPosition);
View view; View view;
if ((convertView != null) && (convertView.getId() == R.layout.folder_list_item)) if (convertView != null)
{ {
view = convertView; view = convertView;
} }
else else
{ {
view = mInflater.inflate(R.layout.folder_list_item, parent, false); view = mInflater.inflate(R.layout.folder_list_item, parent, false);
view.setId(R.layout.folder_list_item);
} }
FolderViewHolder holder = (FolderViewHolder) view.getTag(); FolderViewHolder holder = (FolderViewHolder) view.getTag();
if (holder == null) if (holder == null)
@ -1337,6 +1335,7 @@ public class FolderList extends K9ListActivity
holder.folderStatus = (TextView) view.findViewById(R.id.folder_status); holder.folderStatus = (TextView) view.findViewById(R.id.folder_status);
holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons); holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons);
holder.chip = view.findViewById(R.id.chip); holder.chip = view.findViewById(R.id.chip);
holder.folderListItemLayout = (LinearLayout)view.findViewById(R.id.folder_list_item_layout);
holder.rawFolderName = folder.name; holder.rawFolderName = folder.name;
view.setTag(holder); view.setTag(holder);
@ -1405,6 +1404,10 @@ public class FolderList extends K9ListActivity
{ {
holder.flaggedMessageCount.setVisibility(View.GONE); holder.flaggedMessageCount.setVisibility(View.GONE);
} }
if (K9.isHighDensity() && holder.folderListItemLayout != null)
{
holder.folderListItemLayout.setMinimumHeight(0);
}
holder.activeIcons.setOnClickListener(new OnClickListener() holder.activeIcons.setOnClickListener(new OnClickListener()
{ {
public void onClick(View v) public void onClick(View v)
@ -1450,6 +1453,7 @@ public class FolderList extends K9ListActivity
public RelativeLayout activeIcons; public RelativeLayout activeIcons;
public String rawFolderName; public String rawFolderName;
public View chip; public View chip;
public LinearLayout folderListItemLayout;
} }
private class FolderClickListener implements OnClickListener private class FolderClickListener implements OnClickListener

View File

@ -61,6 +61,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name"; private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name";
private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color"; private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color";
private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font"; private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
private static final String PREFERENCE_HIGH_DENSITY = "high_density";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list"; private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
private static final String PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED = "messageview_zoom_controls"; private static final String PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED = "messageview_zoom_controls";
@ -103,6 +104,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mUseGalleryBugWorkaround; private CheckBoxPreference mUseGalleryBugWorkaround;
private CheckBoxPreference mDebugLogging; private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging; private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference highDensity;
private CheckBoxPreference mQuietTimeEnabled; private CheckBoxPreference mQuietTimeEnabled;
private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts; private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts;
@ -171,6 +173,9 @@ public class Prefs extends K9PreferenceActivity
mGestures = (CheckBoxPreference)findPreference(PREFERENCE_GESTURES); mGestures = (CheckBoxPreference)findPreference(PREFERENCE_GESTURES);
mGestures.setChecked(K9.gesturesEnabled()); mGestures.setChecked(K9.gesturesEnabled());
highDensity = (CheckBoxPreference)findPreference(PREFERENCE_HIGH_DENSITY);
highDensity.setChecked(K9.isHighDensity());
mVolumeNavigation = (CheckBoxListPreference)findPreference(PREFERENCE_VOLUME_NAVIGATION); mVolumeNavigation = (CheckBoxListPreference)findPreference(PREFERENCE_VOLUME_NAVIGATION);
mVolumeNavigation.setItems(new CharSequence[] {getString(R.string.volume_navigation_message), getString(R.string.volume_navigation_list)}); mVolumeNavigation.setItems(new CharSequence[] {getString(R.string.volume_navigation_message), getString(R.string.volume_navigation_list)});
mVolumeNavigation.setCheckedItems(new boolean[] {K9.useVolumeKeysForNavigationEnabled(), K9.useVolumeKeysForListNavigationEnabled()}); mVolumeNavigation.setCheckedItems(new boolean[] {K9.useVolumeKeysForNavigationEnabled(), K9.useVolumeKeysForListNavigationEnabled()});
@ -311,6 +316,7 @@ public class Prefs extends K9PreferenceActivity
K9.setK9Theme(mTheme.getValue().equals("dark") ? android.R.style.Theme : android.R.style.Theme_Light); K9.setK9Theme(mTheme.getValue().equals("dark") ? android.R.style.Theme : android.R.style.Theme_Light);
K9.setAnimations(mAnimations.isChecked()); K9.setAnimations(mAnimations.isChecked());
K9.setGesturesEnabled(mGestures.isChecked()); K9.setGesturesEnabled(mGestures.isChecked());
K9.setHighDensity(highDensity.isChecked());
K9.setUseVolumeKeysForNavigation(mVolumeNavigation.getCheckedItems()[0]); K9.setUseVolumeKeysForNavigation(mVolumeNavigation.getCheckedItems()[0]);
K9.setUseVolumeKeysForListNavigation(mVolumeNavigation.getCheckedItems()[1]); K9.setUseVolumeKeysForListNavigation(mVolumeNavigation.getCheckedItems()[1]);
K9.setManageBack(mManageBack.isChecked()); K9.setManageBack(mManageBack.isChecked());