mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-26 00:17:47 -10:00
Commands run were: ag #FFFF9500 .. -l | grep -v colors.xml | xargs sed -i "s/#FFFF9500/@color\/fennec_ui_orange/g" ag #FF9500 .. -l | grep -v colors.xml | xargs sed -i "s/#FF9500/@color\/fennec_ui_orange/g" ag text_color_highlight .. -l | grep -v colors.xml | xargs sed -i "s/text_color_highlight\([^_]\)/fennec_ui_orange\1/g" ag url_bar_text_highlight .. -l | grep -v colors.xml | xargs sed -i "s/url_bar_text_highlight\([^_]\)/fennec_ui_orange\1/g" ag highlight_orange .. -l | grep -v colors.xml | xargs sed -i "s/highlight_orange/fennec_ui_orange/g" Then text_color_highlight and url_bar_text_highlight were manually deleted from colors.xml and highlight_orange was manually deleted from search_colors.xml. Note that there are still two uses of #B3FF9500 in the code as opposed to fennec_ui_orange of #FF9500.
89 lines
2.9 KiB
Java
89 lines
2.9 KiB
Java
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* 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/. */
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
import org.mozilla.gecko.widget.ThemedEditText;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.KeyEvent;
|
|
import android.view.View;
|
|
|
|
public class CustomEditText extends ThemedEditText {
|
|
private OnKeyPreImeListener mOnKeyPreImeListener;
|
|
private OnSelectionChangedListener mOnSelectionChangedListener;
|
|
private OnWindowFocusChangeListener mOnWindowFocusChangeListener;
|
|
private int mHighlightColor;
|
|
|
|
public CustomEditText(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
setPrivateMode(false); // Initialize mHighlightColor.
|
|
}
|
|
|
|
public interface OnKeyPreImeListener {
|
|
public boolean onKeyPreIme(View v, int keyCode, KeyEvent event);
|
|
}
|
|
|
|
public void setOnKeyPreImeListener(OnKeyPreImeListener listener) {
|
|
mOnKeyPreImeListener = listener;
|
|
}
|
|
|
|
@Override
|
|
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
|
if (mOnKeyPreImeListener != null)
|
|
return mOnKeyPreImeListener.onKeyPreIme(this, keyCode, event);
|
|
|
|
return false;
|
|
}
|
|
|
|
public interface OnSelectionChangedListener {
|
|
public void onSelectionChanged(int selStart, int selEnd);
|
|
}
|
|
|
|
public void setOnSelectionChangedListener(OnSelectionChangedListener listener) {
|
|
mOnSelectionChangedListener = listener;
|
|
}
|
|
|
|
@Override
|
|
protected void onSelectionChanged(int selStart, int selEnd) {
|
|
if (mOnSelectionChangedListener != null)
|
|
mOnSelectionChangedListener.onSelectionChanged(selStart, selEnd);
|
|
|
|
super.onSelectionChanged(selStart, selEnd);
|
|
}
|
|
|
|
public interface OnWindowFocusChangeListener {
|
|
public void onWindowFocusChanged(boolean hasFocus);
|
|
}
|
|
|
|
public void setOnWindowFocusChangeListener(OnWindowFocusChangeListener listener) {
|
|
mOnWindowFocusChangeListener = listener;
|
|
}
|
|
|
|
@Override
|
|
public void onWindowFocusChanged(boolean hasFocus) {
|
|
super.onWindowFocusChanged(hasFocus);
|
|
if (mOnWindowFocusChangeListener != null)
|
|
mOnWindowFocusChangeListener.onWindowFocusChanged(hasFocus);
|
|
}
|
|
|
|
// Provide a getHighlightColor implementation for API level < 16.
|
|
@Override
|
|
public int getHighlightColor() {
|
|
return mHighlightColor;
|
|
}
|
|
|
|
@Override
|
|
public void setPrivateMode(boolean isPrivate) {
|
|
super.setPrivateMode(isPrivate);
|
|
|
|
mHighlightColor = getContext().getResources().getColor(isPrivate
|
|
? R.color.url_bar_text_highlight_pb : R.color.fennec_ui_orange);
|
|
// android:textColorHighlight cannot support a ColorStateList.
|
|
setHighlightColor(mHighlightColor);
|
|
}
|
|
}
|