Search in sources :

Example 16 with BaseScalaActivity

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

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