Search in sources :

Example 1 with OpenedAppFromQuickReplyEvent

use of com.waz.zclient.core.controllers.tracking.events.notifications.OpenedAppFromQuickReplyEvent in project wire-android by wireapp.

the class QuickReplyFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.layout_quick_reply, container, false);
    name = ViewUtils.getView(view, R.id.ttv__quick_reply__name);
    counter = ViewUtils.getView(view, R.id.ttv__quick_reply__counter);
    counter.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new SwitchedMessageInQuickReplyEvent());
            contentContainer.smoothScrollToPosition((layoutManager.findFirstVisibleItemPosition() + 1) % adapter.getItemCount());
        }
    });
    contentContainer = ViewUtils.getView(view, R.id.rv__quick_reply__content_container);
    contentContainer.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new SwitchedMessageInQuickReplyEvent());
                updateScrolledItemText();
            }
        }
    });
    layoutManager = new ViewPagerLikeLayoutManager(getContext());
    contentContainer.setLayoutManager(layoutManager);
    message = ViewUtils.getView(view, R.id.tet__quick_reply__message);
    message.setOnEditorActionListener(this);
    openWire = ViewUtils.getView(view, R.id.ll__quick_reply__open_external);
    openWire.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getActivity() == null || conversation == null || message == null) {
                return;
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedAppFromQuickReplyEvent());
            Intent appLaunchIntent = IntentUtils.getAppLaunchIntent(getContext(), conversation.getId(), message.getText().toString());
            startActivity(appLaunchIntent);
            getActivity().finish();
        }
    });
    return view;
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) SwitchedMessageInQuickReplyEvent(com.waz.zclient.core.controllers.tracking.events.notifications.SwitchedMessageInQuickReplyEvent) OpenedAppFromQuickReplyEvent(com.waz.zclient.core.controllers.tracking.events.notifications.OpenedAppFromQuickReplyEvent) RecyclerView(android.support.v7.widget.RecyclerView) Intent(android.content.Intent) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Nullable(android.support.annotation.Nullable)

Aggregations

Intent (android.content.Intent)1 Nullable (android.support.annotation.Nullable)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 OpenedAppFromQuickReplyEvent (com.waz.zclient.core.controllers.tracking.events.notifications.OpenedAppFromQuickReplyEvent)1 SwitchedMessageInQuickReplyEvent (com.waz.zclient.core.controllers.tracking.events.notifications.SwitchedMessageInQuickReplyEvent)1