diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 104abea..b985abc 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 b0c7b20..37a7509 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,35 +1,6 @@ - - - - - + diff --git a/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java b/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java index 40e2140..5213dcb 100644 --- a/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java +++ b/app/src/main/java/ru/volgorobot/vrcatalog/MainActivity.java @@ -108,12 +108,13 @@ public class MainActivity extends AppCompatActivity firstLevelNodes.add(new TreeNode(firstLevelObjects.get(i).getName())); } + ViewGroup containerView = findViewById(R.id.treeViewContainer); + containerView.removeAllViews(); 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()); } @@ -127,14 +128,6 @@ public class MainActivity extends AppCompatActivity } catch (IllegalStateException e) { // } - - - mSwipeRefreshLayout.post(new Runnable() { - @Override - public void run() { - mSwipeRefreshLayout.setRefreshing(false); - } - }); } private void refreshTree(boolean clean) throws IllegalStateException { @@ -165,6 +158,12 @@ public class MainActivity extends AppCompatActivity if(response != null) { try { firstLevelObjects.addAll(response.body()); + mSwipeRefreshLayout.post(new Runnable() { + @Override + public void run() { + mSwipeRefreshLayout.setRefreshing(false); + } + }); } catch(Exception e) { Toast.makeText(MainActivity.this, "Ответ от сервера неверен! Перепроверьте данные подключения!", Toast.LENGTH_LONG).show(); Log.e("VRCatalog", "Answer of server is wrong! Re-check your connection credentials! Error: " + response.message());