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;
}
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;
}
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;
}
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));
}
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()));
}
}
Aggregations