예제 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar ab = getActionBar();
    ab.setDisplayUseLogoEnabled(true);
    ab.setDisplayShowTitleEnabled(false);
    setContentView(R.layout.activity_main);

    table = Table.getInstance(this);
    List<User> users = (List<User>) table.users.select("usr_logged_in='1'");
    if (users.isEmpty()) {
      Intent intent = new Intent(this, AccountManagement.class);
      startActivity(intent);
    }

    user = users.get(0);

    tasks = table.tasks.select("task_username='******'");
    listView = (ListView) findViewById(R.id.list_view_tasks);

    taskArrayAdapter = new TaskArrayAdapter(this, R.layout.task, tasks);

    // listView.setClickable(true);
    // listView.setItemsCanFocus(true);
    // listView.setOnItemClickListener(clickOnTask);
    // listTasks.setOnItemLongClickListener(editOnTask);
    listView.setAdapter(taskArrayAdapter);

    taskArrayAdapter.notifyDataSetChanged();
  }
예제 #2
0
  private void logoutUser() {

    Table table = Table.getInstance(this);
    List<User> users = (List<User>) table.users.select("usr_logged_in='1'");
    if (!users.isEmpty()) {

      User user = users.get(0);
      user.setLoggedIn(0);

      table.users.update(user);

      Intent intent = new Intent(this, AccountManagement.class);
      startActivity(intent);
    }
  }