mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 715179 - (4 of 8) Created the full FontSizePreference dialog UI. This includes the font preview box and the increase/decrease font size buttons. These buttons do not function yet. r=bnicholson
This commit is contained in:
parent
b06ec1622f
commit
65c436cfe4
@ -5,12 +5,42 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.DialogPreference;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
class FontSizePreference extends DialogPreference {
|
||||
private static final String LOGTAG = "FontSizePreference";
|
||||
|
||||
private final Context mContext;
|
||||
private TextView mPreviewFontView;
|
||||
private Button mIncreaseFontButton;
|
||||
private Button mDecreaseFontButton;
|
||||
|
||||
public FontSizePreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||
final LayoutInflater inflater =
|
||||
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
View dialogView = inflater.inflate(R.layout.font_size_preference, null);
|
||||
mPreviewFontView = (TextView) dialogView.findViewById(R.id.preview);
|
||||
mPreviewFontView.setMovementMethod(new ScrollingMovementMethod());
|
||||
|
||||
mDecreaseFontButton = (Button) dialogView.findViewById(R.id.decrease_preview_font_button);
|
||||
mIncreaseFontButton = (Button) dialogView.findViewById(R.id.increase_preview_font_button);
|
||||
|
||||
builder.setView(dialogView);
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +86,12 @@
|
||||
<!ENTITY pref_font_size_large "Large">
|
||||
<!ENTITY pref_font_size_xlarge "Extra Large">
|
||||
<!ENTITY pref_font_size_set "Set">
|
||||
<!-- Localization note (pref_font_size_adjust_char): A button with a small version of this character
|
||||
(or combination of characters) is used to decrease the preview font size; a larger version of the
|
||||
same character/combination is used to increase the preview font size. It should be a concise
|
||||
representation of the language it is used in that will help show the text in the preview will change
|
||||
size. -->
|
||||
<!ENTITY pref_font_size_adjust_char "A">
|
||||
|
||||
<!-- Localization note (pref_font_size_preview_text): This paragraph is used as an example to
|
||||
demonstrate the font size setting. It is meant to be whimsical and fun. -->
|
||||
|
@ -3,11 +3,41 @@
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/preview"
|
||||
style="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pref_font_size_preview_text"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#ffffffff"
|
||||
android:padding="2dp"
|
||||
android:text="@string/pref_font_size_preview_text"
|
||||
android:textColor="#ff000000"
|
||||
android:scrollbars="vertical"
|
||||
android:fadeScrollbars="true"/>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/decrease_preview_font_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/pref_font_size_adjust_char"
|
||||
android:textSize="8sp"/>
|
||||
|
||||
<Button android:id="@+id/increase_preview_font_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/pref_font_size_adjust_char"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -92,6 +92,7 @@
|
||||
<string name="pref_font_size_large">&pref_font_size_large;</string>
|
||||
<string name="pref_font_size_xlarge">&pref_font_size_xlarge;</string>
|
||||
<string name="pref_font_size_set">&pref_font_size_set;</string>
|
||||
<string name="pref_font_size_adjust_char">&pref_font_size_adjust_char;</string>
|
||||
<string name="pref_font_size_preview_text">&pref_font_size_preview_text;</string>
|
||||
<string name="pref_sync">&pref_sync;</string>
|
||||
<string name="pref_search_suggestions">&pref_search_suggestions;</string>
|
||||
|
Loading…
Reference in New Issue
Block a user