mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
Merge branch 'master' into 2.6-master
This commit is contained in:
commit
c6071b4d41
15 changed files with 25 additions and 92 deletions
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2015 FBReader.ORG Limited <contact@fbreader.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.fbreader.util;
|
||||
|
||||
public final class Pair<T1,T2> {
|
||||
public T1 First;
|
||||
public T2 Second;
|
||||
|
||||
public Pair(T1 first, T2 second) {
|
||||
First = first;
|
||||
Second = second;
|
||||
}
|
||||
|
||||
public Pair() {
|
||||
this(null, null);
|
||||
}
|
||||
}
|
|
@ -21,11 +21,10 @@ package org.geometerplus.android.fbreader.tree;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Pair;
|
||||
import android.view.*;
|
||||
|
||||
import org.geometerplus.android.util.UIMessageUtil;
|
||||
|
@ -168,10 +167,10 @@ public abstract class TreeActivity<T extends FBTree> extends ListActivity {
|
|||
}
|
||||
|
||||
private void setTitleAndSubtitle(Pair<String,String> pair) {
|
||||
if (pair.Second != null) {
|
||||
setTitle(pair.First + " - " + pair.Second);
|
||||
if (pair.second != null) {
|
||||
setTitle(pair.first + " - " + pair.second);
|
||||
} else {
|
||||
setTitle(pair.First);
|
||||
setTitle(pair.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.app.ProgressDialog;
|
|||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
@ -34,16 +35,7 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
|
|||
public abstract class UIUtil {
|
||||
private static final Object ourMonitor = new Object();
|
||||
private static ProgressDialog ourProgress;
|
||||
private static class Pair {
|
||||
final Runnable Action;
|
||||
final String Message;
|
||||
|
||||
Pair(Runnable action, String message) {
|
||||
Action = action;
|
||||
Message = message;
|
||||
}
|
||||
};
|
||||
private static final Queue<Pair> ourTaskQueue = new LinkedList<Pair>();
|
||||
private static final Queue<Pair<Runnable,String>> ourTaskQueue = new LinkedList<Pair<Runnable,String>>();
|
||||
private static volatile Handler ourProgressHandler;
|
||||
|
||||
private static boolean init() {
|
||||
|
@ -59,7 +51,7 @@ public abstract class UIUtil {
|
|||
ourProgress.dismiss();
|
||||
ourProgress = null;
|
||||
} else {
|
||||
ourProgress.setMessage(ourTaskQueue.peek().Message);
|
||||
ourProgress.setMessage(ourTaskQueue.peek().second);
|
||||
}
|
||||
ourMonitor.notify();
|
||||
}
|
||||
|
@ -106,8 +98,8 @@ public abstract class UIUtil {
|
|||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
while (ourProgress == currentProgress && !ourTaskQueue.isEmpty()) {
|
||||
Pair p = ourTaskQueue.poll();
|
||||
p.Action.run();
|
||||
final Pair<Runnable,String> p = ourTaskQueue.poll();
|
||||
p.first.run();
|
||||
synchronized (ourMonitor) {
|
||||
ourProgressHandler.sendEmptyMessage(0);
|
||||
try {
|
||||
|
|
|
@ -21,40 +21,15 @@ package org.geometerplus.fbreader.book;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||
|
||||
public final class FileInfoSet {
|
||||
private static final class Pair {
|
||||
private final String myName;
|
||||
private final FileInfo myParent;
|
||||
|
||||
Pair(String name, FileInfo parent) {
|
||||
myName = name;
|
||||
myParent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (myParent == null) ? myName.hashCode() : myParent.hashCode() + myName.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Pair)) {
|
||||
return false;
|
||||
}
|
||||
Pair p = (Pair)o;
|
||||
return myName.equals(p.myName) && MiscUtil.equals(myParent, p.myParent);
|
||||
}
|
||||
}
|
||||
|
||||
private final HashMap<ZLFile,FileInfo> myInfosByFile = new HashMap<ZLFile,FileInfo>();
|
||||
private final HashMap<FileInfo,ZLFile> myFilesByInfo = new HashMap<FileInfo,ZLFile>();
|
||||
private final HashMap<Pair,FileInfo> myInfosByPair = new HashMap<Pair,FileInfo>();
|
||||
private final HashMap<Pair<String,FileInfo>,FileInfo> myInfosByPair =
|
||||
new HashMap<Pair<String,FileInfo>,FileInfo>();
|
||||
private final HashMap<Long,FileInfo> myInfosById = new HashMap<Long,FileInfo>();
|
||||
|
||||
private final LinkedHashSet<FileInfo> myInfosToSave = new LinkedHashSet<FileInfo>();
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.fbreader.library;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.fbreader.library;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.geometerplus.fbreader.library;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.network.tree;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.fbreader.tree.FBTree;
|
||||
import org.geometerplus.fbreader.network.*;
|
||||
|
|
|
@ -21,8 +21,9 @@ package org.geometerplus.fbreader.network.tree;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import org.fbreader.util.Boolean3;
|
||||
import org.fbreader.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
import org.geometerplus.zlibrary.core.network.QuietNetworkContext;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.geometerplus.fbreader.network.tree;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.fbreader.tree;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.fbreader.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
import org.geometerplus.zlibrary.core.tree.ZLTree;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue