Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- obj=new SessionManager(getActivity());
- btnup.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- FirebaseDatabase mDatabase;
- final DatabaseReference mDatabaseReference;
- mDatabase = FirebaseDatabase.getInstance();
- mDatabaseReference = mDatabase.getReference().child("User").child("Account").child(phone).child("child").child(name);
- mDatabaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot dataSnapshot) {
- point = Integer.parseInt(String.valueOf(dataSnapshot.child("point").getValue()));
- levels= Integer.parseInt(String.valueOf(dataSnapshot.child("level").getValue()));
- int rocketLevel = levels;
- mDatabaseReference.child("level").setValue(levels + 1);
- Toast.makeText(getActivity(), "level == "+rocketLevel, Toast.LENGTH_SHORT).show();
- switch (rocketLevel){
- // case 0:
- // layoutrocket.setVisibility(View.VISIBLE);
- // translate(layoutrocket,leve1);
- // break;
- //
- case 1:
- rocketpath.setSpeed(1);
- rocketpath.setMaxFrame(180);
- rocketpath.resumeAnimation();
- break;
- case 2:
- rocketpath.setMaxFrame(349);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 3:
- rocketpath.setMaxFrame(527);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 4:
- rocketpath.setMaxFrame(696);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 5:
- rocketpath.setMaxFrame(893);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 6:
- rocketpath.setMaxFrame(1062);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 7:
- rocketpath.setMaxFrame(1227);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 8:
- rocketpath.setMaxFrame(1405);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- break;
- case 9:
- rocketpath.setMaxFrame(1560);
- rocketpath.setSpeed(1);
- rocketpath.resumeAnimation();
- levelup();
- new SessionManager(getActivity()).setKeyDailyClaimed(false);
- mDatabaseReference.child("level").setValue(0);
- mDatabaseReference.child("point").setValue(point + 1);
- MainScreen.arrayList.get(MainScreen.postiongrid).setChildpoints(point+1+"");
- MainScreen.arrayList.get(MainScreen.postiongrid).setChildlevel(0+"");
- ChilddetailActivity.txtpoint.setText(point+1+"");
- }
- // Toast.makeText(getActivity(), "childPoints"+point, Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onCancelled(@NonNull DatabaseError databaseError) {
- // Toast.makeText(getActivity(), "Error", Toast.LENGTH_SHORT).show();
- // Toast.makeText(getActivity(), databaseError.getMessage(), Toast.LENGTH_SHORT).show();
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement