Skip to content

Commit

Permalink
v0.6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
YaminMahdi committed Sep 30, 2022
1 parent 5f8200e commit 3085324
Show file tree
Hide file tree
Showing 23 changed files with 1,562 additions and 383 deletions.
10 changes: 6 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ plugins {
android {
signingConfigs {
debug {
storeFile file('D/:/linux/line2box_key.jks')
storeFile file('/mnt/ntfs2/linux/line2box_key.jks')
storePassword 's2451998'
keyPassword 's2451998'
keyAlias 'key0'
}
release {
storeFile file('D/://linux/line2box_key.jks')
storeFile file('/mnt/ntfs2/linux/line2box_key.jks')
keyAlias 'key0'
keyPassword 's2451998'
storePassword 's2451998'
Expand All @@ -24,8 +24,8 @@ android {
applicationId "com.diu.yk_games.line2box"
minSdk 27
targetSdk 32
versionCode 7
versionName '0.6.9'
versionCode 8
versionName '0.8'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -66,6 +66,8 @@ dependencies {
implementation platform('com.google.firebase:firebase-bom:30.3.1')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:20.2.0'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'io.ak1:bubbletabbar:1.0.8'
implementation 'com.mikhaellopez:circularimageview:4.3.0'
testImplementation 'junit:junit:4.13.2'
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package="com.diu.yk_games.line2box">

<uses-feature android:name="android.hardware.screen.portrait" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand All @@ -18,6 +19,7 @@
android:screenOrientation="sensorPortrait"
android:supportsRtl="true"
android:theme="@style/Theme.Line2Box"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".GameActivity3"
Expand Down
113 changes: 107 additions & 6 deletions app/src/main/java/com/diu/yk_games/line2box/ChatFragmentFriendly.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.diu.yk_games.line2box;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.media.MediaPlayer;
import android.os.Bundle;

Expand All @@ -17,16 +22,23 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnSuccessListener;
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 com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand All @@ -45,12 +57,15 @@ public class ChatFragmentFriendly extends Fragment {
static String key=null;
Context context;
Activity activity;
String playerId;
SharedPreferences sharedPref;

public static ChatFragmentFriendly newInstance(String key)
public static ChatFragmentFriendly newInstance(String key, String playerId)
{
ChatFragmentFriendly fragment = new ChatFragmentFriendly();
Bundle args = new Bundle();
args.putString("key", key);
args.putString("playerId", playerId);
fragment.setArguments(args);
return fragment;
}
Expand All @@ -65,6 +80,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
key = getArguments().getString("key");
playerId = getArguments().getString("playerId");
}
myRef = database.getReference("MultiPlayer").child(key).child("friendlyChat");

Expand All @@ -81,7 +97,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

context=requireContext();
activity=requireActivity();
SharedPreferences sharedPref = context.getSharedPreferences(
sharedPref = context.getSharedPreferences(
getString(R.string.preference_file_key), Context.MODE_PRIVATE);
GameProfile.setPreferences(sharedPref);

Expand All @@ -107,6 +123,87 @@ public void onChildAdded(@NonNull DataSnapshot dataSnapshot, String s)
MsgListAdapter adapter=new MsgListAdapter(getActivity(),msList); //
ListView list = v.findViewById(R.id.showMsgList);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MsgStore msgData = (MsgStore) list.getItemAtPosition(position);
//prestationEco str = (prestationEco)o; //As you are using Default String Adapter

if(!sharedPref.getBoolean("muted", false))
{
MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.btn_click_ef);
mediaPlayer.start();
mediaPlayer.setOnCompletionListener(MediaPlayer::release);
}
if(!msgData.playerId.equals(""))
{
Toast.makeText(context,"Long Press To Copy Text/ID",Toast.LENGTH_SHORT).show();
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("gamerProfile").document(msgData.playerId)
.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@SuppressLint("SetTextI18n")
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if(documentSnapshot.exists())
{
GameProfile server2device = documentSnapshot.toObject(GameProfile.class);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View v = LayoutInflater.from(context).inflate(
R.layout.dialog_layout_profile, parent.findViewById(R.id.profileLayoutDialog)
);
builder.setView(v);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
params.setMargins(60, 150, 60, 0);
v.findViewById(R.id.linearLayoutFrame).setLayoutParams(params);
//v.findViewById(R.id.linearLayoutFrame).setPadding(20,0,20,0);
assert server2device != null;
((TextView) v.findViewById(R.id.countryTxt)).setText(server2device.countryNm+" "+server2device.countryEmoji);
((TextView) v.findViewById(R.id.lvlTxt)).setText(""+server2device.lvl);
((TextView) v.findViewById(R.id.coinHave)).setText(""+server2device.coin);
((TextView) v.findViewById(R.id.matchPlayedTxt)).setText(""+server2device.matchPlayed);
((TextView) v.findViewById(R.id.matchWonTxt)).setText(""+server2device.matchWinMulti);
EditText nmEditText = v.findViewById(R.id.nmTxt);
nmEditText.setEnabled(false);
nmEditText.setText(server2device.nm);
//nmEditText.setVisibility(View.GONE);
((TextView) v.findViewById(R.id.profileTitle)).setTextSize(28);

v.findViewById(R.id.profileShapeLayout).setVisibility(View.GONE);
v.findViewById(R.id.nmEditBtn).setVisibility(View.GONE);
v.findViewById(R.id.nmLTxt).setVisibility(View.GONE);
v.findViewById(R.id.themeBox).setVisibility(View.GONE);
v.findViewById(R.id.countryLTxt).setVisibility(View.GONE);
v.findViewById(R.id.buttonSaveInfo).setVisibility(View.GONE);
final AlertDialog alertDialog = builder.create();

if (alertDialog.getWindow() != null) {
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
}
try {alertDialog.show();}
catch (NullPointerException npe) {npe.printStackTrace();}
}
}
});
}
else
Toast.makeText(context,"Older messages don't have profile info.",Toast.LENGTH_SHORT).show();

}
});
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id)
{
Toast.makeText(context, "Text/ID copied", Toast.LENGTH_SHORT).show();
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("msgData", ms.msgData);
clipboard.setPrimaryClip(clip);
return true;
}
});
getActivity().findViewById(R.id.newMsgBoltu).setVisibility(View.VISIBLE);
}
catch (NullPointerException npe) {npe.printStackTrace();}
Expand All @@ -124,7 +221,7 @@ public void onChildAdded(@NonNull DataSnapshot dataSnapshot, String s)
myRef.addValueEventListener(new ValueEventListener(){
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if(snapshot.exists()&&!sharedPref.getBoolean("muted", false))
if(snapshot.exists())
{
if(lastMsg.equals("🤣"))
emojiRunner(R.drawable.emoji_haha,R.raw.haha,v);
Expand Down Expand Up @@ -174,9 +271,12 @@ public void emojiRunner(int gif, int sound, View v)
v.findViewById(R.id.sendKiss).setEnabled(false);
v.findViewById(R.id.sendScream).setEnabled(false);
v.findViewById(R.id.sendYawn).setEnabled(false);
MediaPlayer mediaPlayer = MediaPlayer.create(context, sound);
mediaPlayer.start();
mediaPlayer.setOnCompletionListener(MediaPlayer::release);
if(!sharedPref.getBoolean("muted", false))
{
MediaPlayer mediaPlayer = MediaPlayer.create(context, sound);
mediaPlayer.start();
mediaPlayer.setOnCompletionListener(MediaPlayer::release);
}
((GifImageView)activity.findViewById(R.id.emojiPlay)).setImageResource(gif);
activity.findViewById(R.id.emojiPlay).setVisibility(View.VISIBLE);
((DrawerLayout)activity.findViewById(R.id.drawer_layout)).closeDrawer(GravityCompat.START);
Expand All @@ -197,6 +297,7 @@ public void sendThisMsg(String msg)
{
GameProfile gp=new GameProfile();
MsgStore ms =new MsgStore();
ms.playerId=playerId;
ms.nmData= gp.nm;
ms.lvlData= gp.getLvlByCal().toString();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd MMM, hh:mm a");
Expand Down
Loading

0 comments on commit 3085324

Please sign in to comment.