mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Minor logging changes
This commit is contained in:
parent
9350a1cdbb
commit
0fa2d4e66c
@ -296,7 +296,6 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
Log.i(TAG_KIWIX, "Speaking selection.");
|
|
||||||
tts.readSelection(getCurrentWebView());
|
tts.readSelection(getCurrentWebView());
|
||||||
if (actionMode != null) {
|
if (actionMode != null) {
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
@ -960,7 +959,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
showHelpPage();
|
showHelpPage();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG_KIWIX, "ZIM file doesn't exist at " + file.getAbsolutePath());
|
Log.w(TAG_KIWIX, "ZIM file doesn't exist at " + file.getAbsolutePath());
|
||||||
|
|
||||||
Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG)
|
Toast.makeText(this, getResources().getString(R.string.error_filenotfound), Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
@ -1578,7 +1577,6 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Night mode status
|
// Night mode status
|
||||||
Log.d(TAG_KIWIX, "nightMode value (" + nightMode + ")");
|
|
||||||
if (nightMode) {
|
if (nightMode) {
|
||||||
getCurrentWebView().toggleNightMode();
|
getCurrentWebView().toggleNightMode();
|
||||||
} else {
|
} else {
|
||||||
@ -1650,7 +1648,8 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
}
|
}
|
||||||
selectTab(currentTab);
|
selectTab(currentTab);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(TAG_KIWIX, " Kiwix sharedpreferences corrupted");
|
Log.w(TAG_KIWIX, " Kiwix sharedpreferences corrupted");
|
||||||
|
//TODO: Show to user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1680,7 +1679,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (BuildConfig.IS_CUSTOM_APP) {
|
if (BuildConfig.IS_CUSTOM_APP) {
|
||||||
Log.d(TAG_KIWIX, "Kiwix Custom App starting for the first time. Check Companion ZIM.");
|
Log.d(TAG_KIWIX, "Kiwix Custom App starting for the first time. Check Companion ZIM: " + BuildConfig.ZIM_FILE_NAME);
|
||||||
|
|
||||||
String currentLocaleCode = Locale.getDefault().toString();
|
String currentLocaleCode = Locale.getDefault().toString();
|
||||||
// Custom App recommends to start off a specific language
|
// Custom App recommends to start off a specific language
|
||||||
@ -1788,7 +1787,6 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
|||||||
@Override public void webViewProgressChanged(int progress) {
|
@Override public void webViewProgressChanged(int progress) {
|
||||||
progressBar.setProgress(progress);
|
progressBar.setProgress(progress);
|
||||||
if (progress == 100) {
|
if (progress == 100) {
|
||||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Loading article finished.");
|
|
||||||
if (requestClearHistoryAfterLoad) {
|
if (requestClearHistoryAfterLoad) {
|
||||||
Log.d(KiwixMobileActivity.TAG_KIWIX,
|
Log.d(KiwixMobileActivity.TAG_KIWIX,
|
||||||
"Loading article finished and requestClearHistoryAfterLoad -> clearHistory");
|
"Loading article finished and requestClearHistoryAfterLoad -> clearHistory");
|
||||||
|
@ -49,7 +49,7 @@ public class KiwixWebViewClient extends WebViewClient {
|
|||||||
// Allow javascript for HTML functions and code execution (EX: night mode)
|
// Allow javascript for HTML functions and code execution (EX: night mode)
|
||||||
return true;
|
return true;
|
||||||
} else if (url.startsWith(ZimContentProvider.UI_URI.toString())) {
|
} else if (url.startsWith(ZimContentProvider.UI_URI.toString())) {
|
||||||
Log.e("KiwixWevViewClient", "UI Url " + url + " not supported.");
|
Log.e("KiwixWebViewClient", "UI Url " + url + " not supported.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,16 +98,16 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
|
|
||||||
public synchronized static String setZimFile(String fileName) {
|
public synchronized static String setZimFile(String fileName) {
|
||||||
if (!jniKiwix.loadZIM(fileName)) {
|
if (!jniKiwix.loadZIM(fileName)) {
|
||||||
Log.e(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
|
Log.w(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
|
||||||
zimFileName = null;
|
zimFileName = null;
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG_KIWIX, "Opening ZIM file " + fileName);
|
Log.i(TAG_KIWIX, "Opening ZIM file " + fileName);
|
||||||
zimFileName = fileName;
|
zimFileName = fileName;
|
||||||
|
|
||||||
/* Try to open the corresponding fulltext index */
|
/* Try to open the corresponding fulltext index */
|
||||||
String fullText = getFulltextIndexPath(fileName);
|
String fullText = getFulltextIndexPath(fileName);
|
||||||
if (!jniKiwix.loadFulltextIndex(fullText)) {
|
if (!jniKiwix.loadFulltextIndex(fullText)) {
|
||||||
Log.e(TAG_KIWIX, "Unable to open the ZIM fulltext index " + fullText);
|
Log.w(TAG_KIWIX, "Unable to open the ZIM fulltext index " + fullText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return zimFileName;
|
return zimFileName;
|
||||||
@ -289,7 +289,8 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
return icuDir.getAbsolutePath();
|
return icuDir.getAbsolutePath();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG_KIWIX, "Error copying icu data file", e);
|
Log.w(TAG_KIWIX, "Error copying icu data file", e);
|
||||||
|
//TODO: Consider surfacing to user
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +369,6 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
pipe = ParcelFileDescriptor.createPipe();
|
pipe = ParcelFileDescriptor.createPipe();
|
||||||
new TransferThread(jniKiwix, uri, new AutoCloseOutputStream(pipe[1])).start();
|
new TransferThread(jniKiwix, uri, new AutoCloseOutputStream(pipe[1])).start();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG_KIWIX, "Exception opening pipe", e);
|
|
||||||
throw new FileNotFoundException("Could not open pipe for: "
|
throw new FileNotFoundException("Could not open pipe for: "
|
||||||
+ uri.toString());
|
+ uri.toString());
|
||||||
}
|
}
|
||||||
@ -438,7 +438,6 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
|
|
||||||
TransferThread(JNIKiwix jniKiwix, Uri articleUri, OutputStream out) throws IOException {
|
TransferThread(JNIKiwix jniKiwix, Uri articleUri, OutputStream out) throws IOException {
|
||||||
this.jniKiwix = jniKiwix;
|
this.jniKiwix = jniKiwix;
|
||||||
Log.d(TAG_KIWIX, "Retrieving: " + articleUri.toString());
|
|
||||||
|
|
||||||
String filePath = getFilePath(articleUri);
|
String filePath = getFilePath(articleUri);
|
||||||
|
|
||||||
@ -465,13 +464,13 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
Log.d(TAG_KIWIX, "reading " + articleZimUrl
|
Log.d(TAG_KIWIX, "reading " + articleZimUrl
|
||||||
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
||||||
} catch (IOException | NullPointerException e) {
|
} catch (IOException | NullPointerException e) {
|
||||||
Log.e(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
|
Log.w(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
|
||||||
e);
|
e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG_KIWIX,
|
Log.w(TAG_KIWIX,
|
||||||
"Custom exception by closing out stream for article " + articleZimUrl,
|
"Custom exception by closing out stream for article " + articleZimUrl,
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,11 @@ public class KiwixDatabase extends SquidDatabase {
|
|||||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Switched to bookmarkfile " + ZimContentProvider.getId());
|
Log.d(KiwixMobileActivity.TAG_KIWIX, "Switched to bookmarkfile " + ZimContentProvider.getId());
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(KiwixMobileActivity.TAG_KIWIX, "File not found: " + e.toString());
|
Log.e(KiwixMobileActivity.TAG_KIWIX, "Bookmark File ( " + id + " ) not found", e);
|
||||||
|
//TODO: Surface to user
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(KiwixMobileActivity.TAG_KIWIX, "Can not read file: " + e.toString());
|
Log.e(KiwixMobileActivity.TAG_KIWIX, "Can not read file " + id, e);
|
||||||
|
//TODO: Surface to user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class KiwixTextToSpeech {
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
onInitSucceedListener.onInitSucceed();
|
onInitSucceedListener.onInitSucceed();
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG_KIWIX, "Initilization of TextToSpeech Failed!");
|
Log.w(TAG_KIWIX, "Initilization of TextToSpeech Failed!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ public class KiwixTextToSpeech {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String s) {
|
public void onError(String s) {
|
||||||
Log.e(TAG_KIWIX, "TextToSpeech: " + s);
|
Log.w(TAG_KIWIX, "TextToSpeech Error: " + s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ public class LanguageUtils {
|
|||||||
field.setBoolean(layoutInflater, false);
|
field.setBoolean(layoutInflater, false);
|
||||||
layoutInflater.setFactory(new LayoutInflaterFactory(mContext, layoutInflater));
|
layoutInflater.setFactory(new LayoutInflaterFactory(mContext, layoutInflater));
|
||||||
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
|
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
|
||||||
Log.e(TAG_KIWIX, "could not access private field of the LayoutInflater");
|
Log.w(TAG_KIWIX, "could not access private field of the LayoutInflater");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ public class LanguageUtils {
|
|||||||
|
|
||||||
return view;
|
return view;
|
||||||
} catch (InflateException | ClassNotFoundException e) {
|
} catch (InflateException | ClassNotFoundException e) {
|
||||||
Log.e(TAG_KIWIX,
|
Log.w(TAG_KIWIX,
|
||||||
"Could not apply the custom font to " + name + " " + e.getMessage());
|
"Could not apply the custom font to " + name + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class NetworkUtils {
|
|||||||
details = details.trim().replaceAll(" +", " ");
|
details = details.trim().replaceAll(" +", " ");
|
||||||
return details;
|
return details;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url");
|
Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url: " + url);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class KiwixWebView extends WebView {
|
|||||||
String imageSaved = getResources().getString(R.string.save_media_saved);
|
String imageSaved = getResources().getString(R.string.save_media_saved);
|
||||||
toastText = String.format(imageSaved, newUrl);
|
toastText = String.format(imageSaved, newUrl);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d("kiwix", "Couldn't save image", e);
|
Log.w("kiwix", "Couldn't save image", e);
|
||||||
toastText = getResources().getString(R.string.save_media_error);
|
toastText = getResources().getString(R.string.save_media_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class ZimFileSelectFragment extends Fragment
|
|||||||
if (path != null) {
|
if (path != null) {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
Uri uri = Uri.fromFile(file);
|
Uri uri = Uri.fromFile(file);
|
||||||
Log.i(TAG_KIWIX, "Opening " + uri);
|
Log.i(TAG_KIWIX, "Opening Zim File: " + uri);
|
||||||
zimManageActivity.setResult(Activity.RESULT_OK, new Intent().setData(uri));
|
zimManageActivity.setResult(Activity.RESULT_OK, new Intent().setData(uri));
|
||||||
zimManageActivity.finish();
|
zimManageActivity.finish();
|
||||||
} else {
|
} else {
|
||||||
@ -209,7 +209,7 @@ public class ZimFileSelectFragment extends Fragment
|
|||||||
public void onBookFound(LibraryNetworkEntity.Book book) {
|
public void onBookFound(LibraryNetworkEntity.Book book) {
|
||||||
if (!mFiles.contains(book)) {
|
if (!mFiles.contains(book)) {
|
||||||
context.runOnUiThread(() -> {
|
context.runOnUiThread(() -> {
|
||||||
Log.i("Scanner", "Found "+book.title);
|
Log.i("Scanner", "File Search: Found Book "+book.title);
|
||||||
mFiles.add(book);
|
mFiles.add(book);
|
||||||
mRescanAdapter.notifyDataSetChanged();
|
mRescanAdapter.notifyDataSetChanged();
|
||||||
checkEmpty();
|
checkEmpty();
|
||||||
@ -276,7 +276,6 @@ public class ZimFileSelectFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
|
||||||
Log.d(TAG_KIWIX, " mZimFileList.onItemClick");
|
|
||||||
// Stop file search from accessing content provider potentially opening wrong file
|
// Stop file search from accessing content provider potentially opening wrong file
|
||||||
ZimContentProvider.canIterate = false;
|
ZimContentProvider.canIterate = false;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class LibraryPresenter extends BasePresenter<LibraryViewCallback> {
|
|||||||
getMvpView().showBooks(library.getBooks());
|
getMvpView().showBooks(library.getBooks());
|
||||||
}, error -> {
|
}, error -> {
|
||||||
String msg = error.getLocalizedMessage();
|
String msg = error.getLocalizedMessage();
|
||||||
Log.w("kiwixLibrary", "Error:" + (msg != null ? msg : "(null)"));
|
Log.w("kiwixLibrary", "Error loading books:" + (msg != null ? msg : "(null)"));
|
||||||
getMvpView().displayNoNetworkConnection();
|
getMvpView().displayNoNetworkConnection();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user