-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9b5864
commit 57d4a1d
Showing
53 changed files
with
12,266 additions
and
212 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "351530286669", | ||
"firebase_url": "https://line2box-default-rtdb.firebaseio.com", | ||
"project_id": "line2box", | ||
"storage_bucket": "line2box.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:351530286669:android:a700619cf2442f12d2e604", | ||
"android_client_info": { | ||
"package_name": "com.diu.yk_games.line2box" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "351530286669-1d57184u3fvkl8vaim4gdh1n4g970ps7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyBr_tXEA3by1QmimDncUSay9NdrUG8uXDw" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "351530286669-1d57184u3fvkl8vaim4gdh1n4g970ps7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/diu/yk_games/line2box/BlankFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.diu.yk_games.line2box; | ||
|
||
import android.os.Bundle; | ||
import androidx.fragment.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
/** | ||
* A simple {@link Fragment} subclass. | ||
* Use the {@link BlankFragment#newInstance} factory method to | ||
* create an instance of this fragment. | ||
* | ||
*/ | ||
public class BlankFragment extends Fragment { | ||
|
||
// TODO: Rename parameter arguments, choose names that match | ||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
private static final String ARG_PARAM1 = "param1"; | ||
private static final String ARG_PARAM2 = "param2"; | ||
|
||
// TODO: Rename and change types of parameters | ||
private String mParam1; | ||
private String mParam2; | ||
|
||
/** | ||
* Use this factory method to create a new instance of | ||
* this fragment using the provided parameters. | ||
* | ||
* @param param1 Parameter 1. | ||
* @param param2 Parameter 2. | ||
* @return A new instance of fragment BlankFragment. | ||
*/ | ||
// TODO: Rename and change types and number of parameters | ||
public static BlankFragment newInstance(String param1, String param2) { | ||
BlankFragment fragment = new BlankFragment(); | ||
Bundle args = new Bundle(); | ||
args.putString(ARG_PARAM1, param1); | ||
args.putString(ARG_PARAM2, param2); | ||
fragment.setArguments(args); | ||
return fragment; | ||
} | ||
|
||
public BlankFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
if (getArguments() != null) { | ||
mParam1 = getArguments().getString(ARG_PARAM1); | ||
mParam2 = getArguments().getString(ARG_PARAM2); | ||
} | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_blank, container, false); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/diu/yk_games/line2box/DataStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.diu.yk_games.line2box; | ||
|
||
import android.util.Log; | ||
|
||
public class DataStore | ||
{ | ||
public String timeData=""; | ||
public String redData="Red"; | ||
public String blueData="Blue"; | ||
public String starData="★"; | ||
|
||
public DataStore(){} | ||
public DataStore(String redData, String blueData, String starData) | ||
{ | ||
this.redData = redData; | ||
this.blueData = blueData; | ||
this.starData = starData; | ||
} | ||
|
||
} |
122 changes: 122 additions & 0 deletions
122
app/src/main/java/com/diu/yk_games/line2box/DisplayFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.diu.yk_games.line2box; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import android.os.Handler; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ListView; | ||
import android.widget.TextView; | ||
|
||
import com.google.firebase.database.ChildEventListener; | ||
import com.google.firebase.database.DataSnapshot; | ||
import com.google.firebase.database.DatabaseError; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
import com.google.firebase.database.ValueEventListener; | ||
|
||
import java.util.ArrayList; | ||
|
||
|
||
public class DisplayFragment extends Fragment | ||
{ | ||
|
||
|
||
private final String TAG="frag"; | ||
ArrayList<DataStore> dsList; | ||
String bestScore="\n\n\nNetwork Error"; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
// Initialize dataset, this data would usually come from a local content provider or | ||
// remote server. | ||
dsList = new ArrayList<>(); | ||
FirebaseDatabase database = FirebaseDatabase.getInstance(); | ||
DatabaseReference myRef = database.getReference("ScoreBoard"); | ||
|
||
myRef.child("Last Best Player").addValueEventListener(new ValueEventListener() { | ||
@SuppressLint("SetTextI18n") | ||
@Override | ||
public void onDataChange(@NonNull DataSnapshot dataSnapshot) | ||
{ | ||
// This method is called once with the initial value and again | ||
// whenever data at this location is updated. | ||
bestScore = dataSnapshot.getValue(String.class); | ||
//Log.d(TAG, "Last Value is: " + bestScore); | ||
|
||
} | ||
@Override | ||
public void onCancelled(@NonNull DatabaseError error) { | ||
// Failed to read value | ||
Log.w(TAG, "Failed to read value.", error.toException()); | ||
} | ||
}); | ||
myRef.child("allScore").addChildEventListener(new ChildEventListener() | ||
{ | ||
@Override | ||
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, String s) | ||
{ | ||
DataStore ds = dataSnapshot.getValue(DataStore.class); | ||
assert ds != null; | ||
ds.timeData = dataSnapshot.getKey(); | ||
dsList.add(ds); | ||
//Log.i(TAG,"key data = " + ds.timeData); | ||
|
||
} | ||
@Override | ||
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) { | ||
|
||
} | ||
@Override | ||
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) { | ||
|
||
} | ||
@Override | ||
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) { | ||
|
||
} | ||
@Override | ||
public void onCancelled(@NonNull DatabaseError databaseError) { | ||
|
||
Log.w(TAG, "Failed to read value.", databaseError.toException()); | ||
|
||
} | ||
|
||
}); | ||
} | ||
|
||
|
||
@SuppressLint("SetTextI18n") | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) | ||
{ | ||
|
||
View v=inflater.inflate(R.layout.fragment_display, container, false); | ||
TextView lbs= v.findViewById(R.id.lastBestScore); | ||
|
||
Handler handler = new Handler(); | ||
handler.postDelayed(() -> | ||
{ | ||
lbs.setText("Last Best Score is from: "+bestScore); | ||
//Log.d(TAG, "Last Value is: " + bestScore); | ||
MyListAdapter adapter=new MyListAdapter(getActivity(),dsList); // | ||
ListView list = v.findViewById(R.id.showNotesList); | ||
list.setAdapter(adapter); | ||
}, 1420); | ||
|
||
return v; | ||
} | ||
|
||
} |
Oops, something went wrong.