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

Remove unused stuff

This commit is contained in:
cketti 2013-02-21 02:00:12 +01:00
parent 92c21ece6d
commit d6d9effbec
29 changed files with 3 additions and 575 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/actionbar_title_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-4dip"
android:textSize="14sp"
android:singleLine="true"
android:ellipsize="start" />
<TextView
android:id="@+id/actionbar_title_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:singleLine="true"
android:ellipsize="end" />
</LinearLayout>

View File

@ -11,7 +11,7 @@
android:padding="6dip" android:padding="6dip"
android:fadingEdge="none" android:fadingEdge="none"
android:scrollbarStyle="outsideInset"> android:scrollbarStyle="outsideInset">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="center_horizontal|center_vertical" android:layout_gravity="center_horizontal|center_vertical"
android:layout_height="fill_parent" android:layout_height="fill_parent"

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/actionbar_title_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-4dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:singleLine="true"
android:ellipsize="start" />
<TextView
android:id="@+id/actionbar_title_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:ellipsize="end" />
</LinearLayout>

View File

@ -883,7 +883,6 @@ Por favor, nos envie relatórios de bugs, contribua para novas melhorias e faça
<string name="font_size_message_view_cc">Cc</string> <string name="font_size_message_view_cc">Cc</string>
<string name="font_size_message_view_additional_headers">Cabeçalho adicional</string> <string name="font_size_message_view_additional_headers">Cabeçalho adicional</string>
<string name="font_size_message_view_subject">Assunto</string> <string name="font_size_message_view_subject">Assunto</string>
<string name="font_size_message_view_time">Hora</string>
<string name="font_size_message_view_date">Data</string> <string name="font_size_message_view_date">Data</string>
<string name="font_size_message_view_content">Corpo da mensagem</string> <string name="font_size_message_view_content">Corpo da mensagem</string>

View File

@ -877,7 +877,6 @@ K-9改进的功能包括
<string name="font_size_message_view_cc">抄送</string> <string name="font_size_message_view_cc">抄送</string>
<string name="font_size_message_view_additional_headers">额外的邮件信息</string> <string name="font_size_message_view_additional_headers">额外的邮件信息</string>
<string name="font_size_message_view_subject">主题</string> <string name="font_size_message_view_subject">主题</string>
<string name="font_size_message_view_time">时间</string>
<string name="font_size_message_view_date">日期</string> <string name="font_size_message_view_date">日期</string>
<string name="font_size_message_view_content">邮件内容</string> <string name="font_size_message_view_content">邮件内容</string>

View File

@ -878,7 +878,6 @@ K-9改良的功能包括
<string name="font_size_message_view_cc">副本</string> <string name="font_size_message_view_cc">副本</string>
<string name="font_size_message_view_additional_headers">額外的郵件訊息</string> <string name="font_size_message_view_additional_headers">額外的郵件訊息</string>
<string name="font_size_message_view_subject">主題</string> <string name="font_size_message_view_subject">主題</string>
<string name="font_size_message_view_time">時間</string>
<string name="font_size_message_view_date">日期</string> <string name="font_size_message_view_date">日期</string>
<string name="font_size_message_view_content">郵件本文內容</string> <string name="font_size_message_view_content">郵件本文內容</string>

View File

@ -1,14 +0,0 @@
package com.fsck.k9;
public class EmailReceivedIntent {
public static final String ACTION_EMAIL_RECEIVED = "com.fsck.k9.intent.action.EMAIL_RECEIVED";
public static final String EXTRA_ACCOUNT = "com.fsck.k9.intent.extra.ACCOUNT";
public static final String EXTRA_FOLDER = "com.fsck.k9.intent.extra.FOLDER";
public static final String EXTRA_SENT_DATE = "com.fsck.k9.intent.extra.SENT_DATE";
public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.FROM";
public static final String EXTRA_TO = "com.fsck.k9.intent.extra.TO";
public static final String EXTRA_CC = "com.fsck.k9.intent.extra.CC";
public static final String EXTRA_BCC = "com.fsck.k9.intent.extra.BCC";
public static final String EXTRA_SUBJECT = "com.fsck.k9.intent.extra.SUBJECT";
}

View File

@ -34,7 +34,6 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.widget.SearchView; import com.actionbarsherlock.widget.SearchView;
@ -46,7 +45,6 @@ import com.fsck.k9.FontSizes;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.R; import com.fsck.k9.R;
import com.fsck.k9.activity.misc.ActionBarNavigationSpinner;
import com.fsck.k9.activity.setup.AccountSettings; import com.fsck.k9.activity.setup.AccountSettings;
import com.fsck.k9.activity.setup.FolderSettings; import com.fsck.k9.activity.setup.FolderSettings;
import com.fsck.k9.activity.setup.Prefs; import com.fsck.k9.activity.setup.Prefs;
@ -71,7 +69,7 @@ import de.cketti.library.changelog.ChangeLog;
* Activity shows list of the Account's folders * Activity shows list of the Account's folders
*/ */
public class FolderList extends K9ListActivity implements OnNavigationListener { public class FolderList extends K9ListActivity {
private static final String EXTRA_ACCOUNT = "account"; private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_INITIAL_FOLDER = "initialFolder"; private static final String EXTRA_INITIAL_FOLDER = "initialFolder";
@ -323,19 +321,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayHomeAsUpEnabled(true);
} }
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
if (itemId == ActionBarNavigationSpinner.AB_NAVIGATION_INBOX) {
onOpenFolder(mAccount.getInboxFolderName());
return true;
} else if (itemId == ActionBarNavigationSpinner.AB_NAVIGATION_ACCOUNTS) {
onAccounts();
return true;
}
return false;
}
@Override @Override
public void onNewIntent(Intent intent) { public void onNewIntent(Intent intent) {
setIntent(intent); // onNewIntent doesn't autoset our "internal" intent setIntent(intent); // onNewIntent doesn't autoset our "internal" intent
@ -657,7 +642,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
}); });
folderSearchView.setOnCloseListener(new SearchView.OnCloseListener() { folderSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override @Override
public boolean onClose() { public boolean onClose() {
mActionBarTitle.setText(getString(R.string.folders_title)); mActionBarTitle.setText(getString(R.string.folders_title));

View File

@ -1,36 +0,0 @@
package com.fsck.k9.activity;
import android.content.Context;
/**
* A listener that the user can register for global, persistent progress events.
*/
public interface ProgressListener {
/**
* @param context
* @param title
* @param message
* @param currentProgress
* @param maxProgress
* @param indeterminate
*/
void showProgress(Context context, String title, String message, long currentProgress,
long maxProgress, boolean indeterminate);
/**
* @param context
* @param title
* @param message
* @param currentProgress
* @param maxProgress
* @param indeterminate
*/
void updateProgress(Context context, String title, String message, long currentProgress,
long maxProgress, boolean indeterminate);
/**
* @param context
*/
void hideProgress(Context context);
}

View File

@ -1,90 +0,0 @@
package com.fsck.k9.activity.misc;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.fsck.k9.R;
public class ActionBarNavigationSpinner extends ArrayAdapter<String> implements SpinnerAdapter {
public static final long AB_NAVIGATION_INBOX = 0L;
public static final long AB_NAVIGATION_FOLDERS = 1L;
public static final long AB_NAVIGATION_ACCOUNTS = 2L;
private String mTitle = "";
private String mSubTitle = "";
private long[] mIds;
private Context mContext;
public ActionBarNavigationSpinner(Context context, String[] objects, long[] ids) {
super(context, R.layout.actionbar_spinner, objects);
setDropDownViewResource(android.R.layout.simple_list_item_1);
mIds = ids;
this.mContext = context;
}
public boolean setTitle(String title) {
if (!title.equals(mTitle)) {
mTitle = title;
notifyDataSetChanged();
return true;
}
return false;
}
public boolean setSubTitle(String subtitle) {
if (!subtitle.equals(mSubTitle)) {
mSubTitle = subtitle;
notifyDataSetChanged();
return true;
}
return false;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
return super.getDropDownView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
row = inflater.inflate(R.layout.actionbar_spinner, parent, false);
}
TextView title = (TextView) row.findViewById(R.id.actionbar_title_first);
TextView subtitle = (TextView) row.findViewById(R.id.actionbar_title_sub);
title.setText(mTitle);
subtitle.setText(mSubTitle);
return row;
}
@Override
public long getItemId(int position) {
return mIds[position];
}
public static ActionBarNavigationSpinner getDefaultSpinner(Context context) {
return new ActionBarNavigationSpinner(context,
new String[] {
context.getString(R.string.special_mailbox_name_inbox),
context.getString(R.string.folders_title),
context.getString(R.string.accounts_title) },
new long[] {
ActionBarNavigationSpinner.AB_NAVIGATION_INBOX,
ActionBarNavigationSpinner.AB_NAVIGATION_FOLDERS,
ActionBarNavigationSpinner.AB_NAVIGATION_ACCOUNTS });
}
}

View File

@ -1,71 +0,0 @@
package com.fsck.k9.activity.setup;
/*
* SpinnerHelper donated to K-9 Mail by Boutique Software
*/
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class SpinnerHelper {
public static void initSpinner(Context context, Spinner spinner, int entryRes, int valueRes, String curVal) {
String[] entryArray = context.getResources().getStringArray(entryRes);
String[] valueArray = context.getResources().getStringArray(valueRes);
initSpinner(context, spinner, entryArray, valueArray, curVal);
}
public static void initSpinner(Context context, Spinner spinner, String[] entryArray, String[] valueArray, String curVal) {
if (entryArray.length != valueArray.length) {
throw new RuntimeException("Entry and value arrays are of unequal lenght");
}
EntryValue[] entryValues = new EntryValue[entryArray.length];
int curSelection = 0;
for (int i = 0; i < entryArray.length; i++) {
entryValues[i] = new EntryValue(entryArray[i], valueArray[i]);
if (valueArray[i].equals(curVal)) {
curSelection = i;
}
}
ArrayAdapter<EntryValue> entryValuesAdapter = new ArrayAdapter<EntryValue>(context, android.R.layout.simple_spinner_item, entryValues);
entryValuesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(entryValuesAdapter);
spinner.setSelection(curSelection);
}
public static String getSpinnerValue(Spinner spinner) {
EntryValue entryValue = (EntryValue)spinner.getSelectedItem();
if (entryValue != null) {
return entryValue.getValue();
} else {
return null;
}
}
public static String getSpinnerEntry(Spinner spinner) {
EntryValue entryValue = (EntryValue)spinner.getSelectedItem();
if (entryValue != null) {
return entryValue.getEntry();
} else {
return null;
}
}
private static class EntryValue {
final String entry;
final String value;
EntryValue(String entry, String value) {
this.entry = entry;
this.value = value;
}
@Override
public String toString() {
return entry;
}
public String getEntry() {
return entry;
}
public String getValue() {
return value;
}
}
}

View File

@ -1,20 +0,0 @@
package com.fsck.k9.controller;
import java.util.Comparator;
import com.fsck.k9.mail.Message;
public class MessageDateComparator implements Comparator<Message> {
public int compare(Message o1, Message o2) {
try {
if (o1.getSentDate() == null) {
return 1;
} else if (o2.getSentDate() == null) {
return -1;
} else
return o2.getSentDate().compareTo(o1.getSentDate());
} catch (Exception e) {
return 0;
}
}
}

View File

@ -1,24 +0,0 @@
package com.fsck.k9.helper;
import android.content.Context;
import android.view.View;
import com.actionbarsherlock.internal.view.menu.MenuBuilder;
import com.actionbarsherlock.internal.view.menu.MenuPopupHelper;
import com.actionbarsherlock.view.MenuItem;
public class MenuPopup extends MenuPopupHelper {
private MenuBuilder mMenu;
public MenuPopup(Context context, MenuBuilder menu, View anchorView) {
super(context, menu, anchorView);
mMenu = menu;
}
public void setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener listener) {
for (int i = 0, end = mMenu.size(); i < end; i++) {
mMenu.getItem(i).setOnMenuItemClickListener(listener);
}
}
}

View File

@ -21,7 +21,6 @@
package com.fsck.k9.helper; package com.fsck.k9.helper;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -29,47 +28,6 @@ import java.util.regex.Pattern;
*/ */
public class Regex { public class Regex {
/**
* Regular expression to match all IANA top-level domains.
* List accurate as of 2011/01/12. List taken from:
* http://data.iana.org/TLD/tlds-alpha-by-domain.txt
* This pattern is auto-generated by frameworks/base/common/tools/make-iana-tld-pattern.py
*/
public static final String TOP_LEVEL_DOMAIN_STR =
"((aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
+ "|(biz|b[abdefghijmnorstvwyz])"
+ "|(cat|com|coop|c[acdfghiklmnoruvxyz])"
+ "|d[ejkmoz]"
+ "|(edu|e[cegrstu])"
+ "|f[ijkmor]"
+ "|(gov|g[abdefghilmnpqrstuwy])"
+ "|h[kmnrtu]"
+ "|(info|int|i[delmnoqrst])"
+ "|(jobs|j[emop])"
+ "|k[eghimnprwyz]"
+ "|l[abcikrstuvy]"
+ "|(mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])"
+ "|(name|net|n[acefgilopruz])"
+ "|(org|om)"
+ "|(pro|p[aefghklmnrstwy])"
+ "|qa"
+ "|r[eosuw]"
+ "|s[abcdeghijklmnortuvyz]"
+ "|(tel|travel|t[cdfghjklmnoprtvwz])"
+ "|u[agksyz]"
+ "|v[aceginu]"
+ "|w[fs]"
+ "|(xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-80akhbyknj4f|xn\\-\\-9t4b11yi5a|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah)"
+ "|y[et]"
+ "|z[amw])";
/**
* Regular expression pattern to match all IANA top-level domains.
*/
public static final Pattern TOP_LEVEL_DOMAIN_PATTERN =
Pattern.compile(TOP_LEVEL_DOMAIN_STR);
/** /**
* Goegular expression to match all IANA top-level domains for WEB_URL. * Goegular expression to match all IANA top-level domains for WEB_URL.
* List accurate as of 2011/01/12. List taken from: * List accurate as of 2011/01/12. List taken from:
@ -135,19 +93,6 @@ public class Regex {
// input. This is to stop foo.sure from // input. This is to stop foo.sure from
// matching as foo.su // matching as foo.su
public static final Pattern IP_ADDRESS_PATTERN
= Pattern.compile(
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
+ "|[1-9][0-9]|[0-9]))");
public static final Pattern DOMAIN_NAME_PATTERN
= Pattern.compile(
"(((([" + GOOD_IRI_CHAR + "][" + GOOD_IRI_CHAR + "\\-]*)*[" + GOOD_IRI_CHAR + "]\\.)+"
+ TOP_LEVEL_DOMAIN_PATTERN + ")|"
+ IP_ADDRESS_PATTERN + ")");
public static final Pattern EMAIL_ADDRESS_PATTERN public static final Pattern EMAIL_ADDRESS_PATTERN
= Pattern.compile( = Pattern.compile(
"[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
@ -158,76 +103,4 @@ public class Regex {
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
")+" ")+"
); );
/**
* This pattern is intended for searching for things that look like they
* might be phone numbers in arbitrary text, not for validating whether
* something is in fact a phone number. It will miss many things that
* are legitimate phone numbers.
*
* <p> The pattern matches the following:
* <ul>
* <li>Optionally, a + sign followed immediately by one or more digits. Spaces, dots, or dashes
* may follow.
* <li>Optionally, sets of digits in parentheses, separated by spaces, dots, or dashes.
* <li>A string starting and ending with a digit, containing digits, spaces, dots, and/or dashes.
* </ul>
*/
public static final Pattern PHONE_PATTERN
= Pattern.compile( // sdd = space, dot, or dash
"(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
+ "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
+ "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>
/**
* Convenience method to take all of the non-null matching groups in a
* regex Matcher and return them as a concatenated string.
*
* @param matcher The Matcher object from which grouped text will
* be extracted
*
* @return A String comprising all of the non-null matched
* groups concatenated together
*/
public static final String concatGroups(Matcher matcher) {
StringBuilder b = new StringBuilder();
final int numGroups = matcher.groupCount();
for (int i = 1; i <= numGroups; i++) {
String s = matcher.group(i);
System.err.println("Group(" + i + ") : " + s);
if (s != null) {
b.append(s);
}
}
return b.toString();
}
/**
* Convenience method to return only the digits and plus signs
* in the matching string.
*
* @param matcher The Matcher object from which digits and plus will
* be extracted
*
* @return A String comprising all of the digits and plus in
* the match
*/
public static final String digitsAndPlusOnly(Matcher matcher) {
StringBuilder buffer = new StringBuilder();
String matchingRegion = matcher.group();
for (int i = 0, size = matchingRegion.length(); i < size; i++) {
char character = matchingRegion.charAt(i);
if (character == '+' || Character.isDigit(character)) {
buffer.append(character);
}
}
return buffer.toString();
}
} }

View File

@ -227,24 +227,6 @@ public class Utility {
} }
} }
private static final long MILISECONDS_IN_18_HOURS = 18 * 60 * 60 * 1000;
/**
* Check a date to see if it was from "today."
* @param date Date of item to check.
* @return true if the specified date is within 18 hours of now.
*/
public static boolean isDateToday(final Date date) {
if (date == null) {
return false;
}
final Date now = new Date();
if (now.getTime() - MILISECONDS_IN_18_HOURS > date.getTime() || now.getTime() + MILISECONDS_IN_18_HOURS < date.getTime()) {
return false;
} else {
return true;
}
}
/* /*
* TODO disabled this method globally. It is used in all the settings screens but I just * TODO disabled this method globally. It is used in all the settings screens but I just
* noticed that an unrelated icon was dimmed. Android must share drawables internally. * noticed that an unrelated icon was dimmed. Android must share drawables internally.

View File

@ -1,70 +0,0 @@
/* Sourced from http://code.google.com/p/android-color-picker/source/browse/trunk/AmbilWarna/src/yuku/ambilwarna/AmbilWarnaBox.java?r=1
* On 2010-11-07
* Translated to English, Ported to use the same (inferior) API as the more standard "ColorPickerDialog" and imported into the K-9 namespace by Jesse Vincent
* In an ideal world, we should move to using AmbilWarna as an Android Library Project in the future
* License: Apache 2.0
* Author: yukuku@code.google.com
*/
package com.fsck.k9.view;
import com.fsck.k9.R;
import android.content.*;
import android.graphics.*;
import android.graphics.Shader.*;
import android.util.*;
import android.view.*;
public class ColorPickerBox extends View {
Paint paint;
Shader dalam;
Shader luar;
float hue;
float onedp;
float sizeUiDp = 240.f;
float sizeUiPx; // diset di constructor
float[] tmp00 = new float[3];
public ColorPickerBox(Context context) {
this(context, null);
}
public ColorPickerBox(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ColorPickerBox(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
onedp = context.getResources().getDimension(R.dimen.colorpicker_onedp);
sizeUiPx = sizeUiDp * onedp;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (paint == null) {
paint = new Paint();
luar = new LinearGradient(0.f, 0.f, 0.f, sizeUiPx, 0xffffffff, 0xff000000, TileMode.CLAMP);
}
tmp00[1] = tmp00[2] = 1.f;
tmp00[0] = hue;
int rgb = Color.HSVToColor(tmp00);
dalam = new LinearGradient(0.f, 0.f, sizeUiPx, 0.f, 0xffffffff, rgb, TileMode.CLAMP);
ComposeShader shader = new ComposeShader(luar, dalam, PorterDuff.Mode.MULTIPLY);
paint.setShader(shader);
canvas.drawRect(0.f, 0.f, sizeUiPx, sizeUiPx, paint);
}
public void setHue(float hue) {
this.hue = hue;
invalidate();
}
}

View File

@ -1,36 +0,0 @@
package com.fsck.k9.view;
import com.actionbarsherlock.internal.view.View_HasStateListenerSupport;
import com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;
public class ImageButtonAnchor extends ImageButton implements View_HasStateListenerSupport {
public ImageButtonAnchor(Context context) {
super(context);
}
public ImageButtonAnchor(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ImageButtonAnchor(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void addOnAttachStateChangeListener(View_OnAttachStateChangeListener listener) {
// TODO Auto-generated method stub
}
@Override
public void removeOnAttachStateChangeListener(View_OnAttachStateChangeListener listener) {
// TODO Auto-generated method stub
}
}