mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
add 'Audio' tab to profile (#2387)
This commit is contained in:
@@ -56,6 +56,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
public static final int TAB_SETTINGS = 10;
|
||||
public static final int TAB_GALLERY = 20;
|
||||
public static final int TAB_AUDIO = 25;
|
||||
public static final int TAB_DOCS = 30;
|
||||
public static final int TAB_WEBXDC = 35;
|
||||
public static final int TAB_LINKS = 40;
|
||||
@@ -243,6 +244,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
tabs.add(TAB_SETTINGS);
|
||||
}
|
||||
tabs.add(TAB_GALLERY);
|
||||
tabs.add(TAB_AUDIO);
|
||||
tabs.add(TAB_DOCS);
|
||||
tabs.add(TAB_WEBXDC);
|
||||
//tabs.add(TAB_LINKS);
|
||||
@@ -325,6 +327,13 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
args.putSerializable(ProfileGalleryFragment.LOCALE_EXTRA, dynamicLanguage.getCurrentLocale());
|
||||
break;
|
||||
|
||||
case TAB_AUDIO:
|
||||
fragment = new ProfileDocumentsFragment();
|
||||
args.putInt(ProfileDocumentsFragment.CHAT_ID_EXTRA, (chatId==0&&!isGlobalProfile())? -1 : chatId);
|
||||
args.putBoolean(ProfileDocumentsFragment.SHOW_AUDIO_EXTRA, true);
|
||||
args.putSerializable(ProfileDocumentsFragment.LOCALE_EXTRA, dynamicLanguage.getCurrentLocale());
|
||||
break;
|
||||
|
||||
case TAB_WEBXDC:
|
||||
fragment = new ProfileDocumentsFragment();
|
||||
args.putInt(ProfileDocumentsFragment.CHAT_ID_EXTRA, (chatId==0&&!isGlobalProfile())? -1 : chatId);
|
||||
@@ -370,6 +379,9 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
case TAB_GALLERY:
|
||||
return getString(R.string.tab_gallery);
|
||||
|
||||
case TAB_AUDIO:
|
||||
return getString(R.string.audio);
|
||||
|
||||
case TAB_DOCS:
|
||||
return getString(R.string.files);
|
||||
|
||||
|
||||
@@ -39,12 +39,14 @@ public class ProfileDocumentsFragment
|
||||
{
|
||||
public static final String LOCALE_EXTRA = "locale_extra";
|
||||
public static final String CHAT_ID_EXTRA = "chat_id";
|
||||
public static final String SHOW_AUDIO_EXTRA = "show_audio";
|
||||
public static final String SHOW_WEBXDC_EXTRA = "show_webxdc";
|
||||
|
||||
protected TextView noMedia;
|
||||
protected RecyclerView recyclerView;
|
||||
private StickyHeaderGridLayoutManager gridManager;
|
||||
private ActionModeCallback actionModeCallback = new ActionModeCallback();
|
||||
private boolean showAudio;
|
||||
private boolean showWebxdc;
|
||||
|
||||
protected int chatId;
|
||||
@@ -56,6 +58,7 @@ public class ProfileDocumentsFragment
|
||||
|
||||
dcContext = DcHelper.getContext(getContext());
|
||||
chatId = getArguments().getInt(CHAT_ID_EXTRA, -1);
|
||||
showAudio = getArguments().getBoolean(SHOW_AUDIO_EXTRA, false);
|
||||
showWebxdc = getArguments().getBoolean(SHOW_WEBXDC_EXTRA, false);
|
||||
locale = (Locale)getArguments().getSerializable(LOCALE_EXTRA);
|
||||
if (locale == null) throw new AssertionError();
|
||||
@@ -106,10 +109,12 @@ public class ProfileDocumentsFragment
|
||||
|
||||
@Override
|
||||
public Loader<BucketedThreadMediaLoader.BucketedThreadMedia> onCreateLoader(int i, Bundle bundle) {
|
||||
if (showWebxdc) {
|
||||
if (showAudio) {
|
||||
return new BucketedThreadMediaLoader(getContext(), chatId, DcMsg.DC_MSG_AUDIO, DcMsg.DC_MSG_VOICE, 0);
|
||||
} else if (showWebxdc) {
|
||||
return new BucketedThreadMediaLoader(getContext(), chatId, DcMsg.DC_MSG_WEBXDC, 0, 0);
|
||||
} else {
|
||||
return new BucketedThreadMediaLoader(getContext(), chatId, DcMsg.DC_MSG_FILE, DcMsg.DC_MSG_AUDIO, 0);
|
||||
return new BucketedThreadMediaLoader(getContext(), chatId, DcMsg.DC_MSG_FILE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +124,9 @@ public class ProfileDocumentsFragment
|
||||
((ProfileDocumentsAdapter) recyclerView.getAdapter()).notifyAllSectionsDataSetChanged();
|
||||
|
||||
noMedia.setVisibility(recyclerView.getAdapter().getItemCount() > 0 ? View.GONE : View.VISIBLE);
|
||||
if (showWebxdc) {
|
||||
if (showAudio) {
|
||||
noMedia.setText(R.string.tab_audio_empty_hint);
|
||||
} else if (showWebxdc) {
|
||||
noMedia.setText(R.string.tab_webxdc_empty_hint);
|
||||
}
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
||||
Reference in New Issue
Block a user