Пример #1
0
  @Override
  protected void onResume() {
    super.onResume();
    if (!AppGlobals.isVirgin()
        && AppGlobals.isServiceOn()
        && !ServiceHelpers.DISCOVER
        && LongRunningService.isRunning()) {

      ServiceHelpers.discover(MainActivity.this, peerList);
    }
  }
Пример #2
0
  // called when activity first starts up
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // on create is called,extends parent class
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    sInstance = this;

    startActivity(new Intent(this, MessagesListActivity.class));
    layoutUsername = (LinearLayout) findViewById(R.id.layout_username);
    layoutMain = (RelativeLayout) findViewById(R.id.layout_main);
    layoutMainTwo = (LinearLayout) findViewById(R.id.layout_main_two);
    // check here
    showUsername = (TextView) findViewById(R.id.tv_username);
    serviceSwitch = (Switch) findViewById(R.id.switch_service);
    serviceSwitch.setOnCheckedChangeListener(this);
    peerList = (ListView) findViewById(R.id.lv_peer_list);
    peerList.setOnItemClickListener(this);

    //  if appglobals is virgin, hides mainlayout, sets username visible,captures username
    // else notvirgin
    if (AppGlobals.isVirgin()) {
      // hides main layout
      layoutMain.setVisibility(View.GONE);
      // username is set as visible in second interface
      layoutUsername.setVisibility(View.VISIBLE);
      // checks xml file to get username and display it
      editTextUsername = (EditText) findViewById(R.id.editTextDisplayName);
      // sets listener from edittextdisplayname
      editTextUsername.setOnFocusChangeListener(this);
      // xml button, capture button from layout
      Button startButton = (Button) findViewById(R.id.buttonStart);
      // listener is set , when button is clicked, operation starts
      startButton.setOnClickListener(this);
    } else {
      notVirgin();
    }

    // REMOVE
    //        Toolbar mToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    //  setSupportActionBar(mToolbar);

    getSupportActionBar().setTitle("VOIP");
    //  getSupportActionBar().setSubtitle("T");
  }