use of android.support.v7.widget.RecyclerView.LayoutManager in project MadMax by deviz92.
the class PendingExpenseDetailFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
Log.i(TAG, "onCreateView");
// Read expenseID from ExpenseDetailPagerAdapter
Bundle b = this.getArguments();
expenseID = b.getString("expenseID");
final View view = inflater.inflate(R.layout.skeleton_list, container, false);
RecyclerView.ItemDecoration divider = new InsetDivider.Builder(getContext()).orientation(InsetDivider.VERTICAL_LIST).dividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height)).color(ContextCompat.getColor(getContext(), R.color.colorDivider)).insets(getResources().getDimensionPixelSize(R.dimen.divider_inset), 0).overlay(true).build();
recyclerView = (RecyclerView) view.findViewById(R.id.rv_skeleton);
layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(divider);
// todo mettere a posto
votersViewAdapter = new VotersViewAdapter(voters, getContext());
recyclerView.setAdapter(votersViewAdapter);
// Retrieve data of this pending expense
databaseReference.child("proposedExpenses").child(expenseID).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Show list of voters for this pending expense
for (DataSnapshot voterSnap : dataSnapshot.child("participants").getChildren()) {
String vote = voterSnap.child("vote").getValue(String.class);
FirebaseUtils.getInstance().getVoter(voterSnap.getKey(), vote, voters, votersViewAdapter);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
return view;
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project MadMax by deviz92.
the class ProposedExpenseCommentsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
RecyclerView recyclerView;
RecyclerView.LayoutManager layoutManager;
String expenseID;
View view = inflater.inflate(R.layout.skeleton_list, container, false);
Bundle fragmentArguments = getArguments();
expenseID = fragmentArguments.getString("expenseID");
RecyclerView.ItemDecoration divider = new InsetDivider.Builder(getContext()).orientation(InsetDivider.VERTICAL_LIST).dividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height)).color(getResources().getColor(R.color.colorDivider)).insets(getResources().getDimensionPixelSize(R.dimen.divider_inset), 0).overlay(true).build();
recyclerView = (RecyclerView) view.findViewById(R.id.rv_skeleton);
layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(divider);
expenseCommentsViewAdapter = new ExpenseCommentsViewAdapter(this.getContext(), this, commentsMap, getFragmentManager());
recyclerView.setAdapter(expenseCommentsViewAdapter);
DatabaseReference expenseRef = databaseReference.child("proposedExpenses");
expenseRef.child(expenseID).child("comments").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot commentSnapshot) {
for (DataSnapshot comment : commentSnapshot.getChildren()) {
FirebaseUtils.getInstance().getComment(comment.getKey(), commentsMap, expenseCommentsViewAdapter);
Log.d(TAG, comment.getKey());
}
expenseCommentsViewAdapter.update(commentsMap);
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Log.w(TAG, "Failed to read value.", error.toException());
}
});
return view;
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project MadMax by deviz92.
the class SplitPolicyActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_split_policy);
// somma quote già splittate
totalTextView = (TextView) findViewById(R.id.total);
// costo della spesa
amountTextView = (TextView) findViewById(R.id.tv_amount);
currencyTextView = (TextView) findViewById(R.id.currency);
currencyAmountTextView = (TextView) findViewById(R.id.currency_amount);
Intent intent = getIntent();
amount = intent.getDoubleExtra("amount", 0);
currency = intent.getStringExtra("currency");
groupID = intent.getStringExtra("groupID");
amountsList = (HashMap<String, Double>) intent.getSerializableExtra("participants");
Log.d(TAG, "I just entered SplitPolicyActivity. amountsList contains: ");
for (Map.Entry<String, Double> entry : amountsList.entrySet()) {
Log.d(TAG, entry.getKey() + " " + entry.getValue());
}
totalSplit = intent.getDoubleExtra("totalSplit", 0d);
totalTextView.setText(df.format(totalSplit));
amountTextView.setText(df.format(amount));
currencyTextView.setText(currency);
currencyAmountTextView.setText(currency);
participants.clear();
// Retrieve info about members for this expense
for (final Map.Entry<String, Double> entry : amountsList.entrySet()) {
databaseReference.child("users").child(entry.getKey()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
User u = new User();
u.setName(dataSnapshot.child("name").getValue(String.class));
u.setSurname(dataSnapshot.child("surname").getValue(String.class));
u.setProfileImage(dataSnapshot.child("image").getValue(String.class));
u.setSplitPart(entry.getValue());
u.setExpenseCurrency(currency);
participants.put(entry.getKey(), u);
splittersViewAdapter.update(participants);
splittersViewAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
RecyclerView.ItemDecoration divider = new InsetDivider.Builder(SplitPolicyActivity.this).orientation(InsetDivider.VERTICAL_LIST).dividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height)).color(ContextCompat.getColor(SplitPolicyActivity.this, R.color.colorDivider)).insets(getResources().getDimensionPixelSize(R.dimen.divider_inset), 0).overlay(true).build();
recyclerView = (RecyclerView) findViewById(R.id.rv_skeleton);
layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(divider);
splittersViewAdapter = new SplittersViewAdapter(participants, SplitPolicyActivity.this, this);
recyclerView.setAdapter(splittersViewAdapter);
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project MadMax by deviz92.
the class BalancesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.skeleton_list);
Intent intent = getIntent();
balances = (HashMap<String, Double>) intent.getSerializableExtra("balances");
groupID = intent.getStringExtra("groupID");
RecyclerView.ItemDecoration divider = new InsetDivider.Builder(this).orientation(InsetDivider.VERTICAL_LIST).dividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height)).color(getResources().getColor(R.color.colorDivider)).insets(getResources().getDimensionPixelSize(R.dimen.divider_inset), 0).overlay(true).build();
recyclerView = (RecyclerView) findViewById(R.id.rv_skeleton);
layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(divider);
// todo mettere a posto
balancesViewAdapter = new BalancesViewAdapter(this, this, balances);
recyclerView.setAdapter(balancesViewAdapter);
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project MadMax by deviz92.
the class ChooseGroupActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choose_group);
RecyclerView.ItemDecoration divider = new InsetDivider.Builder(this).orientation(InsetDivider.VERTICAL_LIST).dividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height)).color(getResources().getColor(R.color.colorDivider)).insets(getResources().getDimensionPixelSize(R.dimen.divider_inset), 0).overlay(true).build();
recyclerView = (RecyclerView) findViewById(R.id.rv_skeleton);
layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(divider);
groupsViewAdapter = new GroupsViewAdapter(getBaseContext(), this, groups, ChooseGroupActivity.TAG);
recyclerView.setAdapter(groupsViewAdapter);
// Ascolto i gruppi dello user
databaseReference.child("users").child(MainActivity.getCurrentUID()).child("groups").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Per ogni gruppo dello user
for (DataSnapshot groupSnapshot : dataSnapshot.getChildren()) {
// Se il gruppo è true, ossia è ancora tra quelli dello user
if (groupSnapshot.getValue(Boolean.class))
FirebaseUtils.getInstance().getGroup(groupSnapshot.getKey(), groups, groupsViewAdapter);
else {
// tolgo il gruppo da quelli che verranno stampati, così lo vedo sparire realtime
groups.remove(groupSnapshot.getKey());
groupsViewAdapter.update(groups);
groupsViewAdapter.notifyDataSetChanged();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.w(TAG, databaseError.toException());
}
});
}
Aggregations