Search in sources :

Example 1 with BaseScalaActivity

use of com.waz.zclient.BaseScalaActivity 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 2 with BaseScalaActivity

use of com.waz.zclient.BaseScalaActivity in project wire-android by wireapp.

the class PhoneInvitationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_invite__phone, viewGroup, false);
    int buttonColor = getResources().getColor(R.color.text__primary_dark);
    TextView termsOfServicesTextView = ViewUtils.getView(view, R.id.tv__phone_invite__terms_of_service);
    TextViewUtils.linkifyText(termsOfServicesTextView, buttonColor, false, new Runnable() {

        @Override
        public void run() {
            getContainer().onOpenUrlInApp(getString(R.string.url_terms_of_service), true);
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new ViewTOS(ViewTOS.Source.FROM_JOIN_PAGE));
        }
    });
    signUpAlternativeButton = ViewUtils.getView(view, R.id.zb__phone_invite__signup_alternative);
    signUpAlternativeButton.setIsFilled(false);
    signUpAlternativeButton.setAccentColor(getResources().getColor(R.color.text__secondary_dark__40));
    if (LayoutSpec.isPhone(getActivity())) {
        signUpAlternativeButton.setText(getString(R.string.invitation_phone__normal_phone_signup_button));
    } else {
        signUpAlternativeButton.setText(getString(R.string.invitation_phone__normal_email_signup_button));
    }
    headerTextView = ViewUtils.getView(view, R.id.ttv_phone_invite__header);
    headerTextView.setText(getResources().getString(R.string.invitation_email__welcome_header, name));
    registerButton = ViewUtils.getView(view, R.id.zb__first_launch__confirm);
    registerButton.setIsFilled(true);
    registerButton.setAccentColor(buttonColor);
    phoneNumberTextView = ViewUtils.getView(view, R.id.tet__phone_invite__number);
    phoneNumberTextView.setText(phone);
    return view;
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) ViewTOS(com.waz.zclient.core.controllers.tracking.events.registration.ViewTOS) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 3 with BaseScalaActivity

use of com.waz.zclient.BaseScalaActivity in project wire-android by wireapp.

the class ConversationListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup c, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_conversation_list, c, false);
    layoutNoConversations = ViewUtils.getView(view, R.id.ll__conversation_list__no_contacts);
    layoutNoConversations.setVisibility(View.GONE);
    conversationsListAdapter = new ConversationListAdapter(conversationCallback, getActivity());
    conversationsListAdapter.setConversationListMode(mode);
    swipeListView = new SwipeListView(getActivity());
    FrameLayout.LayoutParams paramsSticky = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    paramsSticky.topMargin = getResources().getDimensionPixelSize(R.dimen.conversation_list__sticky_view__top_margin);
    pullForActionContainer = ViewUtils.getView(view, R.id.pfac__conversation_list);
    swipeListView.setAllowSwipeAway(true);
    swipeListView.setAdapter(conversationsListAdapter);
    swipeListView.setOnItemClickListener(this);
    swipeListView.setDivider(null);
    swipeListView.setVerticalScrollBarEnabled(false);
    swipeListView.setSelector(R.drawable.empty_list_view_selector);
    swipeListView.setScrollingCacheEnabled(false);
    swipeListView.setAnimationCacheEnabled(false);
    conversationsListAdapter.setListView(swipeListView);
    archiveBox = ViewUtils.getView(view, R.id.ll__archiving_container);
    archiveBox.setVisibility(View.INVISIBLE);
    swipeListView.post(new Runnable() {

        @Override
        public void run() {
            if (swipeListView != null) {
                swipeListView.setOffsetRight(swipeListView.getMeasuredWidth() - // right side offset
                getResources().getDimensionPixelOffset(R.dimen.list_menu_distance_threshold));
            }
        }
    });
    swipeListView.setOnScrollListener(new ConversationListViewOnScrollListener());
    maxSwipeAlpha = ResourceUtils.getResourceFloat(getResources(), R.dimen.list__swipe_max_alpha);
    conversationsListAdapter.setMaxAlpha(maxSwipeAlpha);
    pullForActionContainer.setPullForActionView(swipeListView, PullForActionContainer.FillType.WRAP);
    pullForActionContainer.setPullToActionListener(this);
    pullForActionContainer.setPullForActionMode(PullForActionMode.BOTTOM);
    pebbleViewX = getResources().getDimensionPixelSize(R.dimen.framework__general__left_padding);
    if (mode != Mode.SHARING) {
        pebbleViewX += getResources().getDimensionPixelSize(R.dimen.list_extra_padding_when_unread);
    }
    hintContainer = ViewUtils.getView(view, R.id.ll__conversation_list__hint_container);
    hintHeader = ViewUtils.getView(view, R.id.chttv__conversation_list__hint_header);
    listActionsView = ViewUtils.getView(view, R.id.lav__conversation_list_actions);
    if (mode == Mode.SHARING) {
        listActionsView.setVisibility(View.GONE);
    } else {
        listActionsView.setCallback(new ListActionsView.Callback() {

            @Override
            public void onAvatarPress() {
                getControllerFactory().getPickUserController().showPickUser(IPickUserController.Destination.CONVERSATION_LIST, null);
                boolean hintVisible = hintContainer != null && hintContainer.getVisibility() == View.VISIBLE;
                ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedContactsEvent(hintVisible));
                getControllerFactory().getOnboardingController().hideConversationListHint();
            }

            @Override
            public void onSettingsPress() {
                startActivity(ZetaPreferencesActivity.getDefaultIntent(getContext()));
            }
        });
    }
    return view;
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) AdapterView(android.widget.AdapterView) SwipeListView(com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView) ListActionsView(com.waz.zclient.pages.main.conversationlist.views.ListActionsView) AbsListView(android.widget.AbsListView) RightIndicatorView(com.waz.zclient.pages.main.conversationlist.views.row.RightIndicatorView) SwipeListView(com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView) ListActionsView(com.waz.zclient.pages.main.conversationlist.views.ListActionsView) FrameLayout(android.widget.FrameLayout) OpenedContactsEvent(com.waz.zclient.controllers.tracking.events.navigation.OpenedContactsEvent)

Example 4 with BaseScalaActivity

use of com.waz.zclient.BaseScalaActivity in project wire-android by wireapp.

the class ConversationListFragment method onReleasedBottom.

@Override
public void onReleasedBottom() {
    if (conversationsListAdapter.getArchivedState() != ConversationListAdapter.ArchivedState.GONE) {
        return;
    }
    conversationsListAdapter.setArchivedState(ConversationListAdapter.ArchivedState.INVISIBLE, getResources().getInteger(R.integer.framework_animation_duration_medium));
    final int smoothScrollPosition = conversationsListAdapter.getUnarchivedCount() - 1;
    swipeListView.customSmoothScrollToPosition(smoothScrollPosition);
    // The list view needs to be rearranged due to archive state
    // we post it to the end of this rearrangement
    new Handler().post(new Runnable() {

        @Override
        public void run() {
            int offset = 0;
            for (int i = 0; i < swipeListView.getChildCount(); i++) {
                View view = swipeListView.getChildAt(i);
                int id = view.getId();
                if (id == smoothScrollPosition) {
                    offset = view.getTop() + view.getMeasuredHeight() + getResources().getDimensionPixelSize(R.dimen.list__archived_border_height) / 2;
                }
            }
            getControllerFactory().getConversationListController().onReleasedPullDownFromBottom(offset);
        }
    });
    // post to set archived to visible from invisible
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            if (conversationsListAdapter != null) {
                conversationsListAdapter.setArchivedState(ConversationListAdapter.ArchivedState.VISIBLE, getResources().getInteger(R.integer.framework_animation_duration_medium));
                if (getControllerFactory() == null || getControllerFactory().isTornDown()) {
                    return;
                }
                ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedArchiveEvent());
            }
        }
    }, getResources().getInteger(R.integer.list__show_archived_delay));
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) OpenedArchiveEvent(com.waz.zclient.controllers.tracking.events.navigation.OpenedArchiveEvent) Handler(android.os.Handler) ExceptionHandler(net.hockeyapp.android.ExceptionHandler) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) AdapterView(android.widget.AdapterView) SwipeListView(com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView) ListActionsView(com.waz.zclient.pages.main.conversationlist.views.ListActionsView) AbsListView(android.widget.AbsListView) RightIndicatorView(com.waz.zclient.pages.main.conversationlist.views.row.RightIndicatorView) SuppressLint(android.annotation.SuppressLint)

Example 5 with BaseScalaActivity

use of com.waz.zclient.BaseScalaActivity in project wire-android by wireapp.

the class ConversationManagerFragment method onSelectedUsers.

@Override
public void onSelectedUsers(List<User> users, ConversationChangeRequester requester) {
    // TODO https://wearezeta.atlassian.net/browse/AN-3730
    getControllerFactory().getPickUserController().hidePickUser(getCurrentPickerDestination(), false);
    IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
    if (currentConversation.getType() == IConversation.Type.ONE_TO_ONE) {
        getStoreFactory().getConversationStore().createGroupConversation(users, requester);
        if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
            ViewUtils.showAlertDialog(getActivity(), R.string.conversation__create_group_conversation__no_network__title, R.string.conversation__create_group_conversation__no_network__message, R.string.conversation__create_group_conversation__no_network__button, null, true);
        }
        ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new CreatedGroupConversationEvent(true, (users.size() + 1)));
    } else if (currentConversation.getType() == IConversation.Type.GROUP) {
        currentConversation.addMembers(users);
        if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
            ViewUtils.showAlertDialog(getActivity(), R.string.conversation__add_user__no_network__title, R.string.conversation__add_user__no_network__message, R.string.conversation__add_user__no_network__button, null, true);
        }
        ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new AddedMemberToGroupEvent(getParticipantsCount(), users.size()));
    }
}
Also used : CreatedGroupConversationEvent(com.waz.zclient.controllers.tracking.events.group.CreatedGroupConversationEvent) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) IConversation(com.waz.api.IConversation) AddedMemberToGroupEvent(com.waz.zclient.controllers.tracking.events.group.AddedMemberToGroupEvent)

Aggregations

BaseScalaActivity (com.waz.zclient.BaseScalaActivity)16 View (android.view.View)7 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)5 TextView (android.widget.TextView)4 IConversation (com.waz.api.IConversation)4 Handler (android.os.Handler)3 NetworkMode (com.waz.api.NetworkMode)3 AddedMemberToGroupEvent (com.waz.zclient.controllers.tracking.events.group.AddedMemberToGroupEvent)3 CreatedGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.CreatedGroupConversationEvent)3 TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)3 Nullable (android.support.annotation.Nullable)2 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 OpenedGroupActionEvent (com.waz.zclient.controllers.tracking.events.group.OpenedGroupActionEvent)2 ViewTOS (com.waz.zclient.core.controllers.tracking.events.registration.ViewTOS)2 NetworkAction (com.waz.zclient.core.stores.network.NetworkAction)2 ListActionsView (com.waz.zclient.pages.main.conversationlist.views.ListActionsView)2 SwipeListView (com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView)2 RightIndicatorView (com.waz.zclient.pages.main.conversationlist.views.row.RightIndicatorView)2 FooterMenuCallback (com.waz.zclient.views.menus.FooterMenuCallback)2