From 79a32d590baf6e178b4c2a201c2be1e1e991f4e5 Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Thu, 3 Jan 2019 12:33:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B5=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/caches/build_file_checksums.ser | Bin 531 -> 537 bytes .idea/misc.xml | 31 +----------------- .../ru/volgorobot/vrcatalog/MainActivity.java | 17 +++++----- 3 files changed, 9 insertions(+), 39 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 104abea78f7d9bda2d7ee9eba7b650ed766d6b0c..b985abcbd5df558021ad0c25cadbc739c643f094 100644 GIT binary patch delta 67 zcmbQtGLvP(bk+=^>wLl!=XCIE=x5~Trs^kW6y@jT7gtPfW;C0u!ssHb!Y3u|6mwKE X)M$3R9kZ%s34`F|9!BZOR~hX9?*kP8 delta 68 zcmV-K0K5O01d{}imj!1#VSz%CoQRWY0YoIW#44S!$R;WJb;PN-B#X6l03t7FZ*65S ab1^S2XL4a=Y-KN#zyTYRR{;`}zX4jjUK*DG 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());