mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 07:16:04 -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.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -73,11 +74,14 @@ public class ZimContentProvider extends ContentProvider {
|
||||
public static JNIKiwixSearcher jniSearcher;
|
||||
|
||||
@Inject public static Context context;
|
||||
|
||||
private static ArrayList<String> listedEntries;
|
||||
|
||||
public void setupDagger() {
|
||||
KiwixApplication.getInstance().getApplicationComponent().inject(this);
|
||||
setIcuDataDirectory();
|
||||
jniSearcher = new JNIKiwixSearcher();
|
||||
listedEntries = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +109,12 @@ public class ZimContentProvider extends ContentProvider {
|
||||
|
||||
public synchronized static String setZimFile(String fileName) {
|
||||
JNIKiwixReader reader = new JNIKiwixReader(fileName);
|
||||
jniSearcher.addKiwixReader(reader);
|
||||
|
||||
if(!listedEntries.contains(reader.getId())) {
|
||||
listedEntries.add(reader.getId());
|
||||
jniSearcher.addKiwixReader(reader);
|
||||
}
|
||||
|
||||
if (!new File(fileName).exists() || reader == null) {
|
||||
Log.e(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
|
||||
zimFileName = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user