mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
refatoring: unused code has been removed
This commit is contained in:
parent
4bd5314226
commit
4b7469a0de
3 changed files with 16 additions and 93 deletions
|
@ -29,13 +29,11 @@ public abstract class ZLOptionsDialog {
|
|||
protected final ArrayList<ZLDialogContent> myTabs = new ArrayList<ZLDialogContent>();
|
||||
protected Runnable myExitAction;
|
||||
protected Runnable myApplyAction;
|
||||
protected ZLStringOption myTabOption;
|
||||
|
||||
protected ZLOptionsDialog(ZLResource resource, Runnable exitAction, Runnable applyAction) {
|
||||
myResource = resource;
|
||||
myExitAction = exitAction;
|
||||
myApplyAction = applyAction;
|
||||
myTabOption = new ZLStringOption(resource.Name, "SelectedTab", "");
|
||||
}
|
||||
|
||||
protected void acceptTab(ZLDialogContent tab) {
|
||||
|
@ -59,12 +57,6 @@ public abstract class ZLOptionsDialog {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract String getSelectedTabKey();
|
||||
|
||||
protected abstract void selectTab(String key);
|
||||
|
||||
protected abstract void runInternal();
|
||||
|
||||
protected final String getCaption() {
|
||||
return myResource.getResource(ZLDialogManager.DIALOG_TITLE).getValue();
|
||||
}
|
||||
|
@ -75,22 +67,5 @@ public abstract class ZLOptionsDialog {
|
|||
|
||||
public abstract ZLDialogContent createTab(String key);
|
||||
|
||||
public void run() {
|
||||
selectTab(myTabOption.getValue());
|
||||
runInternal();
|
||||
myTabOption.setValue(getSelectedTabKey());
|
||||
}
|
||||
|
||||
/*
|
||||
* protected:
|
||||
static void addPlatformDependentBuilder(shared_ptr<ZLDialogContentBuilder> builder);
|
||||
|
||||
private:
|
||||
static std::vector<shared_ptr<ZLDialogContentBuilder> > ourPlatformDependentBuilders;
|
||||
|
||||
public void createPlatformDependentTabs() {
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
public abstract void run();
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ import android.os.*;
|
|||
|
||||
import org.geometerplus.zlibrary.core.dialogs.*;
|
||||
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
||||
import org.geometerplus.zlibrary.ui.android.application.ZLAndroidApplicationWindow;
|
||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
||||
|
||||
import org.geometerplus.android.util.AndroidUtil;
|
||||
|
||||
|
@ -42,15 +40,6 @@ public class ZLAndroidDialogManager extends ZLDialogManager {
|
|||
myActivity = activity;
|
||||
}
|
||||
|
||||
static void runDialog(Activity activity, ZLAndroidDialogInterface dialog) {
|
||||
((ZLAndroidApplication)activity.getApplication()).putData(
|
||||
DialogActivity.DIALOG_KEY, dialog
|
||||
);
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(activity, DialogActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
public void runActivity(Class<?> activityClass, Map<String,String> data) {
|
||||
Intent intent = new Intent(myActivity.getApplicationContext(), activityClass);
|
||||
for (Map.Entry<String,String> entry : data.entrySet()) {
|
||||
|
|
|
@ -21,12 +21,15 @@ package org.geometerplus.zlibrary.ui.android.dialogs;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.dialogs.*;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
||||
|
||||
class ZLAndroidOptionsDialog extends ZLOptionsDialog implements ZLAndroidDialogInterface {
|
||||
private final String myCaption;
|
||||
private TabListView myTabListView;
|
||||
|
@ -57,37 +60,18 @@ class ZLAndroidOptionsDialog extends ZLOptionsDialog implements ZLAndroidDialogI
|
|||
myExitAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
private static void runDialog(Activity activity, ZLAndroidDialogInterface dialog) {
|
||||
((ZLAndroidApplication)activity.getApplication()).putData(
|
||||
DialogActivity.DIALOG_KEY, dialog
|
||||
);
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(activity, DialogActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
protected String getSelectedTabKey() {
|
||||
/*
|
||||
if (myTabListView != null) {
|
||||
int index = myTabListView.getSelectedItemPosition();
|
||||
if ((index >= 0) && (index <= myTabs.size())) {
|
||||
return ((ZLDialogContent)myTabs.get(index)).getKey();
|
||||
}
|
||||
}
|
||||
*/
|
||||
return "";
|
||||
}
|
||||
|
||||
protected void selectTab(String key) {
|
||||
/*
|
||||
if (myTabListView != null) {
|
||||
final ArrayList tabs = myTabs;
|
||||
final int len = tabs.size();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
ZLDialogContent tab = (ZLDialogContent)tabs.get(i);
|
||||
if (tab.getKey().equals(key)) {
|
||||
myTabListView.setSelection(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
protected void runInternal() {
|
||||
ZLAndroidDialogManager.runDialog(myMainActivity, this);
|
||||
public void run() {
|
||||
runDialog(myMainActivity, this);
|
||||
}
|
||||
|
||||
public ZLDialogContent createTab(String key) {
|
||||
|
@ -103,7 +87,7 @@ class ZLAndroidOptionsDialog extends ZLOptionsDialog implements ZLAndroidDialogI
|
|||
final ZLAndroidDialogContent tab =
|
||||
(ZLAndroidDialogContent)myTabListView.getAdapter().getItem(index);
|
||||
final Activity activity = (Activity)myTabListView.getContext();
|
||||
ZLAndroidDialogManager.runDialog(activity, tab);
|
||||
runDialog(activity, tab);
|
||||
}
|
||||
|
||||
private class TabListView extends ListView implements AdapterView.OnItemClickListener {
|
||||
|
@ -140,14 +124,6 @@ class ZLAndroidOptionsDialog extends ZLOptionsDialog implements ZLAndroidDialogI
|
|||
return textView;
|
||||
}
|
||||
|
||||
/*public boolean areAllItemsSelectable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSelectable(int position) {
|
||||
return true;
|
||||
}*/
|
||||
|
||||
public int getCount() {
|
||||
return myTabs.size();
|
||||
}
|
||||
|
@ -160,21 +136,4 @@ class ZLAndroidOptionsDialog extends ZLOptionsDialog implements ZLAndroidDialogI
|
|||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
/*private static class TabButton extends Button {
|
||||
private Runnable myAction;
|
||||
|
||||
TabButton(Context context, String text, Runnable action) {
|
||||
super(context);
|
||||
setText(text);
|
||||
setFocusable(false);
|
||||
myAction = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
myAction.run();
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue