package com.example.instilostandfound;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class RedirectMyPosts extends AppCompatActivity implements View.OnClickListener {
    String username;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_redirect_my_posts);

        Intent i = getIntent();
        username = i.getStringExtra("username");
        findViewById(R.id.lost_button).setOnClickListener(this);
        findViewById(R.id.found_button).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.lost_button:
                    Intent intent = new Intent(RedirectMyPosts.this, MyPosts.class);
                    intent.putExtra("type", "lost");
                    intent.putExtra("username", username);
                    startActivity(intent);
                break;
            case R.id.found_button:
                intent = new Intent(RedirectMyPosts.this, MyPostsFoundRV.class);
                intent.putExtra("username", username);
                intent.putExtra("type", "found");
                startActivity(intent);
                break;
        }
    }
}
