Search in sources :

Example 1 with MediaAdapter

use of eu.siacs.conversations.ui.adapter.MediaAdapter in project Conversations by siacs.

the class ConferenceDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_details);
    this.binding.changeConferenceButton.setOnClickListener(this.mChangeConferenceSettings);
    setSupportActionBar(binding.toolbar);
    configureActionBar(getSupportActionBar());
    this.binding.editNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(), R.string.nickname, value -> {
        if (xmppConnectionService.renameInMuc(mConversation, value, renameCallback)) {
            return null;
        } else {
            return getString(R.string.invalid_muc_nick);
        }
    }));
    this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false);
    this.binding.mucInfoMore.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
    this.binding.notificationStatusButton.setOnClickListener(this.mNotifyStatusClickListener);
    this.binding.yourPhoto.setOnClickListener(v -> {
        final MucOptions mucOptions = mConversation.getMucOptions();
        if (!mucOptions.hasVCards()) {
            Toast.makeText(this, R.string.host_does_not_support_group_chat_avatars, Toast.LENGTH_SHORT).show();
            return;
        }
        if (!mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
            Toast.makeText(this, R.string.only_the_owner_can_change_group_chat_avatar, Toast.LENGTH_SHORT).show();
            return;
        }
        final Intent intent = new Intent(this, PublishGroupChatProfilePictureActivity.class);
        intent.putExtra("uuid", mConversation.getUuid());
        startActivity(intent);
    });
    this.binding.editMucNameButton.setOnClickListener(this::onMucEditButtonClicked);
    this.binding.mucEditTitle.addTextChangedListener(this);
    this.binding.mucEditSubject.addTextChangedListener(this);
    this.binding.mucEditSubject.addTextChangedListener(new StylingHelper.MessageEditorStyler(this.binding.mucEditSubject));
    this.mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
    this.mUserPreviewAdapter = new UserPreviewAdapter();
    this.binding.media.setAdapter(mMediaAdapter);
    this.binding.users.setAdapter(mUserPreviewAdapter);
    GridManager.setupLayoutManager(this, this.binding.media, R.dimen.media_size);
    GridManager.setupLayoutManager(this, this.binding.users, R.dimen.media_size);
    this.binding.invite.setOnClickListener(v -> inviteToConversation(mConversation));
    this.binding.showUsers.setOnClickListener(v -> {
        Intent intent = new Intent(this, MucUsersActivity.class);
        intent.putExtra("uuid", mConversation.getUuid());
        startActivity(intent);
    });
}
Also used : Bundle(android.os.Bundle) SoftKeyboardUtils(eu.siacs.conversations.ui.util.SoftKeyboardUtils) PendingIntent(android.app.PendingIntent) LinkMovementMethod(android.text.method.LinkMovementMethod) MenuDoubleTabUtil(eu.siacs.conversations.ui.util.MenuDoubleTabUtil) StringUtils(eu.siacs.conversations.utils.StringUtils) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) View(android.view.View) MucDetailsContextMenuHelper(eu.siacs.conversations.ui.util.MucDetailsContextMenuHelper) StylingHelper(eu.siacs.conversations.utils.StylingHelper) AvatarWorkerTask(eu.siacs.conversations.ui.util.AvatarWorkerTask) DataBindingUtil(androidx.databinding.DataBindingUtil) Attachment(eu.siacs.conversations.ui.util.Attachment) OnConversationUpdate(eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate) MucOptions(eu.siacs.conversations.entities.MucOptions) List(java.util.List) GridManager(eu.siacs.conversations.ui.util.GridManager) MediaAdapter(eu.siacs.conversations.ui.adapter.MediaAdapter) ToastCompat(me.drakeet.support.toast.ToastCompat) ActivityMucDetailsBinding(eu.siacs.conversations.databinding.ActivityMucDetailsBinding) Bookmark(eu.siacs.conversations.entities.Bookmark) Bookmark.printableValue(eu.siacs.conversations.entities.Bookmark.printableValue) TextWatcher(android.text.TextWatcher) Context(android.content.Context) Config(eu.siacs.conversations.Config) AlertDialog(androidx.appcompat.app.AlertDialog) EmojiWrapper(eu.siacs.conversations.utils.EmojiWrapper) Intent(android.content.Intent) Account(eu.siacs.conversations.entities.Account) Editable(android.text.Editable) MenuItem(android.view.MenuItem) Conversation(eu.siacs.conversations.entities.Conversation) AccountUtils(eu.siacs.conversations.utils.AccountUtils) Compatibility(eu.siacs.conversations.utils.Compatibility) StringUtils.changed(eu.siacs.conversations.utils.StringUtils.changed) SpannableStringBuilder(android.text.SpannableStringBuilder) OnMediaLoaded(eu.siacs.conversations.ui.interfaces.OnMediaLoaded) Toast(android.widget.Toast) Menu(android.view.Menu) MyLinkify(eu.siacs.conversations.ui.util.MyLinkify) UserPreviewAdapter(eu.siacs.conversations.ui.adapter.UserPreviewAdapter) MucConfiguration(eu.siacs.conversations.ui.util.MucConfiguration) R(eu.siacs.conversations.R) XmppConnectionService(eu.siacs.conversations.services.XmppConnectionService) OnMucRosterUpdate(eu.siacs.conversations.services.XmppConnectionService.OnMucRosterUpdate) User(eu.siacs.conversations.entities.MucOptions.User) Activity(android.app.Activity) Collections(java.util.Collections) XmppUri(eu.siacs.conversations.utils.XmppUri) Jid(eu.siacs.conversations.xmpp.Jid) OnClickListener(android.view.View.OnClickListener) MucOptions(eu.siacs.conversations.entities.MucOptions) MediaAdapter(eu.siacs.conversations.ui.adapter.MediaAdapter) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) UserPreviewAdapter(eu.siacs.conversations.ui.adapter.UserPreviewAdapter) StylingHelper(eu.siacs.conversations.utils.StylingHelper)

Example 2 with MediaAdapter

use of eu.siacs.conversations.ui.adapter.MediaAdapter in project Conversations by siacs.

the class MediaBrowserActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.binding = DataBindingUtil.setContentView(this, R.layout.activity_media_browser);
    setSupportActionBar(binding.toolbar);
    configureActionBar(getSupportActionBar());
    mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
    this.binding.media.setAdapter(mMediaAdapter);
    GridManager.setupLayoutManager(this, this.binding.media, R.dimen.browser_media_size);
}
Also used : MediaAdapter(eu.siacs.conversations.ui.adapter.MediaAdapter)

Example 3 with MediaAdapter

use of eu.siacs.conversations.ui.adapter.MediaAdapter in project Conversations by siacs.

the class ContactDetailsActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    showInactiveOmemo = savedInstanceState != null && savedInstanceState.getBoolean("show_inactive_omemo", false);
    if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
        try {
            this.accountJid = Jid.ofEscaped(getIntent().getExtras().getString(EXTRA_ACCOUNT));
        } catch (final IllegalArgumentException ignored) {
        }
        try {
            this.contactJid = Jid.ofEscaped(getIntent().getExtras().getString("contact"));
        } catch (final IllegalArgumentException ignored) {
        }
    }
    this.messageFingerprint = getIntent().getStringExtra("fingerprint");
    this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details);
    setSupportActionBar(binding.toolbar);
    configureActionBar(getSupportActionBar());
    binding.showInactiveDevices.setOnClickListener(v -> {
        showInactiveOmemo = !showInactiveOmemo;
        populateView();
    });
    binding.addContactButton.setOnClickListener(v -> showAddToRosterDialog(contact));
    mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
    this.binding.media.setAdapter(mMediaAdapter);
    GridManager.setupLayoutManager(this, this.binding.media, R.dimen.media_size);
}
Also used : MediaAdapter(eu.siacs.conversations.ui.adapter.MediaAdapter)

Aggregations

MediaAdapter (eu.siacs.conversations.ui.adapter.MediaAdapter)3 Activity (android.app.Activity)1 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 TextWatcher (android.text.TextWatcher)1 LinkMovementMethod (android.text.method.LinkMovementMethod)1 Menu (android.view.Menu)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 Toast (android.widget.Toast)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 DataBindingUtil (androidx.databinding.DataBindingUtil)1 Config (eu.siacs.conversations.Config)1 R (eu.siacs.conversations.R)1 ActivityMucDetailsBinding (eu.siacs.conversations.databinding.ActivityMucDetailsBinding)1