diff --git a/.idea/libraries/animated_vector_drawable_24_2_0.xml b/.idea/libraries/animated_vector_drawable_24_2_0.xml deleted file mode 100644 index 0a374b7..0000000 --- a/.idea/libraries/animated_vector_drawable_24_2_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/appcompat_v7_24_2_0.xml b/.idea/libraries/appcompat_v7_24_2_0.xml deleted file mode 100644 index f11eefb..0000000 --- a/.idea/libraries/appcompat_v7_24_2_0.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/design_24_2_0.xml b/.idea/libraries/design_24_2_0.xml deleted file mode 100644 index 79d967c..0000000 --- a/.idea/libraries/design_24_2_0.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_analytics_10_0_1.xml b/.idea/libraries/firebase_analytics_10_0_1.xml deleted file mode 100644 index 4cf6b2b..0000000 --- a/.idea/libraries/firebase_analytics_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_analytics_impl_10_0_1.xml b/.idea/libraries/firebase_analytics_impl_10_0_1.xml deleted file mode 100644 index f01eed7..0000000 --- a/.idea/libraries/firebase_analytics_impl_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_common_10_0_1.xml b/.idea/libraries/firebase_common_10_0_1.xml deleted file mode 100644 index 5e58fd2..0000000 --- a/.idea/libraries/firebase_common_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_core_10_0_1.xml b/.idea/libraries/firebase_core_10_0_1.xml deleted file mode 100644 index 7eac249..0000000 --- a/.idea/libraries/firebase_core_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_iid_10_0_1.xml b/.idea/libraries/firebase_iid_10_0_1.xml deleted file mode 100644 index 8b20884..0000000 --- a/.idea/libraries/firebase_iid_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/firebase_messaging_10_0_1.xml b/.idea/libraries/firebase_messaging_10_0_1.xml deleted file mode 100644 index 9274a51..0000000 --- a/.idea/libraries/firebase_messaging_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/hamcrest_core_1_3.xml b/.idea/libraries/hamcrest_core_1_3.xml deleted file mode 100644 index 157e3f3..0000000 --- a/.idea/libraries/hamcrest_core_1_3.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/junit_4_12.xml b/.idea/libraries/junit_4_12.xml deleted file mode 100644 index 305df30..0000000 --- a/.idea/libraries/junit_4_12.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/mobmetricalib_2_51.xml b/.idea/libraries/mobmetricalib_2_51.xml deleted file mode 100644 index a617f70..0000000 --- a/.idea/libraries/mobmetricalib_2_51.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/play_services_basement_10_0_1.xml b/.idea/libraries/play_services_basement_10_0_1.xml deleted file mode 100644 index b4d86ac..0000000 --- a/.idea/libraries/play_services_basement_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/play_services_tasks_10_0_1.xml b/.idea/libraries/play_services_tasks_10_0_1.xml deleted file mode 100644 index b9e9877..0000000 --- a/.idea/libraries/play_services_tasks_10_0_1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/recyclerview_v7_24_2_0.xml b/.idea/libraries/recyclerview_v7_24_2_0.xml deleted file mode 100644 index 7685fa4..0000000 --- a/.idea/libraries/recyclerview_v7_24_2_0.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_annotations_24_2_0.xml b/.idea/libraries/support_annotations_24_2_0.xml deleted file mode 100644 index b01b9db..0000000 --- a/.idea/libraries/support_annotations_24_2_0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_compat_24_2_0.xml b/.idea/libraries/support_compat_24_2_0.xml deleted file mode 100644 index 47523fc..0000000 --- a/.idea/libraries/support_compat_24_2_0.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_core_ui_24_2_0.xml b/.idea/libraries/support_core_ui_24_2_0.xml deleted file mode 100644 index d556aee..0000000 --- a/.idea/libraries/support_core_ui_24_2_0.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_core_utils_24_2_0.xml b/.idea/libraries/support_core_utils_24_2_0.xml deleted file mode 100644 index d25d4e2..0000000 --- a/.idea/libraries/support_core_utils_24_2_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_fragment_24_2_0.xml b/.idea/libraries/support_fragment_24_2_0.xml deleted file mode 100644 index 0454e30..0000000 --- a/.idea/libraries/support_fragment_24_2_0.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_media_compat_24_2_0.xml b/.idea/libraries/support_media_compat_24_2_0.xml deleted file mode 100644 index a384736..0000000 --- a/.idea/libraries/support_media_compat_24_2_0.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_v4_24_2_0.xml b/.idea/libraries/support_v4_24_2_0.xml deleted file mode 100644 index c8f65e5..0000000 --- a/.idea/libraries/support_v4_24_2_0.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_vector_drawable_24_2_0.xml b/.idea/libraries/support_vector_drawable_24_2_0.xml deleted file mode 100644 index f11f5ef..0000000 --- a/.idea/libraries/support_vector_drawable_24_2_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/volley_1_0_0.xml b/.idea/libraries/volley_1_0_0.xml deleted file mode 100644 index 319ac37..0000000 --- a/.idea/libraries/volley_1_0_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 211abac..8740b82 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/java/ru/aacidov/distalkpro/GridViewController.java b/app/src/main/java/ru/aacidov/distalkpro/GridViewController.java index 5adf7c8..e3bf9e7 100755 --- a/app/src/main/java/ru/aacidov/distalkpro/GridViewController.java +++ b/app/src/main/java/ru/aacidov/distalkpro/GridViewController.java @@ -1,16 +1,22 @@ package ru.aacidov.distalkpro; import android.app.Activity; +import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; +import android.graphics.drawable.ColorDrawable; import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.View; +import android.view.ViewGroup; +import android.view.Window; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.GridView; +import android.widget.ImageView; +import android.widget.RelativeLayout; import com.yandex.metrica.YandexMetrica; @@ -30,6 +36,7 @@ public class GridViewController implements AdapterView.OnItemLongClickListener, private GridView gv; private Context cxt; private String[] pictureMenuItems; + private ImageItem[] items; private static GridViewController instance; public GridViewController() { @@ -56,14 +63,34 @@ public int setColumnWidth(int width){ } public void load() { - ImageItem[] items = mfs.getImages(); + items = mfs.getImages(); gv.setAdapter(new ImageAdapter(cxt, R.layout.grid_view_item, items)); } + public void showImage(ImageItem image) { + Dialog builder = new Dialog(cxt); + builder.requestWindowFeature(Window.FEATURE_NO_TITLE); + builder.getWindow().setBackgroundDrawable( + new ColorDrawable(android.graphics.Color.TRANSPARENT)); + builder.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialogInterface) { + //nothing; + } + }); + + ImageView imageView = new ImageView(cxt); + imageView.setImageBitmap(image.getImage()); + builder.addContentView(imageView, new RelativeLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); + builder.show(); + } + @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { + showImage(items[i]); String text = mfs.getText(i); - tts.speak(text); YandexMetriсaHelper.saidEvent(text); } diff --git a/app/src/main/java/ru/aacidov/distalkpro/TTS.java b/app/src/main/java/ru/aacidov/distalkpro/TTS.java index 87542d6..114376c 100755 --- a/app/src/main/java/ru/aacidov/distalkpro/TTS.java +++ b/app/src/main/java/ru/aacidov/distalkpro/TTS.java @@ -2,6 +2,7 @@ import android.content.Context; import android.speech.tts.TextToSpeech; +import android.widget.Toast; import java.util.Locale; @@ -16,10 +17,16 @@ public TTS() { tts = new TextToSpeech(MainActivity.context, new TextToSpeech.OnInitListener() { @Override public void onInit(int i) { - tts.setLanguage(Locale.getDefault()); + if(i == TextToSpeech.SUCCESS) { + tts.setLanguage(Locale.getDefault()); + } + else if (i == TextToSpeech.LANG_MISSING_DATA || + i == TextToSpeech.LANG_NOT_SUPPORTED) { + Toast.makeText(MainActivity.context, "Error initializing text to speech!", Toast.LENGTH_LONG).show(); + return; + } } }); - } public static TTS getInstance() { diff --git a/build.gradle b/build.gradle index 363efae..17e953a 100755 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.yandex.android:mobmetricalib:2.51' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 297777f..fe07b48 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 18 22:13:25 MSK 2017 +#Tue Dec 19 14:46:08 MSK 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip