Search in sources :

Example 1 with DetailFragment

use of com.polito.mad17.madmax.activities.DetailFragment in project MadMax by deviz92.

the class GroupDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.app_bar_main);
    databaseReference = FirebaseDatabase.getInstance().getReference();
    Intent intent = getIntent();
    groupID = intent.getStringExtra("groupID");
    userID = intent.getStringExtra("userID");
    Log.d(TAG, "onCreate di GroupDetailActivity. Group: " + groupID);
    Bundle bundle = new Bundle();
    bundle.putString("groupID", groupID);
    bundle.putString("userID", userID);
    if (findViewById(R.id.collapsed_content) != null) {
        Log.d(TAG, groupID);
        barDetailFragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.collapsed_content, barDetailFragment).commit();
    }
    if (findViewById(R.id.main) != null) {
        Log.d(TAG, groupID);
        DetailFragment detailFragment = new DetailFragment();
        detailFragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.main, detailFragment).commit();
    }
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) DetailFragment(com.polito.mad17.madmax.activities.DetailFragment) BarDetailFragment(com.polito.mad17.madmax.activities.BarDetailFragment)

Example 2 with DetailFragment

use of com.polito.mad17.madmax.activities.DetailFragment in project MadMax by deviz92.

the class FriendDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.app_bar_main);
    fab = (FloatingActionButton) findViewById(R.id.fab);
    updateFab(0);
    Log.d(TAG, "onCreate di FriendDetailActivity");
    // ID dell'amico di cui sto guardando il dettaglio
    Intent intent = getIntent();
    friendID = intent.getStringExtra("friendID");
    userID = intent.getStringExtra("userID");
    if (findViewById(R.id.collapsed_content) != null) {
        Bundle bundle = new Bundle();
        bundle.putString("friendID", friendID);
        Log.d(TAG, friendID);
        BarDetailFragment barDetailFragment = new BarDetailFragment();
        barDetailFragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.collapsed_content, barDetailFragment).commit();
        DetailFragment detailFragment = new DetailFragment();
        detailFragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.main, detailFragment).commit();
    }
}
Also used : Bundle(android.os.Bundle) BarDetailFragment(com.polito.mad17.madmax.activities.BarDetailFragment) Intent(android.content.Intent) DetailFragment(com.polito.mad17.madmax.activities.DetailFragment) BarDetailFragment(com.polito.mad17.madmax.activities.BarDetailFragment)

Example 3 with DetailFragment

use of com.polito.mad17.madmax.activities.DetailFragment in project MadMax by deviz92.

the class DetailFragment method updateFab.

private void updateFab(int position) {
    switch(position) {
        case 0:
            // expenses fragment
            Log.d(TAG, "fab 0");
            fab.setImageResource(android.R.drawable.ic_input_add);
            fab.setVisibility(View.VISIBLE);
            fab.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent myIntent = new Intent(getActivity(), NewExpenseActivity.class);
                    myIntent.putExtra("groupID", groupID);
                    myIntent.putExtra("userID", MainActivity.getCurrentUID());
                    myIntent.putExtra("callingActivity", "DetailFragment");
                    myIntent.putExtra("newPending", false);
                    startActivity(myIntent);
                }
            });
            break;
        case 1:
            // members fragment
            Log.d(TAG, "fab 1");
            fab.setImageResource(R.drawable.user_add);
            fab.setVisibility(View.VISIBLE);
            fab.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(getContext(), NewMemberActivity.class);
                    intent.putExtra("groupID", groupID);
                    intent.putExtra("groupName", groupName);
                    startActivity(intent);
                }
            });
            break;
        case 2:
            // history fragment
            Log.d(TAG, "fab 2");
            // lo storico non si tocca
            fab.setVisibility(View.GONE);
            break;
    }
}
Also used : NewMemberActivity(com.polito.mad17.madmax.activities.users.NewMemberActivity) NewExpenseActivity(com.polito.mad17.madmax.activities.expenses.NewExpenseActivity) Intent(android.content.Intent) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

Intent (android.content.Intent)3 Bundle (android.os.Bundle)2 BarDetailFragment (com.polito.mad17.madmax.activities.BarDetailFragment)2 DetailFragment (com.polito.mad17.madmax.activities.DetailFragment)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 NewExpenseActivity (com.polito.mad17.madmax.activities.expenses.NewExpenseActivity)1 NewMemberActivity (com.polito.mad17.madmax.activities.users.NewMemberActivity)1