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() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Log.i(TAG_KIWIX, "Speaking selection.");
|
||||
tts.readSelection(getCurrentWebView());
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
@ -960,7 +959,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
||||
showHelpPage();
|
||||
}
|
||||
} 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)
|
||||
.show();
|
||||
@ -1578,7 +1577,6 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
||||
}
|
||||
|
||||
// Night mode status
|
||||
Log.d(TAG_KIWIX, "nightMode value (" + nightMode + ")");
|
||||
if (nightMode) {
|
||||
getCurrentWebView().toggleNightMode();
|
||||
} else {
|
||||
@ -1650,7 +1648,8 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
|
||||
}
|
||||
selectTab(currentTab);
|
||||
} 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 {
|
||||
|
||||
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();
|
||||
// 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) {
|
||||
progressBar.setProgress(progress);
|
||||
if (progress == 100) {
|
||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Loading article finished.");
|
||||
if (requestClearHistoryAfterLoad) {
|
||||
Log.d(KiwixMobileActivity.TAG_KIWIX,
|
||||
"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)
|
||||
return true;
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
@ -98,16 +98,16 @@ public class ZimContentProvider extends ContentProvider {
|
||||
|
||||
public synchronized static String setZimFile(String 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;
|
||||
} else {
|
||||
Log.d(TAG_KIWIX, "Opening ZIM file " + fileName);
|
||||
Log.i(TAG_KIWIX, "Opening ZIM file " + fileName);
|
||||
zimFileName = fileName;
|
||||
|
||||
/* Try to open the corresponding fulltext index */
|
||||
String fullText = getFulltextIndexPath(fileName);
|
||||
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;
|
||||
@ -289,7 +289,8 @@ public class ZimContentProvider extends ContentProvider {
|
||||
}
|
||||
return icuDir.getAbsolutePath();
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -368,7 +369,6 @@ public class ZimContentProvider extends ContentProvider {
|
||||
pipe = ParcelFileDescriptor.createPipe();
|
||||
new TransferThread(jniKiwix, uri, new AutoCloseOutputStream(pipe[1])).start();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG_KIWIX, "Exception opening pipe", e);
|
||||
throw new FileNotFoundException("Could not open pipe for: "
|
||||
+ uri.toString());
|
||||
}
|
||||
@ -438,7 +438,6 @@ public class ZimContentProvider extends ContentProvider {
|
||||
|
||||
TransferThread(JNIKiwix jniKiwix, Uri articleUri, OutputStream out) throws IOException {
|
||||
this.jniKiwix = jniKiwix;
|
||||
Log.d(TAG_KIWIX, "Retrieving: " + articleUri.toString());
|
||||
|
||||
String filePath = getFilePath(articleUri);
|
||||
|
||||
@ -465,13 +464,13 @@ public class ZimContentProvider extends ContentProvider {
|
||||
Log.d(TAG_KIWIX, "reading " + articleZimUrl
|
||||
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
||||
} 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);
|
||||
} finally {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG_KIWIX,
|
||||
Log.w(TAG_KIWIX,
|
||||
"Custom exception by closing out stream for article " + articleZimUrl,
|
||||
e);
|
||||
}
|
||||
|
@ -154,9 +154,11 @@ public class KiwixDatabase extends SquidDatabase {
|
||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Switched to bookmarkfile " + ZimContentProvider.getId());
|
||||
}
|
||||
} 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) {
|
||||
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;
|
||||
onInitSucceedListener.onInitSucceed();
|
||||
} 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
|
||||
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);
|
||||
layoutInflater.setFactory(new LayoutInflaterFactory(mContext, layoutInflater));
|
||||
} 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;
|
||||
} catch (InflateException | ClassNotFoundException e) {
|
||||
Log.e(TAG_KIWIX,
|
||||
Log.w(TAG_KIWIX,
|
||||
"Could not apply the custom font to " + name + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class NetworkUtils {
|
||||
details = details.trim().replaceAll(" +", " ");
|
||||
return details;
|
||||
} catch (Exception e) {
|
||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url");
|
||||
Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url: " + url);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class KiwixWebView extends WebView {
|
||||
String imageSaved = getResources().getString(R.string.save_media_saved);
|
||||
toastText = String.format(imageSaved, newUrl);
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class ZimFileSelectFragment extends Fragment
|
||||
if (path != null) {
|
||||
File file = new File(path);
|
||||
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.finish();
|
||||
} else {
|
||||
@ -209,7 +209,7 @@ public class ZimFileSelectFragment extends Fragment
|
||||
public void onBookFound(LibraryNetworkEntity.Book book) {
|
||||
if (!mFiles.contains(book)) {
|
||||
context.runOnUiThread(() -> {
|
||||
Log.i("Scanner", "Found "+book.title);
|
||||
Log.i("Scanner", "File Search: Found Book "+book.title);
|
||||
mFiles.add(book);
|
||||
mRescanAdapter.notifyDataSetChanged();
|
||||
checkEmpty();
|
||||
@ -276,7 +276,6 @@ public class ZimFileSelectFragment extends Fragment
|
||||
@Override
|
||||
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
|
||||
ZimContentProvider.canIterate = false;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class LibraryPresenter extends BasePresenter<LibraryViewCallback> {
|
||||
getMvpView().showBooks(library.getBooks());
|
||||
}, error -> {
|
||||
String msg = error.getLocalizedMessage();
|
||||
Log.w("kiwixLibrary", "Error:" + (msg != null ? msg : "(null)"));
|
||||
Log.w("kiwixLibrary", "Error loading books:" + (msg != null ? msg : "(null)"));
|
||||
getMvpView().displayNoNetworkConnection();
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user