{"id":262394,"date":"2015-07-28T10:26:02","date_gmt":"2015-07-28T06:26:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=262394"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=262394","title":{"rendered":"\u0429\u0443\u043f\u0430\u0435\u043c Kotlin (\u0438 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c Gradle) \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u043a\u0438-\u0434\u043b\u0438\u043d\u043d\u044b\u0445-\u0442\u0432\u0438\u0442\u043e\u0432 (\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438)"},"content":{"rendered":"<p>     \t\u042f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u043c HelloWorld \u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432. D \u043d\u0438\u0445 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u043e, \u0430 \u0432\u043e\u0442 \u043e\u0441\u0442\u0440\u044b\u0435 \u0443\u0433\u043b\u044b \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0434\u0435\u043b\u0438\u043a\u0430\u0442\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f. \u041f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043f\u043e\u0449\u0443\u043f\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u00ab\u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043e\u0434\u0430\u00bb, \u0430 \u043d\u0435 \u00ab\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0444\u0430\u0431\u0440\u0438\u043a \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e. \u041d\u0443 \u0447\u0442\u043e, \u043f\u043e\u0435\u0445\u0430\u043b\u0438?<\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/bz-GXC7x3iE?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u043a \u0437\u0430\u0434\u0430\u0447\u0435<\/h2>\n<p>  \u042f \u043b\u044e\u0431\u043b\u044e \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043d\u0438\u0433\u0438 \u0441 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0438 \u043b\u044e\u0431\u043b\u044e \u0442\u0432\u0438\u0442\u0438\u0442\u044c \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043d\u0438\u0433 \u0446\u0438\u0442\u0430\u0442\u044b. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0438 \u043a\u043d\u0438\u0433\u0438 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0446\u0438\u0442\u0430\u0442\u044b \u0434\u043b\u0438\u043d\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c 140 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u043b\u0430. \u0420\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u0432\u0443\u043c\u044f \u043f\u0443\u0442\u044f\u043c\u0438:<\/p>\n<ol>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0446\u0438\u0442\u0430\u0442\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0442\u0432\u0438\u0442\u0430\u043c\u0438<\/li>\n<li>\u0442\u0432\u0438\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u0430\u043c\u0438.<\/li>\n<\/ol>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u0442\u044c \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u0443\u0436\u0430\u0441\u043d\u044b\u043c. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -&gt; \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 -&gt; \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0443\u0436\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043b\u044e\u0431\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<h2>\u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u043b\u044e\u0441\u044b Kotlin<\/li>\n<li>\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0442\u0438\u043f\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 Gradle<\/li>\n<li>\u0443\u0442\u0430\u0449\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0440\u0438\u0444\u0442\u0430 \u0434\u043b\u044f \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043f\u0440\u0438\u0435\u043c\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0440\u0430\u0441\u0448\u0430\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437 \u0447\u0443\u0436\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432 \u0447\u0443\u0436\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043c\u0435\u043b\u043e\u0447\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u0411\u0435\u043d\u0435\u0444\u0438\u0442\u044b Kotlin<\/h2>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u0435\u0441\u044f\u0446\u044b, \u0441\u043b\u0430\u0432\u0430* Xamarin&#8217;\u0443, \u044f \u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0434 \u043c\u043e\u0431\u0438\u043b\u043a\u0438 \u043d\u0430 .NET (C#). \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 Android (\u0433\u0434\u0435 \u0446\u0430\u0440\u0438\u0442 Java 7 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434 Android 4.1+) \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0431\u044b \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e, \u043d\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442 \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u043c\u0435\u0442\u0435\u043d. \u0421\u0430\u0445\u0430\u0440\u043a\u0443 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442. Kotlin \u0436\u0435 \u0434\u0438\u043a\u043e \u0440\u0430\u0434\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e, \u043c\u0430\u0448\u0438\u043d\u0430 \u0437\u0430 \u0432\u0430\u0441 \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0445\u0438\u043b\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u044b.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e POJO-\u043a\u043b\u0430\u0441\u0441 \u0441 readonly \u043f\u043e\u043b\u044f\u043c? \u041b\u0435\u0433\u043a\u043e.<\/p>\n<pre><code class=\"java\">public class Size(val width:Int,val height:Int); <\/code><\/pre>\n<p>  \u0421\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445? \u041d\u043e \u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0445 \u0437\u0430 \u0432\u0430\u0441!<\/p>\n<pre><code class=\"java\">val textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG); var paint = Paint(); <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0447\u0435\u043c <b>var<\/b> \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0430 <b>val<\/b> \u2014 \u044d\u0442\u043e <b>final<\/b> \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u0430\u043c \u0435\u0451 \u0438\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u043a\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432\u0440\u043e\u0434\u0435 <b>with<\/b>:<\/p>\n<pre><code class=\"java\">fun alertError(text:String){     val builder = AlertDialog.Builder(this);     with(builder) {         setTitle(R.string.error_title)         setMessage(text)         setPositiveButton(R.string.ok, { dialogInterface, button -&gt; })     }     builder.create().show(); } <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0442\u044b\u043a\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 format \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443:<\/p>\n<pre><code class=\"java\">val cachePath = File(getExternalCacheDir(), &quot;temp&quot;); cachePath.mkdirs(); val fileName = &quot;$cachePath\/long_text_image.png&quot;; <\/code><\/pre>\n<p>  Callback&#8217;\u0438 \u0434\u043b\u044f \u043a\u043b\u0438\u043a\u043e\u0432 \u0442\u043e\u0436\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"java\">buttonSend.setOnClickListener {     val text = editText.getText().toString();     \/\/\u0438 \u0442.\u043f.... } <\/code><\/pre>\n<p>  \u0418 \u043a\u0430\u043a \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0448\u0435, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u00abnew\u00bb \u0442\u043e\u0436\u0435 \u0443\u043f\u0440\u0430\u0437\u0434\u043d\u0451\u043d.<\/p>\n<p>  \u0415\u0449\u0451 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043a\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 Kotlin, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u043d\u0435\u0442.<\/p>\n<pre><code class=\"java\">package com.newbilius.longtextsharer import [...]  public fun getMaxFontSizeOfMultilineText(text: String, maxSize: Size, maxTextSize: Int): Float {     fun getHeightOfMultiLineText(text: String, textSize: Int, maxWidth: Int): Int {     \/\/[...]     }      var textSize = maxTextSize;     while (getHeightOfMultiLineText(text, textSize, maxSize.width) &gt; maxSize.height)         textSize--;      return textSize.toFloat(); } <\/code><\/pre>\n<p>  \u0410 \u0435\u0449\u0451 \u043f\u043e\u0434 Kotlin+Android \u0443 Kotlin \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430 \u2014 <a href=\"http:\/\/kotlinlang.org\/docs\/tutorials\/android-plugin.html\">Kotlin Android Extensions<\/a>. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0431\u044b\u0442\u044c <b>findViewById()<\/b> \u043a\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0439 \u0441\u043e\u043d \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0438\u043d\u0442 \u0443\u0448\u0430\u043c\u0438:<\/p>\n<pre><code class=\"java\">import kotlinx.android.synthetic.activity.\u0438\u043c\u044f_xml_\u0444\u0430\u0439\u043b\u0430_activity.* \/\/\u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043a\u043e\u0434\u0435 ID-\u0449\u043d\u0438\u043a\u0438, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 XML'\u0435 override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)     setContentView(R.layout.activity_send)     editText.setText(getIntent().getStringExtra(Intent.EXTRA_TEXT));     \/\/[...] } <\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0447\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <b>RoboGuice<\/b>.<\/p>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 CallBack&#8217;\u0430:<\/p>\n<pre><code class=\"java\">buttonSend.setOnClickListener {     val text = editText.getText().toString();     if (text.length()==0)     {         alertError(R.string.error_empty_text);         return@setOnClickListener; \/\/\u0432\u043e\u0442 \u0442\u0443\u0442 \u0432\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0431\u0435\u0440\u0451\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u043c     }     \/\/[...] }  <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Gradle<\/h2>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u0431\u043e\u0440\u043a\u0430 Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gradle \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c. \u041f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 Groovy \u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 Gradle \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 (?) \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0433\u043e\u0434\u0430. \u041d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e, \u043f\u043e\u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0430\u043c\u0438. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0432 debug- \u0438 release-\u0441\u0431\u043e\u0440\u043a\u0435) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Gradle-\u0441\u043a\u0440\u0438\u043f\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>apply plugin: 'com.android.application' apply plugin: 'kotlin-android' import groovy.swing.SwingBuilder  buildscript {     ext.kotlin_version = '0.12.1218'     repositories {         jcenter()         mavenCentral()     }     dependencies {         classpath &quot;com.android.tools.build:gradle:1.1.1&quot;         classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;         classpath &quot;org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version&quot;     } }  repositories {     jcenter()     mavenCentral() }  gradle.taskGraph.whenReady { taskGraph -&gt;     if(taskGraph.hasTask(':longtextsharer:assembleRelease')) {         def pass = '';         pass = System.console().readPassword(&quot;\\nPlease enter key passphrase: &quot;)         pass = new String(pass)         if(pass.size() &lt;= 0) {             throw new InvalidUserDataException(&quot;You must enter a password to proceed.&quot;)         }         android.signingConfigs.release.storePassword = pass         android.signingConfigs.release.keyPassword = pass     } }  android {     compileSdkVersion 22     buildToolsVersion &quot;22.0.1&quot;      signingConfigs {         release {             storeFile file(&quot;sign\/SET_YOU_KEY.jks&quot;)             storePassword &quot;&quot;             keyAlias &quot;SET_YOU_KEY&quot;             keyPassword &quot;&quot;         }     }      defaultConfig {         applicationId &quot;com.newbilius.longtextsharer&quot;         minSdkVersion 16         targetSdkVersion 22         versionCode 1         versionName &quot;1.0&quot;     }     buildTypes {         debug {             debuggable true         }         release {             debuggable false             minifyEnabled true             signingConfig signingConfigs.release             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     }     sourceSets {         main.java.srcDirs += 'src\/main\/kotlin'     } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:22.2.1'     compile 'com.android.support:design:22.2.1'     compile &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot; }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041a \u0441\u043b\u043e\u0432\u0443, \u043a\u0440\u0430\u0439\u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>proguard<\/b> \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u0431\u0435\u0437 \u043d\u0435\u0451 \u0443 \u043c\u0435\u043d\u044f Kotlin-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u0438\u043b\u043e \u0440\u0430\u0437 \u0432 5 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 Java-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 proguard&#8217;\u043e\u043c \u0436\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0431\u044b\u043b\u0430 \u0432 100 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u0438\u043b\u0438 \u043e\u043a\u043e\u043b\u043e \u0442\u043e\u0433\u043e. \u0412 proguard-\u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e:<\/p>\n<pre><code>-dontwarn org.w3c.dom.events.*<\/code><\/pre>\n<p>  \u0412\u043f\u0440\u043e\u0447\u0435\u043c \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0430 \u0438\u0437 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 IntelliJ IDEA \u0432\u044b \u043d\u0430\u0442\u043a\u043d\u0451\u0442\u0435\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u2014 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0443 \u0432\u0430\u0441 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0442. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b <a href=\"https:\/\/www.timroes.de\/2014\/01\/19\/using-password-prompts-with-gradle-build-files\/\">\u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a> \u2014 \u043d\u043e \u043c\u043d\u0435 \u043e\u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u043e, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"bash\">Error:(29, 0) Gradle: Failed to create component for \u2018dialog\u2019 reason: java.awt.HeadlessException &gt; java.awt.HeadlessException (no error message) <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0432\u044b \u043f\u043e\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0443? \u0412\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, Java \u0438 \u0441\u0430\u043c\u043e\u0439 IDE \u0441\u0430\u043c\u044b\u0435 \u0441\u0432\u0435\u0436\u0438\u0435.<\/p>\n<h2>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>  \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0440\u0438\u0444\u0442\u0430 \u0434\u043b\u044f \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u2014 \u0432\u0441\u0451 \u0435\u0441\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 GitHub&#8217;\u0435.<\/p>\n<p>  <a href=\"https:\/\/github.com\/Newbilius\/longtext_sharer\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 GitHub.<\/a><\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u043a\u0430\u043a \u043f\u043e \u043c\u043d\u0435, \u043d\u0430 Kotlin \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (\u043a\u0430\u043a \u0438 \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438) \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0449\u0451 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0435 (\u0438 \u0443\u043c\u0435\u0441\u0442\u043d\u044b\u0435) \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Kotlin \u0438\u043b\u0438 Gradle \u2014 \u0436\u0434\u0443 pull-request&#8217;\u043e\u0432 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432!<\/p>\n<p>  * \u0441\u043b\u0430\u0432\u0430 \u043e\u0447\u0435\u043d\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u0430\u044f, \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u0438\u043b\u043e\u0442\u043e\u043d\u043d \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439 \u0443\u0436\u0435 \u0432 \u043f\u0443\u0442\u0438     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/263657\/\"> http:\/\/habrahabr.ru\/post\/263657\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u042f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u043c HelloWorld \u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432. D \u043d\u0438\u0445 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u043e, \u0430 \u0432\u043e\u0442 \u043e\u0441\u0442\u0440\u044b\u0435 \u0443\u0433\u043b\u044b \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0434\u0435\u043b\u0438\u043a\u0430\u0442\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f. \u041f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043f\u043e\u0449\u0443\u043f\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u00ab\u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043e\u0434\u0430\u00bb, \u0430 \u043d\u0435 \u00ab\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0444\u0430\u0431\u0440\u0438\u043a \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e. \u041d\u0443 \u0447\u0442\u043e, \u043f\u043e\u0435\u0445\u0430\u043b\u0438?<\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/bz-GXC7x3iE?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-262394","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=262394"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262394\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=262394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=262394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=262394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}