SHARE
TWEET

Untitled

a guest Dec 8th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.itmo.simpleq;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4. import androidx.core.app.NotificationManagerCompat;
  5. import androidx.databinding.DataBindingUtil;
  6. import androidx.databinding.ViewDataBinding;
  7.  
  8. import android.app.NotificationChannel;
  9. import android.app.NotificationManager;
  10. import android.content.Context;
  11. import android.content.Intent;
  12. import android.content.IntentFilter;
  13. import android.graphics.Color;
  14. import android.os.AsyncTask;
  15. import android.os.Bundle;
  16. import android.view.View;
  17. import android.widget.Toast;
  18.  
  19. import com.itmo.simpleq.databinding.ActivityMainBinding;
  20. import com.itmo.simpleq.domain.Interfaces.ServiceApi;
  21. import com.itmo.simpleq.gag.Gag;
  22. import com.itmo.simpleq.modules.serverChikChirik.Impl.ServiceApiImpl;
  23. import com.itmo.simpleq.modules.serverChikChirik.Interface.ServerApi;
  24. import com.itmo.simpleq.notification.CustomNotificationManager;
  25. import com.itmo.simpleq.vm.MainVM;
  26.  
  27. import java.io.IOException;
  28. import java.util.concurrent.ExecutionException;
  29.  
  30.  
  31. public class MainActivity extends AppCompatActivity {
  32.     private class AsyncSingUp extends AsyncTask<String, Integer,String> {
  33.         ServiceApi serviceApi;
  34.  
  35.         public AsyncSingUp(ServiceApi serviceApi) {
  36.             this.serviceApi = serviceApi;
  37.         }
  38.  
  39.         @Override
  40.         protected String doInBackground(String... arg) {
  41.             try {
  42.                 serviceApi.authenticate(arg[0],arg[1]);
  43.             } catch (IOException e) {
  44.                return e.getMessage();
  45.             }
  46.             return "ok";
  47.         }
  48.  
  49.  
  50.     }
  51.     @Override
  52.     protected void onCreate(Bundle savedInstanceState) {
  53.         super.onCreate(savedInstanceState);
  54.         setContentView(R.layout.activity_main);
  55.         ServiceApi serviceApi = new ServiceApiImpl();
  56.  
  57.         try {
  58.             String a=  new AsyncSingUp(serviceApi).execute(Gag.LOGIN,Gag.PASSWORD).get();
  59.             int i =0;
  60.         } catch (Exception e) {
  61.             e.printStackTrace();
  62.             int i =0;
  63.         }
  64.  
  65.         ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
  66.         binding.setVmodel(new MainVM(serviceApi));
  67.     }
  68.     public void login(){
  69.         Intent intent =  new Intent(this,MainSimpleQ.class);
  70.         startActivity(intent);
  71.         this.finish();
  72.     }
  73.  
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top