1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 12:51:16 +00:00

Minor refactoring.

This commit is contained in:
George Venios 2015-08-03 00:25:28 +01:00
parent ebf885a4bb
commit ea94302676

View file

@ -13,6 +13,7 @@ import android.widget.AdapterView;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.activities.MainActivity;
import com.nutomic.syncthingandroid.activities.SettingsActivity;
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.util.FoldersAdapter;
@ -43,6 +44,15 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
initAdapter();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setEmptyText(getString(R.string.folder_list_empty));
getListView().setOnItemClickListener(this);
getListView().setOnItemLongClickListener(this);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@ -52,16 +62,13 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
}
private void initAdapter() {
MainActivity activity = (MainActivity) getActivity();
SyncthingActivity activity = (SyncthingActivity) getActivity();
if (activity == null || activity.getApi() == null)
return;
mAdapter = new FoldersAdapter(activity);
mAdapter.add(activity.getApi().getFolders());
setListAdapter(mAdapter);
setEmptyText(getString(R.string.folder_list_empty));
getListView().setOnItemClickListener(this);
getListView().setOnItemLongClickListener(this);
}
private void updateList() {