<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/Util"/>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/actionbarsherlock"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
split.density=false
# Project target.
target=android-17
-android.library.reference.1=../Util
+android.library.reference.1=../JakeWharton-ActionBarSherlock-071a61c/actionbarsherlock
+android.library.reference.1=../JakeWharton-ActionBarSherlock-071a61c/actionbarsherlock
+android.library.reference.2=../Util
+<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/ScrollView01"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- tools:ignore="HardcodedText" >
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
<LinearLayout
- android:id="@+id/LinearLayout01"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
- <LinearLayout
- android:id="@+id/LinearLayout02"
+ <TextView
+ android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:paddingBottom="10dip" >
-
- <ImageView
- android:id="@+id/ImageView01"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:background="@drawable/icon"
- android:contentDescription="icon" />
-
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|fill_vertical"
- android:text="@string/titleWithVersion"
- android:textAppearance="?android:attr/textAppearanceLarge" />
- </LinearLayout>
+ android:drawableLeft="@drawable/icon"
+ android:text="@string/titleWithVersion"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
- android:id="@+id/copyright"
+ android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:text="Copyright 2009-2011 Google Inc." />
+ android:text="Copyright 2009-2013 Google Inc."
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ tools:ignore="HardcodedText" />
<TextView
- android:id="@+id/author"
+ android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:paddingBottom="10dip"
- android:text="Thad Hughes" />
+ android:text="Thad Hughes"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ tools:ignore="HardcodedText" />
<TextView
- android:id="@+id/emailMe"
+ android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/contactMe" />
-
+ android:text="@string/contactMe"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:autoLink="email"
android:clickable="true"
+ android:text="@string/myEmail"
android:paddingBottom="10dip"
- android:text="@string/myEmail" />
+ />
<TextView
android:id="@+id/webPage"
android:layout_gravity="left"
android:autoLink="web"
android:clickable="true"
+ android:text="@string/webPageUrl"
android:paddingBottom="10dip"
- android:text="@string/webPageUrl" />
+ />
<TextView
android:id="@+id/license"
style="@style/BorderlessButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:padding="@dimen/default_padding"
android:src="@drawable/ic_input_delete" />
- <ImageButton
- android:id="@+id/DownButton"
- style="@style/BorderlessButton"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:src="@drawable/arrow_down_float" />
-
- <ImageButton
- android:id="@+id/UpButton"
- style="@style/BorderlessButton"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:src="@drawable/arrow_up_float" />
</LinearLayout>
<ListView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
android:layout_weight="1"
android:hint="@string/managerFilterText" />
- <CheckBox
- android:id="@+id/showLocal"
+ <ImageButton
+ android:id="@+id/ClearSearchTextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
- android:text="@string/managerFilterCheckbox" />
+ android:src="@android:drawable/ic_input_delete"
+ android:contentDescription="@string/clearSearchText"/>
+
+ <ToggleButton
+ android:id="@+id/showLocal"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_weight="0"
+ android:textOff="@string/managerFilterCheckboxAll"
+ android:textOn="@string/managerFilterCheckboxLocal" />
+
</LinearLayout>
<ListView
android:choiceMode="singleChoice"
android:clickable="true"
android:fastScrollEnabled="true"
- android:focusable="true" />
+ android:focusable="true"
+ tools:listitem="@layout/dictionary_manager_row" />
<TextView
android:id="@+id/DictionaryListHeader"
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+ <TextView
+ android:id="@+id/dictionaryName"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="English-German"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ tools:ignore="HardcodedText" />
+
+ <Button
+ android:id="@+id/dictionaryDownloadButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:drawableLeft="@android:drawable/ic_menu_add"
+ android:text="@string/downloadButton" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/dictionaryDetails"
+ android:layout_width="fill_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:text="@string/indexInfo"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ tools:ignore="HardcodedText" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="horizontal" >
+
+ <EditText
+ android:id="@+id/SearchText"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1.0"
+ android:hint="@string/searchText"
+ android:imeOptions="actionSearch|flagNoEnterAction|flagNoExtractUi"
+ android:inputType="text" />
+
+</LinearLayout>
\ No newline at end of file
+++ /dev/null
-<LinearLayout android:id="@+id/LinearLayout01"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
-
- <TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Downloading..."/>
-
- <LinearLayout android:id="@+id/sourceLayout"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
- <TextView android:id="@+id/sourceTitle" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Source: "/>
- <TextView android:id="@+id/source" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="source"/>
- </LinearLayout>
-
- <LinearLayout android:id="@+id/destLayout"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
- <TextView android:id="@+id/destTitle" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="Destination: "/>
- <TextView android:id="@+id/dest" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:text="dest"/>
- </LinearLayout>
-
- <ProgressBar android:id="@+id/downloadProgressBar" style="?android:attr/progressBarStyleHorizontal"
- android:max="100" android:progress="50"
- android:layout_width="fill_parent" android:layout_height="wrap_content" android:indeterminate="false"/>
-
- <TextView android:id="@+id/downloadMessage" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:visibility="visible" android:text="Download message."
- android:layout_marginTop="10dip"
- android:layout_marginBottom="10dip"/>
-
- <TextView android:id="@+id/downloadStatus" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:visibility="visible" android:text="Download status."/>
-
-</LinearLayout>
<resources>
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
<style name="BorderlessButton">
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:paddingLeft">4dip</item>
<item name="android:paddingRight">4dip</item>
</style>
-</resources>
\ No newline at end of file
+</resources>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <!-- Default: dark theme -->
-
- <style name="Theme.Default" parent="@android:style/Theme.Holo">
- </style>
-
-
- <!-- ****************************************************************** -->
-
- <style name="Theme.Light" parent="@android:style/Theme.Holo.Light">
- </style>
-
-
-</resources>
\ No newline at end of file
<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
+
</resources>
<string name="help">Help</string>
<string name="reportIssue">Report issue…</string>
<string name="fontWorkaround">Detected font problem (common on Sony Ericsson devices), switching back to default font.</string>
+ <string name="clearSearchText">Clear search text</string>
<!-- DictionaryManagerActivity -->
<string name="dictionaryManager">Dictionary manager</string>
<string name="helpText">Long-press a dictionary for more options.</string>
- <string name="downloadButton">Download (%.1fMB)</string>
- <string name="updateButton">Update (%.1fMB)</string>
+ <string name="downloadButton">%.1fMB</string>
<string name="moveToTop">Move to top</string>
<string name="deleteDictionary">Delete dictionary</string>
<string name="indexInfo">%1$s: %2$,d words</string>
<string name="managerFilterText">List filter</string>
- <string name="managerFilterCheckbox">Local only</string>
-
+ <string name="managerFilterCheckboxAll">All</string>
+ <string name="managerFilterCheckboxLocal">Local</string>
<string name="thanksForUpdatingVersion">4.0.1_en_a</string>
<string name="fontFailure">Font failure: %s</string>
<string name="seeAlso">See also: %1$s (%2$s)</string>
<string name="speak">Speak</string>
+ <string name="nextWord">Next word</string>
+ <string name="previousWord">Previous word</string>
<!-- About dictionary. -->
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
- <style name="AppBaseTheme" parent="android:Theme.Light">
+ <style name="AppBaseThemeLight" parent="Theme.Sherlock.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
+ <!--
+ Make search icon magnifying glass disappear:
+ http://stackoverflow.com/questions/13604506/show-actionbarsherlock-searchview-always-expanded
+ -->
+ <item name="searchViewSearchIcon">@android:color/transparent</item>
+ <item name="searchViewCloseIcon">@android:color/transparent</item>
+ </style>
+
+ <style name="AppBaseThemeDark" parent="Theme.Sherlock">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ <!--
+ Make search icon magnifying glass disappear:
+ http://stackoverflow.com/questions/13604506/show-actionbarsherlock-searchview-always-expanded
+ -->
+ <item name="searchViewSearchIcon">@android:color/transparent</item>
+ <item name="searchViewCloseIcon">@android:color/transparent</item>
</style>
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ <!-- Dark theme -->
+
+ <style name="Theme.Default" parent="AppBaseThemeDark"></style>
+
+ <style name="Theme.Default.TokenRow.Fg" parent="Theme.Default">
+ <!-- <item name="android:textColor">#FFFFFF</item> -->
+ <item name="android:textColorLink">#00AAFF</item>
</style>
+ <color name="theme_default_token_row_fg">#FFFFFF</color>
+ <color name="theme_default_token_row_main_bg">#222222</color>
+ <color name="theme_default_token_row_other_bg">#222222</color>
+ <color name="theme_default_other_lang_bg">#000000</color>
+
+ <!-- ****************************************************************** -->
+
+ <!-- Light theme -->
+
+ <style name="Theme.Light" parent="AppBaseThemeLight"></style>
+
+ <style name="Theme.Light.TokenRow.Fg" parent="Theme.Light">
+ <!-- <item name="android:textColor">#000000</item> -->
+ <item name="android:textColorLink">#0000FF</item>
+ </style>
+
+ <color name="theme_light_token_row_fg">#000000</color>
+ <color name="theme_light_token_row_main_bg">#EEEEEE</color>
+ <color name="theme_light_token_row_other_bg">#EEEEEE</color>
+ <color name="theme_light_other_lang_bg">#FFFFFF</color>
+
<style name="BorderlessButton">
<item name="android:background">@null</item>
<item name="android:paddingLeft">4dip</item>
<item name="android:paddingRight">4dip</item>
</style>
-</resources>
+</resources>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <!-- Default: dark theme -->
-
- <style name="Theme.Default" parent="@android:style/Theme">
- </style>
-
- <style name="Theme.Default.TokenRow.Fg" parent="@style/Theme.Default">
-<!-- <item name="android:textColor">#FFFFFF</item> -->
- <item name="android:textColorLink">#00AAFF</item>
- </style>
-
- <color name="theme_default_token_row_fg">#FFFFFF</color>
- <color name="theme_default_token_row_main_bg">#222222</color>
- <color name="theme_default_token_row_other_bg">#222222</color>
- <color name="theme_default_other_lang_bg">#000000</color>
-
-
- <!-- ****************************************************************** -->
-
- <style name="Theme.Light" parent="@android:style/Theme.Light">
- </style>
-
- <style name="Theme.Light.TokenRow.Fg" parent="@style/Theme.Light">
- <!-- <item name="android:textColor">#000000</item> -->
- <item name="android:textColorLink">#0000FF</item>
- </style>
-
- <color name="theme_light_token_row_fg">#000000</color>
- <color name="theme_light_token_row_main_bg">#EEEEEE</color>
- <color name="theme_light_token_row_other_bg">#EEEEEE</color>
- <color name="theme_light_other_lang_bg">#FFFFFF</color>
-
-</resources>
\ No newline at end of file
package com.hughes.android.dictionary;
+import android.annotation.SuppressLint;
import android.app.Dialog;
-import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.BaseAdapter;
import android.widget.TextView.BufferType;
import android.widget.Toast;
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockListActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener;
+import com.actionbarsherlock.widget.SearchView;
import com.hughes.android.dictionary.DictionaryInfo.IndexInfo;
import com.hughes.android.dictionary.engine.Dictionary;
import com.hughes.android.dictionary.engine.EntrySource;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class DictionaryActivity extends ListActivity {
+public class DictionaryActivity extends SherlockListActivity {
static final String LOG = "QuickDic";
EditText searchText;
Button langButton;
+
+ MenuItem nextWordMenuItem, previousWordMenuItem;
// Never null.
private File wordList = null;
});
updateLangButton();
- final View upButton = findViewById(R.id.UpButton);
- upButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- onUpDownButton(true);
- }
- });
- final View downButton = findViewById(R.id.DownButton);
- downButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- onUpDownButton(false);
- }
- });
- upButton.setVisibility(PreferenceManager.getDefaultSharedPreferences(this)
- .getBoolean(getString(R.string.showPrevNextButtonsKey), true) ? View.VISIBLE
- : View.GONE);
- downButton.setVisibility(PreferenceManager.getDefaultSharedPreferences(this)
- .getBoolean(getString(R.string.showPrevNextButtonsKey), true) ? View.VISIBLE
- : View.GONE);
-
// getListView().setOnItemSelectedListener(new ListView.OnItemSelectedListener() {
// @Override
// public void onItemSelected(AdapterView<?> adapterView, View arg1, final int position,
Log.d(LOG, "wordList=" + wordList + ", saveOnlyFirstSubentry=" + saveOnlyFirstSubentry);
setDictionaryPrefs(this, dictFile, indexIndex, searchText.getText().toString());
+
+ ActionBar actionBar = getSupportActionBar();
+ actionBar.setDisplayShowTitleEnabled(false);
+
+ //Inflate the custom view
+// View customNav = LayoutInflater.from(this).inflate(R.layout.dictionary_search_view, null);
+ SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
+ searchView.setIconifiedByDefault(false);
+ searchView.setQueryHint(getString(R.string.searchText));
+ searchView.setSubmitButtonEnabled(false);
+// searchView.setMaxWidth(200);
+ searchView.setImeOptions(
+ EditorInfo.IME_ACTION_SEARCH |
+ EditorInfo.IME_FLAG_NO_EXTRACT_UI |
+ EditorInfo.IME_FLAG_NO_ENTER_ACTION |
+// EditorInfo.IME_FLAG_NO_FULLSCREEN |
+ EditorInfo.IME_MASK_ACTION |
+ EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
+// searchView.setOnQueryTextListener(this);
+// menu.add("Search")
+//// .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search)
+// .setActionView(searchView)
+// .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ actionBar.setCustomView(searchView);
+ actionBar.setDisplayShowCustomEnabled(true);
}
@Override
// --------------------------------------------------------------------------
final Random random = new Random();
-
+
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
+ //Create the search view
+// SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
+// searchView.setIconifiedByDefault(false);
+// searchView.setQueryHint(getString(R.string.searchText));
+// searchView.setSubmitButtonEnabled(false);
+// searchView.setMaxWidth(200);
+// searchView.setImeOptions(
+// EditorInfo.IME_ACTION_SEARCH |
+// EditorInfo.IME_FLAG_NO_EXTRACT_UI |
+// EditorInfo.IME_FLAG_NO_ENTER_ACTION |
+//// EditorInfo.IME_FLAG_NO_FULLSCREEN |
+// EditorInfo.IME_MASK_ACTION |
+// EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
+//// searchView.setOnQueryTextListener(this);
+// menu.add("Search")
+//// .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search)
+// .setActionView(searchView)
+// .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+
+
+ if (PreferenceManager.getDefaultSharedPreferences(this)
+ .getBoolean(getString(R.string.showPrevNextButtonsKey), true)) {
+ // Next word.
+ nextWordMenuItem = menu.add(getString(R.string.nextWord))
+ .setIcon(R.drawable.arrow_down_float);
+ nextWordMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ nextWordMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ onUpDownButton(true);
+ return true;
+ }
+ });
+
+ // Previous word.
+ previousWordMenuItem = menu.add(getString(R.string.previousWord))
+ .setIcon(R.drawable.arrow_up_float);
+ previousWordMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ previousWordMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ onUpDownButton(false);
+ return true;
+ }
+ });
+ }
+
application.onCreateGlobalOptionsMenu(this, menu);
// {
{
final MenuItem dictionaryList = menu.add(getString(R.string.dictionaryManager));
+ dictionaryList.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
dictionaryList.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
startActivity(DictionaryManagerActivity.getLaunchIntent());
{
final MenuItem aboutDictionary = menu.add(getString(R.string.aboutDictionary));
+ aboutDictionary.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
aboutDictionary.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
final Context context = getListView().getContext();
AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) menuInfo;
final RowBase row = (RowBase) getListAdapter().getItem(adapterContextMenuInfo.position);
- final MenuItem addToWordlist = menu.add(getString(R.string.addToWordList,
+ final android.view.MenuItem addToWordlist = menu.add(getString(R.string.addToWordList,
wordList.getName()));
- addToWordlist.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
+ addToWordlist.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
onAppendToWordList(row);
return false;
}
});
- final MenuItem share = menu.add("Share");
- share.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
+ final android.view.MenuItem share = menu.add("Share");
+ share.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, row.getTokenRow(true).getToken());
}
});
- final MenuItem copy = menu.add(android.R.string.copy);
- copy.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
+ final android.view.MenuItem copy = menu.add(android.R.string.copy);
+ copy.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
onCopy(row);
return false;
}
if (selectedSpannableText != null) {
final String selectedText = selectedSpannableText;
- final MenuItem searchForSelection = menu.add(getString(R.string.searchForSelection,
+ final android.view.MenuItem searchForSelection = menu.add(getString(R.string.searchForSelection,
selectedSpannableText));
- searchForSelection.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
+ searchForSelection.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
jumpToTextFromHyperLink(selectedText, selectedSpannableIndex);
return false;
}
}
if (row instanceof TokenRow && ttsReady) {
- final MenuItem speak = menu.add(R.string.speak);
- speak.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ final android.view.MenuItem speak = menu.add(R.string.speak);
+ speak.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
@Override
- public boolean onMenuItemClick(MenuItem item) {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
textToSpeech.speak(((TokenRow) row).getToken(), TextToSpeech.QUEUE_FLUSH,
new HashMap<String, String>());
return false;
}
}
+ @SuppressLint("SimpleDateFormat")
void onAppendToWordList(final RowBase row) {
defocusSearchText();
}
void setFiltered(final SearchOperation searchOperation) {
- ((ImageButton) findViewById(R.id.UpButton)).setEnabled(false);
- ((ImageButton) findViewById(R.id.DownButton)).setEnabled(false);
+ if (nextWordMenuItem != null) {
+ nextWordMenuItem.setEnabled(false);
+ previousWordMenuItem.setEnabled(false);
+ }
rowsToShow = searchOperation.multiWordSearchResult;
setListAdapter(new IndexAdapter(index, rowsToShow, searchOperation.searchTokens));
}
void clearFiltered() {
- ((ImageButton) findViewById(R.id.UpButton)).setEnabled(true);
- ((ImageButton) findViewById(R.id.DownButton)).setEnabled(true);
+ if (nextWordMenuItem != null) {
+ nextWordMenuItem.setEnabled(true);
+ previousWordMenuItem.setEnabled(true);
+ }
setListAdapter(new IndexAdapter(index));
rowsToShow = null;
}
import android.net.Uri;
import android.preference.PreferenceManager;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener;
import com.hughes.android.dictionary.engine.Dictionary;
import com.hughes.android.dictionary.engine.Language;
import com.hughes.android.dictionary.engine.TransliteratorManager;
public void onCreateGlobalOptionsMenu(
final Context context, final Menu menu) {
final MenuItem about = menu.add(getString(R.string.about));
+ about.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
about.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
final Intent intent = new Intent().setClassName(AboutActivity.class
});
final MenuItem help = menu.add(getString(R.string.help));
+ help.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
help.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
context.startActivity(HtmlDisplayActivity.getHelpLaunchIntent());
});
final MenuItem preferences = menu.add(getString(R.string.settings));
+ preferences.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
preferences.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
SettingsActivity.settingsMightHaveChanged = true;
final MenuItem reportIssue = menu.add(getString(R.string.reportIssue));
+ reportIssue.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
reportIssue.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
package com.hughes.android.dictionary;
-import android.app.ListActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
-import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
-import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
+import android.widget.ImageButton;
import android.widget.TextView;
+import android.widget.ToggleButton;
+import com.actionbarsherlock.app.SherlockListActivity;
+import com.actionbarsherlock.view.Menu;
import com.hughes.android.dictionary.DictionaryInfo.IndexInfo;
import com.hughes.android.util.IntentLauncher;
import java.util.ArrayList;
import java.util.List;
-public class DictionaryManagerActivity extends ListActivity {
+public class DictionaryManagerActivity extends SherlockListActivity {
static final String LOG = "QuickDic";
static boolean blockAutoLaunch = false;
Adapter adapter;
EditText filterText;
- CheckBox showLocal;
+ ToggleButton showLocal;
Handler uiHandler;
setContentView(R.layout.dictionary_manager_activity);
filterText = (EditText) findViewById(R.id.filterText);
- showLocal = (CheckBox) findViewById(R.id.showLocal);
+ showLocal = (ToggleButton) findViewById(R.id.showLocal);
filterText.addTextChangedListener(new TextWatcher() {
@Override
}
});
+ final ImageButton clearSearchText = (ImageButton) findViewById(R.id.ClearSearchTextButton);
+ clearSearchText.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ filterText.setText("");
+ filterText.requestFocus();
+ }
+ });
+
showLocal.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
final DictionaryInfo dictionaryInfo = adapter.getItem(position);
if (position > 0 && application.isDictionaryOnDevice(dictionaryInfo.uncompressedFilename)) {
- final MenuItem moveToTopMenuItem = menu.add(R.string.moveToTop);
- moveToTopMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ final android.view.MenuItem moveToTopMenuItem = menu.add(R.string.moveToTop);
+ moveToTopMenuItem.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
@Override
- public boolean onMenuItemClick(MenuItem item) {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
application.moveDictionaryToTop(dictionaryInfo);
setListAdapter(adapter = new Adapter());
return true;
});
}
- final MenuItem deleteMenuItem = menu.add(R.string.deleteDictionary);
- deleteMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ final android.view.MenuItem deleteMenuItem = menu.add(R.string.deleteDictionary);
+ deleteMenuItem.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
@Override
- public boolean onMenuItemClick(MenuItem item) {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
application.deleteDictionary(dictionaryInfo);
setListAdapter(adapter = new Adapter());
return true;
final DictionaryInfo downloadable = application.getDownloadable(dictionaryInfo.uncompressedFilename);
if (downloadable != null) {
- final MenuItem downloadMenuItem = menu.add(getString(R.string.downloadButton, downloadable.zipBytes/1024.0/1024.0));
- downloadMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ final android.view.MenuItem downloadMenuItem = menu.add(getString(R.string.downloadButton, downloadable.zipBytes/1024.0/1024.0));
+ downloadMenuItem.setOnMenuItemClickListener(new android.view.MenuItem.OnMenuItemClickListener() {
@Override
- public boolean onMenuItemClick(MenuItem item) {
+ public boolean onMenuItemClick(android.view.MenuItem item) {
final Intent intent = getDownloadIntent(downloadable);
startActivity(intent);
setListAdapter(adapter = new Adapter());
}
private Intent getDownloadIntent(final DictionaryInfo downloadable) {
- final Intent intent = DownloadActivity.getLaunchIntent(downloadable.downloadUrl,
- application.getPath(downloadable.uncompressedFilename).getPath() + ".zip",
- downloadable.dictInfo);
- return intent;
+// DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
+// DownloadManager.Request request = new DownloadManager.Request(Uri.parse(""));
+// long id = downloadManager.enqueue(request);
+// DownloadManager.Query query;
+ return null;
}
private void onFilterTextChanged() {
}
if (canShow) {
dictionaryInfos.add(dictionaryInfo);
-
}
}
}
}
@Override
- public View getView(final int position, final View convertView, final ViewGroup parent) {
- final LinearLayout result;
- // Android 4.0.3 leaks memory like crazy if we don't do this.
- if (convertView instanceof LinearLayout) {
- result = (LinearLayout) convertView;
- result.removeAllViews();
- } else {
- result = new LinearLayout(parent.getContext());
- }
-
+ public View getView(final int position, View convertView, final ViewGroup parent) {
+ if (convertView == null) {
+ convertView = LayoutInflater.from(parent.getContext()).inflate(
+ R.layout.dictionary_manager_row, parent, false);
+ }
+
final DictionaryInfo dictionaryInfo = getItem(position);
- result.setOrientation(LinearLayout.VERTICAL);
-
- final LinearLayout row = new LinearLayout(parent.getContext());
- row.setOrientation(LinearLayout.HORIZONTAL);
- result.addView(row);
- {
- final TextView textView = new TextView(parent.getContext());
+ final TextView textView = (TextView) convertView.findViewById(R.id.dictionaryName);
final String name = application.getDictionaryName(dictionaryInfo.uncompressedFilename);
textView.setText(name);
- textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
- row.addView(textView);
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
- layoutParams.weight = 1.0f;
- textView.setLayoutParams(layoutParams);
- }
+ final Button downloadButton = (Button) convertView.findViewById(R.id.dictionaryDownloadButton);
final boolean updateAvailable = application.updateAvailable(dictionaryInfo);
- final DictionaryInfo downloadable = application.getDownloadable(dictionaryInfo.uncompressedFilename);
- if ((!application.isDictionaryOnDevice(dictionaryInfo.uncompressedFilename) || updateAvailable) && downloadable != null) {
- final Button downloadButton = new Button(parent.getContext());
- downloadButton.setText(getString(updateAvailable ? R.string.updateButton : R.string.downloadButton, downloadable.zipBytes / 1024.0 / 1024.0));
- final Intent intent = getDownloadIntent(downloadable);
- downloadButton.setOnClickListener(new IntentLauncher(parent.getContext(), intent));
- WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
- layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
- layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
- downloadButton.setLayoutParams(layoutParams);
- row.addView(downloadButton);
+ final DictionaryInfo downloadable = application.getDownloadable(dictionaryInfo.uncompressedFilename);
+ if (updateAvailable) {
+ downloadButton.setCompoundDrawablesWithIntrinsicBounds(
+ android.R.drawable.ic_menu_add,
+ 0, 0, 0);
+ downloadButton.setText(getString(R.string.downloadButton, downloadable.zipBytes / 1024.0 / 1024.0));
+ } else if (!application.isDictionaryOnDevice(dictionaryInfo.uncompressedFilename)) {
+ downloadButton.setCompoundDrawablesWithIntrinsicBounds(
+ android.R.drawable.ic_menu_add,
+ 0, 0, 0);
+ downloadButton.setText(getString(R.string.downloadButton, downloadable.zipBytes / 1024.0 / 1024.0));
} else {
- final ImageView checkMark = new ImageView(parent.getContext());
- checkMark.setImageResource(R.drawable.btn_check_buttonless_on);
- row.addView(checkMark);
+ downloadButton.setCompoundDrawablesWithIntrinsicBounds(
+ android.R.drawable.checkbox_on_background,
+ 0, 0, 0);
+ downloadButton.setText("");
}
+ final Intent intent = getDownloadIntent(downloadable);
+ downloadButton.setOnClickListener(new IntentLauncher(parent.getContext(), intent));
// Add the information about each index.
- final LinearLayout row2 = new LinearLayout(parent.getContext());
- row2.setOrientation(LinearLayout.HORIZONTAL);
- final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
- row2.setLayoutParams(layoutParams);
- result.addView(row2);
+ final TextView dictionaryDetails = (TextView) convertView.findViewById(R.id.dictionaryDetails);
final StringBuilder builder = new StringBuilder();
for (final IndexInfo indexInfo : dictionaryInfo.indexInfos) {
if (builder.length() > 0) {
}
builder.append(getString(R.string.indexInfo, indexInfo.shortName, indexInfo.mainTokenCount));
}
- final TextView indexView = new TextView(parent.getContext());
- indexView.setText(builder.toString());
- row2.addView(indexView);
-
+ dictionaryDetails.setText(builder.toString());
- // Because we have a Button inside a ListView row:
- // http://groups.google.com/group/android-developers/browse_thread/thread/3d96af1530a7d62a?pli=1
- result.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
- result.setClickable(true);
- result.setFocusable(true);
- result.setLongClickable(true);
- result.setBackgroundResource(android.R.drawable.menuitem_background);
- result.setOnClickListener(new TextView.OnClickListener() {
+// // Because we have a Button inside a ListView row:
+// // http://groups.google.com/group/android-developers/browse_thread/thread/3d96af1530a7d62a?pli=1
+ //convertView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
+ convertView.setClickable(true);
+ convertView.setFocusable(true);
+ convertView.setLongClickable(true);
+// result.setBackgroundResource(android.R.drawable.menuitem_background);
+ convertView.setOnClickListener(new TextView.OnClickListener() {
@Override
public void onClick(View v) {
DictionaryManagerActivity.this.onClick(position);
}
});
- return result;
+ return convertView;
}
}
+++ /dev/null
-// Copyright 2011 Google Inc. All Rights Reserved.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-package com.hughes.android.dictionary;\r
-\r
-import android.app.Activity;\r
-import android.content.Intent;\r
-import android.os.Bundle;\r
-import android.os.Handler;\r
-import android.util.Log;\r
-import android.widget.ProgressBar;\r
-import android.widget.TextView;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-import java.net.URL;\r
-import java.net.URLConnection;\r
-import java.util.concurrent.Executor;\r
-import java.util.concurrent.Executors;\r
-import java.util.concurrent.atomic.AtomicBoolean;\r
-import java.util.zip.ZipEntry;\r
-import java.util.zip.ZipFile;\r
-\r
-public class DownloadActivity extends Activity {\r
-\r
- public static final String SOURCE = "source";\r
- public static final String DEST = "dest";\r
- public static final String MESSAGE = "message";\r
-\r
- String source;\r
- String dest;\r
- String message;\r
- long bytesProcessed = 0;\r
- long contentLength = -1;\r
-\r
- private final Executor downloadExecutor = Executors.newSingleThreadExecutor();\r
- private final Handler uiHandler = new Handler();\r
-\r
- final AtomicBoolean stop = new AtomicBoolean(false);\r
- \r
- public static Intent getLaunchIntent(final String source, final String dest, final String message) {\r
- final Intent intent = new Intent();\r
- intent.setClassName(DownloadActivity.class.getPackage().getName(), DownloadActivity.class.getName());\r
- intent.putExtra(SOURCE, source);\r
- intent.putExtra(DEST, dest);\r
- intent.putExtra(MESSAGE, message);\r
- return intent;\r
- }\r
-\r
- /** Called when the activity is first created. */\r
- @Override\r
- public void onCreate(final Bundle savedInstanceState) {\r
- setTheme(((DictionaryApplication)getApplication()).getSelectedTheme().themeId);\r
-\r
- super.onCreate(savedInstanceState);\r
- final Intent intent = getIntent();\r
- source = intent.getStringExtra(SOURCE);\r
- dest = intent.getStringExtra(DEST);\r
- message = intent.getStringExtra(MESSAGE);\r
- if (source == null || dest == null) {\r
- throw new RuntimeException("null source or dest.");\r
- }\r
- setContentView(R.layout.download_activity);\r
-\r
- final TextView sourceTextView = (TextView) findViewById(R.id.source);\r
- sourceTextView.setText(source);\r
-\r
- final TextView destTextView = (TextView) findViewById(R.id.dest);\r
- destTextView.setText(dest);\r
-\r
- final TextView messageTextView = (TextView) findViewById(R.id.downloadMessage);\r
- messageTextView.setText(message);\r
-\r
- final ProgressBar progressBar = (ProgressBar) findViewById(R.id.downloadProgressBar);\r
- progressBar.setIndeterminate(false);\r
- progressBar.setMax(100);\r
- \r
- bytesProcessed = 0;\r
- contentLength = 100;\r
- setDownloadStatus(getString(R.string.openingConnection));\r
-\r
- final Runnable runnable = new Runnable() {\r
- public void run() {\r
-\r
- try {\r
- final File destFile = new File(dest);\r
- if (destFile.getAbsoluteFile().getParent() != null) {\r
- destFile.getAbsoluteFile().getParentFile().mkdirs();\r
- }\r
-\r
- final File destTmpFile = File.createTempFile("dictionaryDownload", "tmp", destFile\r
- .getParentFile());\r
- destTmpFile.deleteOnExit();\r
-\r
- final URL uri = new URL(source);\r
- final URLConnection connection = uri.openConnection();\r
- contentLength = connection.getContentLength();\r
- final InputStream in = connection.getInputStream();\r
- if (in == null) {\r
- throw new IOException("Unable to open InputStream from source: " + source);\r
- }\r
- final FileOutputStream out = new FileOutputStream(destTmpFile); \r
- int bytesRead = copyStream(in, out, R.string.downloading);\r
- \r
- if (bytesRead == -1 && !stop.get()) {\r
- destFile.delete();\r
- destTmpFile.renameTo(destFile);\r
- } else {\r
- Log.d("THAD", "Stopped downloading file.");\r
- }\r
- \r
- if (dest.toLowerCase().endsWith(".zip")) {\r
- final ZipFile zipFile = new ZipFile(destFile);\r
- final File destUnzipped = new File(dest.substring(0, dest.length() - 4));\r
- final ZipEntry zipEntry = zipFile.getEntry(destUnzipped.getName());\r
- if (zipEntry != null) {\r
- destUnzipped.delete();\r
- Log.d("THAD", "Unzipping entry: " + zipEntry.getName() + " to " + destUnzipped);\r
- final InputStream zipIn = zipFile.getInputStream(zipEntry);\r
- final OutputStream zipOut = new FileOutputStream(destUnzipped);\r
- contentLength = zipEntry.getSize();\r
- bytesRead = copyStream(zipIn, zipOut, R.string.unzipping);\r
- destFile.delete();\r
- }\r
- }\r
- \r
- setDownloadStatus(String.format(getString(R.string.downloadFinished),\r
- bytesProcessed));\r
- \r
- // If all went well, we can exit this activity.\r
- uiHandler.post(new Runnable() {\r
- @Override\r
- public void run() {\r
- finish();\r
- }\r
- });\r
- \r
- } catch (IOException e) {\r
- Log.e("THAD", "Error downloading file", e);\r
- setDownloadStatus(String.format(getString(R.string.errorDownloadingFile), e.getLocalizedMessage()));\r
- }\r
- }\r
-\r
- private int copyStream(final InputStream in, final OutputStream out, final int messageId)\r
- throws IOException {\r
- bytesProcessed = 0;\r
- int bytesRead;\r
- final byte[] bytes = new byte[1024 * 16];\r
- int count = 0;\r
- while ((bytesRead = in.read(bytes)) != -1 && !stop.get()) {\r
- out.write(bytes, 0, bytesRead);\r
- bytesProcessed += bytesRead;\r
- if (count++ % 20 == 0) {\r
- setDownloadStatus(getString(messageId, bytesProcessed, contentLength));\r
- }\r
- }\r
- in.close();\r
- out.close();\r
- return bytesRead;\r
- }\r
- };\r
-\r
- downloadExecutor.execute(runnable);\r
- }\r
-\r
- @Override\r
- protected void onStop() {\r
- stop.set(true);\r
- super.onStop();\r
- }\r
-\r
- private void setDownloadStatus(final String status) {\r
- uiHandler.post(new Runnable() {\r
- public void run() {\r
- final ProgressBar progressBar = (ProgressBar) findViewById(R.id.downloadProgressBar);\r
- if (contentLength > 0) {\r
- progressBar.setProgress((int) (bytesProcessed * 100 / contentLength));\r
- }\r
- \r
- final TextView downloadStatus = (TextView) findViewById(R.id.downloadStatus);\r
- downloadStatus.setText(status);\r
- }\r
- });\r
- }\r
-\r
-}\r
activity.finish();
return true;
}
- // TODO Auto-generated method stub
return super.shouldOverrideUrlLoading(view, url);
}
};
private LanguageResources(final String englishName, int nameId) {\r
this(englishName, nameId, 0);\r
}\r
-}\r
+ }\r
\r
+ // Useful:\r
+ // http://www.loc.gov/standards/iso639-2/php/code_list.php\r
public static final Map<String,LanguageResources> isoCodeToResources = new LinkedHashMap<String,LanguageResources>();\r
static {\r
isoCodeToResources.put("AF", new LanguageResources("Afrikaans", R.string.AF));\r
--- /dev/null
+* Make top of Dictionary activity good
+ * Fit search text alongside other buttons if possible.
+ * List other dictinaries beside
+ * Make search text work.
+
+ http://stackoverflow.com/questions/13604506/show-actionbarsherlock-searchview-always-expanded
+ <style name="application_theme" parent="application_base_theme">
+ <item name="searchViewSearchIcon">@android:color/transparent</item>
+ <item name="searchViewCloseIcon">@android:color/transparent</item>
+</style>
\ No newline at end of file