11package com .mcal .disassembler .activities ;
22
33import android .Manifest ;
4+ import android .animation .LayoutTransition ;
45import android .annotation .SuppressLint ;
56import android .app .ProgressDialog ;
67import android .content .Intent ;
1213import android .view .Menu ;
1314import android .view .MenuItem ;
1415import android .view .View ;
16+ import android .widget .LinearLayout ;
1517
1618import androidx .annotation .NonNull ;
1719import 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 ));
0 commit comments