@Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.savePwd:
       CheckBox cb = (CheckBox) v;
       if (cb.isChecked()) {
         addToPref = true;
       } else {
         addToPref = false;
         password = (EditText) getActivity().findViewById(R.id.password);
         password.setVisibility(View.VISIBLE);
         password.setText("");
       }
       break;
     case R.id.btn_login:
       loading = Toast.makeText(this.getActivity(), "Initializing login", Toast.LENGTH_LONG);
       ActionMainActivity ama = (ActionMainActivity) getActivity();
       if (addToPref) {
         try {
           ActionMainActivity.setUserNamePassword(
               username.getText().toString(), password.getText().toString());
           ActionMainActivity.setStored(true);
         } catch (Exception e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
         }
       }
       loading.show();
       task = new GetParamsTask();
       task.act = this;
       task.execute();
       break;
   }
 }
 public void callback2() {
   ActionMainActivity a = (ActionMainActivity) this.getActivity();
   int i = html.indexOf("17732 - APA of Central Florida");
   if (i > 0) {
     ((TextView) a.findViewById(R.id.message_login)).setText("Logged in");
     WebViewFragment f = new WebViewFragment();
     f.html = html;
     a.changeFragment(f);
   } else {
     ((TextView) a.findViewById(R.id.message_login))
         .setText("Problems logging in please try again");
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.team, container, false);
    View v = rootView.findViewById(R.id.btn_login);
    username = (EditText) rootView.findViewById(R.id.username);
    password = (EditText) rootView.findViewById(R.id.password);
    cb = (CheckBox) rootView.findViewById(R.id.savePwd);
    cb.setOnClickListener(this);
    synchronized (ActionMainActivity.class) {
      if (ActionMainActivity.isStored()) {
        username.setText(ActionMainActivity.getUsername());
        //				username.setVisibility(View.INVISIBLE);
        password.setText(ActionMainActivity.getPassword());
        password.setVisibility(View.INVISIBLE);
        cb.setChecked(true);
      }
    }

    if (v != null) v.setOnClickListener(this);
    return rootView;
  }
Exemple #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar ab = getSupportActionBar();

    if (ab != null) {
      ab.setDisplayOptions(
          ActionBar.DISPLAY_SHOW_TITLE
              | ActionBar.DISPLAY_SHOW_HOME
              | ActionBar.DISPLAY_HOME_AS_UP);
    }

    // Activamos el modo fullscreen
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    fragment_tags = new ArrayList<String>();
    fragment_tags.add("list_fragment");
    fragment_tags.add("images_fragment");
    fragment_tags.add("places_fragment");
    fragment_tags.add("about_fragment");

    setContentView(R.layout.tabs_activity_main);

    fragments[0].setHasOptionsMenu(true);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    actionBar.addTab(
        actionBar
            .newTab()
            .setText(getResources().getString(R.string.listado))
            .setTabListener(this));

    actionBar.addTab(
        actionBar
            .newTab()
            .setText(getResources().getString(R.string.imagenes))
            .setTabListener(this));

    actionBar.addTab(
        actionBar.newTab().setText(getResources().getString(R.string.places)).setTabListener(this));

    actionBar.addTab(
        actionBar
            .newTab()
            .setText(getResources().getString(R.string.acercaDe))
            .setTabListener(this));

    FragmentManager manager = getSupportFragmentManager();
    manager
        .beginTransaction()
        .add(R.id.mainContent2, fragments[0], fragment_tags.get(0))
        .add(R.id.mainContent2, fragments[1], fragment_tags.get(1))
        .add(R.id.mainContent2, fragments[2], fragment_tags.get(2))
        .add(R.id.mainContent2, fragments[3], fragment_tags.get(3))
        .commit();
  }