mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-11 08:27:50 -04:00
Fixed duplicate search (#301)
* Fixed the Duplicate Search Bug * Fixed a Variable Name * Updated Indent Spacing * Fixed Indenting Again
This commit is contained in:
parent
44a2e29099
commit
03f27f6580
@ -43,6 +43,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -74,10 +75,13 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
|
|
||||||
@Inject public static Context context;
|
@Inject public static Context context;
|
||||||
|
|
||||||
|
private static ArrayList<String> listedEntries;
|
||||||
|
|
||||||
public void setupDagger() {
|
public void setupDagger() {
|
||||||
KiwixApplication.getInstance().getApplicationComponent().inject(this);
|
KiwixApplication.getInstance().getApplicationComponent().inject(this);
|
||||||
setIcuDataDirectory();
|
setIcuDataDirectory();
|
||||||
jniSearcher = new JNIKiwixSearcher();
|
jniSearcher = new JNIKiwixSearcher();
|
||||||
|
listedEntries = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +109,12 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
|
|
||||||
public synchronized static String setZimFile(String fileName) {
|
public synchronized static String setZimFile(String fileName) {
|
||||||
JNIKiwixReader reader = new JNIKiwixReader(fileName);
|
JNIKiwixReader reader = new JNIKiwixReader(fileName);
|
||||||
|
|
||||||
|
if(!listedEntries.contains(reader.getId())) {
|
||||||
|
listedEntries.add(reader.getId());
|
||||||
jniSearcher.addKiwixReader(reader);
|
jniSearcher.addKiwixReader(reader);
|
||||||
|
}
|
||||||
|
|
||||||
if (!new File(fileName).exists() || reader == null) {
|
if (!new File(fileName).exists() || reader == null) {
|
||||||
Log.e(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
|
Log.e(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
|
||||||
zimFileName = null;
|
zimFileName = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user