1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -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"?>
<LinearLayout
android:id="@+id/accounts_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View File

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

View File

@ -902,6 +902,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="animations_summary">Use gaudy visual effects</string>
<string name="gestures_title">Gestures</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_summary">Flip through items using the volume controls</string>

View File

@ -66,6 +66,13 @@
android:key="animations"
android:title="@string/animations_title"
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>

View File

@ -176,6 +176,9 @@ public class K9 extends Application
private static boolean mQuietTimeEnabled = false;
private static String mQuietTimeStarts = null;
private static String mQuietTimeEnds = null;
private static boolean highDensity = false;
private static boolean useGalleryBugWorkaround = false;
private static boolean galleryBuggy;
@ -451,6 +454,8 @@ public class K9 extends Application
editor.putBoolean("confirmDelete", mConfirmDelete);
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
editor.putBoolean("highDensity", highDensity);
fontSizes.save(editor);
}
@ -501,6 +506,8 @@ public class K9 extends Application
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
highDensity = sprefs.getBoolean("highDensity", false);
fontSizes.load(sprefs);
@ -1034,6 +1041,16 @@ public class K9 extends Application
{
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.

View File

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

View File

@ -1315,17 +1315,15 @@ public class FolderList extends K9ListActivity
{
FolderInfoHolder folder = (FolderInfoHolder) getItem(itemPosition);
View view;
if ((convertView != null) && (convertView.getId() == R.layout.folder_list_item))
if (convertView != null)
{
view = convertView;
}
else
{
view = mInflater.inflate(R.layout.folder_list_item, parent, false);
view.setId(R.layout.folder_list_item);
}
FolderViewHolder holder = (FolderViewHolder) view.getTag();
if (holder == null)
@ -1337,6 +1335,7 @@ public class FolderList extends K9ListActivity
holder.folderStatus = (TextView) view.findViewById(R.id.folder_status);
holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons);
holder.chip = view.findViewById(R.id.chip);
holder.folderListItemLayout = (LinearLayout)view.findViewById(R.id.folder_list_item_layout);
holder.rawFolderName = folder.name;
view.setTag(holder);
@ -1405,6 +1404,10 @@ public class FolderList extends K9ListActivity
{
holder.flaggedMessageCount.setVisibility(View.GONE);
}
if (K9.isHighDensity() && holder.folderListItemLayout != null)
{
holder.folderListItemLayout.setMinimumHeight(0);
}
holder.activeIcons.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
@ -1450,6 +1453,7 @@ public class FolderList extends K9ListActivity
public RelativeLayout activeIcons;
public String rawFolderName;
public View chip;
public LinearLayout folderListItemLayout;
}
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_CONTACT_NAME_COLOR = "messagelist_contact_name_color";
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_ZOOM_CONTROLS_ENABLED = "messageview_zoom_controls";
@ -103,6 +104,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mUseGalleryBugWorkaround;
private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference highDensity;
private CheckBoxPreference mQuietTimeEnabled;
private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts;
@ -170,6 +172,9 @@ public class Prefs extends K9PreferenceActivity
mGestures = (CheckBoxPreference)findPreference(PREFERENCE_GESTURES);
mGestures.setChecked(K9.gesturesEnabled());
highDensity = (CheckBoxPreference)findPreference(PREFERENCE_HIGH_DENSITY);
highDensity.setChecked(K9.isHighDensity());
mVolumeNavigation = (CheckBoxListPreference)findPreference(PREFERENCE_VOLUME_NAVIGATION);
mVolumeNavigation.setItems(new CharSequence[] {getString(R.string.volume_navigation_message), getString(R.string.volume_navigation_list)});
@ -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.setAnimations(mAnimations.isChecked());
K9.setGesturesEnabled(mGestures.isChecked());
K9.setHighDensity(highDensity.isChecked());
K9.setUseVolumeKeysForNavigation(mVolumeNavigation.getCheckedItems()[0]);
K9.setUseVolumeKeysForListNavigation(mVolumeNavigation.getCheckedItems()[1]);
K9.setManageBack(mManageBack.isChecked());