Exemplo n.º 1
0
 public ThemeController(Context context) {
   isTablet = LayoutSpec.isTablet(context);
   deprecatedThemeKey = context.getString(R.string.pref_account_theme_key);
   themeKey = context.getString(R.string.pref_account_theme_switch_key);
   prefs =
       context.getSharedPreferences(
           UserPreferencesController.USER_PREFS_TAG, Context.MODE_PRIVATE);
   currentTheme = getThemeFromPreferences();
   optionsDarkTheme = new OptionsDarkTheme(context);
   optionsLightTheme = new OptionsLightTheme(context);
 }
  @Override
  public void openCommonUserProfile(View anchor, User user) {
    if (LayoutSpec.isTablet(getActivity())) {
      IConnectStore.UserRequester userRequester =
          IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
      if (userRequester == IConnectStore.UserRequester.CONVERSATION) {
        // Launch common user in new popover
        getControllerFactory()
            .getConversationScreenController()
            .setPopoverLaunchedMode(DialogLaunchMode.COMMON_USER);
        getControllerFactory().getPickUserController().showUserProfile(user, anchor);
      } else {
        // Lauch common user in existing popover
        getContainer().openCommonUserProfile(anchor, user);
      }
    } else {
      if (isShowingCommonUserProfile) {
        return;
      }

      isShowingCommonUserProfile = true;

      getControllerFactory().getNavigationController().setRightPage(Page.COMMON_USER_PROFILE, TAG);

      UserProfile profileFragment =
          (UserProfile)
              getChildFragmentManager().findFragmentById(R.id.fl__pending_connect_request);
      if (profileFragment != null) {
        profileFragment.isBelowUserProfile(true);
      }

      getStoreFactory().getSingleParticipantStore().setUser(user);

      getChildFragmentManager()
          .beginTransaction()
          .setCustomAnimations(
              R.anim.open_profile, R.anim.close_profile, R.anim.open_profile, R.anim.close_profile)
          .replace(
              R.id.fl__pending_connect_request,
              SingleParticipantFragment.newInstance(true, IConnectStore.UserRequester.SEARCH),
              SingleParticipantFragment.TAG)
          .addToBackStack(SingleParticipantFragment.TAG)
          .commit();
    }
  }
Exemplo n.º 3
0
  public static int getDistanceOfAudioMessageIconToLeftScreenEdge(Context context, int totalWidth) {
    int cursorToolbarMarginRight =
        context
            .getResources()
            .getDimensionPixelSize(R.dimen.cursor_toolbar_padding_horizontal_edge);
    int cursorButtonWidth =
        context.getResources().getDimensionPixelSize(R.dimen.new_cursor_menu_button_width);
    int cursorButtonMarginRight = CursorUtils.getMarginBetweenCursorButtons(context);

    if (LayoutSpec.isTablet(context)) {
      return totalWidth
          - (getCursorMenuLeftMargin(context, totalWidth)
              + (NUM_CURSOR_ROW_BUTTONS - 1) * cursorButtonWidth
              + (NUM_CURSOR_ROW_BUTTONS - 2) * cursorButtonMarginRight);
    } else {
      return cursorButtonWidth + cursorButtonMarginRight + cursorToolbarMarginRight;
    }
  }