Skip to content

Commit 87a00c3

Browse files
committed
Update main ui
1 parent a5659d6 commit 87a00c3

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

app/src/main/java/com/mcal/disassembler/activities/MainActivity.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mcal.disassembler.activities;
22

33
import android.Manifest;
4+
import android.animation.LayoutTransition;
45
import android.annotation.SuppressLint;
56
import android.app.ProgressDialog;
67
import android.content.Intent;
@@ -12,6 +13,7 @@
1213
import android.view.Menu;
1314
import android.view.MenuItem;
1415
import android.view.View;
16+
import android.widget.LinearLayout;
1517

1618
import androidx.annotation.NonNull;
1719
import androidx.appcompat.app.AppCompatActivity;
@@ -45,8 +47,9 @@ public class MainActivity extends AppCompatActivity implements MainView {
4547
ProgressDialog dialog;
4648
private CenteredToolBar toolbar;
4749
private RecyclerView recentOpened;
48-
private ArrayList<String> paths = new ArrayList<>();
50+
private final ArrayList<String> paths = new ArrayList<>();
4951
private String path;
52+
private LinearLayout welcomeLayout;
5053

5154
@Override
5255
public void onCreate(Bundle savedInstanceState) {
@@ -58,19 +61,18 @@ public void onCreate(Bundle savedInstanceState) {
5861
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Settings.ACTION_MANAGE_OVERLAY_PERMISSION}, 1);
5962
}
6063
}
61-
6264
new Database(this);
63-
//welcomeLayout = findViewById(R.id.welcome_layout);
65+
welcomeLayout = findViewById(R.id.welcome_layout);
6466
recentOpened = findViewById(R.id.items);
6567
recentOpened.setLayoutManager(new LinearLayoutManager(this));
66-
Cursor cursor = RecentsManager.getRecents();
68+
/*Cursor cursor = RecentsManager.getRecents();
6769
if (cursor.getCount() > 0) {
6870
while (cursor.moveToNext()) {
6971
paths.add(cursor.getString(0));
7072
}
7173
}
72-
recentOpened.setAdapter(new ListAdapter(paths, this));
73-
//setupList();
74+
recentOpened.setAdapter(new ListAdapter(paths, this));*/
75+
updateRecents();
7476
}
7577

7678
@Override
@@ -105,9 +107,10 @@ private void setupToolbar(String title) {
105107
getSupportActionBar().setDisplayShowHomeEnabled(false);
106108
}
107109

108-
/*public void setupList() {
110+
void updateRecents() {
111+
paths.clear();
109112
Cursor cursor = RecentsManager.getRecents();
110-
if (cursor.getCount() == 0) {
113+
if (cursor.getCount() == 0) { // TODO: FIXME
111114
recentOpened.setVisibility(View.GONE);
112115
welcomeLayout.setVisibility(View.VISIBLE);
113116
recentOpened.setAdapter(new ListAdapter(paths, this));
@@ -122,11 +125,7 @@ private void setupToolbar(String title) {
122125
}
123126
recentOpened.setAdapter(new ListAdapter(paths, this));
124127
}
125-
}*/
126128

127-
void updateRecents() {
128-
paths.clear();
129-
Cursor cursor = RecentsManager.getRecents();
130129
if (cursor.getCount() > 0) {
131130
while (cursor.moveToNext()) {
132131
paths.add(cursor.getString(0));

app/src/main/java/com/mcal/disassembler/adapters/ListAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import java.util.ArrayList;
2121

2222
public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ViewHolder> implements Filterable {
23-
private SearchFilter filter;
23+
private final SearchFilter filter;
2424
private ArrayList<String> paths;
25-
private MainView mainView;
25+
private final MainView mainView;
2626

2727
public ListAdapter(ArrayList<String> paths, MainView mainView) {
2828
this.paths = paths;
@@ -56,7 +56,7 @@ public void onBindViewHolder(@NotNull final ListAdapter.ViewHolder holder, final
5656
}
5757

5858
@Override
59-
public ListAdapter.ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int p2) {
59+
public ListAdapter.@NotNull ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int p2) {
6060
View item = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
6161
return new ViewHolder(item);
6262
}
@@ -76,8 +76,8 @@ static class ViewHolder extends RecyclerView.ViewHolder {
7676
}
7777

7878
private class SearchFilter extends Filter {
79-
private ArrayList<String> items_backup = paths;
80-
private ArrayList<String> filteredItems = new ArrayList<>();
79+
private final ArrayList<String> items_backup = paths;
80+
private final ArrayList<String> filteredItems = new ArrayList<>();
8181

8282
@Override
8383
protected Filter.FilterResults performFiltering(CharSequence p1) {

app/src/main/res/layout/main_activity.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@
3131
android:gravity="center_horizontal"
3232
android:orientation="horizontal" />
3333

34-
<!-- RelativeLayout
34+
<RelativeLayout
3535
android:id="@+id/layoutHolder"
3636
android:layout_width="match_parent"
3737
android:layout_height="match_parent"
3838
android:orientation="vertical">
3939

4040
<LinearLayout
4141
android:id="@+id/welcome_layout"
42+
android:animateLayoutChanges="true"
4243
android:layout_width="match_parent"
4344
android:layout_height="match_parent"
4445
android:gravity="center"
@@ -54,7 +55,7 @@
5455
android:textAppearance="?android:attr/textAppearanceLarge"
5556
android:textSize="35sp" />
5657

57-
</LinearLayout -->
58+
</LinearLayout>
5859

5960
<androidx.recyclerview.widget.RecyclerView
6061
android:id="@+id/items"
@@ -64,7 +65,7 @@
6465
android:listSelector="@android:color/transparent"
6566
android:scrollbarStyle="outsideOverlay" />
6667

67-
<!-- /RelativeLayout -->
68+
</RelativeLayout>
6869

6970
<com.google.android.material.floatingactionbutton.FloatingActionButton
7071
android:id="@+id/fab"

0 commit comments

Comments
 (0)