move note display into menuitem to save space

This commit is contained in:
Eric House 2020-08-13 13:01:49 -07:00
parent 360f454c3e
commit fe742b7e81
4 changed files with 21 additions and 12 deletions

View file

@ -26,6 +26,7 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -136,6 +137,7 @@ public class DictBrowseDelegate extends DelegateBase
private Spinner m_spinnerMin; private Spinner m_spinnerMin;
private Spinner m_spinnerMax; private Spinner m_spinnerMax;
private boolean m_newAlertShown; private boolean m_newAlertShown;
private String m_desc;
private class DictListAdapter extends BaseAdapter private class DictListAdapter extends BaseAdapter
implements SectionIndexer { implements SectionIndexer {
@ -258,12 +260,7 @@ public class DictBrowseDelegate extends DelegateBase
} ) } )
.setExpanded( m_browseState.m_expanded ); .setExpanded( m_browseState.m_expanded );
String desc = XwJNI.dict_getDesc( m_dict ); m_desc = XwJNI.dict_getDesc( m_dict );
if ( null != desc ) {
TextView view = (TextView)findViewById( R.id.desc );
view.setVisibility( View.VISIBLE );
view.setText( desc );
}
int[] ids = { R.id.button_useconfig, R.id.button_addBlank, }; int[] ids = { R.id.button_useconfig, R.id.button_addBlank, };
for ( int id : ids ) { for ( int id : ids ) {
@ -358,6 +355,14 @@ public class DictBrowseDelegate extends DelegateBase
return dialog; return dialog;
} }
@Override
public boolean onPrepareOptionsMenu( Menu menu )
{
Utils.setItemVisible( menu, R.id.dicts_shownote,
null != m_desc );
return true;
}
@Override @Override
public boolean onOptionsItemSelected( MenuItem item ) public boolean onOptionsItemSelected( MenuItem item )
{ {
@ -370,6 +375,11 @@ public class DictBrowseDelegate extends DelegateBase
case R.id.dicts_showfaq: case R.id.dicts_showfaq:
showFaq( FAQ_PARAMS ); showFaq( FAQ_PARAMS );
break; break;
case R.id.dicts_shownote:
makeOkOnlyBuilder( m_desc )
.setTitle(R.string.show_note_menu)
.show();
break;
default: default:
handled = false; handled = false;
} }

View file

@ -10,12 +10,6 @@
android:layout_weight="1" android:layout_weight="1"
> >
<TextView android:id="@+id/desc"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:visibility="gone"
/>
<!-- A summary followed by a hideable filter-config section --> <!-- A summary followed by a hideable filter-config section -->
<LinearLayout android:orientation="vertical" <LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -5,6 +5,9 @@
<item android:id="@+id/dicts_showtiles" <item android:id="@+id/dicts_showtiles"
android:title="@string/show_tiles_menu" android:title="@string/show_tiles_menu"
/> />
<item android:id="@+id/dicts_shownote"
android:title="@string/show_note_menu"
/>
<item android:id="@+id/dicts_showfaq" <item android:id="@+id/dicts_showfaq"
android:title="@string/button_faq" android:title="@string/button_faq"
/> />

View file

@ -2611,4 +2611,6 @@
<string name="mqtt_invite_title">MQTT Invitation</string> <string name="mqtt_invite_title">MQTT Invitation</string>
<string name="not_again_comms_mqtt">Im experimenting with this <string name="not_again_comms_mqtt">Im experimenting with this
as a replacement for the relay.</string> as a replacement for the relay.</string>
<string name="show_note_menu">About Wordlist</string>
</resources> </resources>