File tree 1 file changed +15
-14
lines changed
app/src/main/java/com/dp/logcatapp/fragments/savedlogsviewer
1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -163,20 +163,6 @@ class SavedLogsViewerFragment : BaseFragment() {
163
163
viewModel = ViewModelProviders .of(this )
164
164
.get(SavedLogsViewerViewModel ::class .java)
165
165
viewModel.init (Uri .parse(arguments!! .getString(KEY_FILE_URI )))
166
- viewModel.getLogs().observe(this , Observer {
167
- progressBar.visibility = View .GONE
168
- if (it != null ) {
169
- if (it.isEmpty()) {
170
- textViewEmpty.visibility = View .VISIBLE
171
- } else {
172
- textViewEmpty.visibility = View .GONE
173
- setLogs(it)
174
- scrollRecyclerView()
175
- }
176
- } else {
177
- textViewEmpty.visibility = View .VISIBLE
178
- }
179
- })
180
166
}
181
167
182
168
override fun onCreateView (inflater : LayoutInflater , container : ViewGroup ? ,
@@ -228,6 +214,21 @@ class SavedLogsViewerFragment : BaseFragment() {
228
214
.show(fragmentManager, CopyToClipboardDialogFragment .TAG )
229
215
}
230
216
}
217
+
218
+ viewModel.getLogs().observe(viewLifecycleOwner, Observer {
219
+ progressBar.visibility = View .GONE
220
+ if (it != null ) {
221
+ if (it.isEmpty()) {
222
+ textViewEmpty.visibility = View .VISIBLE
223
+ } else {
224
+ textViewEmpty.visibility = View .GONE
225
+ setLogs(it)
226
+ scrollRecyclerView()
227
+ }
228
+ } else {
229
+ textViewEmpty.visibility = View .VISIBLE
230
+ }
231
+ })
231
232
}
232
233
233
234
override fun onCreateOptionsMenu (menu : Menu , inflater : MenuInflater ) {
You can’t perform that action at this time.
0 commit comments