diff options
author | tom79 <tschneider.ac@gmail.com> | 2017-10-01 15:36:14 +0200 |
---|---|---|
committer | tom79 <tschneider.ac@gmail.com> | 2017-10-01 15:36:14 +0200 |
commit | f071a25820b227d62ec0c37d31dc0676b23182d6 (patch) | |
tree | 778ad41311cde75b30c428349f7d63ac8849f033 /app/src/main | |
parent | 8c91f242ba2e828b9029baae93225773a1586d3b (diff) |
Fixes some issues with menu + prepares 1.4.9-rc-1
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java | 58 | ||||
-rw-r--r-- | app/src/main/res/layout-sw600dp/activity_toot.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_toot.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/menu/main_toot.xml | 5 |
4 files changed, 32 insertions, 79 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index 2dcddec04..29ff1a8fd 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -149,7 +149,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc private Button toot_it; private AutoCompleteTextView toot_content; private EditText toot_cw_content; - private LinearLayout toot_reply_content_container; private Status tootReply = null; private String tootMention = null; private String urlMention = null; @@ -231,7 +230,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc int newInputType = toot_content.getInputType() & (toot_content.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); toot_content.setInputType(newInputType); toot_cw_content = (EditText) findViewById(R.id.toot_cw_content); - toot_reply_content_container = (LinearLayout) findViewById(R.id.toot_reply_content_container); picture_scrollview = (HorizontalScrollView) findViewById(R.id.picture_scrollview); toot_sensitive = (CheckBox) findViewById(R.id.toot_sensitive); //search_small_container = (LinearLayout) findViewById(R.id.search_small_container); @@ -714,6 +712,28 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc case android.R.id.home: finish(); return true; + case R.id.action_view_reply: + AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this); + alert.setTitle(R.string.toot_reply_content_title); + final TextView input = new TextView(TootActivity.this); + //Set the padding + input.setPadding(30, 30, 30, 30); + alert.setView(input); + String content = tootReply.getContent(); + if(tootReply.getReblog() != null) + content = tootReply.getReblog().getContent(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + input.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY)); + else + //noinspection deprecation + input.setText(Html.fromHtml(content)); + alert.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + dialog.dismiss(); + } + }); + alert.show(); + return true; case R.id.action_microphone: Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, @@ -906,6 +926,11 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc if( itemSchedule != null) itemSchedule.setVisible(false); } + MenuItem itemViewReply = menu.findItem(R.id.action_view_reply); + if( tootReply == null){ + if( itemViewReply != null) + itemViewReply.setVisible(false); + } return true; } @@ -1285,35 +1310,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc setTitle(R.string.toot_title_reply); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); - - FloatingActionButton ic_show = (FloatingActionButton) findViewById(R.id.toot_show_reply); - - ic_show.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this); - alert.setTitle(R.string.toot_reply_content_title); - final TextView input = new TextView(TootActivity.this); - //Set the padding - input.setPadding(30, 30, 30, 30); - alert.setView(input); - String content = tootReply.getContent(); - if(tootReply.getReblog() != null) - content = tootReply.getReblog().getContent(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - input.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY)); - else - //noinspection deprecation - input.setText(Html.fromHtml(content)); - alert.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - dialog.dismiss(); - } - }); - alert.show(); - } - }); - toot_reply_content_container.setVisibility(View.VISIBLE); switch (tootReply.getVisibility()){ case "public": visibility = "public"; diff --git a/app/src/main/res/layout-sw600dp/activity_toot.xml b/app/src/main/res/layout-sw600dp/activity_toot.xml index 301ef658e..b7c1aaa86 100644 --- a/app/src/main/res/layout-sw600dp/activity_toot.xml +++ b/app/src/main/res/layout-sw600dp/activity_toot.xml @@ -22,7 +22,6 @@ android:layout_height="match_parent" > <LinearLayout - xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -40,29 +39,6 @@ android:hint="@string/toot_cw_placeholder" android:layout_width="match_parent" android:layout_height="wrap_content" /> - <LinearLayout - android:id="@+id/toot_reply_content_container" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - > - <TextView - android:id="@+id/toot_reply_content_title" - android:text="@string/show_reply" - android:layout_width="wrap_content" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content" /> - <android.support.design.widget.FloatingActionButton - android:id="@+id/toot_show_reply" - android:layout_marginStart="30dp" - android:layout_marginLeft="30dp" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center_vertical|end" - app:fabSize="mini" - app:srcCompat="@drawable/ic_action_eye_open" /> - </LinearLayout> <AutoCompleteTextView android:layout_marginTop="10dp" android:id="@+id/toot_content" diff --git a/app/src/main/res/layout/activity_toot.xml b/app/src/main/res/layout/activity_toot.xml index a3c5ff942..5cb74d361 100644 --- a/app/src/main/res/layout/activity_toot.xml +++ b/app/src/main/res/layout/activity_toot.xml @@ -22,7 +22,6 @@ android:layout_height="match_parent" > <LinearLayout - xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -40,29 +39,6 @@ android:hint="@string/toot_cw_placeholder" android:layout_width="match_parent" android:layout_height="wrap_content" /> - <LinearLayout - android:id="@+id/toot_reply_content_container" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - > - <TextView - android:id="@+id/toot_reply_content_title" - android:text="@string/show_reply" - android:layout_width="0dp" - android:layout_weight="1" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content" /> - <android.support.design.widget.FloatingActionButton - android:id="@+id/toot_show_reply" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center_vertical|end" - app:fabSize="mini" - android:layout_margin="5dp" - app:srcCompat="@drawable/ic_action_eye_open" /> - </LinearLayout> <AutoCompleteTextView android:layout_marginTop="10dp" android:id="@+id/toot_content" diff --git a/app/src/main/res/menu/main_toot.xml b/app/src/main/res/menu/main_toot.xml index a8b468ce2..24e948e29 100644 --- a/app/src/main/res/menu/main_toot.xml +++ b/app/src/main/res/menu/main_toot.xml @@ -2,6 +2,11 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item + android:id="@+id/action_view_reply" + android:title="@string/microphone" + android:icon="@drawable/ic_action_eye_open" + app:showAsAction="always" /> + <item android:id="@+id/action_microphone" android:title="@string/microphone" android:icon="@drawable/ic_action_mic" |