mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-24 05:04:50 -04:00
Fix ZimHostActivity selection mode
Hide selection mode when server is started Display selection mode when server is off
This commit is contained in:
parent
3212810980
commit
2027bdc3a1
@ -91,6 +91,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
ProgressDialog progressDialog;
|
ProgressDialog progressDialog;
|
||||||
|
|
||||||
private BooksOnDiskAdapter booksAdapter;
|
private BooksOnDiskAdapter booksAdapter;
|
||||||
|
BookOnDiskDelegate.BookDelegate bookDelegate;
|
||||||
HotspotService hotspotService;
|
HotspotService hotspotService;
|
||||||
private String ip;
|
private String ip;
|
||||||
boolean bound;
|
boolean bound;
|
||||||
@ -110,8 +111,10 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
getString(R.string.server_started_message, ip));
|
getString(R.string.server_started_message, ip));
|
||||||
startServerButton.setText(getString(R.string.stop_server_label));
|
startServerButton.setText(getString(R.string.stop_server_label));
|
||||||
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
||||||
|
bookDelegate.setSelectionMode(SelectionMode.NORMAL);
|
||||||
|
booksAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
BookOnDiskDelegate.BookDelegate bookDelegate =
|
bookDelegate =
|
||||||
new BookOnDiskDelegate.BookDelegate(sharedPreferenceUtil,
|
new BookOnDiskDelegate.BookDelegate(sharedPreferenceUtil,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -250,6 +253,8 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
serverTextView.setText(getString(R.string.server_started_message, ip));
|
serverTextView.setText(getString(R.string.server_started_message, ip));
|
||||||
startServerButton.setText(getString(R.string.stop_server_label));
|
startServerButton.setText(getString(R.string.stop_server_label));
|
||||||
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
||||||
|
bookDelegate.setSelectionMode(SelectionMode.NORMAL);
|
||||||
|
booksAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,6 +467,12 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
startServerButton.setText(getString(R.string.stop_server_label));
|
startServerButton.setText(getString(R.string.stop_server_label));
|
||||||
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer));
|
||||||
isServerStarted = true;
|
isServerStarted = true;
|
||||||
|
|
||||||
|
bookDelegate.setSelectionMode(SelectionMode.NORMAL);
|
||||||
|
for (BooksOnDiskListItem item : booksAdapter.getItems()) {
|
||||||
|
item.setSelected(false);
|
||||||
|
}
|
||||||
|
booksAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onServerStopped() {
|
@Override public void onServerStopped() {
|
||||||
@ -472,6 +483,8 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
if (selectedBooksPath.size() > 0) {
|
if (selectedBooksPath.size() > 0) {
|
||||||
selectedBooksPath.clear();
|
selectedBooksPath.clear();
|
||||||
}
|
}
|
||||||
|
bookDelegate.setSelectionMode(SelectionMode.MULTI);
|
||||||
|
booksAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onServerFailedToStart() {
|
@Override public void onServerFailedToStart() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user