FileDetailSharingFragment.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Andy Scherzinger
  5. * Copyright (C) 2018 Andy Scherzinger
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  9. * License as published by the Free Software Foundation; either
  10. * version 3 of the License, or any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public
  18. * License along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. package com.owncloud.android.ui.fragment;
  21. import android.accounts.Account;
  22. import android.accounts.AccountManager;
  23. import android.app.SearchManager;
  24. import android.content.Context;
  25. import android.content.res.Resources;
  26. import android.graphics.drawable.Drawable;
  27. import android.os.Bundle;
  28. import android.text.TextUtils;
  29. import android.view.LayoutInflater;
  30. import android.view.Menu;
  31. import android.view.MenuItem;
  32. import android.view.View;
  33. import android.view.ViewGroup;
  34. import android.widget.ImageView;
  35. import android.widget.LinearLayout;
  36. import android.widget.PopupMenu;
  37. import android.widget.TextView;
  38. import com.google.android.material.snackbar.Snackbar;
  39. import com.owncloud.android.R;
  40. import com.owncloud.android.authentication.AccountUtils;
  41. import com.owncloud.android.datamodel.FileDataStorageManager;
  42. import com.owncloud.android.datamodel.OCFile;
  43. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  44. import com.owncloud.android.lib.resources.shares.OCShare;
  45. import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder;
  46. import com.owncloud.android.lib.resources.shares.ShareType;
  47. import com.owncloud.android.lib.resources.status.OCCapability;
  48. import com.owncloud.android.ui.activity.FileActivity;
  49. import com.owncloud.android.ui.activity.FileDisplayActivity;
  50. import com.owncloud.android.ui.adapter.UserListAdapter;
  51. import com.owncloud.android.ui.decoration.SimpleListItemDividerDecoration;
  52. import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
  53. import com.owncloud.android.ui.dialog.NoteDialogFragment;
  54. import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
  55. import com.owncloud.android.ui.fragment.util.FileDetailSharingFragmentHelper;
  56. import com.owncloud.android.ui.fragment.util.SharingMenuHelper;
  57. import com.owncloud.android.ui.helpers.FileOperationsHelper;
  58. import com.owncloud.android.utils.ClipboardUtil;
  59. import com.owncloud.android.utils.DisplayUtils;
  60. import com.owncloud.android.utils.ThemeUtils;
  61. import java.util.List;
  62. import androidx.annotation.NonNull;
  63. import androidx.annotation.Nullable;
  64. import androidx.appcompat.widget.AppCompatCheckBox;
  65. import androidx.appcompat.widget.SearchView;
  66. import androidx.fragment.app.Fragment;
  67. import androidx.recyclerview.widget.LinearLayoutManager;
  68. import androidx.recyclerview.widget.RecyclerView;
  69. import butterknife.BindView;
  70. import butterknife.ButterKnife;
  71. import butterknife.OnClick;
  72. import butterknife.Unbinder;
  73. public class FileDetailSharingFragment extends Fragment implements UserListAdapter.ShareeListAdapterListener,
  74. DisplayUtils.AvatarGenerationListener {
  75. private static final String ARG_FILE = "FILE";
  76. private static final String ARG_ACCOUNT = "ACCOUNT";
  77. // to show share with users/groups info
  78. private List<OCShare> shares;
  79. private OCFile file;
  80. private Account account;
  81. private OCCapability capabilities;
  82. private OCShare publicShare;
  83. private FileOperationsHelper fileOperationsHelper;
  84. private FileDisplayActivity fileDisplayActivity;
  85. private FileDataStorageManager fileDataStorageManager;
  86. private Unbinder unbinder;
  87. @BindView(R.id.searchView)
  88. SearchView searchView;
  89. @BindView(R.id.shareUsersList)
  90. RecyclerView usersList;
  91. @BindView(R.id.shareNoUsers)
  92. TextView noList;
  93. @BindView(R.id.share_by_link)
  94. AppCompatCheckBox shareByLink;
  95. @BindView(R.id.share_link_copy_icon)
  96. ImageView shareLinkCopyIcon;
  97. @BindView(R.id.overflow_menu_share_link)
  98. ImageView overflowMenuShareLink;
  99. @BindView(R.id.share_by_link_allow_editing)
  100. AppCompatCheckBox shareByLinkAllowEditing;
  101. @BindView(R.id.share_by_link_container)
  102. LinearLayout shareByLinkContainer;
  103. @BindView(R.id.shared_with_you_container)
  104. LinearLayout sharedWithYouContainer;
  105. @BindView(R.id.shared_with_you_avatar)
  106. ImageView sharedWithYouAvatar;
  107. @BindView(R.id.shared_with_you_username)
  108. TextView sharedWithYouUsername;
  109. @BindView(R.id.shared_with_you_note)
  110. TextView sharedWithYouNote;
  111. public static FileDetailSharingFragment newInstance(OCFile file, Account account) {
  112. FileDetailSharingFragment fragment = new FileDetailSharingFragment();
  113. Bundle args = new Bundle();
  114. args.putParcelable(ARG_FILE, file);
  115. args.putParcelable(ARG_ACCOUNT, account);
  116. fragment.setArguments(args);
  117. return fragment;
  118. }
  119. @Override
  120. public void onCreate(@Nullable Bundle savedInstanceState) {
  121. super.onCreate(savedInstanceState);
  122. if (savedInstanceState != null) {
  123. file = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE);
  124. account = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT);
  125. } else {
  126. Bundle arguments = getArguments();
  127. if (arguments != null) {
  128. file = getArguments().getParcelable(ARG_FILE);
  129. account = getArguments().getParcelable(ARG_ACCOUNT);
  130. }
  131. }
  132. if (file == null) {
  133. throw new IllegalArgumentException("File may not be null");
  134. }
  135. if (account == null) {
  136. throw new IllegalArgumentException("Account may not be null");
  137. }
  138. fileDisplayActivity = (FileDisplayActivity) getActivity();
  139. if (fileDisplayActivity == null) {
  140. throw new IllegalArgumentException("FileActivity may not be null");
  141. }
  142. fileOperationsHelper = fileDisplayActivity.getFileOperationsHelper();
  143. fileDataStorageManager = fileDisplayActivity.getStorageManager();
  144. }
  145. @Override
  146. public void onActivityCreated(Bundle savedInstanceState) {
  147. super.onActivityCreated(savedInstanceState);
  148. refreshCapabilitiesFromDB();
  149. refreshPublicShareFromDB();
  150. }
  151. @Override
  152. public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  153. View view = inflater.inflate(R.layout.file_details_sharing_fragment, container, false);
  154. unbinder = ButterKnife.bind(this, view);
  155. if (fileDataStorageManager == null) {
  156. fileDataStorageManager = new FileDataStorageManager(account, fileDisplayActivity.getContentResolver());
  157. }
  158. setupView();
  159. return view;
  160. }
  161. @Override
  162. public void onDestroy() {
  163. super.onDestroy();
  164. unbinder.unbind();
  165. }
  166. @Override
  167. public void onAttach(Context context) {
  168. super.onAttach(context);
  169. if (!(getActivity() instanceof FileActivity)) {
  170. throw new IllegalArgumentException("Calling activity must be of type FileActivity");
  171. }
  172. }
  173. private void setupView() {
  174. setShareWithYou();
  175. if (file.canReshare()) {
  176. setShareByLinkInfo(file.isSharedViaLink());
  177. setShareWithUserInfo();
  178. FileDetailSharingFragmentHelper.setupSearchView(
  179. (SearchManager) fileDisplayActivity.getSystemService(Context.SEARCH_SERVICE), searchView,
  180. fileDisplayActivity.getComponentName());
  181. ThemeUtils.themeSearchView(getContext(), searchView, false);
  182. } else {
  183. searchView.setVisibility(View.GONE);
  184. shareByLinkContainer.setVisibility(View.GONE);
  185. noList.setText(R.string.reshare_not_allowed);
  186. }
  187. }
  188. /**
  189. * Updates Share by link UI
  190. *
  191. * @param isShareByLink flag is share by link is enable
  192. */
  193. public void setShareByLinkInfo(boolean isShareByLink) {
  194. shareByLink.setChecked(isShareByLink);
  195. if (isShareByLink) {
  196. shareLinkCopyIcon.setVisibility(View.VISIBLE);
  197. } else {
  198. shareLinkCopyIcon.setVisibility(View.INVISIBLE);
  199. }
  200. int accentColor = ThemeUtils.primaryAccentColor(getContext());
  201. ThemeUtils.tintCheckbox(shareByLink, accentColor);
  202. ThemeUtils.tintCheckbox(shareByLinkAllowEditing, accentColor);
  203. setLinkDetailVisible(isShareByLink);
  204. }
  205. private void setLinkDetailVisible(boolean visible) {
  206. if (visible) {
  207. shareByLinkAllowEditing.setVisibility(View.VISIBLE);
  208. overflowMenuShareLink.setVisibility(View.VISIBLE);
  209. } else {
  210. shareByLinkAllowEditing.setVisibility(View.INVISIBLE);
  211. overflowMenuShareLink.setVisibility(View.INVISIBLE);
  212. }
  213. }
  214. /**
  215. * Update Share With data
  216. */
  217. public void setShareWithUserInfo() {
  218. // Get Users and Groups
  219. shares = fileDataStorageManager.getSharesWithForAFile(file.getRemotePath(), account.name);
  220. // Update list of users/groups
  221. updateListOfUserGroups();
  222. }
  223. private void setShareWithYou() {
  224. if (AccountUtils.accountOwnsFile(file, account)) {
  225. sharedWithYouContainer.setVisibility(View.GONE);
  226. } else {
  227. sharedWithYouUsername.setText(
  228. String.format(getString(R.string.shared_with_you_by), file.getOwnerDisplayName()));
  229. DisplayUtils.setAvatar(account, file.getOwnerId(), this, getResources().getDimension(
  230. R.dimen.file_list_item_avatar_icon_radius), getResources(), sharedWithYouAvatar,
  231. getContext());
  232. sharedWithYouAvatar.setVisibility(View.VISIBLE);
  233. String note = file.getNote();
  234. if (!TextUtils.isEmpty(note)) {
  235. sharedWithYouNote.setText(file.getNote());
  236. sharedWithYouNote.setVisibility(View.VISIBLE);
  237. } else {
  238. sharedWithYouNote.setVisibility(View.GONE);
  239. }
  240. }
  241. }
  242. private void updateListOfUserGroups() {
  243. // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
  244. if (shares.size() > 0) {
  245. AccountManager accountManager = AccountManager.get(getContext());
  246. String userId = accountManager.getUserData(account,
  247. com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);
  248. usersList.setVisibility(View.VISIBLE);
  249. usersList.setAdapter(new UserListAdapter(fileDisplayActivity.getSupportFragmentManager(),
  250. fileDisplayActivity, shares, account, file, this, userId));
  251. usersList.setLayoutManager(new LinearLayoutManager(getContext()));
  252. usersList.addItemDecoration(new SimpleListItemDividerDecoration(getContext()));
  253. noList.setVisibility(View.GONE);
  254. } else {
  255. usersList.setVisibility(View.GONE);
  256. noList.setVisibility(View.VISIBLE);
  257. }
  258. }
  259. @OnClick(R.id.share_by_link)
  260. public void toggleShareByLink() {
  261. if (shareByLink.isChecked()) {
  262. createShareLink();
  263. } else {
  264. fileOperationsHelper.unshareFileViaLink(file);
  265. }
  266. }
  267. private void createShareLink() {
  268. if (capabilities != null && (capabilities.getFilesSharingPublicPasswordEnforced().isTrue() ||
  269. capabilities.getFilesSharingPublicAskForPassword().isTrue())) {
  270. // password enforced by server, request to the user before trying to create
  271. requestPasswordForShareViaLink(true, capabilities.getFilesSharingPublicAskForPassword().isTrue());
  272. } else {
  273. // create without password if not enforced by server or we don't know if enforced;
  274. fileOperationsHelper.shareFileViaLink(file, null);
  275. }
  276. }
  277. private void showSendLinkTo() {
  278. if (file.isSharedViaLink()) {
  279. if (TextUtils.isEmpty(file.getPublicLink())) {
  280. fileOperationsHelper.getFileWithLink(file);
  281. } else {
  282. FileDisplayActivity.showShareLinkDialog(fileDisplayActivity, file.getPublicLink());
  283. }
  284. }
  285. }
  286. @OnClick({R.id.share_link_copy_icon})
  287. public void copyLinkToClipboard() {
  288. if (file.isSharedViaLink()) {
  289. if (TextUtils.isEmpty(file.getPublicLink())) {
  290. fileOperationsHelper.getFileWithLink(file);
  291. } else {
  292. ClipboardUtil.copyToClipboard(getActivity(), file.getPublicLink());
  293. }
  294. }
  295. }
  296. @OnClick(R.id.share_by_link_allow_editing)
  297. public void toggleShareLinkAllowEditing() {
  298. if (file.isSharedViaLink()) {
  299. fileOperationsHelper.setUploadPermissionsToShare(file, shareByLinkAllowEditing.isChecked());
  300. }
  301. }
  302. @OnClick(R.id.overflow_menu_share_link)
  303. public void showLinkOverflowMenu() {
  304. Context context = getContext();
  305. if (context != null && ThemeUtils.themingEnabled(context)) {
  306. // use grey as fallback for elements where custom theming is not available
  307. context.getTheme().applyStyle(R.style.FallbackThemingTheme, true);
  308. } else {
  309. context = getActivity();
  310. }
  311. PopupMenu popup = new PopupMenu(context, overflowMenuShareLink);
  312. popup.inflate(R.menu.file_detail_sharing_link_menu);
  313. prepareOptionsMenu(popup.getMenu());
  314. popup.setOnMenuItemClickListener(this::optionsItemSelected);
  315. popup.show();
  316. }
  317. private void prepareOptionsMenu(Menu menu) {
  318. Resources res = getResources();
  319. SharingMenuHelper.setupHideFileListingMenuItem(
  320. menu.findItem(R.id.action_hide_file_listing),
  321. file.isFolder(),
  322. shareByLinkAllowEditing.isChecked(),
  323. publicShare.getPermissions()
  324. );
  325. SharingMenuHelper.setupHideFileDownload(menu.findItem(R.id.action_hide_file_download),
  326. publicShare.isHideFileDownload(), capabilities);
  327. SharingMenuHelper.setupPasswordMenuItem(
  328. menu.findItem(R.id.action_password),
  329. publicShare.isPasswordProtected()
  330. );
  331. SharingMenuHelper.setupExpirationDateMenuItem(
  332. menu.findItem(R.id.action_share_expiration_date),
  333. publicShare.getExpirationDate(),
  334. res
  335. );
  336. menu.findItem(R.id.action_share_send_note).setVisible(capabilities.getVersion().isNoteOnShareSupported());
  337. }
  338. private boolean optionsItemSelected(MenuItem item) {
  339. switch (item.getItemId()) {
  340. case R.id.action_hide_file_listing: {
  341. item.setChecked(!item.isChecked());
  342. if (capabilities.getFilesFileDrop().isTrue()) {
  343. setHideFileListingPermissionsToShare(publicShare, item.isChecked());
  344. } else {
  345. // not supported in ownCloud
  346. showNotSupportedByOcMessage();
  347. }
  348. return true;
  349. }
  350. case R.id.action_hide_file_download:
  351. item.setChecked(!item.isChecked());
  352. setHideFileDownloadPermissionToShare(file, item.isChecked());
  353. return true;
  354. case R.id.action_password: {
  355. requestPasswordForShareViaLink(false, capabilities.getFilesSharingPublicAskForPassword().isTrue());
  356. return true;
  357. }
  358. case R.id.action_share_expiration_date: {
  359. ExpirationDatePickerDialogFragment dialog = ExpirationDatePickerDialogFragment.newInstance(file, -1);
  360. dialog.show(
  361. fileDisplayActivity.getSupportFragmentManager(),
  362. ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
  363. );
  364. return true;
  365. }
  366. case R.id.action_share_send_link: {
  367. if(shareByLink.isChecked() && file.isSharedViaLink() && !TextUtils.isEmpty(file.getPublicLink())) {
  368. FileDisplayActivity.showShareLinkDialog(fileDisplayActivity, file.getPublicLink());
  369. } else {
  370. showSendLinkTo();
  371. }
  372. return true;
  373. }
  374. case R.id.action_share_send_note:
  375. NoteDialogFragment dialog = NoteDialogFragment.newInstance(publicShare);
  376. dialog.show(fileDisplayActivity.getSupportFragmentManager(), NoteDialogFragment.NOTE_FRAGMENT);
  377. return true;
  378. default:
  379. return super.onOptionsItemSelected(item);
  380. }
  381. }
  382. @Override
  383. public void setHideFileListingPermissionsToShare(OCShare share, boolean hideFileListing) {
  384. fileOperationsHelper.setHideFileListingPermissionsToShare(share, hideFileListing);
  385. }
  386. @Override
  387. public void setHideFileDownloadPermissionToShare(OCFile file, boolean hideFileDownload) {
  388. fileOperationsHelper.setHideFileDownloadPermissionsToShare(file, hideFileDownload);
  389. }
  390. @Override
  391. public void showNotSupportedByOcMessage() {
  392. if (getView() != null) {
  393. Snackbar.make(getView(), R.string.files_drop_not_supported, Snackbar.LENGTH_LONG)
  394. .setAction(R.string.learn_more, v ->
  395. DisplayUtils.startLinkIntent(requireActivity(), R.string.url_server_install))
  396. .show();
  397. }
  398. }
  399. /**
  400. * Updates the UI after the result of an update operation on the edited {@link OCFile}.
  401. *
  402. * @param result {@link RemoteOperationResult} of an update on the edited {@link OCFile} sharing information.
  403. * @param file the edited {@link OCFile}
  404. */
  405. public void onUpdateShareInformation(RemoteOperationResult result, OCFile file) {
  406. this.file = file;
  407. if (result.isSuccess()) {
  408. refreshUiFromDB();
  409. } else {
  410. setupView();
  411. }
  412. }
  413. /**
  414. * Get {@link OCShare} instance from DB and updates the UI.
  415. */
  416. private void refreshUiFromDB() {
  417. if (publicShare != null) {
  418. // Get edited shared by link
  419. publicShare = fileDataStorageManager.getShareById(publicShare.getId());
  420. }
  421. // Updates UI with new state
  422. setupView();
  423. }
  424. @Override
  425. public void unshareWith(OCShare share) {
  426. fileOperationsHelper.unshareFileWithUserOrGroup(file, share.getShareType(), share.getShareWith());
  427. }
  428. @Override
  429. public int updatePermissionsToShare(OCShare share, boolean canReshare, boolean canEdit, boolean canEditCreate,
  430. boolean canEditChange, boolean canEditDelete) {
  431. SharePermissionsBuilder spb = new SharePermissionsBuilder();
  432. spb.setSharePermission(canReshare);
  433. if (file.isFolder()) {
  434. spb.setUpdatePermission(canEditChange)
  435. .setCreatePermission(canEditCreate)
  436. .setDeletePermission(canEditDelete);
  437. } else {
  438. spb.setUpdatePermission(canEdit);
  439. }
  440. int permissions = spb.build();
  441. fileOperationsHelper.setPermissionsToShare(share, permissions);
  442. return permissions;
  443. }
  444. @Override
  445. public void updateNoteToShare(OCShare share, String note) {
  446. fileOperationsHelper.updateNoteToShare(share, note);
  447. }
  448. /**
  449. * Starts a dialog that requests a password to the user to protect a share link.
  450. *
  451. * @param createShare When 'true', the request for password will be followed by the creation of a new public
  452. * link; when 'false', a public share is assumed to exist, and the password is bound to it.
  453. * @param askForPassword if true, password is optional
  454. */
  455. public void requestPasswordForShareViaLink(boolean createShare, boolean askForPassword) {
  456. SharePasswordDialogFragment dialog = SharePasswordDialogFragment.newInstance(file,
  457. createShare,
  458. askForPassword);
  459. dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
  460. }
  461. @Override
  462. public void requestPasswordForShare(OCShare share) {
  463. SharePasswordDialogFragment dialog = SharePasswordDialogFragment.newInstance(share);
  464. dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
  465. }
  466. /**
  467. * Get known server capabilities from DB
  468. */
  469. public void refreshCapabilitiesFromDB() {
  470. capabilities = fileDataStorageManager.getCapability(account.name);
  471. }
  472. /**
  473. * Get public link from the DB to fill in the "Share link" section in the UI.
  474. *
  475. * Takes into account server capabilities before reading database.
  476. */
  477. public void refreshPublicShareFromDB() {
  478. if (FileDetailSharingFragmentHelper.isPublicShareDisabled(capabilities) || !file.canReshare()) {
  479. shareByLinkContainer.setVisibility(View.GONE);
  480. } else {
  481. // Get public share
  482. publicShare = fileDataStorageManager.getFirstShareByPathAndType(file.getRemotePath(),
  483. ShareType.PUBLIC_LINK, "");
  484. // Update public share section
  485. updatePublicShareSection();
  486. }
  487. }
  488. /**
  489. * Updates in the UI the section about public share with the information
  490. * in the current public share bound to, if any.
  491. */
  492. private void updatePublicShareSection() {
  493. if (publicShare != null && ShareType.PUBLIC_LINK.equals(publicShare.getShareType())) {
  494. shareByLink.setChecked(true);
  495. if (publicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {
  496. shareByLinkAllowEditing.setChecked(true);
  497. } else {
  498. shareByLinkAllowEditing.setChecked(false);
  499. }
  500. setShareByLinkInfo(true);
  501. } else {
  502. setShareByLinkInfo(false);
  503. }
  504. }
  505. @Override
  506. public void onSaveInstanceState(@NonNull Bundle outState) {
  507. super.onSaveInstanceState(outState);
  508. outState.putParcelable(FileActivity.EXTRA_FILE, file);
  509. outState.putParcelable(FileActivity.EXTRA_ACCOUNT, account);
  510. }
  511. @Override
  512. public void avatarGenerated(Drawable avatarDrawable, Object callContext) {
  513. sharedWithYouAvatar.setImageDrawable(avatarDrawable);
  514. }
  515. @Override
  516. public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
  517. return false;
  518. }
  519. }