use of com.waz.api.AccentColor in project wire-android by wireapp.
the class ConversationFragmentTest method assertCursorImagesGalleryButton.
@TargetApi(Build.VERSION_CODES.KITKAT)
public void assertCursorImagesGalleryButton() throws Exception {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
IAccentColorController mockAccentColorController = activity.getControllerFactory().getAccentColorController();
AccentColor mockAccentColor = mock(AccentColor.class);
when(mockAccentColor.getColor()).thenReturn(Color.RED);
when(mockAccentColorController.getAccentColor()).thenReturn(mockAccentColor);
String action = Intent.ACTION_OPEN_DOCUMENT;
Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("image/*"));
Intent intent = new Intent();
intent.setData(Uri.parse("file:///tmp/whatever.txt"));
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
intending(expectedIntent).respondWith(result);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.cursor_menu_item_camera)).check(isVisible());
onView(withId(R.id.cursor_menu_item_camera)).perform(click());
Thread.sleep(500);
onView(withId(R.id.rv__cursor_images)).check(isVisible());
onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).check(isVisible());
// onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).perform(click());
}
use of com.waz.api.AccentColor in project wire-android by wireapp.
the class FirstTimeAssignUsernameFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_username_first_launch, container, false);
nameTextView = ViewUtils.getView(view, R.id.ttv__name);
usernameTextView = ViewUtils.getView(view, R.id.ttv__username);
backgroundImageView = ViewUtils.getView(view, R.id.iaiv__user_photo);
final ImageView vignetteOverlay = ViewUtils.getView(view, R.id.iv_background_vignette_overlay);
ZetaButton chooseYourOwnButton = ViewUtils.getView(view, R.id.zb__username_first_assign__choose);
ZetaButton keepButton = ViewUtils.getView(view, R.id.zb__username_first_assign__keep);
TypefaceTextView summaryTextView = ViewUtils.getView(view, R.id.ttv__username_first_assign__summary);
AccentColor accentColor = getControllerFactory().getAccentColorController().getAccentColor();
final int color = accentColor != null ? accentColor.getColor() : Color.TRANSPARENT;
final int darkenColor = ColorUtils.injectAlpha(ResourceUtils.getResourceFloat(getResources(), R.dimen.background_solid_black_overlay_opacity), Color.BLACK);
backgroundImageView.setDisplayType(ImageAssetImageView.DisplayType.REGULAR);
vignetteOverlay.setImageBitmap(BitmapUtils.getVignetteBitmap(getResources()));
vignetteOverlay.setColorFilter(darkenColor, PorterDuff.Mode.DARKEN);
selfModelObserver.setAndUpdate(getStoreFactory().getZMessagingApiStore().getApi().getSelf());
chooseYourOwnButton.setIsFilled(true);
chooseYourOwnButton.setAccentColor(color);
chooseYourOwnButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getContainer().onChooseUsernameChosen();
}
});
suggestedUsername = getArguments().getString(ARG_SUGGESTED_USERNAME, "");
keepButton.setIsFilled(false);
keepButton.setAccentColor(color);
keepButton.setTextColor(getResources().getColor(R.color.white));
keepButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getContainer().onKeepUsernameChosen(suggestedUsername);
}
});
nameTextView.setText(getArguments().getString(ARG_NAME, ""));
usernameTextView.setText(StringUtils.formatHandle(suggestedUsername));
if (TextUtils.isEmpty(suggestedUsername)) {
usernameTextView.setVisibility(View.INVISIBLE);
keepButton.setVisibility(View.GONE);
}
TextViewUtils.linkifyText(summaryTextView, Color.WHITE, com.waz.zclient.ui.R.string.wire__typeface__light, false, new Runnable() {
@Override
public void run() {
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedUsernameFAQEvent());
getContainer().onOpenUrl(getString(R.string.usernames__learn_more__link));
}
});
return view;
}
use of com.waz.api.AccentColor in project wire-android by wireapp.
the class ScalaProfileStore method setAccentColor.
@Override
public void setAccentColor(Object sender, int myColor) {
this.myColor = myColor;
// identify color
if (accentColors.length <= 0) {
return;
}
AccentColor selectedColor = accentColors[0];
for (AccentColor accentColor : accentColors) {
if (myColor == accentColor.getColor()) {
selectedColor = accentColor;
break;
}
}
selfUser.setAccent(selectedColor);
}
use of com.waz.api.AccentColor in project wire-android by wireapp.
the class MockHelper method createMockUser.
public static User createMockUser(String name, String id) {
User mockUser = mock(User.class);
when(mockUser.getId()).thenReturn(id);
when(mockUser.getDisplayName()).thenReturn(name);
AccentColor mockAccent = mock(AccentColor.class);
when(mockAccent.getColor()).thenReturn(3);
when(mockUser.getAccent()).thenReturn(mockAccent);
return mockUser;
}
Aggregations