Search in sources :

Example 1 with AccentColor

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());
}
Also used : AccentColor(com.waz.api.AccentColor) Instrumentation(android.app.Instrumentation) IConversation(com.waz.api.IConversation) Intent(android.content.Intent) IAccentColorController(com.waz.zclient.controllers.accentcolor.IAccentColorController) TargetApi(android.annotation.TargetApi)

Example 2 with AccentColor

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;
}
Also used : AccentColor(com.waz.api.AccentColor) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) OpenedUsernameFAQEvent(com.waz.zclient.core.controllers.tracking.events.onboarding.OpenedUsernameFAQEvent) ZetaButton(com.waz.zclient.ui.views.ZetaButton) ImageView(android.widget.ImageView) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) ImageView(android.widget.ImageView) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 3 with AccentColor

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);
}
Also used : AccentColor(com.waz.api.AccentColor)

Example 4 with AccentColor

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;
}
Also used : AccentColor(com.waz.api.AccentColor) User(com.waz.api.User)

Aggregations

AccentColor (com.waz.api.AccentColor)4 TargetApi (android.annotation.TargetApi)1 Instrumentation (android.app.Instrumentation)1 Intent (android.content.Intent)1 Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 IConversation (com.waz.api.IConversation)1 User (com.waz.api.User)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 IAccentColorController (com.waz.zclient.controllers.accentcolor.IAccentColorController)1 OpenedUsernameFAQEvent (com.waz.zclient.core.controllers.tracking.events.onboarding.OpenedUsernameFAQEvent)1 TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)1 ZetaButton (com.waz.zclient.ui.views.ZetaButton)1 ImageAssetImageView (com.waz.zclient.views.images.ImageAssetImageView)1