+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package com.hughes.android.dictionary;
+import java.io.File;
+
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
+import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
}
});
+ final MenuItem removeAllDictionariesMenuItem = menu.add(R.string.removeAllDictionaries);
+ removeAllDictionariesMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ public boolean onMenuItemClick(final MenuItem menuItem) {
+ quickDicConfig.dictionaryConfigs.clear();
+ dictionaryConfigsChanged();
+ return false;
+ }
+ });
+
final MenuItem about = menu.add(getString(R.string.about));
about.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(final MenuItem menuItem) {
});
if (adapterContextMenuInfo.position > 0) {
- final MenuItem moveUpMenuItem = menu.add(R.string.moveUp);
- moveUpMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ final MenuItem moveToTopMenuItem = menu.add(R.string.moveToTop);
+ moveToTopMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
final DictionaryConfig dictionaryConfig = quickDicConfig.dictionaryConfigs.remove(adapterContextMenuInfo.position);
- quickDicConfig.dictionaryConfigs.add(adapterContextMenuInfo.position - 1, dictionaryConfig);
+ quickDicConfig.dictionaryConfigs.add(0, dictionaryConfig);
dictionaryConfigsChanged();
return true;
}
final DictionaryConfig dictionaryConfig = getItem(position);
final TableLayout tableLayout = new TableLayout(parent.getContext());
final TextView view = new TextView(parent.getContext());
+
+ String name = dictionaryConfig.name;
+ if (!new File(dictionaryConfig.localFile).canRead()) {
+ name = getString(R.string.notOnDevice, dictionaryConfig.name);
+ }
- view.setText(dictionaryConfig.name);
- view.setTextSize(20);
+ view.setText(name);
+ view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
tableLayout.addView(view);
return tableLayout;