Skip to content

Commit

Permalink
feat: Redesign Local Libraries UI
Browse files Browse the repository at this point in the history
  • Loading branch information
aikrq committed Dec 29, 2024
1 parent fa0d2ee commit 56e74e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import pro.sketchware.utility.FileUtil;
import pro.sketchware.utility.SketchwareUtil;

import a.a.a.mB;

public class ManageLocalLibraryActivity extends AppCompatActivity {

private ArrayList<HashMap<String, Object>> lookupList = new ArrayList<>();
Expand Down Expand Up @@ -77,10 +79,8 @@ protected void onCreate(Bundle savedInstanceState) {
binding.searchList.setAdapter(searchAdapter);

binding.searchBar.setNavigationOnClickListener(v -> {
if (!binding.searchView.isShowing()) {
binding.searchView.hide();
} else {
finish();
if (!mB.a()) {
onBackPressed();
}
});

Expand Down Expand Up @@ -122,6 +122,15 @@ public void onTextChanged(CharSequence newText, int start, int before, int count
loadLibraries();
}

@Override
public void onBackPressed() {
if (binding.searchView.isShowing()) {
binding.searchView.hide();
} else {
super.onBackPressed();
}
}

private void loadLibraries() {
projectUsedLibs.clear();
lookupList.clear();
Expand Down Expand Up @@ -205,6 +214,7 @@ public void onBindViewHolder(ViewHolder holder, final int position) {
final String librarySize = FileUtil.formatFileSize(libraryFile.length());
binding.libraryName.setText(libraryFile.getName());
binding.librarySize.setText(librarySize);
binding.libraryName.setSelected(true);

binding.card.setOnClickListener(v -> binding.checkbox.performClick());
binding.checkbox.setOnClickListener(v -> onItemClicked(binding));
Expand Down Expand Up @@ -310,6 +320,7 @@ public void onBindViewHolder(ViewHolder holder, final int position) {
final String librarySize = FileUtil.formatFileSize(libraryFile.length());
binding.libraryName.setText(libraryFile.getName());
binding.librarySize.setText(librarySize);
binding.libraryName.setSelected(true);

binding.getRoot().setOnClickListener(v -> binding.checkbox.performClick());
binding.checkbox.setOnClickListener(v -> onItemClicked(binding));
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/view_item_local_lib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="12dp"
android:paddingEnd="8dp"
android:paddingStart="20dp"
android:paddingVertical="12dp">

Expand All @@ -27,6 +27,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:textColor="?attr/colorOnSurface"
android:textSize="17sp"
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/view_item_local_lib_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingEnd="8dp"
android:paddingStart="16dp"
android:paddingVertical="12dp">
android:paddingEnd="12dp"
android:paddingStart="20dp"
android:paddingVertical="16dp">

<TextView
android:id="@+id/library_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:textColor="?attr/colorOnSurface"
android:textSize="17sp"
Expand Down

0 comments on commit 56e74e1

Please sign in to comment.