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:
parent
ebf885a4bb
commit
ea94302676
1 changed files with 11 additions and 4 deletions
|
@ -13,6 +13,7 @@ import android.widget.AdapterView;
|
||||||
import com.nutomic.syncthingandroid.R;
|
import com.nutomic.syncthingandroid.R;
|
||||||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||||
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
||||||
|
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
|
||||||
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
||||||
import com.nutomic.syncthingandroid.util.FoldersAdapter;
|
import com.nutomic.syncthingandroid.util.FoldersAdapter;
|
||||||
|
|
||||||
|
@ -43,6 +44,15 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
||||||
initAdapter();
|
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
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
@ -52,16 +62,13 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAdapter() {
|
private void initAdapter() {
|
||||||
MainActivity activity = (MainActivity) getActivity();
|
SyncthingActivity activity = (SyncthingActivity) getActivity();
|
||||||
if (activity == null || activity.getApi() == null)
|
if (activity == null || activity.getApi() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mAdapter = new FoldersAdapter(activity);
|
mAdapter = new FoldersAdapter(activity);
|
||||||
mAdapter.add(activity.getApi().getFolders());
|
mAdapter.add(activity.getApi().getFolders());
|
||||||
setListAdapter(mAdapter);
|
setListAdapter(mAdapter);
|
||||||
setEmptyText(getString(R.string.folder_list_empty));
|
|
||||||
getListView().setOnItemClickListener(this);
|
|
||||||
getListView().setOnItemLongClickListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList() {
|
private void updateList() {
|
||||||
|
|
Loading…
Reference in a new issue