示例#1
0
 @Override
 protected void onPostResume() {
   super.onPostResume();
   ArrayAdapter<String> carsAdapter =
       new ArrayAdapter<String>(
           this,
           android.R.layout.simple_list_item_1,
           dbHelper.myCars(dbHelper.getUser(token).getId()));
   carSelect.setAdapter(carsAdapter);
 }
示例#2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.post_ride);
    ButterKnife.bind(this);
    dbHelper = new RideshareDbHelper(getApplicationContext());
    findViews();
    token =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
            .getString("AuthToken", "");

    HashMap<String, String> ride_details;

    Window window = this.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
      window.setStatusBarColor(
          ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    else
      getSupportActionBar()
          .setBackgroundDrawable(
              new ColorDrawable(getResources().getColor(R.color.colorPrimaryDark)));

    ArrayAdapter<String> carsAdapter =
        new ArrayAdapter<String>(
            this,
            android.R.layout.simple_list_item_1,
            dbHelper.myCars(dbHelper.getUser(token).getId()));
    carSelect.setAdapter(carsAdapter);

    addCarNavigator.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(getApplicationContext(), AddCar.class);
            startActivity(intent);
          }
        });

    publish_ride.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            publishRide();
          }
        });
  }