Esempio n. 1
0
 public void reconnect5() {
   try {
     List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
     for (WifiConfiguration i : list) {
       if (i.SSID.equals(FirstSettings_two.first_ssid)) {
         wifiManager.enableNetwork(i.networkId, true);
         wifiManager.reconnect();
         File_Video downloadFile_video = new File_Video();
         downloadFile_video.execute(BroadcastNewSms.filepath);
         break;
       }
     }
   } catch (Exception e) {
     Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
   }
   ;
 }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // new
    getActionBar().hide(); // new
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);
    first_activity_bool = true;
    Window window = this.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    first_activity = this;
    context = getApplicationContext();
    ConnectivityManager connMgr =
        (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
    android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    try {
      if ((wifi.isConnected() == false)) {
        Toast.makeText(getApplicationContext(), "подключение к сети Wi-Fi", Toast.LENGTH_LONG)
            .show();
        reconnect5();
      } else {
        //  Toast.makeText(getApplicationContext(), "Уже соеденено", Toast.LENGTH_LONG).show();
        File_Video downloadFile_video = new File_Video();
        downloadFile_video.execute(BroadcastNewSms.filepath);
      }

    } catch (Exception e) {
      Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
    }

    mPreview = (SurfaceView) findViewById(R.id.video_surface);
    holder = mPreview.getHolder();
    holder.addCallback(BroadcastNewSms_Two.this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    mp = new MediaPlayer();

    decorView = findViewById(R.id.firstsettings_two_layout);

    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    decorView.setSystemUiVisibility(uiOptions);
    View decorView2 = getWindow().getDecorView();
    decorView2.setOnSystemUiVisibilityChangeListener(
        new View.OnSystemUiVisibilityChangeListener() {
          @Override
          public void onSystemUiVisibilityChange(int visibility) {
            // Note that system bars will only be "visible" if none of the
            // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
            if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {

              timer1();

            } else {

            }
          }
        });

    timer2();
  }