Skip to content

Commit

Permalink
version 3.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
suragch committed Oct 27, 2023
1 parent 076b3e9 commit b468f12
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 143 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 13 additions & 125 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'net.studymongolian:mongol-library:2.1.0'
implementation 'com.github.suragch:mongol-library:2.1.0'
}
10 changes: 6 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize">
android:windowSoftInputMode="stateHidden|adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -38,7 +38,8 @@
<activity android:name=".CodeConverterDetailsActivity" />
<activity
android:name=".ReaderActivity"
android:noHistory="true">
android:noHistory="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand Down Expand Up @@ -66,7 +67,8 @@
<service
android:name=".ChimeeInputMethodService"
android:label="@string/keyboard_name"
android:permission="android.permission.BIND_INPUT_METHOD">
android:permission="android.permission.BIND_INPUT_METHOD"
android:exported="true">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

@Override
public void onBackPressed() {
super.onBackPressed();
handleUserFinishing();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

@Override
public void onBackPressed() {
super.onBackPressed();
handleUserFinishing();
}

Expand Down
26 changes: 14 additions & 12 deletions app/src/main/java/net/studymongolian/chimee/UserDictionary.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.studymongolian.chimee;

import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
Expand Down Expand Up @@ -280,6 +281,7 @@ static int importWordAndFollowingList(Context context, ArrayList<CharSequence> t
* @param word the word whose following list needs updating
* @param followingWord the following word to add
*/
@SuppressLint("Range")
static void addFollowing(Context context, String word, String followingWord) {

// do error checking on input params
Expand All @@ -294,16 +296,16 @@ static void addFollowing(Context context, String word, String followingWord) {
String[] projection = new String[]{_ID, FOLLOWING};
String selection = WORD + "=?";
String[] selectionArgs = {word};
try (Cursor cursor = resolver.query(CONTENT_URI, projection, selection,
selectionArgs, null)) {
if (cursor != null && cursor.moveToNext()) {
wordId = cursor.getLong(cursor.getColumnIndex(_ID));
followingString = cursor.getString(cursor
.getColumnIndex(FOLLOWING));
try (Cursor cursor = resolver.query(CONTENT_URI, projection, selection,
selectionArgs, null)) {
if (cursor != null && cursor.moveToNext()) {
wordId = cursor.getLong(cursor.getColumnIndex(_ID));
followingString = cursor.getString(cursor
.getColumnIndex(FOLLOWING));
}
} catch (Exception e) {
Log.e("UserDictionary", e.toString());
}
} catch (Exception e) {
Log.e("UserDictionary", e.toString());
}
if (wordId == -1) {
return;
}
Expand Down Expand Up @@ -366,8 +368,8 @@ static int incrementFrequency(Context context, String word) {
return -1;
}

long id = cursor.getLong(cursor.getColumnIndex(UserDictionary.Words._ID));
int frequency = cursor.getInt(cursor.getColumnIndex(UserDictionary.Words.FREQUENCY));
@SuppressLint("Range") long id = cursor.getLong(cursor.getColumnIndex(UserDictionary.Words._ID));
@SuppressLint("Range") int frequency = cursor.getInt(cursor.getColumnIndex(UserDictionary.Words.FREQUENCY));
cursor.close();

frequency++;
Expand Down Expand Up @@ -415,7 +417,7 @@ static void deleteFollowingWord(Context context, String word, String followingWo
return;
}

String followingString = cursor.getString(cursor.getColumnIndex(Words.FOLLOWING));
@SuppressLint("Range") String followingString = cursor.getString(cursor.getColumnIndex(Words.FOLLOWING));
cursor.close();

followingString = removeWordFromFollowingString(followingString, followingWord);
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

Expand Down

0 comments on commit b468f12

Please sign in to comment.