Skip to content

Commit

Permalink
Fixing the crashing Share feature
Browse files Browse the repository at this point in the history
TODO: Rebuild this screen in compose because the search functionality is not working
  • Loading branch information
ThomasSession authored and fanchao committed Sep 5, 2024
1 parent 786485d commit c4f0854
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected void onCreate(Bundle icicle, boolean ready) {

setContentView(R.layout.share_activity);

initializeToolbar();
// initializeToolbar();
initializeResources();
initializeSearch();
initializeMedia();
Expand Down Expand Up @@ -126,13 +126,13 @@ public void onBackPressed() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

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;
Expand All @@ -19,7 +17,7 @@

import network.loki.messenger.R;

public class SearchToolbar extends LinearLayout {
public class SearchToolbar extends Toolbar {

private float x, y;
private MenuItem searchItem;
Expand All @@ -41,15 +39,10 @@ public SearchToolbar(Context context, @Nullable AttributeSet attrs, int defStyle
}

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);

Expand Down Expand Up @@ -82,7 +75,7 @@ public boolean onMenuItemActionCollapse(MenuItem item) {
}
});

toolbar.setNavigationOnClickListener(v -> hide());
setNavigationOnClickListener(v -> hide());
}

@MainThread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit c4f0854

Please sign in to comment.