Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. public class Preferences extends PreferenceActivity {
  2.  
  3. /** Called when the activity is first created. */
  4. @Override
  5. public void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. addPreferencesFromResource(R.xml.preferences);
  8. Toast.makeText(Preferences.this, "Set your server settings here", Toast.LENGTH_LONG).show();
  9.  
  10. }
  11.  
  12. }
  13.  
  14.  
  15. *&*@&(&!@^*&#@!^@ IN A DIFFERENT ACTIVITY *&*@&(&!@^*&#@!^@
  16.  
  17. dnloadButton.setOnClickListener(new View.OnClickListener() {
  18. public void onClick(View v) {
  19. getServerSettings();
  20. if(serverSettings == null)
  21. {
  22. Toast.makeText(getApplicationContext(), "Please set your server settings correctly", Toast.LENGTH_LONG).show();
  23. return;
  24. }else if(serverSettings.port == -1 || serverSettings.userName == null || serverSettings.hostName == null || serverSettings.passWord == null)
  25. {
  26. Toast.makeText(getApplicationContext(), "Please set your server settings correctly", Toast.LENGTH_LONG).show();
  27. return;
  28. }else if(DownloadService.downloadQueue.isEmpty())
  29. {
  30. Toast.makeText(getApplicationContext(), " No items in the Download Queue \r\n Add items to the dowload queue from NZB List tab", Toast.LENGTH_LONG).show();
  31. return;
  32. }else
  33. {
  34. Toast beginDownloadToast = Toast.makeText(getApplicationContext(), " Beginning Download\r\n Check the Status tab for more info", Toast.LENGTH_LONG);
  35. beginDownloadToast.show();
  36. DownloadService.serverSettings = serverSettings;
  37. Intent svc = new Intent(getApplicationContext(),DownloadService.class);
  38. startService(svc);
  39. }
  40.  
  41.  
  42. }
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement