Skip to content

Commit

Permalink
Commented logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-raoul committed Feb 7, 2013
1 parent d504aaa commit f81bfbc
Show file tree
Hide file tree
Showing 45 changed files with 367 additions and 367 deletions.
2 changes: 1 addition & 1 deletion src/com/ichi2/anki/AnkiDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void closeDatabase() {
// set journal mode again to delete in order to make the db accessible for anki desktop and for full upload
queryString("PRAGMA journal_mode = DELETE");
mDatabase.close();
Log.i(AnkiDroidApp.TAG, "AnkiDb - closeDatabase, database " + mDatabase.getPath() + " closed = " + !mDatabase.isOpen());
// Log.i(AnkiDroidApp.TAG, "AnkiDb - closeDatabase, database " + mDatabase.getPath() + " closed = " + !mDatabase.isOpen());
mDatabase = null;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/com/ichi2/anki/AnkiDroidApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public static Compat getCompat() {

public static synchronized Collection openCollection(String path) {
mLock.lock();
Log.i(AnkiDroidApp.TAG, "openCollection: " + path);
// Log.i(AnkiDroidApp.TAG, "openCollection: " + path);
try {
if (!colIsOpen() || !sInstance.mCurrentCollection.getPath().equals(path)) {
if (colIsOpen()) {
Expand All @@ -371,10 +371,10 @@ public static synchronized Collection openCollection(String path) {
}
sInstance.mCurrentCollection = Storage.Collection(path);
sInstance.mAccessThreadCount++;
Log.i(AnkiDroidApp.TAG, "Access to collection is requested: collection has been opened");
// Log.i(AnkiDroidApp.TAG, "Access to collection is requested: collection has been opened");
} else {
sInstance.mAccessThreadCount++;
Log.i(AnkiDroidApp.TAG, "Access to collection is requested: collection has not been reopened (count: " + sInstance.mAccessThreadCount + ")");
// Log.i(AnkiDroidApp.TAG, "Access to collection is requested: collection has not been reopened (count: " + sInstance.mAccessThreadCount + ")");
}
return sInstance.mCurrentCollection;
} finally {
Expand All @@ -388,12 +388,12 @@ public static Collection getCol() {

public static void closeCollection(boolean save) {
mLock.lock();
Log.i(AnkiDroidApp.TAG, "closeCollection");
// Log.i(AnkiDroidApp.TAG, "closeCollection");
try {
if (sInstance.mAccessThreadCount > 0) {
sInstance.mAccessThreadCount--;
}
Log.i(AnkiDroidApp.TAG, "Access to collection jas been closed: (count: " + sInstance.mAccessThreadCount + ")");
// Log.i(AnkiDroidApp.TAG, "Access to collection jas been closed: (count: " + sInstance.mAccessThreadCount + ")");
if (sInstance.mAccessThreadCount == 0 && sInstance.mCurrentCollection != null) {
Collection col = sInstance.mCurrentCollection;
sInstance.mCurrentCollection = null;
Expand All @@ -413,7 +413,7 @@ public static boolean colIsOpen() {
public static void resetAccessThreadCount() {
sInstance.mAccessThreadCount = 0;
sInstance.mCurrentCollection = null;
Log.i(AnkiDroidApp.TAG, "Access has been reset to 0");
// Log.i(AnkiDroidApp.TAG, "Access has been reset to 0");
}

public static void shutdownConnections(final ThreadSafeClientConnManager cm) {
Expand Down
10 changes: 5 additions & 5 deletions src/com/ichi2/anki/BackupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static void performBackup(String path, int interval, boolean force) {
File[] deckBackups = getBackups(collectionFile);
int len = deckBackups.length;
if (len > 0 && deckBackups[len - 1].lastModified() == collectionFile.lastModified()) {
Log.i(AnkiDroidApp.TAG, "performBackup: No backup necessary due to no collection changes");
// Log.i(AnkiDroidApp.TAG, "performBackup: No backup necessary due to no collection changes");
return;
}

Expand All @@ -195,7 +195,7 @@ public static void performBackup(String path, int interval, boolean force) {
}
}
if (lastBackupDate != null && lastBackupDate.getTime() + interval * 3600000 > Utils.intNow(1000) && !force) {
Log.i(AnkiDroidApp.TAG, "performBackup: No backup created. Last backup younger than 5 hours");
// Log.i(AnkiDroidApp.TAG, "performBackup: No backup created. Last backup younger than 5 hours");
return;
}

Expand All @@ -210,7 +210,7 @@ public static void performBackup(String path, int interval, boolean force) {

File backupFile = new File(getBackupDirectory().getPath(), backupFilename);
if (backupFile.exists()) {
Log.i(AnkiDroidApp.TAG, "performBackup: No new backup created. File already exists");
// Log.i(AnkiDroidApp.TAG, "performBackup: No new backup created. File already exists");
return;
}

Expand Down Expand Up @@ -304,7 +304,7 @@ public static boolean repairDeck(String deckPath) {

// repair file
String execString = "sqlite3 " + deckPath + " .dump | sqlite3 " + deckPath + ".tmp";
Log.i(AnkiDroidApp.TAG, "repairDeck - Execute: " + execString);
// Log.i(AnkiDroidApp.TAG, "repairDeck - Execute: " + execString);
try {
String[] cmd = { "/system/bin/sh", "-c", execString };
Process process = Runtime.getRuntime().exec(cmd);
Expand All @@ -317,7 +317,7 @@ public static boolean repairDeck(String deckPath) {
if (!moveDatabaseToBrokenFolder(deckPath, false)) {
return false;
}
Log.i(AnkiDroidApp.TAG, "repairDeck - moved corrupt file to broken folder");
// Log.i(AnkiDroidApp.TAG, "repairDeck - moved corrupt file to broken folder");
File repairedFile = new File(deckPath + ".tmp");
if (!repairedFile.renameTo(deckFile)) {
return false;
Expand Down
22 changes: 11 additions & 11 deletions src/com/ichi2/anki/BroadcastMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public static void checkForNewMessages(Activity activity) {
if (!prefs.getBoolean("showBroadcastMessages", true)) {
return;
}
Log.i(AnkiDroidApp.TAG, "BroadcastMessages: checkForNewMessages");
// Log.i(AnkiDroidApp.TAG, "BroadcastMessages: checkForNewMessages");
// don't proceed if messages were already shown today
if (!prefs.getBoolean("showBroadcastMessageToday", true)) {
Log.i(AnkiDroidApp.TAG, "BroadcastMessages: already shown today");
// Log.i(AnkiDroidApp.TAG, "BroadcastMessages: already shown today");
return;
}
AsyncTask<Activity, Void, Context> checkForNewMessage = new DownloadBroadcastMessage();
Expand Down Expand Up @@ -151,7 +151,7 @@ private static class DownloadBroadcastMessage extends AsyncTask<Activity, Void,

@Override
protected Context doInBackground(Activity... params) {
Log.i(AnkiDroidApp.TAG, "BroadcastMessage.DownloadBroadcastMessage.doInBackground()");
// Log.i(AnkiDroidApp.TAG, "BroadcastMessage.DownloadBroadcastMessage.doInBackground()");

Activity activity = params[0];
mActivity = activity;
Expand All @@ -165,7 +165,7 @@ protected Context doInBackground(Activity... params) {
return activity;
}
try {
Log.i(AnkiDroidApp.TAG, "BroadcastMessage: download file " + FILE_URL);
// Log.i(AnkiDroidApp.TAG, "BroadcastMessage: download file " + FILE_URL);
URL fileUrl;
fileUrl = new URL(FILE_URL);
URLConnection conn = fileUrl.openConnection();
Expand All @@ -184,21 +184,21 @@ protected Context doInBackground(Activity... params) {
// get message number
mNum = Integer.parseInt(getXmlValue(el, NUM));
if (mNum <= lastNum) {
Log.i(AnkiDroidApp.TAG, "BroadcastMessage - message " + mNum + " already shown");
// Log.i(AnkiDroidApp.TAG, "BroadcastMessage - message " + mNum + " already shown");
continue;
}

// get message version info
mMinVersion = getXmlValue(el, MIN_VERSION);
if (mMinVersion != null && mMinVersion.length() > 0
&& compareVersions(mMinVersion, currentVersion) > 0) {
Log.i(AnkiDroidApp.TAG, "BroadcastMessage - too low AnkiDroid version (" + currentVersion + "), message " + mNum + " only for >= " + mMinVersion);
// Log.i(AnkiDroidApp.TAG, "BroadcastMessage - too low AnkiDroid version (" + currentVersion + "), message " + mNum + " only for >= " + mMinVersion);
continue;
}
mMaxVersion = getXmlValue(el, MAX_VERSION);
if (mMaxVersion != null && mMaxVersion.length() > 0
&& compareVersions(mMaxVersion, currentVersion) < 0) {
Log.i(AnkiDroidApp.TAG, "BroadcastMessage - too high AnkiDroid version (" + currentVersion + "), message " + mNum + " only for <= " + mMaxVersion);
// Log.i(AnkiDroidApp.TAG, "BroadcastMessage - too high AnkiDroid version (" + currentVersion + "), message " + mNum + " only for <= " + mMaxVersion);
continue;
}

Expand All @@ -212,7 +212,7 @@ && compareVersions(mMaxVersion, currentVersion) < 0) {
}
}
// no valid message left
Log.d(AnkiDroidApp.TAG, "BroadcastMessages: disable messaging system for today");
// Log.d(AnkiDroidApp.TAG, "BroadcastMessages: disable messaging system for today");
prefs.edit().putBoolean("showBroadcastMessageToday", false).commit();
mShowDialog = false;
}
Expand All @@ -236,7 +236,7 @@ && compareVersions(mMaxVersion, currentVersion) < 0) {

@Override
protected void onPostExecute(Context context) {
Log.d(AnkiDroidApp.TAG, "BroadcastMessage.DownloadBroadcastMessage.onPostExecute()");
// Log.d(AnkiDroidApp.TAG, "BroadcastMessage.DownloadBroadcastMessage.onPostExecute()");
if (!mShowDialog) {
return;
}
Expand Down Expand Up @@ -281,7 +281,7 @@ public void onClick(DialogInterface dialog, int which) {
}
try {
mDialog = builder.create();
Log.d(AnkiDroidApp.TAG, "BroadcastMessages: show dialog");
// Log.d(AnkiDroidApp.TAG, "BroadcastMessages: show dialog");
mDialog.setOwnerActivity(mActivity);
mDialog.show();
} catch (BadTokenException e) {
Expand All @@ -293,7 +293,7 @@ public void onClick(DialogInterface dialog, int which) {

private static void setMessageRead(Context context, int num) {
Editor editor = AnkiDroidApp.getSharedPrefs(context).edit();
Log.d(AnkiDroidApp.TAG, "BroadcastMessages: set message " + num + " as read");
// Log.d(AnkiDroidApp.TAG, "BroadcastMessages: set message " + num + " as read");
editor.putInt("lastMessageNum", num);
editor.commit();
}
Expand Down
18 changes: 9 additions & 9 deletions src/com/ichi2/anki/CardBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ protected void onDestroy() {
if (mUnmountReceiver != null) {
unregisterReceiver(mUnmountReceiver);
}
Log.i(AnkiDroidApp.TAG, "CardBrowser - onDestroy()");
// Log.i(AnkiDroidApp.TAG, "CardBrowser - onDestroy()");
}


Expand All @@ -384,7 +384,7 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuIn
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
Log.i(AnkiDroidApp.TAG, "CardBrowser - onBackPressed()");
// Log.i(AnkiDroidApp.TAG, "CardBrowser - onBackPressed()");
if (mSearchEditText.getText().length() == 0) {
closeCardBrowser(Activity.RESULT_OK);
} else {
Expand Down Expand Up @@ -512,7 +512,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}

if (requestCode == EDIT_CARD && resultCode != RESULT_CANCELED) {
Log.i(AnkiDroidApp.TAG, "CardBrowser: Saving card...");
// Log.i(AnkiDroidApp.TAG, "CardBrowser: Saving card...");
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_UPDATE_FACT, mUpdateCardHandler,
new DeckTask.TaskData(mCol.getSched(), sCardBrowserCard, false));
} else if (requestCode == ADD_NOTE && resultCode == RESULT_OK) {
Expand Down Expand Up @@ -596,10 +596,10 @@ public void onClick(DialogInterface arg0, int which) {
public void onClick(DialogInterface dialog, int which) {
String tag = allTags[which];
if (mSelectedTags.contains(tag)) {
Log.i(AnkiDroidApp.TAG, "unchecked tag: " + tag);
// Log.i(AnkiDroidApp.TAG, "unchecked tag: " + tag);
mSelectedTags.remove(tag);
} else {
Log.i(AnkiDroidApp.TAG, "checked tag: " + tag);
// Log.i(AnkiDroidApp.TAG, "checked tag: " + tag);
mSelectedTags.add(tag);
}
}
Expand Down Expand Up @@ -695,13 +695,13 @@ protected void onPrepareDialog(int id, Dialog dialog) {
int flags = Integer.parseInt(card.get("flags"));
if (flags == 2 || flags == 3) {
ad.changeListItem(CONTEXT_MENU_MARK, res.getString(R.string.card_browser_unmark_card));
Log.d(AnkiDroidApp.TAG, "Selected Card is currently marked");
// Log.d(AnkiDroidApp.TAG, "Selected Card is currently marked");
} else {
ad.changeListItem(CONTEXT_MENU_MARK, res.getString(R.string.card_browser_mark_card));
}
if (flags == 1 || flags == 3) {
ad.changeListItem(CONTEXT_MENU_SUSPEND, res.getString(R.string.card_browser_unsuspend_card));
Log.d(AnkiDroidApp.TAG, "Selected Card is currently suspended");
// Log.d(AnkiDroidApp.TAG, "Selected Card is currently suspended");
} else {
ad.changeListItem(CONTEXT_MENU_SUSPEND, res.getString(R.string.card_browser_suspend_card));
}
Expand All @@ -714,10 +714,10 @@ protected void onPrepareDialog(int id, Dialog dialog) {
public void onClick(DialogInterface dialog, int which) {
String tag = allTags[which];
if (mSelectedTags.contains(tag)) {
Log.d(AnkiDroidApp.TAG, "unchecked tag: " + tag);
// Log.d(AnkiDroidApp.TAG, "unchecked tag: " + tag);
mSelectedTags.remove(tag);
} else {
Log.d(AnkiDroidApp.TAG, "checked tag: " + tag);
// Log.d(AnkiDroidApp.TAG, "checked tag: " + tag);
mSelectedTags.add(tag);
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/com/ichi2/anki/CardEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void onPostExecute(DeckTask.TaskData result) {

@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(AnkiDroidApp.TAG, "CardEditor: onCreate");
// Log.i(AnkiDroidApp.TAG, "CardEditor: onCreate");
Themes.applyTheme(this);
super.onCreate(savedInstanceState);

Expand All @@ -310,7 +310,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
}
}
Log.i(AnkiDroidApp.TAG, "CardEditor: caller: " + mCaller);
// Log.i(AnkiDroidApp.TAG, "CardEditor: caller: " + mCaller);

SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext());

Expand Down Expand Up @@ -355,7 +355,7 @@ public void onClick(View v) {

switch (mCaller) {
case CALLER_NOCALLER:
Log.i(AnkiDroidApp.TAG, "CardEditor: no caller could be identified, closing");
// Log.i(AnkiDroidApp.TAG, "CardEditor: no caller could be identified, closing");
finish();
return;

Expand Down Expand Up @@ -696,7 +696,7 @@ private void resetEditFields (String[] content) {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
Log.i(AnkiDroidApp.TAG, "CardEditor - onBackPressed()");
// Log.i(AnkiDroidApp.TAG, "CardEditor - onBackPressed()");
closeCardEditor();
return true;
}
Expand All @@ -717,11 +717,11 @@ protected void onDestroy() {
@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO
// Log.i(AnkiDroidApp.TAG, "onSaveInstanceState: " + path);
// // Log.i(AnkiDroidApp.TAG, "onSaveInstanceState: " + path);
// outState.putString("deckFilename", path);
outState.putBoolean("addFact", mAddNote);
outState.putInt("caller", mCaller);
Log.i(AnkiDroidApp.TAG, "onSaveInstanceState - Ending");
// Log.i(AnkiDroidApp.TAG, "onSaveInstanceState - Ending");
}


Expand Down Expand Up @@ -1270,10 +1270,10 @@ private void actualizeTagDialog(StyledDialog ad) {
public void onClick(DialogInterface arg0, int which) {
String tag = allTags[which];
if (selectedTags.contains(tag)) {
Log.i(AnkiDroidApp.TAG, "unchecked tag: " + tag);
// Log.i(AnkiDroidApp.TAG, "unchecked tag: " + tag);
selectedTags.remove(tag);
} else {
Log.i(AnkiDroidApp.TAG, "checked tag: " + tag);
// Log.i(AnkiDroidApp.TAG, "checked tag: " + tag);
selectedTags.add(tag);
}
}
Expand Down
Loading

0 comments on commit f81bfbc

Please sign in to comment.