Fixing the crashing Share feature

TODO: Rebuild this screen in compose because the search functionality is not working
This commit is contained in:
ThomasSession 2024-08-30 16:10:40 +10:00 committed by fanchao
parent 786485d874
commit c4f0854335
3 changed files with 13 additions and 20 deletions

View File

@ -84,7 +84,7 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
setContentView(R.layout.share_activity);
initializeToolbar();
// initializeToolbar();
initializeResources();
initializeSearch();
initializeMedia();
@ -126,13 +126,13 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
else super.onBackPressed();
}
private void initializeToolbar() {
Toolbar toolbar = findViewById(R.id.search_toolbar);
/* private void initializeToolbar() {
SearchToolbar toolbar = findViewById(R.id.search_toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}
}*/
private void initializeResources() {
progressWheel = findViewById(R.id.progress_wheel);

View File

@ -2,13 +2,11 @@ package org.thoughtcrime.securesms.components;
import android.animation.Animator;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.widget.EditText;
import android.widget.LinearLayout;
import androidx.annotation.MainThread;
import androidx.annotation.Nullable;
@ -19,7 +17,7 @@ import org.thoughtcrime.securesms.util.AnimationCompleteListener;
import network.loki.messenger.R;
public class SearchToolbar extends LinearLayout {
public class SearchToolbar extends Toolbar {
private float x, y;
private MenuItem searchItem;
@ -41,15 +39,10 @@ public class SearchToolbar extends LinearLayout {
}
private void initialize() {
inflate(getContext(), R.layout.search_toolbar, this);
setOrientation(VERTICAL);
setNavigationIcon(getContext().getResources().getDrawable(R.drawable.ic_baseline_clear_24));
inflateMenu(R.menu.conversation_list_search);
Toolbar toolbar = findViewById(R.id.search_toolbar);
toolbar.setNavigationIcon(getContext().getResources().getDrawable(R.drawable.ic_baseline_clear_24));
toolbar.inflateMenu(R.menu.conversation_list_search);
this.searchItem = toolbar.getMenu().findItem(R.id.action_filter_search);
this.searchItem = getMenu().findItem(R.id.action_filter_search);
SearchView searchView = (SearchView) searchItem.getActionView();
EditText searchText = searchView.findViewById(androidx.appcompat.R.id.search_src_text);
@ -82,7 +75,7 @@ public class SearchToolbar extends LinearLayout {
}
});
toolbar.setNavigationOnClickListener(v -> hide());
setNavigationOnClickListener(v -> hide());
}
@MainThread

View File

@ -70,19 +70,19 @@ object UpdateMessageBuilder {
}
1 -> {
Phrase.from(context, R.string.groupMemberNew)
.put(NAME_KEY, updateData.updatedMembers.elementAtOrNull(0))
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.format()
}
2 -> {
Phrase.from(context, R.string.groupMemberTwoNew)
.put(NAME_KEY, updateData.updatedMembers.elementAtOrNull(0))
.put(OTHER_NAME_KEY, updateData.updatedMembers.elementAtOrNull(1))
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
.format()
}
else -> {
val newMemberCountMinusOne = newMemberCount - 1
Phrase.from(context, R.string.groupMemberMoreNew)
.put(NAME_KEY, updateData.updatedMembers.elementAtOrNull(0))
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(COUNT_KEY, newMemberCountMinusOne)
.format()
}