11package org .xedox .webaide ;
22
33import android .content .Intent ;
4+ import android .content .SharedPreferences ;
45import android .os .Bundle ;
56import android .view .View ;
67import android .widget .ImageButton ;
78import androidx .appcompat .app .AppCompatActivity ;
9+ import androidx .preference .PreferenceManager ;
810import androidx .recyclerview .widget .LinearLayoutManager ;
911import androidx .recyclerview .widget .RecyclerView ;
1012import com .google .android .material .appbar .MaterialToolbar ;
13+ import java .io .File ;
1114import org .xedox .filetree .widget .FileTreeView ;
1215import org .xedox .utils .BaseActivity ;
1316import org .xedox .utils .dialog .ErrorDialog ;
14- import org .xedox .utils .sora .SoraEditorManager ;
17+ import org .xedox .webaide .sora .SoraEditorManager ;
18+ import org .xedox .webaide .dialog .CopyAssetsDialog ;
1519import org .xedox .webaide .dialog .CreateProjectDialog ;
1620import org .xedox .webaide .project .Project ;
1721import org .xedox .webaide .project .ProjectsAdapter ;
@@ -25,8 +29,6 @@ public class MainActivity extends BaseActivity {
2529 private View emptyProjectsRecycler ;
2630 private ImageButton newProject , settings , devTools ;
2731
28- public static boolean initialize = false ;
29-
3032 @ Override
3133 protected void onCreate (Bundle savedInstanceState ) {
3234 super .onCreate (savedInstanceState );
@@ -53,20 +55,25 @@ protected void onCreate(Bundle savedInstanceState) {
5355 finish ();
5456 });
5557 newProject .setOnClickListener ((v ) -> CreateProjectDialog .show (this , projectsAdapter ));
56- settings .setOnClickListener ((v ) -> {
57- Intent intent = new Intent (this , SettingsActivity .class );
58- startActivity (intent );
59- });
60- devTools .setOnClickListener ((v ) -> {
61- Intent intent = new Intent (this , DevToolsActivity .class );
62- startActivity (intent );
63- });
58+ settings .setOnClickListener (
59+ (v ) -> {
60+ Intent intent = new Intent (this , SettingsActivity .class );
61+ startActivity (intent );
62+ });
63+ devTools .setOnClickListener (
64+ (v ) -> {
65+ Intent intent = new Intent (this , DevToolsActivity .class );
66+ startActivity (intent );
67+ });
6468 projectsAdapter .setOnChangeListener (
6569 hasItems ->
6670 emptyProjectsRecycler .setVisibility (hasItems ? View .GONE : View .VISIBLE ));
67- if (!initialize ) {
71+ SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences (this );
72+ if (!sp .getBoolean ("isCopyedAssets" , false )
73+ || !new File (AppCore .dir ("files" ), "textmate" ).exists ()) {
74+ CopyAssetsDialog .show (this );
75+ } else {
6876 SoraEditorManager .initialize (this );
69- initialize = true ;
7077 }
7178 }
7279
0 commit comments