Skip to content

Commit

Permalink
qdict 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen D. Nam committed Mar 2, 2016
1 parent df41da6 commit faa4bc5
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 33 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# QDict
This is an open source Android dictionary application which support 'stardict' format dictionaries.
Playstore: https://play.google.com/store/apps/details?id=com.annie.dictionary
2 changes: 1 addition & 1 deletion qDict/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.annie.dictionary"
android:versionCode="20151124"
android:versionCode="20160302"
android:versionName="@string/app_version" >

<uses-sdk
Expand Down
6 changes: 3 additions & 3 deletions qDict/src/main/java/com/annie/dictionary/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public void showSearchContent() {
} else {
try {
mTransaction = mFragmentManager.beginTransaction();
Fragment searchFrag = new SearchFragment(mSpeechEng, mDictions, keyword, true);
Fragment searchFrag = SearchFragment.newInstance(mSpeechEng, mDictions, keyword, true);
mTransaction.replace(R.id.content_frame, searchFrag).commit();
mCurrentNavPosition = NAVIG.SEARCH;
} catch (IllegalStateException ex) {
Expand Down Expand Up @@ -581,7 +581,7 @@ public void onActionButtonClick(View v) {
@Override
public void onNavigationItemSelected(final String title, final int position) {
if (position == NAVIG.SELECT_DICT) {
Fragment fragment = new ListDictFragment(mDictions);
Fragment fragment = ListDictFragment.newInstance(mDictions);
setMenuFragment(fragment);
} else {
onNavig = true;
Expand Down Expand Up @@ -625,7 +625,7 @@ public void setFragment(String keyword, int position) {
switch (position) {
case NAVIG.HOME:
case NAVIG.SEARCH:
fragment = new SearchFragment(mSpeechEng, mDictions, keyword, position == NAVIG.SEARCH);
fragment = SearchFragment.newInstance(mSpeechEng, mDictions, keyword, position == NAVIG.SEARCH);
break;
case NAVIG.RECENT:
case NAVIG.FAVORITE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setHomeButtonEnabled(true);
if (savedInstanceState == null) {
FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
mFrag = new SettingFragment(DictSpeechEng.getInstance(getApplicationContext()));
mFrag = SettingFragment.newInstance(DictSpeechEng.getInstance(getApplicationContext()));
t.replace(R.id.setting_frame, mFrag);
t.commit();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ public class ListDictFragment extends ListFragment implements Def, OnItemClickLi
public ListDictFragment() {

}

public ListDictFragment(QDictions dictions) {
mDictions = dictions;
public static final ListDictFragment newInstance(QDictions dictions){
ListDictFragment f = new ListDictFragment();
f.mDictions = dictions;
return f;
}

public void setDictions(QDictions dictions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ public SearchFragment() {
// default constructor
}

public SearchFragment(DictSpeechEng dictSpeechEng, QDictions dictions, String keyword, boolean search) {
mDictions = dictions;
mSpeechEng = dictSpeechEng;
mKeyword = keyword;
mIsSearch = search;
public static final SearchFragment newInstance(DictSpeechEng dictSpeechEng, QDictions dictions, String keyword, boolean search) {
SearchFragment s = new SearchFragment();
s.mDictions = dictions;
s.mSpeechEng = dictSpeechEng;
s.mKeyword = keyword;
s.mIsSearch = search;
return s;
}

public void setDictions(QDictions dictions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ public SettingFragment() {
// default constructor
}

public SettingFragment(DictSpeechEng speechEng) {
mSpeechEng = speechEng;
public static final SettingFragment newInstance(DictSpeechEng speechEng) {
SettingFragment s = new SettingFragment();
s.mSpeechEng = speechEng;
return s;
}

public void SetSpeechEng(DictSpeechEng speechEng) {
Expand Down
17 changes: 7 additions & 10 deletions qDict/src/main/java/com/mmt/widget/slidemenu/SlidingMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class SlidingMenu extends RelativeLayout {

Expand Down Expand Up @@ -111,8 +112,7 @@ public interface OnOpenListener {
* the object created with that class is registered with a component using
* the component's <code>addOnOpenedListener<code> method. When the onOpened
* event occurs, that object's appropriate method is invoked.
*
* @see OnOpenedEvent
*
*/
public interface OnOpenedListener {

Expand All @@ -128,8 +128,7 @@ public interface OnOpenedListener {
* the object created with that class is registered with a component using
* the component's <code>addOnCloseListener<code> method. When the onClose
* event occurs, that object's appropriate method is invoked.
*
* @see OnCloseEvent
*
*/
public interface OnCloseListener {

Expand All @@ -145,8 +144,7 @@ public interface OnCloseListener {
* the object created with that class is registered with a component using
* the component's <code>addOnClosedListener<code> method. When the onClosed
* event occurs, that object's appropriate method is invoked.
*
* @see OnClosedEvent
*
*/
public interface OnClosedListener {

Expand Down Expand Up @@ -407,7 +405,7 @@ public void setMenu(int res) {
/**
* Set the behind view (menu) content to the given View.
*
* @param view
* @param v
* The desired content to display.
*/
public void setMenu(View v) {
Expand Down Expand Up @@ -438,7 +436,7 @@ public void setSecondaryMenu(int res) {
/**
* Set the secondary behind view (right menu) content to the given View.
*
* @param view
* @param v
* The desired content to display.
*/
public void setSecondaryMenu(View v) {
Expand Down Expand Up @@ -1097,7 +1095,7 @@ protected boolean fitSystemWindows(Rect insets) {
int topPadding = insets.top;
int bottomPadding = insets.bottom;
String brand = android.os.Build.BRAND;
if (Utils.hasLlAbove() && !(brand.equalsIgnoreCase("Bkav") || brand.equalsIgnoreCase("Samsung"))) {
if (Utils.hasLlAbove() && !(brand.equalsIgnoreCase("Bkav") || brand.equalsIgnoreCase("Samsung") || brand.equalsIgnoreCase("Xiaomi"))) {

Resources resources = getContent().getResources();
boolean isBottom = isSystemBarOnBottom(resources);
Expand All @@ -1119,7 +1117,6 @@ protected boolean fitSystemWindows(Rect insets) {
}

if (!mActionbarOverlay) {
Log.v(TAG, "setting padding!");
setPadding(leftPadding, topPadding, rightPadding, bottomPadding);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion qDict/src/main/res/layout/layout_list_dict.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res/com.annie.dictionary"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:id="@+id/list_dict_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion qDict/src/main/res/values/array.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">

<string-array name="function_lables" translatable="false">
<item>@string/guide_lable</item>
Expand Down
2 changes: 1 addition & 1 deletion qDict/src/main/res/values/keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<string name="prefs_key_capture_notification" translatable="false">prefs_key_capture_notification</string>

<!-- app version -->
<string name="app_version" translatable="false">2.0.4</string>
<string name="app_version" translatable="false">2.0.5</string>
<string name="app_email" translatable="false">madman.hust@gmail.com</string>

</resources>
14 changes: 9 additions & 5 deletions qDict/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">

<string name="app_name" translatable="false">QDict</string>
<string name="action_search">Search</string>
Expand All @@ -9,18 +12,19 @@
<string name="prefs_title_whatsnew" translatable="false">What\'s New?</string>
<string name="prefs_title_help">Help</string>
<string name="prefs_title_feed_back">Feedback</string>
<string name="btn_more_apps" translatable="false">More Apps</string>
<string name="btn_more_apps">More Apps</string>

<!-- action -->
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="delete">Remove</string>
<string name="checked_all">Select All</string>
<string name="unchecked_all">Unselect All</string>
<string name="checked_all">Select all</string>
<string name="unchecked_all">Unselect all</string>
<string name="hide">Hide</string>
<string name="close">Close</string>
<string name="corner">Corner</string>
<string name="maximize">Maximize</string>
<string name="delete_all">Delete all</string>
<string name="delete_all_recent_summary">Do you want to delete all recent words?</string>
<string name="delete_all_favorite_summary">Do you want to delete all favorite words?</string>
<string name="delete_recent_summary">Do you want to delete recent words?</string>
Expand Down Expand Up @@ -65,7 +69,7 @@
<string name="pattern_query_prompt">Press \'wordlist\' button to \'pattern\' query with keyword above.</string>

<!-- voice -->
<string name="press_on_when_done" translatable="false">Press on the recording icon when you are done!</string>
<string name="press_on_when_done">Press on the recording icon when you are done!</string>
<!-- setting -->
<string name="prefs_category_title_general">General</string>
<string name="prefs_title_source">Data</string>
Expand Down

0 comments on commit faa4bc5

Please sign in to comment.