diff --git a/DesignResources/1024x500.jpg b/DesignResources/1024x500.jpg new file mode 100644 index 0000000..f2dffc7 Binary files /dev/null and b/DesignResources/1024x500.jpg differ diff --git a/DesignResources/1024x500.psd b/DesignResources/1024x500.psd new file mode 100644 index 0000000..004b7e4 Binary files /dev/null and b/DesignResources/1024x500.psd differ diff --git a/TaigiDict/.gitignore b/TaigiDict/.gitignore index 0582737..65e1a83 100644 --- a/TaigiDict/.gitignore +++ b/TaigiDict/.gitignore @@ -1,12 +1,4 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures -.externalNativeBuild + ### Android template # Built application files *.apk @@ -29,6 +21,7 @@ build/ # Local configuration file (sdk path, etc) local.properties +fabric.properties # Proguard folder generated by Eclipse proguard/ @@ -43,7 +36,14 @@ proguard/ captures/ # Intellij +*.iml .idea/workspace.xml +.idea/tasks.xml +.idea/libraries # Keystore files *.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + diff --git a/TaigiDict/app/build.gradle b/TaigiDict/app/build.gradle index af8fccc..a9a7998 100644 --- a/TaigiDict/app/build.gradle +++ b/TaigiDict/app/build.gradle @@ -1,4 +1,19 @@ +buildscript { + repositories { + maven { url 'https://maven.fabric.io/public' } + } + + dependencies { + classpath 'io.fabric.tools:gradle:1.+' + } +} apply plugin: 'com.android.application' +apply plugin: 'io.fabric' + +repositories { + maven { url 'https://maven.fabric.io/public' } +} + apply plugin: 'realm-android' android { @@ -10,7 +25,7 @@ android { minSdkVersion 16 targetSdkVersion 25 versionCode 1 - versionName "1.0" + versionName "1.0.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -22,16 +37,33 @@ android { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + + applicationVariants.all { variant -> + variant.outputs.each { output -> + project.ext { appName = 'MyAppName' } + def formattedDate = new Date().format('yyyyMMdd-HHmmss') + def newName = output.outputFile.name + newName = newName.replace("app-", "$rootProject.name-") + newName = newName.replace("-release", "-release-v" + versionName + "(" + versionCode + ")-" + formattedDate) + //noinspection GroovyAssignabilityCheck + output.outputFile = new File(output.outputFile.parent, newName) + } + } } } } +allprojects { + repositories { + maven { url 'https://jitpack.io' } + } +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - testCompile 'junit:junit:4.12' compile project(':taigi_dict_realm_model') @@ -51,20 +83,28 @@ dependencies { compile 'com.jakewharton:butterknife:8.4.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' - // UI - compile 'com.yqritc:recyclerview-flexibledivider:1.4.0' + // Font compile 'uk.co.chrisjenx:calligraphy:2.2.0' - // Material design - compile 'com.github.rey5137:material:1.2.4' + // Icon + compile "com.mikepenz:iconics-core:2.8.2@aar" + compile 'com.mikepenz:community-material-typeface:1.7.22.1@aar' // Rx -// compile 'io.reactivex:rxjava:1.2.5' -// compile 'io.reactivex:rxandroid:1.2.1' compile 'io.reactivex.rxjava2:rxjava:2.0.4' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' -// compile "com.github.akarnokd:rxjava2-interop:0.8.3" - // Media Player - compile 'com.google.android.exoplayer:exoplayer:r2.1.1' + // About + compile('com.mikepenz:aboutlibraries:5.9.1@aar') { + transitive = true + } + compile 'com.github.daniel-stoneuk:material-about-library:1.5.0' + + testCompile 'junit:junit:4.12' + compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') { + transitive = true; + } + compile('com.crashlytics.sdk.android:answers:1.3.11@aar') { + transitive = true; + } } diff --git a/TaigiDict/app/proguard-rules.pro b/TaigiDict/app/proguard-rules.pro index 9a7e272..18b5e3d 100644 --- a/TaigiDict/app/proguard-rules.pro +++ b/TaigiDict/app/proguard-rules.pro @@ -15,3 +15,11 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Android-Iconics: https://github.com/mikepenz/Android-Iconics +# AboutLibraries: https://github.com/mikepenz/AboutLibraries +-keep class .R +-keep class **.R$* { + ; +} + diff --git a/TaigiDict/app/src/main/AndroidManifest.xml b/TaigiDict/app/src/main/AndroidManifest.xml index 92ec864..0c35606 100644 --- a/TaigiDict/app/src/main/AndroidManifest.xml +++ b/TaigiDict/app/src/main/AndroidManifest.xml @@ -31,6 +31,9 @@ + \ No newline at end of file diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/MainActivity.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/MainActivity.java index 22a45f1..5cfa585 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/MainActivity.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/MainActivity.java @@ -14,7 +14,6 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); startActivity(new Intent(this, DictDrawerActivity.class)); -// startActivity(new Intent(this, TailoSearchActivity.class)); finish(); } } diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/TaigiDictApp.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/TaigiDictApp.java index 0314751..a6fc0a8 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/TaigiDictApp.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/TaigiDictApp.java @@ -2,10 +2,12 @@ import android.app.Application; +import com.crashlytics.android.Crashlytics; import com.eggheadgames.realmassethelper.IRealmAssetHelperStorageListener; import com.eggheadgames.realmassethelper.RealmAssetHelper; import com.eggheadgames.realmassethelper.RealmAssetHelperStatus; +import io.fabric.sdk.android.Fabric; import io.realm.Realm; import io.realm.RealmConfiguration; import uk.co.chrisjenx.calligraphy.CalligraphyConfig; @@ -18,6 +20,7 @@ public class TaigiDictApp extends Application { @Override public void onCreate() { super.onCreate(); + Fabric.with(this, new Crashlytics()); initRealm(); initCalligraphy(); diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/AboutFragment.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/AboutFragment.java new file mode 100644 index 0000000..64e96b9 --- /dev/null +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/AboutFragment.java @@ -0,0 +1,73 @@ +package com.taccotap.taigidict.portal; + + +import android.content.Context; +import android.content.pm.PackageManager; +import android.support.v4.app.Fragment; + +import com.danielstone.materialaboutlibrary.ConvenienceBuilder; +import com.danielstone.materialaboutlibrary.MaterialAboutFragment; +import com.danielstone.materialaboutlibrary.model.MaterialAboutActionItem; +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; +import com.danielstone.materialaboutlibrary.model.MaterialAboutList; +import com.danielstone.materialaboutlibrary.model.MaterialAboutTitleItem; +import com.mikepenz.community_material_typeface_library.CommunityMaterial; +import com.mikepenz.iconics.IconicsDrawable; +import com.taccotap.taigidict.R; + +public class AboutFragment extends MaterialAboutFragment { + + public AboutFragment() { + // Required empty public constructor + } + + public static Fragment newInstance() { + return new AboutFragment(); + } + + @Override + protected MaterialAboutList getMaterialAboutList(Context context) { + MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder(); + + // Add items to card + + appCardBuilder.addItem(new MaterialAboutTitleItem.Builder() + .text(R.string.app_name) + .icon(R.mipmap.ic_launcher) + .build()); + + try { + appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(context, + new IconicsDrawable(context, CommunityMaterial.Icon.cmd_android_debug_bridge).sizeDp(48), + getString(R.string.about_fragment_version_item_text), + false)); + + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + +// appCardBuilder.addItem(new MaterialAboutActionItem.Builder() +// .text("Changelog") +// .icon(context.getResources().getDrawable(R.drawable.ic_assignment_green_900_48dp)) +// .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(context, "Releases", "https://github.com/daniel-stoneuk/material-about-library/releases", true, false)) +// .build()); + + MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder(); + authorCardBuilder.title(getString(R.string.about_fragment_author_card_title_text)); + + authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(getString(R.string.about_fragment_author_item_text)) + .subText(getString(R.string.about_fragment_author_item_subtext)) + .icon(new IconicsDrawable(context, CommunityMaterial.Icon.cmd_account).sizeDp(48)) + .build()); + + authorCardBuilder.addItem(ConvenienceBuilder.createEmailItem(context, + new IconicsDrawable(context, CommunityMaterial.Icon.cmd_email_outline).sizeDp(48), + getString(R.string.help_fragment_email_me_item_text), + true, + getString(R.string.feedback_email), + getString(R.string.help_fragment_email_me_mail_title))); + + return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build()); + } +} diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/DictDrawerActivity.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/DictDrawerActivity.java index d5be458..983a027 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/DictDrawerActivity.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/DictDrawerActivity.java @@ -12,6 +12,8 @@ import android.view.MenuItem; import android.view.View; +import com.mikepenz.aboutlibraries.LibsBuilder; +import com.mikepenz.aboutlibraries.ui.LibsSupportFragment; import com.taccotap.taigidict.R; import com.taccotap.taigidict.tailo.TailoDictFragment; @@ -100,6 +102,33 @@ private void setCurrentContentFragment(int id) { if (supportActionBar != null) { supportActionBar.setTitle(R.string.nav_dict_tailo); } + } else if (id == R.id.nav_help) { + fragmentManager.beginTransaction() + .replace(R.id.content_dicts, HelpFragment.newInstance()) + .commit(); + if (supportActionBar != null) { + supportActionBar.setTitle(R.string.nav_help); + } + } else if (id == R.id.nav_about) { + fragmentManager.beginTransaction() + .replace(R.id.content_dicts, AboutFragment.newInstance()) + .commit(); + if (supportActionBar != null) { + supportActionBar.setTitle(R.string.nav_about); + } + } else if (id == R.id.nav_licenses) { + LibsSupportFragment fragment = new LibsBuilder() + .withAutoDetect(true) + .withLicenseShown(true) + .withVersionShown(true) + .supportFragment(); + + fragmentManager.beginTransaction() + .replace(R.id.content_dicts, fragment) + .commit(); + if (supportActionBar != null) { + supportActionBar.setTitle(R.string.nav_licenses); + } } } } diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/HelpFragment.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/HelpFragment.java new file mode 100644 index 0000000..f5efebb --- /dev/null +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/portal/HelpFragment.java @@ -0,0 +1,70 @@ +package com.taccotap.taigidict.portal; + +import android.content.Context; +import android.net.Uri; + +import com.danielstone.materialaboutlibrary.ConvenienceBuilder; +import com.danielstone.materialaboutlibrary.MaterialAboutFragment; +import com.danielstone.materialaboutlibrary.model.MaterialAboutActionItem; +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; +import com.danielstone.materialaboutlibrary.model.MaterialAboutList; +import com.danielstone.materialaboutlibrary.model.MaterialAboutTitleItem; +import com.mikepenz.community_material_typeface_library.CommunityMaterial; +import com.mikepenz.iconics.IconicsDrawable; +import com.taccotap.taigidict.R; + +public class HelpFragment extends MaterialAboutFragment { + + public HelpFragment() { + // Required empty public constructor + } + + public static HelpFragment newInstance() { + return new HelpFragment(); + } + + @Override + protected MaterialAboutList getMaterialAboutList(Context context) { + MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder(); + + // Add items to card + + appCardBuilder.addItem(new MaterialAboutTitleItem.Builder() + .text(getString(R.string.help_fragment_title_card_text)) + .icon(context.getResources().getDrawable(R.drawable.ic_favorite_green_900_48dp)) + .build()); + + MaterialAboutCard.Builder feedbackCardBuilder = new MaterialAboutCard.Builder(); + feedbackCardBuilder.title(getString(R.string.help_fragment_feedback_card_title_text)); + + feedbackCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(context, + new IconicsDrawable(context, CommunityMaterial.Icon.cmd_facebook_box).sizeDp(48), + getString(R.string.help_fragment_facebook_group_item_text), + true, + Uri.parse(getString(R.string.url_taigidictapp_facebook_group)))); + + feedbackCardBuilder.addItem(ConvenienceBuilder.createEmailItem(context, + new IconicsDrawable(context, CommunityMaterial.Icon.cmd_email_outline).sizeDp(48), + getString(R.string.help_fragment_email_me_item_text), + true, + getString(R.string.feedback_email), + getString(R.string.help_fragment_email_me_mail_title))); + + MaterialAboutCard.Builder helpCardBuilder = new MaterialAboutCard.Builder(); + helpCardBuilder.title(getString(R.string.help_fragment_help_card_title_text)); + + helpCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(context, + new IconicsDrawable(context, CommunityMaterial.Icon.cmd_star).sizeDp(48), + getString(R.string.help_fragment_rate_app_item_text), + null + )); + + helpCardBuilder.addItem(new MaterialAboutActionItem.Builder() + .text("Fork on GitHub") + .icon(new IconicsDrawable(context, CommunityMaterial.Icon.cmd_github_circle).sizeDp(48)) + .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(context, Uri.parse(getString(R.string.url_taigidictapp_github_repo)))) + .build()); + + return new MaterialAboutList(appCardBuilder.build(), feedbackCardBuilder.build(), helpCardBuilder.build()); + } +} diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchActivity.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchActivity.java index bd450e3..c9ba6a0 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchActivity.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchActivity.java @@ -13,6 +13,7 @@ import android.widget.RadioGroup; import com.taccotap.taigidict.R; +import com.taccotap.taigidict.tailo.utils.TailoConstants; import com.taccotap.taigidict.tailo.word.TailoWordActivity; import com.taccotap.taigidictmodel.tailo.TlTaigiWord; @@ -50,7 +51,7 @@ public class TailoSearchActivity extends AppCompatActivity implements SearchView private Realm mRealm; private int mCurrentSearchType = SEARCH_TYPE_LOMAJI; - private String mCurrentQueryString = "Tâi-gí"; + private String mCurrentQueryString = TailoConstants.DEFAULT_QUERY_STRING; private boolean mIsCurrentSearchEquals = false; @Override @@ -134,7 +135,7 @@ private void doSearch(String query, boolean isSearchEquals) { query = query.trim(); if (TextUtils.isEmpty(query)) { - query = "Tâi-gí"; + query = TailoConstants.DEFAULT_QUERY_STRING; } if (mCurrentSearchType == SEARCH_TYPE_LOMAJI) { diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchAdapter.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchAdapter.java index 1389056..d85721e 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchAdapter.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/search/TailoSearchAdapter.java @@ -7,6 +7,7 @@ import com.taccotap.taigidict.R; import com.taccotap.taigidict.databinding.ListitemTailoSearchBinding; +import com.taccotap.taigidict.tailo.utils.TailoConstants; import com.taccotap.taigidictmodel.tailo.TlTaigiWord; import io.reactivex.processors.PublishProcessor; @@ -27,7 +28,7 @@ public class TailoSearchAdapter extends RealmRecyclerViewAdapter mOnClickSubject = PublishProcessor.create(); public TailoSearchAdapter(Context context, Realm realm) { - super(context, realm.where(TlTaigiWord.class).contains("lomaji", "Tâi-gí").findAllAsync(), false); + super(context, realm.where(TlTaigiWord.class).contains("lomaji", TailoConstants.DEFAULT_QUERY_STRING).findAllAsync(), false); mRealm = realm; } diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoConstants.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoConstants.java index 4689402..50900da 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoConstants.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoConstants.java @@ -3,4 +3,6 @@ public class TailoConstants { public static final String URL_AUDIO_FILE_PREFIX = "http://twblg.dict.edu.tw/holodict_new/audio/"; public static final String URL_AUDIO_FILE_POSTFIX = ".mp3"; + + public static final String DEFAULT_QUERY_STRING = "Tâi-gí"; } diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoTaigiWordAudioUrlHelper.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoTaigiWordAudioUrlHelper.java index 4b47379..0e2ee26 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoTaigiWordAudioUrlHelper.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/utils/TailoTaigiWordAudioUrlHelper.java @@ -1,5 +1,7 @@ package com.taccotap.taigidict.tailo.utils; +import java.util.Locale; + public class TailoTaigiWordAudioUrlHelper { public static String getTaigiAudioUrl(int mainCode) { @@ -7,7 +9,7 @@ public static String getTaigiAudioUrl(int mainCode) { stringBuilder.append(TailoConstants.URL_AUDIO_FILE_PREFIX); - String leadingZeroMainCodeString = String.format("%05d", mainCode); + String leadingZeroMainCodeString = String.format(Locale.ENGLISH, "%05d", mainCode); stringBuilder.append(leadingZeroMainCodeString); stringBuilder.append(TailoConstants.URL_AUDIO_FILE_POSTFIX); diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/word/TailoWordActivity.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/word/TailoWordActivity.java index 6f306ec..079aaad 100644 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/word/TailoWordActivity.java +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/tailo/word/TailoWordActivity.java @@ -1,11 +1,8 @@ package com.taccotap.taigidict.tailo.word; -import android.content.Context; import android.databinding.DataBindingUtil; import android.media.AudioManager; import android.media.MediaPlayer; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; @@ -20,6 +17,7 @@ import com.taccotap.taigidict.R; import com.taccotap.taigidict.databinding.ActivityTailoWordBinding; import com.taccotap.taigidict.tailo.utils.TailoTaigiWordAudioUrlHelper; +import com.taccotap.taigidict.utils.NetworkUtils; import com.taccotap.taigidictmodel.tailo.TlDescription; import com.taccotap.taigidictmodel.tailo.TlExampleSentence; import com.taccotap.taigidictmodel.tailo.TlTaigiWord; @@ -164,7 +162,7 @@ public void onChange(RealmModel element) { @OnClick(R.id.fab) void onClickFab() { - if (!isNetworkAvailable()) { + if (!NetworkUtils.isNetworkAvailable(this)) { Toast.makeText(TailoWordActivity.this, R.string.toast_voice_need_network_connection, Toast.LENGTH_SHORT).show(); return; } @@ -243,10 +241,4 @@ protected void onDestroy() { } } - private boolean isNetworkAvailable() { - ConnectivityManager connectivityManager - = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); - return activeNetworkInfo != null && activeNetworkInfo.isConnected(); - } } \ No newline at end of file diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/ui/ClearableEditText.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/ui/ClearableEditText.java deleted file mode 100644 index b87d5a5..0000000 --- a/TaigiDict/app/src/main/java/com/taccotap/taigidict/ui/ClearableEditText.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.taccotap.taigidict.ui; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import android.text.Editable; -import android.text.TextWatcher; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.View; -import android.view.View.OnTouchListener; -import android.widget.EditText; - -import com.taccotap.taigidict.R; - -import static android.view.View.OnFocusChangeListener; - -/** - * A {@link EditText} field with a clear drawable. - */ -public class ClearableEditText extends EditText - implements OnTouchListener, OnFocusChangeListener, TextWatcher { - - private Drawable clearDrawable; - - public ClearableEditText(Context context) { - super(context); - init(); - } - - public ClearableEditText(Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public ClearableEditText(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - init(); - } - - private void init() { - clearDrawable = getCompoundDrawables()[2]; - if (clearDrawable == null) { - clearDrawable = getResources().getDrawable(R.drawable.ic_cancel_grey_400_36dp); - } - setClearDrawable(clearDrawable); - setClearIconVisible(false); - setOnTouchListener(this); - setOnFocusChangeListener(this); - addTextChangedListener(this); - } - - @Override - public boolean onTouch(View v, MotionEvent event) { - if (getCompoundDrawables()[2] != null) { - boolean tappedX = event.getX() > - (getWidth() - getPaddingRight() - clearDrawable.getIntrinsicWidth()); - if (tappedX) { - if (event.getAction() == MotionEvent.ACTION_UP) { - setText(""); - } - return true; - } - } - return false; - } - - @Override - public void onFocusChange(View v, boolean hasFocus) { - if (hasFocus) { - setClearIconVisible(isNotEmpty(getText().toString())); - } else { - setClearIconVisible(false); - } - } - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void afterTextChanged(Editable s) { - if (isFocused()) { - setClearIconVisible(isNotEmpty(s.toString())); - } - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - private boolean isNotEmpty(String text) { - return text != null && !text.isEmpty(); - } - - private void setClearIconVisible(boolean visible) { - boolean wasVisible = (getCompoundDrawables()[2] != null); - if (visible != wasVisible) { - Drawable x = visible ? clearDrawable : null; - setCompoundDrawables( - getCompoundDrawables()[0], - getCompoundDrawables()[1], - x, - getCompoundDrawables()[3]); - } - } - - public void setClearDrawable(Drawable clearDrawable) { - this.clearDrawable = clearDrawable; - this.clearDrawable.setBounds( - 0, - 0, - clearDrawable.getIntrinsicWidth(), - clearDrawable.getIntrinsicHeight()); - } -} \ No newline at end of file diff --git a/TaigiDict/app/src/main/java/com/taccotap/taigidict/utils/NetworkUtils.java b/TaigiDict/app/src/main/java/com/taccotap/taigidict/utils/NetworkUtils.java new file mode 100644 index 0000000..e25da49 --- /dev/null +++ b/TaigiDict/app/src/main/java/com/taccotap/taigidict/utils/NetworkUtils.java @@ -0,0 +1,15 @@ +package com.taccotap.taigidict.utils; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +public class NetworkUtils { + + public static final boolean isNetworkAvailable(Context context) { + ConnectivityManager connectivityManager + = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); + return activeNetworkInfo != null && activeNetworkInfo.isConnected(); + } +} diff --git a/TaigiDict/app/src/main/res/drawable-hdpi/ic_info_green_900_48dp.png b/TaigiDict/app/src/main/res/drawable-hdpi/ic_info_green_900_48dp.png new file mode 100644 index 0000000..cc3e42d Binary files /dev/null and b/TaigiDict/app/src/main/res/drawable-hdpi/ic_info_green_900_48dp.png differ diff --git a/TaigiDict/app/src/main/res/drawable-mdpi/ic_info_green_900_48dp.png b/TaigiDict/app/src/main/res/drawable-mdpi/ic_info_green_900_48dp.png new file mode 100644 index 0000000..6e0b24f Binary files /dev/null and b/TaigiDict/app/src/main/res/drawable-mdpi/ic_info_green_900_48dp.png differ diff --git a/TaigiDict/app/src/main/res/drawable-xhdpi/ic_info_green_900_48dp.png b/TaigiDict/app/src/main/res/drawable-xhdpi/ic_info_green_900_48dp.png new file mode 100644 index 0000000..34bdfed Binary files /dev/null and b/TaigiDict/app/src/main/res/drawable-xhdpi/ic_info_green_900_48dp.png differ diff --git a/TaigiDict/app/src/main/res/drawable-xxhdpi/ic_info_green_900_48dp.png b/TaigiDict/app/src/main/res/drawable-xxhdpi/ic_info_green_900_48dp.png new file mode 100644 index 0000000..cc757b9 Binary files /dev/null and b/TaigiDict/app/src/main/res/drawable-xxhdpi/ic_info_green_900_48dp.png differ diff --git a/TaigiDict/app/src/main/res/drawable-xxxhdpi/ic_info_green_900_48dp.png b/TaigiDict/app/src/main/res/drawable-xxxhdpi/ic_info_green_900_48dp.png new file mode 100644 index 0000000..2306484 Binary files /dev/null and b/TaigiDict/app/src/main/res/drawable-xxxhdpi/ic_info_green_900_48dp.png differ diff --git a/TaigiDict/app/src/main/res/layout/activity_tailo_word.xml b/TaigiDict/app/src/main/res/layout/activity_tailo_word.xml index 174295c..f328c42 100644 --- a/TaigiDict/app/src/main/res/layout/activity_tailo_word.xml +++ b/TaigiDict/app/src/main/res/layout/activity_tailo_word.xml @@ -178,7 +178,7 @@ android:textSize="15sp"/> + + + + + + ReactiveX + http://reactivex.io/ + + RxAndroid + RxJava.

This module adds the minimum classes to RxJava that make writing reactive components in Android applications easy and hassle-free. More specifically, it provides a Scheduler that schedules on the main UI thread or any given Handler.]]>
+ https://github.com/ReactiveX/RxAndroid + 2.0.1 + + true + https://github.com/ReactiveX/RxAndroid + + io.reactivex.android + + apache_2_0 + +
\ No newline at end of file diff --git a/TaigiDict/app/src/main/res/values/aboutLibrary_rxjava2_strings.xml b/TaigiDict/app/src/main/res/values/aboutLibrary_rxjava2_strings.xml new file mode 100644 index 0000000..2432785 --- /dev/null +++ b/TaigiDict/app/src/main/res/values/aboutLibrary_rxjava2_strings.xml @@ -0,0 +1,21 @@ + + + + + + ReactiveX + http://reactivex.io/ + + RxJava + RxJava is a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences.

It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety and concurrent data structures.]]>
+ https://github.com/ReactiveX/RxJava + 2.0.4 + + true + https://github.com/ReactiveX/RxJava + + io.reactivex + + apache_2_0 + +
\ No newline at end of file diff --git a/TaigiDict/app/src/main/res/values/aboutLibrary_tailodict_strings.xml b/TaigiDict/app/src/main/res/values/aboutLibrary_tailodict_strings.xml new file mode 100644 index 0000000..2ceed48 --- /dev/null +++ b/TaigiDict/app/src/main/res/values/aboutLibrary_tailodict_strings.xml @@ -0,0 +1,25 @@ + + + + + + 臺灣教育部 + http://twblg.dict.edu.tw/holodict_new/index.html + + 臺灣閩南語常用詞辭典 + 臺灣閩南語常用詞辭典 授權聲明:

+ 臺灣閩南語常用詞辭典及相關資料皆為教育部國語推行委員會編訂,所含相關資料之所有權歸教育部所有。

+ 本辭典之「文字內容」部分以 創用CC姓名標示-禁止改作 3.0 臺灣 授權條款釋出。]]>
+ http://twblg.dict.edu.tw/holodict_new/index.html + 20160602 + + false + http://twblg.dict.edu.tw/holodict_new/index.html + + com.taccotap.taigidictmodel.tailo + + CC BY-ND 3.0 TW + https://creativecommons.org/licenses/by-nd/3.0/tw/ + 姓名標示-禁止改作 3.0 台灣 + +
\ No newline at end of file diff --git a/TaigiDict/app/src/main/res/values/strings.xml b/TaigiDict/app/src/main/res/values/strings.xml index 01ce7ef..916bf6f 100644 --- a/TaigiDict/app/src/main/res/values/strings.xml +++ b/TaigiDict/app/src/main/res/values/strings.xml @@ -6,9 +6,10 @@ 其他 設定 需要你ê幫贊 + 關於 授權資訊 - 請選一種揣ê方式: + 請選一種揣 ê 方式: 臺語羅馬字 對應ê華語漢字 全文關鍵字 @@ -23,7 +24,28 @@ 語音ê功能需要上網才會使聽。 真歹勢,這無法度聽。 + 多謝你 ê 使用,若是有啥物問題,請你對下跤 ê 方式來和我反應。\n\n若是你會使來幫贊,不管是建議 kap 指教,抑是提供其他 ê 辭典資料,想欲鬥出力出錢,攏誠歡迎,請和我連絡。 + 建議 kap 指教 + 需要你 ê 幫贊 + 面冊 ê 社團 + https://www.facebook.com/groups/TaigiDictApp/ + 寫批予我 + taccotap@gmail.com + 臺語辭典APP ê 建議 kap 指教 + 若是袂䆀用,請鬥拍 5 粒星! + https://github.com/shiami/AndroidTaigiDict + + 版本 + 作者 + Hê-bí + Tánn-káu, Tâi-oân + navigation drawer open navigation drawer close + + true + false + +