mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-28 18:47:41 +00:00
fix(android): Update titlebar styling
Per review comments * Use ellipsis to truncate long titles * Use Keyman styling during installation, but keep green accent line for Settings
This commit is contained in:
parent
b5f7084d08
commit
6d98103f75
4 changed files with 33 additions and 3 deletions
|
|
@ -16,6 +16,8 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
|
@ -77,8 +79,6 @@ public final class SelectLanguageFragment extends Fragment implements BlockingSt
|
|||
super.onCreate(savedInstanceState);
|
||||
context = getActivity();
|
||||
|
||||
final Toolbar toolbar = v.findViewById(R.id.list_toolbar);
|
||||
addKeyboardsList = new ArrayList<Keyboard>();
|
||||
|
||||
final ListView listView = v.findViewById(R.id.listView);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
|
|
@ -112,12 +112,35 @@ public final class SelectLanguageFragment extends Fragment implements BlockingSt
|
|||
final String keyboardName = keyboard.getKeyboardName();
|
||||
String title_install = String.format(getString(R.string.title_select_languages_for_package), keyboardName);
|
||||
String title_no_install = getString(R.string.all_languages_installed);
|
||||
|
||||
final Toolbar toolbar = v.findViewById(R.id.list_toolbar);
|
||||
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
|
||||
ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(null);
|
||||
actionBar.setDisplayUseLogoEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(false);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
|
||||
// When installing packages, use the Keyman theme for the accent
|
||||
if (isInstallingPackage) {
|
||||
actionBar.setBackgroundDrawable(MainActivity.getActionBarDrawable(getContext()));
|
||||
|
||||
// Hide the optional accent that's used in Settings menus
|
||||
View accent = v.findViewById(R.id.bar_accent);
|
||||
accent.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
final TextView textView = v.findViewById(R.id.bar_title);
|
||||
textView.setText(title_no_install);
|
||||
if (titleFont != null) {
|
||||
textView.setTypeface(titleFont, Typeface.BOLD);
|
||||
}
|
||||
|
||||
addKeyboardsList = new ArrayList<Keyboard>();
|
||||
|
||||
List<Keyboard> availableKeyboardsList = kmpProcessor.getKeyboardList(
|
||||
pkgInfo, packageID, keyboardID, isInstallingPackage, excludeInstalledLanguages);
|
||||
int position = KeyboardController.INDEX_NOT_FOUND;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/titlebar_label_textsize"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,17 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/title_add_keyboard"
|
||||
android:textSize="16sp"
|
||||
android:textSize="@dimen/titlebar_label_textsize"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<!-- optional accent -->
|
||||
<View
|
||||
android:id="@+id/bar_accent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<resources>
|
||||
<dimen name="banner_height">50dp</dimen>
|
||||
<dimen name="keyboard_height">205dp</dimen>
|
||||
<dimen name="titlebar_label_textsize">16sp</dimen>
|
||||
<dimen name="key_width">34.25dp</dimen>
|
||||
<dimen name="key_height">49.25dp</dimen>
|
||||
<dimen name="popup_arrow_width">21dp</dimen>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue