use of com.waz.zclient.common.controllers.global.AccentColorCallback in project wire-android by wireapp.
the class MarkdownTextView method configureStyleSheet.
/**
* Configures the style sheet used for rendering.
*/
private void configureStyleSheet() {
mStyleSheet = new StyleSheet();
mStyleSheet.setBaseFontColor(getCurrentTextColor());
mStyleSheet.setBaseFontSize((int) getTextSize());
mStyleSheet.setCodeColor(ContextUtils.getStyledColor(R.attr.codeColor, context()));
mStyleSheet.setQuoteColor(ContextUtils.getStyledColor(R.attr.quoteColor, context()));
mStyleSheet.setQuoteStripeColor(ContextUtils.getStyledColor(R.attr.quoteStripeColor, context()));
mStyleSheet.setListPrefixColor(ContextUtils.getStyledColor(R.attr.listPrefixColor, context()));
BaseActivity activity = (BaseActivity) getContext();
if (activity != null) {
// update the link color whenever the accent color changes
activity.injectJava(AccentColorController.class).accentColorForJava(new AccentColorCallback() {
@Override
public void color(AccentColor color) {
mStyleSheet.setLinkColor(color.color());
setLinkTextColor(color.color());
refreshLinks();
}
}, eventContext());
}
// to make links clickable
mStyleSheet.configureLinkHandler(context());
setMovementMethod(new LinkTextView.MovementMethod(getContext()));
setLineSpacing(0f, 1.1f);
}
use of com.waz.zclient.common.controllers.global.AccentColorCallback in project wire-android by wireapp.
the class LocationFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isGooglePlayServicesAvailable()) {
googleApiClient = new GoogleApiClient.Builder(getContext()).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
googleApiClient.connect();
} else {
locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
}
mainHandler = new Handler();
handlerThread = new HandlerThread("Background handler");
handlerThread.start();
backgroundHandler = new Handler(handlerThread.getLooper());
geocoder = new Geocoder(getContext(), Locale.getDefault());
zoom = true;
// retrieve the accent color to be used for the paint
accentColor = AccentColor.defaultColor().color();
((BaseActivity) getContext()).injectJava(AccentColorController.class).accentColorForJava(new AccentColorCallback() {
@Override
public void color(AccentColor color) {
selectedLocationPin.setTextColor(color.color());
marker = null;
accentColor = color.color();
}
}, EventContext.Implicits$.MODULE$.global());
}
use of com.waz.zclient.common.controllers.global.AccentColorCallback in project wire-android by wireapp.
the class ConfirmationFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.confirmation_fragment, container, false);
dialogId = getArguments().getString(OPTIONAL_FIELD_DIALOG_ID);
confirmationMenu = ViewUtils.getView(view, R.id.cm__confirm_menu);
confirmationMenu.setHeader(getArguments().getString(FIELD_TITLE));
confirmationMenu.setText(getArguments().getString(FIELD_MESSAGE));
confirmationMenu.setPositiveButton(getArguments().getString(FIELD_CONFIRM));
confirmationMenu.setNegativeButton(getArguments().getString(OPTIONAL_FIELD_CANCEL));
confirmationMenu.useModalBackground(getArguments().getBoolean(OPTIONAL_FIELD_USE_BLACK_BACKGROUND));
confirmationMenu.setCallback(new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
getContainer().onDialogConfirm(dialogId);
}
@Override
public void negativeButtonClicked() {
getContainer().onDialogCancel(dialogId);
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
}
});
// update the button color whenever the accent color changes
((BaseActivity) getContext()).injectJava(AccentColorController.class).accentColorForJava(new AccentColorCallback() {
@Override
public void color(AccentColor color) {
confirmationMenu.setButtonColor(color.color());
}
}, EventContext.Implicits$.MODULE$.global());
return view;
}
Aggregations