diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 84fb81f..104abea 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/misc.xml b/.idea/misc.xml index e0d5b93..b0c7b20 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -29,7 +29,7 @@ - + diff --git a/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java b/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java index c964d8f..40e2140 100644 --- a/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java +++ b/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java @@ -32,11 +32,9 @@ import ru.volgorobot.vrcatalog.model.FirstLevelModel; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, SwipeRefreshLayout.OnRefreshListener { - private AndroidTreeView treeView; private VRApi vrApi; private List firstLevelObjects = new ArrayList<>(); private List firstLevelNodes = new ArrayList<>(); - private TreeNode root = TreeNode.root(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -64,14 +62,6 @@ public class MainActivity extends AppCompatActivity } catch (IllegalStateException e) { // } - - root.addChildren(firstLevelNodes); - treeView = new AndroidTreeView(MainActivity.this, root); - treeView.setDefaultAnimation(true); - ViewGroup containerView = (ViewGroup) findViewById(R.id.treeViewContainer); - - containerView.addView(treeView.getView()); - } @Override @@ -117,8 +107,14 @@ public class MainActivity extends AppCompatActivity for (int i = 0; i < firstLevelObjects.size(); i++) { firstLevelNodes.add(new TreeNode(firstLevelObjects.get(i).getName())); } - SwipeRefreshLayout mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout); - mSwipeRefreshLayout.setRefreshing(false); + + TreeNode root = TreeNode.root(); + root.addChildren(firstLevelNodes); + AndroidTreeView treeView = new AndroidTreeView(MainActivity.this, root); + treeView.setDefaultAnimation(true); + treeView.setDefaultContainerStyle(R.style.TreeNodeStyle); + ViewGroup containerView = findViewById(R.id.treeViewContainer); + containerView.addView(treeView.getView()); } @Override @@ -146,10 +142,6 @@ public class MainActivity extends AppCompatActivity final SwipeRefreshLayout mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setRefreshing(true); if(clean) { - List list = new ArrayList<>(root.getChildren()); - for (int i = 0; i < list.size(); i++) { - root.deleteChild(list.get(i)); - } for (int i = 0; i < firstLevelNodes.size(); i++) { firstLevelNodes.remove(i); }