diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..702c125 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..773fe0f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..bee59c8 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,57 @@ +plugins { + id 'com.android.application' + id 'com.google.gms.google-services' +} + +android { + namespace 'com.example.sket' + compileSdk 33 + + defaultConfig { + applicationId "com.example.sket" + minSdk 24 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildFeatures{ + viewBinding true + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.5.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.android.material:compose-theme-adapter:1.0.0' + implementation 'com.google.firebase:firebase-auth-ktx:22.0.0' + implementation 'com.google.firebase:firebase-auth:22.0.0' + implementation 'com.google.firebase:firebase-database:20.1.0' + implementation 'com.google.firebase:firebase-database-ktx:20.2.2' + implementation 'com.google.firebase:firebase-storage-ktx:20.2.0' + implementation 'de.hdodenhof:circleimageview:3.1.0' + implementation 'com.makeramen:roundedimageview:2.3.0' + implementation 'io.github.florent37:shapeofview:1.4.7' + implementation 'com.github.marlonlom:timeago:4.0.3' + + implementation 'com.squareup.picasso:picasso:2.8' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + implementation 'com.google.android.gms:play-services-auth:20.5.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} \ No newline at end of file diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..9a96e94 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "36601718854", + "project_id": "sket-ffe68", + "storage_bucket": "sket-ffe68.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:36601718854:android:ee8b64f25f2477c4e48247", + "android_client_info": { + "package_name": "com.example.sket" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyCEt5UOsn5uQHfHd8--yTNDkUtfkyp-_Ls" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/sket/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/sket/ExampleInstrumentedTest.java new file mode 100644 index 0000000..5c9cf93 --- /dev/null +++ b/app/src/androidTest/java/com/example/sket/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.sket; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.sket", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..4a378df --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..e1af037 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/sket/ChatWin.java b/app/src/main/java/com/example/sket/ChatWin.java new file mode 100644 index 0000000..c58279c --- /dev/null +++ b/app/src/main/java/com/example/sket/ChatWin.java @@ -0,0 +1,129 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.sket.adapter.messageAdapter; +import com.example.sket.model.msgModelclass; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.Date; + +public class ChatWin extends AppCompatActivity { + public static String senderImg,receiverIImg; + String senderRoom, receiverRoom; + EditText textmsg; + ArrayList msgList; + RecyclerView chat_msg_rv; + messageAdapter msgAdapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_chat_win); + Picasso.get().load(getIntent().getStringExtra("profileChat")).into((ImageView)findViewById(R.id.chatProfileIn)); + ((TextView)findViewById(R.id.nameChatIn)).setText(getIntent().getStringExtra("nameChat")); + textmsg = findViewById(R.id.typeChatMessageIn); + chat_msg_rv = findViewById(R.id.chats_rv_inside); + + + FirebaseDatabase.getInstance().getReference("user").child(FirebaseAuth.getInstance().getUid()).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + senderImg = snapshot.child("profilepicture").getValue().toString(); + receiverIImg = getIntent().getStringExtra("profileChat"); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + msgList = new ArrayList<>(); + + senderRoom = FirebaseAuth.getInstance().getUid()+getIntent().getStringExtra("uidChat"); + receiverRoom = getIntent().getStringExtra("uidChat")+FirebaseAuth.getInstance().getUid(); + + FirebaseDatabase.getInstance().getReference("chats").child(senderRoom).child("messages").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + msgList.clear(); + for(DataSnapshot dataSnapshot : snapshot.getChildren()){ + msgModelclass msgModel = dataSnapshot.getValue(msgModelclass.class); + msgList.add(msgModel); + } + msgAdapter.notifyDataSetChanged(); + + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + msgAdapter = new messageAdapter(ChatWin.this, msgList); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); + linearLayoutManager.setStackFromEnd(true); + chat_msg_rv.setNestedScrollingEnabled(true); + chat_msg_rv.setLayoutManager(linearLayoutManager); + chat_msg_rv.setAdapter(msgAdapter); + + + + + ((ImageView)findViewById(R.id.sendMessage)).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String message = textmsg.getText().toString(); + if (message.isEmpty()){ + Toast.makeText(ChatWin.this, "Message can't be invalid!", Toast.LENGTH_SHORT).show(); + return; + } + textmsg.setText(""); + Date date = new Date(); + msgModelclass messagess = new msgModelclass(message,FirebaseAuth.getInstance().getUid(),date.getTime()); + + FirebaseDatabase.getInstance().getReference().child("chats") + .child(senderRoom) + .child("messages") + .push().setValue(messagess).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + FirebaseDatabase.getInstance().getReference().child("chats") + .child(receiverRoom) + .child("messages") + .push().setValue(messagess).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + + } + }); + } + }); + } + }); + + + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/MainActivity.java b/app/src/main/java/com/example/sket/MainActivity.java new file mode 100644 index 0000000..21094ef --- /dev/null +++ b/app/src/main/java/com/example/sket/MainActivity.java @@ -0,0 +1,100 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.auth.FirebaseAuth; + +public class MainActivity extends AppCompatActivity { + Button login_btn; + + EditText email_login,password_login; + + FirebaseAuth auth; + TextView login_to_signup; + + String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+"; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + auth = FirebaseAuth.getInstance(); + login_btn = findViewById(R.id.login_button); + email_login = findViewById(R.id.EmailId_login); + password_login = findViewById(R.id.login_password); + + login_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String Email = email_login.getText().toString(); + String password = password_login.getText().toString(); + + if((TextUtils.isEmpty(Email))){ + Toast.makeText(MainActivity.this,"Enter The Email",Toast.LENGTH_SHORT).show(); + }else if(TextUtils.isEmpty(password)){ + Toast.makeText(MainActivity.this,"Enter The Password",Toast.LENGTH_SHORT).show(); + } else if (!Email.matches(emailPattern)) { + email_login.setError("Give Proper EmailAddress"); + } else if (password_login.length()<6) { + password_login.setError("More Then Six Characters"); + Toast.makeText(MainActivity.this,"Password Needs To Be Longer Then Six Charater",Toast.LENGTH_SHORT).show(); + }else { + auth.signInWithEmailAndPassword(Email,password).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + + if(task.isSuccessful()){ + try { + + Intent intent = new Intent(MainActivity.this,MainActivity2.class); + SharedPreferences sharedPreferences = getSharedPreferences("user", MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString("Email", Email); + editor.putString("Pass", password); + editor.apply(); + startActivity(intent); + + finish(); + }catch (Exception e){ + Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_SHORT).show(); + } + }else { + Toast.makeText(MainActivity.this,task.getException().getMessage(),Toast.LENGTH_SHORT).show(); + } + } + }); + + } + + + } + }); + + + + + login_to_signup = findViewById(R.id.login_to_signup); + Intent Login_to_signup_intent = new Intent(this, SignUp.class); + login_to_signup.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(Login_to_signup_intent); + finish(); + } + }); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/MainActivity2.java b/app/src/main/java/com/example/sket/MainActivity2.java new file mode 100644 index 0000000..7afe949 --- /dev/null +++ b/app/src/main/java/com/example/sket/MainActivity2.java @@ -0,0 +1,80 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.google.android.gms.auth.api.signin.GoogleSignIn; +import com.google.android.gms.auth.api.signin.GoogleSignInAccount; +import com.google.android.gms.auth.api.signin.GoogleSignInClient; +import com.google.android.gms.auth.api.signin.GoogleSignInOptions; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.android.material.bottomnavigation.BottomNavigationView; +import com.google.firebase.auth.FirebaseAuth; + +public class MainActivity2 extends AppCompatActivity { + + BottomNavigationView mainActivity2_bottom_nav; + + FirebaseAuth auth; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main2); + + FragmentManager FM = getSupportFragmentManager(); + FragmentTransaction ft = FM.beginTransaction(); + ft.replace(R.id.container,new nav_home_fragment()); + ft.commit(); + auth = FirebaseAuth.getInstance(); + +// + + mainActivity2_bottom_nav = findViewById(R.id.bottom_navigation_mainactivitytwo); + + mainActivity2_bottom_nav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + int id = item.getItemId(); + if(id == R.id.nav_home){ + load_frag(new nav_home_fragment()); + + } else if (id == R.id.nav_notification) { + load_frag(new nav_notification_fragment()); + + } else if (id == R.id.nav_add) { + load_frag(new nav_add_frag()); + + } else if (id == R.id.nav_search) { + load_frag(new nav_search_frag()); + } else { + load_frag(new nav_profile_frag()); + } + + return true; + } + + }); + mainActivity2_bottom_nav.setSelectedItemId(R.id.nav_home); + } + public void load_frag(Fragment frag){ + FragmentManager FM = getSupportFragmentManager(); + FragmentTransaction ft = FM.beginTransaction(); + ft.replace(R.id.container, frag); + ft.commit(); + + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/Messenger.java b/app/src/main/java/com/example/sket/Messenger.java new file mode 100644 index 0000000..a347f30 --- /dev/null +++ b/app/src/main/java/com/example/sket/Messenger.java @@ -0,0 +1,95 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.os.Bundle; +import android.widget.ProgressBar; +import android.widget.Toast; + +import com.example.sket.adapter.chats_adapter; +import com.example.sket.model.chats_model; +import com.example.sket.model.followers_model; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +public class Messenger extends AppCompatActivity { + ArrayList list; + chats_adapter adapter; + RecyclerView chatlayout; + Set chatid; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_messenger); + chatlayout = findViewById(R.id.chat_rv); + + list = new ArrayList<>(); + chatid = new HashSet<>(); + FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("followers").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + chatid.clear(); + for (DataSnapshot dataSnapshot: snapshot.getChildren()){ + chatid.add(dataSnapshot.getKey()); + + } + adapter.notifyDataSetChanged(); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + + } + }); + + FirebaseDatabase.getInstance().getReference().child("user").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + list.clear(); + for (DataSnapshot dataSnapshot: snapshot.getChildren()){ + Users model = dataSnapshot.getValue(Users.class); + + if(chatid.contains(dataSnapshot.getKey())) { + chats_model chats_model = new chats_model(model.getProfilepicture(), model.getName(), dataSnapshot.getKey()); + list.add(chats_model); + + } + } + adapter.notifyDataSetChanged(); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + + + + adapter = new chats_adapter(Messenger.this,list); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); + chatlayout.setLayoutManager(linearLayoutManager); + chatlayout.setNestedScrollingEnabled(true); + chatlayout.setAdapter(adapter); + + + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/SignUp.java b/app/src/main/java/com/example/sket/SignUp.java new file mode 100644 index 0000000..b1b5f46 --- /dev/null +++ b/app/src/main/java/com/example/sket/SignUp.java @@ -0,0 +1,133 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.storage.FirebaseStorage; +import com.google.firebase.storage.StorageReference; +import com.google.android.gms.auth.api.signin.GoogleSignIn; +import com.google.android.gms.auth.api.signin.GoogleSignInAccount; +import com.google.android.gms.auth.api.signin.GoogleSignInClient; +import com.google.android.gms.auth.api.signin.GoogleSignInOptions; +import com.google.android.gms.common.api.ApiException; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; + +import java.util.Objects; + +public class SignUp extends AppCompatActivity { + + GoogleSignInOptions gso; + GoogleSignInClient gsc; + ImageView googleBtn; + FirebaseAuth auth; + FirebaseDatabase database; + FirebaseStorage storage; + + Button signUp_button; + TextView signUp_password,signUp_EmailId,signUp_username,signUp_Name; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_sign_up); + database = FirebaseDatabase.getInstance(); + storage = FirebaseStorage.getInstance(); + auth = FirebaseAuth.getInstance(); + + googleBtn = findViewById(R.id.google_integration); + signUp_button = findViewById(R.id.signup_button); + signUp_EmailId = findViewById(R.id.signup_emailid); + signUp_Name = findViewById(R.id.signup_firstname); + signUp_password = findViewById(R.id.signup_password); + signUp_username = findViewById(R.id.signup_username); + + + gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build(); + gsc = GoogleSignIn.getClient(this,gso); + + signUp_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String name = signUp_Name.getText().toString(); + String emailid = signUp_EmailId.getText().toString(); + String password = signUp_password.getText().toString(); + String username = signUp_username.getText().toString(); + auth.createUserWithEmailAndPassword(emailid,password).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if(task.isSuccessful()){ + String user_id = task.getResult().getUser().getUid(); + String default_coverpage ="https://firebasestorage.googleapis.com/v0/b/sket-ffe68.appspot.com/o/default_coverPage.png?alt=media&token=0795468f-6cfc-4608-9808-807c4d76c7d7"; + String default_profile ="https://firebasestorage.googleapis.com/v0/b/sket-ffe68.appspot.com/o/default_profile.png?alt=media&token=e00a00df-eca8-4f43-ab4e-4c9c8274a056"; + DatabaseReference databaseReference = database.getReference().child("user").child(user_id); + Users u = new Users(name,username,emailid,password,default_coverpage,default_profile); + databaseReference.setValue(u).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if(task.isSuccessful()){ + Intent signUp_to_login = new Intent(SignUp.this,MainActivity.class); + Toast.makeText(getApplicationContext(),"Successfully Registered",Toast.LENGTH_SHORT).show(); + startActivity(signUp_to_login); + finishAffinity(); + }else { + Toast.makeText(SignUp.this,"Error in creating user", Toast.LENGTH_SHORT).show(); + } + } + }); + }else { + Toast.makeText(SignUp.this, Objects.requireNonNull(task.getException()).getMessage(),Toast.LENGTH_SHORT).show(); + } + } + }); + } + }); + + googleBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + signUp(); + } + }); + + } + + void signUp(){ + Intent signUp_to_googleintehration = gsc.getSignInIntent(); + startActivityForResult(signUp_to_googleintehration,200); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode ==200){ + Task task = GoogleSignIn.getSignedInAccountFromIntent(data); + + try { + task.getResult(ApiException.class); + navigateToSecondActivity(); + } catch (ApiException e) { + Toast.makeText(getApplicationContext()," "+e,Toast.LENGTH_SHORT).show(); + } + + } + } + + void navigateToSecondActivity(){ + + Intent SignUp_Through_Google_toHome = new Intent(SignUp.this,MainActivity2.class); + startActivity(SignUp_Through_Google_toHome); + finish(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/Users.java b/app/src/main/java/com/example/sket/Users.java new file mode 100644 index 0000000..d5f0727 --- /dev/null +++ b/app/src/main/java/com/example/sket/Users.java @@ -0,0 +1,115 @@ +package com.example.sket; + +public class Users { + String name,username,email,password; + private String coverpage; + private String userID; + private String profilepicture; + private int followercount,followingCount; + + public int getPostcount() { + return postcount; + } + + public void setPostcount(int postcount) { + this.postcount = postcount; + } + + private int postcount; + + public Users(String profilepicture) { + this.profilepicture = profilepicture; + } + + public String getProfilepicture() { + return profilepicture; + } + + public void setProfilepicture(String profilepicture) { + this.profilepicture = profilepicture; + } + + + + public Users() { + } + + public String getCoverpage() { + return coverpage; + } + + public void setCoverpage(String coverpage) { + this.coverpage = coverpage; + } + + + + + + public Users(String name, String username, String email, String password,String default_cover,String default_profile){ + this.name = name; + this.username = username; + this.email = email; + this.password = password; + this.coverpage = default_cover; + this.profilepicture = default_profile; + + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public int getFollowercount() { + return followercount; + } + + public void setFollowercount(int followercount) { + this.followercount = followercount; + } + + public int getFollowingCount() { + return followingCount; + } + + public void setFollowingCount(int followingCount) { + this.followingCount = followingCount; + } +} diff --git a/app/src/main/java/com/example/sket/adapter/UserAdapter.java b/app/src/main/java/com/example/sket/adapter/UserAdapter.java new file mode 100644 index 0000000..7a929bf --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/UserAdapter.java @@ -0,0 +1,148 @@ +package com.example.sket.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.R; +import com.example.sket.Users; +import com.example.sket.model.followers_model; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.Date; +import java.util.Objects; + +public class UserAdapter extends RecyclerView.Adapter{ + + Context context; + ArrayList list; + + + + + public UserAdapter(Context context, ArrayList list) { + this.context = context; + this.list = list; + } + + @NonNull + @Override + public viewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.user_sample_rv,parent,false); + return new viewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewHolder holder, int position) { + // to add fetched phtoto,name,username in recycleview(user) + Users users = list.get(position); + Picasso.get().load(users.getProfilepicture()).into(holder.profile); + holder.name.setText(users.getName()); + holder.username.setText(users.getUsername()); + + FirebaseDatabase.getInstance().getReference().child("user").child(users.getUserID()).child("followers").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + if(snapshot.exists()){ + holder.followbtn.setBackgroundColor(context.getResources().getColor(R.color.activefollow)); + holder.followbtn.setText("following"); + holder.followbtn.setEnabled(false); + holder.followbtn.setTextColor(context.getResources().getColor(R.color.textfollow)); + + }else { + // follow button + holder.followbtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + followers_model follow = new followers_model(); + follow.setFollowedby(FirebaseAuth.getInstance().getUid()); + follow.setFollowedat(new Date().getTime()); + + FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("following").child(users.getUserID()).setValue(new Date().getTime()).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users user = snapshot.getValue(Users.class); + FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("followingCount").setValue(user.getFollowingCount()+1); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + } + }); + + FirebaseDatabase.getInstance().getReference().child("user").child(users.getUserID()).child("followers").child(FirebaseAuth.getInstance().getUid()).setValue(follow).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + FirebaseDatabase.getInstance().getReference().child("user").child(users.getUserID()).child("followercount").setValue(users.getFollowercount()+1).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + holder.followbtn.setBackgroundColor(context.getResources().getColor(R.color.activefollow)); + holder.followbtn.setText("following"); + holder.followbtn.setEnabled(false); + holder.followbtn.setTextColor(context.getResources().getColor(R.color.textfollow)); + Toast.makeText(context, "Following"+users.getName(), Toast.LENGTH_SHORT).show(); + + } + }); + } + }); + + } + }); + } + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + + + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewHolder extends RecyclerView.ViewHolder{ + + + TextView name,username; + ImageView profile; + Button followbtn; + + public viewHolder(@NonNull View itemView) { + super(itemView); + + name = itemView.findViewById(R.id.name); + profile = itemView.findViewById(R.id.profile); + username= itemView.findViewById(R.id.username); + followbtn = itemView.findViewById(R.id.followbtn); + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/ViewPagerAdapter.java b/app/src/main/java/com/example/sket/adapter/ViewPagerAdapter.java new file mode 100644 index 0000000..b5da6f2 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/ViewPagerAdapter.java @@ -0,0 +1,45 @@ +package com.example.sket.adapter; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; + +import com.example.sket.notification_two_fragment; +import com.example.sket.request_notification_Fragment; + +public class ViewPagerAdapter extends FragmentPagerAdapter { + public ViewPagerAdapter(@NonNull FragmentManager fm) { + super(fm); + } + + @NonNull + @Override + public Fragment getItem(int position) { + switch (position){ + case 0 : return new notification_two_fragment(); + case 1: return new request_notification_Fragment(); + default: return new notification_two_fragment(); + } + + } + + @Override + public int getCount() { + return 2; + } + + @Nullable + @Override + public CharSequence getPageTitle(int position) { + String title = null; + if(position==0){ + title="NOTIFICATION"; + }else { + title ="REQUEST"; + } + + return title; + } +} diff --git a/app/src/main/java/com/example/sket/adapter/chats_adapter.java b/app/src/main/java/com/example/sket/adapter/chats_adapter.java new file mode 100644 index 0000000..2b3a862 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/chats_adapter.java @@ -0,0 +1,73 @@ +package com.example.sket.adapter; + +import android.content.Context; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.ChatWin; +import com.example.sket.R; +import com.example.sket.databinding.ChatsLayoutBinding; +import com.example.sket.model.chats_model; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +public class chats_adapter extends RecyclerView.Adapter{ + Context context; + ArrayList list; + + public chats_adapter(Context context, ArrayList list) { + this.context = context; + this.list = list; + } + + @NonNull + @Override + public viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.chats_layout,parent,false); + + return new viewholder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewholder holder, int position) { + chats_model chats = list.get(position); + Picasso.get().load(chats.getChatprofile()).into(holder.binding.chatProfile); + holder.binding.chatName.setText(chats.getName()); + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(context, ChatWin.class); + intent.putExtra("profileChat",chats.getChatprofile()); + intent.putExtra("nameChat", chats.getName()); + intent.putExtra("uidChat", chats.getUid()); + context.startActivity(intent); + } + }); + + + + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewholder extends RecyclerView.ViewHolder{ + ChatsLayoutBinding binding; + + public viewholder(@NonNull View itemView) { + super(itemView); + + binding = ChatsLayoutBinding.bind(itemView); + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/comment_adapter.java b/app/src/main/java/com/example/sket/adapter/comment_adapter.java new file mode 100644 index 0000000..4c54698 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/comment_adapter.java @@ -0,0 +1,79 @@ +package com.example.sket.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.R; +import com.example.sket.Users; +import com.example.sket.databinding.CommentrvBinding; +import com.example.sket.model.comment_model; +import com.github.marlonlom.utilities.timeago.TimeAgo; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +public class comment_adapter extends RecyclerView.Adapter{ + Context context; + ArrayList list; + + public comment_adapter(Context context, ArrayList list) { + this.context = context; + this.list = list; + } + + @NonNull + @Override + public viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.commentrv,parent,false); + + return new viewholder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewholder holder, int position) { + comment_model comment = list.get(position); + holder.binding.comment.setText(comment.getCommentbody()); + + String time = TimeAgo.using(comment.getCommentedat()); + holder.binding.time.setText(time); + + FirebaseDatabase.getInstance().getReference().child("user").child(comment.getCommentedby()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users users = snapshot.getValue(Users.class); + Picasso.get().load(users.getProfilepicture()).into(holder.binding.profile); + holder.binding.comment.setText(users.getName()+"-:"+comment.getCommentbody()); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewholder extends RecyclerView.ViewHolder{ + CommentrvBinding binding; + + public viewholder(@NonNull View itemView) { + super(itemView); + binding = CommentrvBinding.bind(itemView); + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/followers_adapter.java b/app/src/main/java/com/example/sket/adapter/followers_adapter.java new file mode 100644 index 0000000..5387193 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/followers_adapter.java @@ -0,0 +1,75 @@ +package com.example.sket.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.R; +import com.example.sket.Users; +import com.example.sket.databinding.FriendRvProfilfragBinding; +import com.example.sket.model.followers_model; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +public class followers_adapter extends RecyclerView.Adapter{ + + ArrayList list; + Context context; + + public followers_adapter(ArrayList list, Context context) { + this.list = list; + this.context = context; + } + + @NonNull + @Override + public viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.friend_rv_profilfrag,parent,false); + + return new viewholder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewholder holder, int position) { + followers_model follow = list.get(position); + + FirebaseDatabase.getInstance().getReference().child("user").child(follow.getFollowedby()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users users = snapshot.getValue(Users.class); + Picasso.get().load(users.getProfilepicture()).into(holder.binding.profileProfilefrag); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewholder extends RecyclerView.ViewHolder{ + + FriendRvProfilfragBinding binding; + public viewholder(@NonNull View itemView) { + super(itemView); + binding = FriendRvProfilfragBinding.bind(itemView); + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/messageAdapter.java b/app/src/main/java/com/example/sket/adapter/messageAdapter.java new file mode 100644 index 0000000..4a35a1c --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/messageAdapter.java @@ -0,0 +1,125 @@ +package com.example.sket.adapter; + +import static com.example.sket.ChatWin.receiverIImg; +import static com.example.sket.ChatWin.senderImg; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.model.msgModelclass; +import com.example.sket.R; +import com.example.sket.model.msgModelclass; +import com.github.marlonlom.utilities.timeago.TimeAgo; +import com.google.firebase.auth.FirebaseAuth; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +import de.hdodenhof.circleimageview.CircleImageView; + +public class messageAdapter extends RecyclerView.Adapter { + Context context; + ArrayList messagesAdpterArrayList; + int ITEM_SEND=1; + int ITEM_RECIVE=2; + + public messageAdapter(Context context, ArrayList messagesAdpterArrayList) { + this.context = context; + this.messagesAdpterArrayList = messagesAdpterArrayList; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == ITEM_SEND){ + View view = LayoutInflater.from(context).inflate(R.layout.sender_chat_layout, parent, false); + return new senderViewHolder(view); + }else { + View view = LayoutInflater.from(context).inflate(R.layout.reciever_chat_layout, parent, false); + return new reciverViewHolder(view); + } + + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + msgModelclass messages = messagesAdpterArrayList.get(position); + holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + new AlertDialog.Builder(context).setTitle("Delete") + .setMessage("Are you sure you want to delete this message?") + .setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + + } + }).setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + } + }).show(); + + return false; + } + }); + if (holder.getClass()==senderViewHolder.class){ + senderViewHolder viewHolder = (senderViewHolder) holder; + viewHolder.msgtxt.setText(messages.getMessage()); + Picasso.get().load(senderImg).into(viewHolder.circleImageView); + viewHolder.time.setText(TimeAgo.using(messages.getTimeStamp())); + }else { reciverViewHolder viewHolder = (reciverViewHolder) holder; + viewHolder.msgtxt.setText(messages.getMessage()); + Picasso.get().load(receiverIImg).into(viewHolder.circleImageView); + viewHolder.time.setText(TimeAgo.using(messages.getTimeStamp())); + + + } + } + + @Override + public int getItemCount() { + return messagesAdpterArrayList.size(); + } + + @Override + public int getItemViewType(int position) { + msgModelclass messages = messagesAdpterArrayList.get(position); + if (FirebaseAuth.getInstance().getCurrentUser().getUid().equals(messages.getSenderid())) { + return ITEM_SEND; + } else { + return ITEM_RECIVE; + } + } + + class senderViewHolder extends RecyclerView.ViewHolder { + CircleImageView circleImageView; + TextView msgtxt, time; + public senderViewHolder(@NonNull View itemView) { + super(itemView); + circleImageView = itemView.findViewById(R.id.profilerggg); + msgtxt = itemView.findViewById(R.id.msgsendertyp); + time = itemView.findViewById(R.id.chatTimeSend); + + } + } + class reciverViewHolder extends RecyclerView.ViewHolder { + CircleImageView circleImageView; + TextView msgtxt, time; + public reciverViewHolder(@NonNull View itemView) { + super(itemView); + circleImageView = itemView.findViewById(R.id.pro); + msgtxt = itemView.findViewById(R.id.recivertextset); + time = itemView.findViewById(R.id.chatTimeRec); + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/post_adapter.java b/app/src/main/java/com/example/sket/adapter/post_adapter.java new file mode 100644 index 0000000..e1249e9 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/post_adapter.java @@ -0,0 +1,146 @@ +package com.example.sket.adapter; + +import android.content.Context; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.R; +import com.example.sket.Users; +import com.example.sket.commentActivity; +import com.example.sket.databinding.DashboardRvSampleHomefragBinding; +import com.example.sket.model.post_model; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + +public class post_adapter extends RecyclerView.Adapter { + + ArrayList list; + Context context; + + public post_adapter(ArrayList list, Context context) { + this.list = list; + this.context = context; + } + + @NonNull + @Override + public viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.dashboard_rv_sample_homefrag,parent,false); + + return new viewholder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewholder holder, int position) { + post_model model = list.get(position); + Picasso.get().load(model.getPostimage()).into(holder.binding.homfragpostimage); + String desc = model.getPostdescription(); + holder.binding.like.setText(model.getPostlike()+""); + holder.binding.comment.setText(model.getCommentcount()+""); + if(desc.equals("")){ + holder.binding.postdiscription.setVisibility(View.GONE); + }else { + holder.binding.postdiscription.setText(model.getPostdescription()); + holder.binding.postdiscription.setVisibility(View.VISIBLE);} + + FirebaseDatabase.getInstance().getReference().child("user").child(model.getPostedby()).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users users = snapshot.getValue(Users.class); + Picasso.get().load(users.getProfilepicture()).into(holder.binding.dashboardProfileHomefrag); + holder.binding.dashboardNameHomefrag.setText(users.getName()); + holder.binding.dashboardUsernameHomefrag.setText(users.getUsername()); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + FirebaseDatabase.getInstance().getReference().child("post").child(model.getPostid()).child("likes").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + if(snapshot.exists()){ + holder.binding.like.setCompoundDrawablesWithIntrinsicBounds(R.drawable.heart_filled, 0, 0, 0); + }else{ + holder.binding.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + FirebaseDatabase.getInstance().getReference().child("post").child(model.getPostid()).child("likes").child(FirebaseAuth.getInstance().getUid()).setValue(true).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + FirebaseDatabase.getInstance().getReference().child("post").child(model.getPostid()).child("postlike").setValue(model.getPostlike() + 1).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + holder.binding.like.setCompoundDrawablesWithIntrinsicBounds(R.drawable.heart_filled, 0, 0, 0); + } + }); + } + }); + } + }); + } + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + holder.binding.comment.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(context, commentActivity.class); + intent.putExtra("postid",model.getPostid()); + intent.putExtra("postedby",model.getPostedby()); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + + } + }); + + holder.binding.shareit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_SEND); + intent.putExtra(Intent.EXTRA_COMPONENT_NAME,model.getPostimage()); + context.startActivity(intent); + + + } + }); + + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewholder extends RecyclerView.ViewHolder{ + + DashboardRvSampleHomefragBinding binding; + public viewholder(@NonNull View itemView) { + super(itemView); + binding = DashboardRvSampleHomefragBinding.bind(itemView); + + + } + } +} diff --git a/app/src/main/java/com/example/sket/adapter/story_adapter.java b/app/src/main/java/com/example/sket/adapter/story_adapter.java new file mode 100644 index 0000000..7a128f1 --- /dev/null +++ b/app/src/main/java/com/example/sket/adapter/story_adapter.java @@ -0,0 +1,59 @@ +package com.example.sket.adapter; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.sket.R; +import com.example.sket.model.story_model; + +import java.util.ArrayList; + +public class story_adapter extends RecyclerView.Adapter{ + + + ArrayList list ; + Context context; + + public story_adapter(ArrayList list, Context context) { + this.list = list; + this.context = context; + } + + @NonNull + @Override + public viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.story_rv_design,parent,false); + return new viewholder(view); + } + + @Override + public void onBindViewHolder(@NonNull viewholder holder, int position) { + story_model model = list.get(position); + holder.story_image_view.setImageResource(model.getStory_imageview()); + holder.story_profile_imageview.setImageResource(model.getStory_profile_view()); + holder.story_name.setText(model.getStory_name()); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class viewholder extends RecyclerView.ViewHolder{ + ImageView story_image_view, story_profile_imageview; + TextView story_name; + public viewholder(@NonNull View itemView) { + super(itemView); + story_image_view = itemView.findViewById(R.id.homfragpostimage); + story_profile_imageview = itemView.findViewById(R.id.dashboard_profile_homefrag); + story_name = itemView.findViewById(R.id.story_name); + + } + } +} diff --git a/app/src/main/java/com/example/sket/commentActivity.java b/app/src/main/java/com/example/sket/commentActivity.java new file mode 100644 index 0000000..5bbeafa --- /dev/null +++ b/app/src/main/java/com/example/sket/commentActivity.java @@ -0,0 +1,153 @@ +package com.example.sket; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Toast; + +import com.example.sket.adapter.comment_adapter; +import com.example.sket.databinding.ActivityCommentBinding; +import com.example.sket.model.comment_model; +import com.example.sket.model.post_model; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.Date; + +public class commentActivity extends AppCompatActivity { + ActivityCommentBinding binding; + Intent intent; + String postid; + String postedby; + FirebaseAuth auth; + FirebaseDatabase database; + ArrayList list; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_comment); + + binding = ActivityCommentBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + intent = getIntent(); + + database = FirebaseDatabase.getInstance(); + auth = FirebaseAuth.getInstance(); + + postid = intent.getStringExtra("postid"); + postedby = intent.getStringExtra("postedby"); + + + database.getReference().child("post").child(postid).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + post_model post = snapshot.getValue(post_model.class); + Picasso.get().load(post.getPostimage()).into(binding.postimage); + binding.description.setText(post.getPostdescription()); + binding.like.setText(post.getPostlike()+""); + binding.comment.setText(post.getCommentcount()+""); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + list = new ArrayList<>(); + + database.getReference().child("user").child(postedby).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users user = snapshot.getValue(Users.class); + Picasso.get().load(user.getProfilepicture()).into(binding.profile); + binding.name.setText(user.getName()); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + binding.commentpostbtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + comment_model comment = new comment_model(); + comment.setCommentbody(binding.commentET.getText().toString()); + comment.setCommentedat(new Date().getTime()); + comment.setCommentedby(FirebaseAuth.getInstance().getUid()); + + // to store data in firebase for comments + database.getReference().child("post").child(postid).child("comments").push().setValue(comment).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + database.getReference().child("post").child(postid).child("commentcount").addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + int commentcount = 0; + if(snapshot.exists()){ + commentcount = snapshot.getValue(Integer.class); + + } + + database.getReference().child("post").child(postid).child("commentcount").setValue(commentcount+1).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + binding.commentET.setText(""); + Toast.makeText(commentActivity.this, "Commented", Toast.LENGTH_SHORT).show(); + } + }); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + } + }); + } + }); + + comment_adapter adapter = new comment_adapter(this,list); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); + binding.commentrv.setLayoutManager(linearLayoutManager); + binding.commentrv.setAdapter(adapter); + + + database.getReference().child("post").child(postid).child("comments").addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + + + list.clear(); + for(DataSnapshot dataSnapshot: snapshot.getChildren()){ + comment_model comment = dataSnapshot.getValue(comment_model.class); + list.add(comment); + } + adapter.notifyDataSetChanged(); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/model/chats_model.java b/app/src/main/java/com/example/sket/model/chats_model.java new file mode 100644 index 0000000..d90b993 --- /dev/null +++ b/app/src/main/java/com/example/sket/model/chats_model.java @@ -0,0 +1,38 @@ +package com.example.sket.model; + +public class chats_model { + private String chatprofile; + private String name; + private String Uid; + + public chats_model(String chatprofile, String name,String Uid) { + this.chatprofile = chatprofile; + this.name = name; + this.Uid = Uid; + + } + + public String getChatprofile() { + return chatprofile; + } + + public void setChatprofile(String chatprofile) { + this.chatprofile = chatprofile; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUid() { + return Uid; + } + + public void setUid(String uid) { + Uid = uid; + } +} diff --git a/app/src/main/java/com/example/sket/model/comment_model.java b/app/src/main/java/com/example/sket/model/comment_model.java new file mode 100644 index 0000000..464a57a --- /dev/null +++ b/app/src/main/java/com/example/sket/model/comment_model.java @@ -0,0 +1,34 @@ +package com.example.sket.model; + +public class comment_model { + private String commentbody; + private long commentedat; + private String commentedby; + + public comment_model() { + } + + public String getCommentbody() { + return commentbody; + } + + public void setCommentbody(String commentbody) { + this.commentbody = commentbody; + } + + public long getCommentedat() { + return commentedat; + } + + public void setCommentedat(long commentedat) { + this.commentedat = commentedat; + } + + public String getCommentedby() { + return commentedby; + } + + public void setCommentedby(String commentedby) { + this.commentedby = commentedby; + } +} diff --git a/app/src/main/java/com/example/sket/model/followers_model.java b/app/src/main/java/com/example/sket/model/followers_model.java new file mode 100644 index 0000000..61b2834 --- /dev/null +++ b/app/src/main/java/com/example/sket/model/followers_model.java @@ -0,0 +1,25 @@ +package com.example.sket.model; + +public class followers_model { + private String followedby; + private long followedat; + + public followers_model() { + } + + public String getFollowedby() { + return followedby; + } + + public void setFollowedby(String followedby) { + this.followedby = followedby; + } + + public long getFollowedat() { + return followedat; + } + + public void setFollowedat(long followedat) { + this.followedat = followedat; + } +} diff --git a/app/src/main/java/com/example/sket/model/msgModelclass.java b/app/src/main/java/com/example/sket/model/msgModelclass.java new file mode 100644 index 0000000..ce338c0 --- /dev/null +++ b/app/src/main/java/com/example/sket/model/msgModelclass.java @@ -0,0 +1,40 @@ +package com.example.sket.model; + +public class msgModelclass { + String message; + String senderid; + long timeStamp; + + public msgModelclass() { + } + + public msgModelclass(String message, String senderid, long timeStamp) { + this.message = message; + this.senderid = senderid; + this.timeStamp = timeStamp; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getSenderid() { + return senderid; + } + + public void setSenderid(String senderid) { + this.senderid = senderid; + } + + public long getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } +} diff --git a/app/src/main/java/com/example/sket/model/post_model.java b/app/src/main/java/com/example/sket/model/post_model.java new file mode 100644 index 0000000..67fc5fe --- /dev/null +++ b/app/src/main/java/com/example/sket/model/post_model.java @@ -0,0 +1,83 @@ +package com.example.sket.model; + +public class post_model { + private String postid; + private String postimage; + private String postedby; + private String postdescription; + private long postedat; + private int postlike; + private int commentcount ; + + + + + + + + public post_model(String postid, String postimage, String postedby, String postdescription, long postedat) { + this.postid = postid; + this.postimage = postimage; + this.postedby = postedby; + this.postdescription = postdescription; + this.postedat = postedat; + } + + public post_model() { + } + + public String getPostid() { + return postid; + } + + public void setPostid(String postid) { + this.postid = postid; + } + + public String getPostimage() { + return postimage; + } + + public void setPostimage(String postimage) { + this.postimage = postimage; + } + + public String getPostedby() { + return postedby; + } + + public void setPostedby(String postedby) { + this.postedby = postedby; + } + + public String getPostdescription() { + return postdescription; + } + + public void setPostdescription(String postdescription) { + this.postdescription = postdescription; + } + + public long getPostedat() { + return postedat; + } + + public void setPostedat(long postedat) { + this.postedat = postedat; + } + + public int getPostlike() { + return postlike; + } + + public void setPostlike(int postlike) { + this.postlike = postlike; + } + public int getCommentcount() { + return commentcount; + } + + public void setCommentcount(int commentcount) { + this.commentcount = commentcount; + } +} diff --git a/app/src/main/java/com/example/sket/model/story_model.java b/app/src/main/java/com/example/sket/model/story_model.java new file mode 100644 index 0000000..a1a8ad2 --- /dev/null +++ b/app/src/main/java/com/example/sket/model/story_model.java @@ -0,0 +1,36 @@ +package com.example.sket.model; + +public class story_model { + int story_imageview,story_profile_view; + String story_name; + + public story_model(int story_imageview, int story_profile_view, String story_name) { + this.story_imageview = story_imageview; + this.story_profile_view = story_profile_view; + this.story_name = story_name; + } + + public int getStory_imageview() { + return story_imageview; + } + + public void setStory_imageview(int story_imageview) { + this.story_imageview = story_imageview; + } + + public int getStory_profile_view() { + return story_profile_view; + } + + public void setStory_profile_view(int story_profile_view) { + this.story_profile_view = story_profile_view; + } + + public String getStory_name() { + return story_name; + } + + public void setStory_name(String story_name) { + this.story_name = story_name; + } +} diff --git a/app/src/main/java/com/example/sket/nav_add_frag.java b/app/src/main/java/com/example/sket/nav_add_frag.java new file mode 100644 index 0000000..46f83ab --- /dev/null +++ b/app/src/main/java/com/example/sket/nav_add_frag.java @@ -0,0 +1,199 @@ +package com.example.sket; + +import android.app.ProgressDialog; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.text.Editable; +import android.text.TextWatcher; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import com.example.sket.databinding.FragmentNavAddFragBinding; +import com.example.sket.model.post_model; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.google.firebase.storage.FirebaseStorage; +import com.google.firebase.storage.StorageReference; +import com.google.firebase.storage.UploadTask; +import com.squareup.picasso.Picasso; + +import java.util.Date; + + +public class nav_add_frag extends Fragment { + + FragmentNavAddFragBinding binding; + Uri uri; + FirebaseAuth auth; + FirebaseDatabase database; + FirebaseStorage storage; + ProgressDialog progressDialog; + + + public nav_add_frag() { + // Required empty public constructor + } + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + auth = FirebaseAuth.getInstance(); + database = FirebaseDatabase.getInstance(); + storage = FirebaseStorage.getInstance(); + progressDialog = new ProgressDialog(getContext()); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + binding = FragmentNavAddFragBinding.inflate(inflater, container, false); + + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.setTitle("Uploading"); + progressDialog.setMessage("Please Wait"); + progressDialog.setCancelable(false); + progressDialog.setCanceledOnTouchOutside(false); + + database.getReference().child("user").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + if(snapshot.exists()){ + Users users = snapshot.getValue(Users.class); + Picasso.get().load(users.getProfilepicture()).into(binding.profile); + binding.name.setText(users.getName()); + binding.username.setText(users.getUsername()); + } + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + + //to set post but enable acoording to edit text + binding.postdiscription.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + String decs = binding.postdiscription.getText().toString(); + if(!decs.isEmpty()){ + binding.postbtn.setBackgroundColor(getContext().getResources().getColor(R.color.purple)); + binding.postbtn.setTextColor(getContext().getResources().getColor(R.color.white)); + binding.postbtn.setEnabled(true); + }else { + binding.postbtn.setBackgroundColor(getContext().getResources().getColor(R.color.down)); + binding.postbtn.setTextColor(getContext().getResources().getColor(R.color.grey)); + binding.postbtn.setEnabled(false); + } + + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + //enabling imagebtn to go to gallery to select an image + binding.addimg.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_GET_CONTENT); + intent.setType("image/*"); + startActivityForResult(intent,11); + } + }); + + binding.postbtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + progressDialog.show(); + + // to store data in storage at a particular path + final StorageReference reference = storage.getReference().child("posts").child(FirebaseAuth.getInstance().getUid()).child(new Date().getTime()+""); + + // reference.putFile(uri) this will put that store imformative uri at that particular location provided + reference.putFile(uri).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { + + //this will download that stored post imformation in database + reference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Uri uri) { + post_model post = new post_model(); + post.setPostimage(uri.toString()); + post.setPostedby(FirebaseAuth.getInstance().getUid()); + post.setPostdescription(binding.postdiscription.getText().toString()); + post.setPostedat(new Date().getTime()); + + database.getReference().child("post").push().setValue(post).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Void unused) { + progressDialog.dismiss(); + + FirebaseDatabase.getInstance().getReference("user").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + Users user = snapshot.getValue(Users.class); + FirebaseDatabase.getInstance().getReference("user").child(FirebaseAuth.getInstance().getUid()).child("postcount").setValue(user.getPostcount()+1); + + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + Toast.makeText(getActivity(),"Posted Successfully",Toast.LENGTH_SHORT).show(); + + } + }); + } + }); + } + }); + } + }); + + return binding.getRoot(); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (data.getData() != null){ + uri = data.getData(); + binding.postimage.setImageURI(uri); + + binding.postimage.setVisibility(View.VISIBLE); + binding.postbtn.setBackgroundColor(getContext().getResources().getColor(R.color.purple)); + binding.postbtn.setTextColor(getContext().getResources().getColor(R.color.white)); + binding.postbtn.setEnabled(true); + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/nav_home_fragment.java b/app/src/main/java/com/example/sket/nav_home_fragment.java new file mode 100644 index 0000000..95763bb --- /dev/null +++ b/app/src/main/java/com/example/sket/nav_home_fragment.java @@ -0,0 +1,124 @@ +package com.example.sket; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import com.example.sket.adapter.post_adapter; +import com.example.sket.adapter.story_adapter; +import com.example.sket.model.post_model; +import com.example.sket.model.story_model; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; + +import java.util.ArrayList; + + +public class nav_home_fragment extends Fragment { + + RecyclerView story_RV,dashboard_rv; + ArrayList list; + ArrayList post_list; + FirebaseAuth auth; + FirebaseDatabase database; + ImageView shareit; + ImageView messenger; + + + + + public nav_home_fragment() { + // Required empty public constructor + } + + + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + + View view= inflater.inflate(R.layout.fragment_nav_home_fragment, container, false); + + story_RV = view.findViewById(R.id.story_rv); + messenger = view.findViewById(R.id.dashboard_profile_homefrag); + + + + auth = FirebaseAuth.getInstance(); + database = FirebaseDatabase.getInstance(); + + list = new ArrayList<>(); + list.add(new story_model(R.drawable.img_1,R.drawable.img_5,"Nikki")); // to add newly added stories + list.add(new story_model(R.drawable.img_1,R.drawable.img_5,"Nikki")); + list.add(new story_model(R.drawable.img_1,R.drawable.img_5,"Nikki")); + list.add(new story_model(R.drawable.img_1,R.drawable.img_5,"Nikki")); + + + story_adapter adapter = new story_adapter(list,getContext()); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false); + story_RV.setLayoutManager(linearLayoutManager); + story_RV.setNestedScrollingEnabled(false); + story_RV.setAdapter(adapter); + + + + dashboard_rv = view.findViewById(R.id.dashboard_rv); + post_list = new ArrayList<>(); + + post_adapter postAdapter = new post_adapter(post_list,getContext()); + LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); + dashboard_rv.setLayoutManager(layoutManager); + dashboard_rv.setNestedScrollingEnabled(true); + dashboard_rv.setAdapter(postAdapter); + + database.getReference().child("post").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + post_list.clear(); + for(DataSnapshot dataSnapshot: snapshot.getChildren()){ + post_model post = dataSnapshot.getValue(post_model.class); + post.setPostid(dataSnapshot.getKey()); + post_list.add(post); + } + postAdapter.notifyDataSetChanged(); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + messenger.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(new Intent(getActivity(), Messenger.class)); + } + }); + + + return view; + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/nav_notification_fragment.java b/app/src/main/java/com/example/sket/nav_notification_fragment.java new file mode 100644 index 0000000..ecd9b8e --- /dev/null +++ b/app/src/main/java/com/example/sket/nav_notification_fragment.java @@ -0,0 +1,47 @@ +package com.example.sket; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.viewpager.widget.ViewPager; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; + +import com.example.sket.adapter.ViewPagerAdapter; +import com.google.android.material.tabs.TabLayout; + + +public class nav_notification_fragment extends Fragment { + + ViewPager viewPager; + TabLayout tabLayout; + + public nav_notification_fragment() { + // Required empty public constructor + } + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view= inflater.inflate(R.layout.fragment_nav_notification_fragment, container, false); + + viewPager = view.findViewById(R.id.ViewPager); + viewPager.setAdapter(new ViewPagerAdapter(getFragmentManager())); + + tabLayout = view.findViewById(R.id.tabLayout); + tabLayout.setupWithViewPager(viewPager); + + return view; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/nav_profile_frag.java b/app/src/main/java/com/example/sket/nav_profile_frag.java new file mode 100644 index 0000000..f0fb777 --- /dev/null +++ b/app/src/main/java/com/example/sket/nav_profile_frag.java @@ -0,0 +1,235 @@ +package com.example.sket; + +import static android.content.Context.MODE_PRIVATE; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.Uri; +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.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.sket.adapter.followers_adapter; +import com.example.sket.model.followers_model; +import com.google.android.gms.tasks.OnSuccessListener; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.google.firebase.storage.FirebaseStorage; +import com.google.firebase.storage.StorageReference; +import com.google.firebase.storage.UploadTask; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; + + +public class nav_profile_frag extends Fragment { + + RecyclerView recyclerView; + ArrayList list; + ImageView change_cover_photo,cover_picture,change_profile_picture,profile_picture; + + FirebaseAuth auth; + FirebaseStorage storage; + FirebaseDatabase database; + + TextView username,name,followerno,postcount,followingcount; + ImageView logoutbtn; + Activity context; + + + public nav_profile_frag() { + // Required empty public constructor + } + + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + auth = FirebaseAuth.getInstance(); + storage = FirebaseStorage.getInstance(); + database = FirebaseDatabase.getInstance(); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_nav_profile_frag, container, false); + context = getActivity(); + + database.getReference().child("user").child(auth.getUid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + if(snapshot.exists()){ + Users user = snapshot.getValue(Users.class); + Picasso.get().load(user.getCoverpage()).into(cover_picture); + Picasso.get().load(user.getProfilepicture()).into(profile_picture); + name.setText(user.getName()); + username.setText(user.getUsername()); + postcount.setText(user.getPostcount()+""); + followingcount.setText(user.getFollowingCount()+""); + followerno.setText(user.getFollowercount()+""); + + } + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + recyclerView = view.findViewById(R.id.friends_rv_profile); + change_cover_photo = view.findViewById(R.id.change_cover_photo); + cover_picture = view.findViewById(R.id.cover_picture); + username = view.findViewById(R.id.username); + name = view.findViewById(R.id.name); + logoutbtn = view.findViewById(R.id.logoutbtn); + change_profile_picture = view.findViewById(R.id.change_profile_picture); + profile_picture = view.findViewById(R.id.profile); + followerno = view.findViewById(R.id.followers); + followingcount = view.findViewById(R.id.following); + postcount = view.findViewById(R.id.post); + + + + list = new ArrayList<>(); + + + followers_adapter adapter = new followers_adapter(list,getContext()); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false); + recyclerView.setLayoutManager((linearLayoutManager)); + recyclerView.setAdapter(adapter); + + // to send data in friends rv only of those who are following + + database.getReference().child("user").child(auth.getUid()).child("followers").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + list.clear(); + for (DataSnapshot dataSnapshot: snapshot.getChildren()){ + followers_model follow = dataSnapshot.getValue(followers_model.class); + list.add(follow); + } + adapter.notifyDataSetChanged(); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + logoutbtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + auth.signOut(); + Intent intent = new Intent(context, MainActivity.class); + Toast.makeText(context,"Successfully Loged out",Toast.LENGTH_SHORT).show(); + SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user", MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString("Email", "NA"); + editor.putString("Pass", "NA"); + editor.apply(); + startActivity(intent); + } + }); + + change_cover_photo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_GET_CONTENT); + intent.setType("image/*"); + startActivityForResult(intent,11); + + } + }); + + change_profile_picture.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_GET_CONTENT); + intent.setType("image/*"); + startActivityForResult(intent,22); + } + }); + + + return view; + } + + public void onstart(){ + super.onStart(); + + } + + @Override + public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode==11){ + if(data.getData() != null){ + Uri uri = data.getData(); + cover_picture.setImageURI(uri); + + final StorageReference reference = storage.getReference().child("cover_picture").child(FirebaseAuth.getInstance().getUid()); + reference.putFile(uri).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { + Toast.makeText(getActivity(),"cover photo saved",Toast.LENGTH_SHORT).show(); + reference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Uri uri) { + database.getReference().child("user").child(auth.getUid()).child("coverpage").setValue(uri.toString()); + } + }); + } + }); + } + }else { + if(data.getData() != null){ + Uri uri = data.getData(); + profile_picture.setImageURI(uri); + + final StorageReference reference = storage.getReference().child("profile_picture").child(FirebaseAuth.getInstance().getUid()); + reference.putFile(uri).addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { + Toast.makeText(getActivity(),"Profile photo saved",Toast.LENGTH_SHORT).show(); + reference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() { + @Override + public void onSuccess(Uri uri) { + database.getReference().child("user").child(auth.getUid()).child("profilepicture").setValue(uri.toString()); + } + }); + } + }); + } + } + + } + + + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/nav_search_frag.java b/app/src/main/java/com/example/sket/nav_search_frag.java new file mode 100644 index 0000000..afffbeb --- /dev/null +++ b/app/src/main/java/com/example/sket/nav_search_frag.java @@ -0,0 +1,90 @@ +package com.example.sket; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.sket.adapter.UserAdapter; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.google.firebase.storage.FirebaseStorage; + +import java.util.ArrayList; + + +public class nav_search_frag extends Fragment { + ArrayList list ; + RecyclerView recyclerView; + FirebaseAuth auth; + FirebaseDatabase database; + FirebaseStorage storage; + + public nav_search_frag() { + // Required empty public constructor + } + + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + + + View view= inflater.inflate(R.layout.fragment_nav_search_frag, container, false); + + auth = FirebaseAuth.getInstance(); + database = FirebaseDatabase.getInstance(); + + list = new ArrayList<>(); + recyclerView = view.findViewById(R.id.usersRV); + + UserAdapter adapter = new UserAdapter(getContext(),list); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); + recyclerView.setLayoutManager(linearLayoutManager); + recyclerView.setAdapter(adapter); + + database.getReference().child("user").addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(@NonNull DataSnapshot snapshot) { + list.clear(); + for(DataSnapshot dataSnapshot : snapshot.getChildren()){ + Users users = dataSnapshot.getValue(Users.class); + users.setUserID(dataSnapshot.getKey()); + if(!dataSnapshot.getKey().equals(FirebaseAuth.getInstance().getUid())){ + list.add(users); + } + + } + adapter.notifyDataSetChanged(); + } + + @Override + public void onCancelled(@NonNull DatabaseError error) { + + } + }); + + + + return view; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/notification_two_fragment.java b/app/src/main/java/com/example/sket/notification_two_fragment.java new file mode 100644 index 0000000..3405d4f --- /dev/null +++ b/app/src/main/java/com/example/sket/notification_two_fragment.java @@ -0,0 +1,64 @@ +package com.example.sket; + +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 notification_two_fragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class notification_two_fragment 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; + + public notification_two_fragment() { + // Required empty public constructor + } + + /** + * 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 notification_two_fragment. + */ + // TODO: Rename and change types and number of parameters + public static notification_two_fragment newInstance(String param1, String param2) { + notification_two_fragment fragment = new notification_two_fragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @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_notification_two_fragment, container, false); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/request_notification_Fragment.java b/app/src/main/java/com/example/sket/request_notification_Fragment.java new file mode 100644 index 0000000..b40adcb --- /dev/null +++ b/app/src/main/java/com/example/sket/request_notification_Fragment.java @@ -0,0 +1,64 @@ +package com.example.sket; + +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 request_notification_Fragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class request_notification_Fragment 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; + + public request_notification_Fragment() { + // Required empty public constructor + } + + /** + * 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 request_notification_Fragment. + */ + // TODO: Rename and change types and number of parameters + public static request_notification_Fragment newInstance(String param1, String param2) { + request_notification_Fragment fragment = new request_notification_Fragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @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_request_notification_, container, false); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/sket/splash_screen.java b/app/src/main/java/com/example/sket/splash_screen.java new file mode 100644 index 0000000..e16b2b2 --- /dev/null +++ b/app/src/main/java/com/example/sket/splash_screen.java @@ -0,0 +1,71 @@ +package com.example.sket; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.Handler; +import android.view.WindowManager; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.auth.FirebaseAuth; + +public class splash_screen extends AppCompatActivity { + + Animation topAnim , bottomAnim; + ImageView image; + TextView Name; + + private static int screen_time = 4000; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash_screen); + + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); + topAnim = AnimationUtils.loadAnimation(this,R.anim.top_animation); + bottomAnim = AnimationUtils.loadAnimation(this,R.anim.bottom_animation); + image = findViewById(R.id.imageView); + Name = findViewById(R.id.Name); + image.setAnimation(topAnim); + Name.setAnimation(bottomAnim); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + SharedPreferences getShared = getSharedPreferences("user", MODE_PRIVATE); + String eml = getShared.getString("Email", "NA"); + String pas = getShared.getString("Pass", "NA"); + + FirebaseAuth.getInstance().signInWithEmailAndPassword(eml, pas).addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(Task task) { + if (task.isSuccessful()) { + try { + Intent loginToMainIntent = new Intent(splash_screen.this, MainActivity2.class); + startActivity(loginToMainIntent); + finishAffinity(); + } catch (Exception e) { + Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); + } + } else { + Intent intent = new Intent(splash_screen.this, MainActivity.class); + startActivity(intent); + finish(); + } + } + }); + + } + },screen_time); + } +} \ No newline at end of file diff --git a/app/src/main/res/anim/bottom_animation.xml b/app/src/main/res/anim/bottom_animation.xml new file mode 100644 index 0000000..b8e5dd5 --- /dev/null +++ b/app/src/main/res/anim/bottom_animation.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/top_animation.xml b/app/src/main/res/anim/top_animation.xml new file mode 100644 index 0000000..135558d --- /dev/null +++ b/app/src/main/res/anim/top_animation.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/add_image.xml b/app/src/main/res/drawable/add_image.xml new file mode 100644 index 0000000..111a60b --- /dev/null +++ b/app/src/main/res/drawable/add_image.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/add_image1.xml b/app/src/main/res/drawable/add_image1.xml new file mode 100644 index 0000000..b3bcb4a --- /dev/null +++ b/app/src/main/res/drawable/add_image1.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/add_image2.xml b/app/src/main/res/drawable/add_image2.xml new file mode 100644 index 0000000..9730cc2 --- /dev/null +++ b/app/src/main/res/drawable/add_image2.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/baseline_add_circle_outline_24.xml b/app/src/main/res/drawable/baseline_add_circle_outline_24.xml new file mode 100644 index 0000000..9b10da7 --- /dev/null +++ b/app/src/main/res/drawable/baseline_add_circle_outline_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_bookmark_border_24.xml b/app/src/main/res/drawable/baseline_bookmark_border_24.xml new file mode 100644 index 0000000..a854be0 --- /dev/null +++ b/app/src/main/res/drawable/baseline_bookmark_border_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_call_24.xml b/app/src/main/res/drawable/baseline_call_24.xml new file mode 100644 index 0000000..f56f10f --- /dev/null +++ b/app/src/main/res/drawable/baseline_call_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_chat_bubble_outline_24.xml b/app/src/main/res/drawable/baseline_chat_bubble_outline_24.xml new file mode 100644 index 0000000..3b090d1 --- /dev/null +++ b/app/src/main/res/drawable/baseline_chat_bubble_outline_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_comment_24.xml b/app/src/main/res/drawable/baseline_comment_24.xml new file mode 100644 index 0000000..43c6e79 --- /dev/null +++ b/app/src/main/res/drawable/baseline_comment_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_home_24.xml b/app/src/main/res/drawable/baseline_home_24.xml new file mode 100644 index 0000000..5a870f5 --- /dev/null +++ b/app/src/main/res/drawable/baseline_home_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_more_vert_24.xml b/app/src/main/res/drawable/baseline_more_vert_24.xml new file mode 100644 index 0000000..39fbab5 --- /dev/null +++ b/app/src/main/res/drawable/baseline_more_vert_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_notifications_none_24.xml b/app/src/main/res/drawable/baseline_notifications_none_24.xml new file mode 100644 index 0000000..605362e --- /dev/null +++ b/app/src/main/res/drawable/baseline_notifications_none_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_person_add_24.xml b/app/src/main/res/drawable/baseline_person_add_24.xml new file mode 100644 index 0000000..ee564be --- /dev/null +++ b/app/src/main/res/drawable/baseline_person_add_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_person_outline_24.xml b/app/src/main/res/drawable/baseline_person_outline_24.xml new file mode 100644 index 0000000..8394a20 --- /dev/null +++ b/app/src/main/res/drawable/baseline_person_outline_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_search_24.xml b/app/src/main/res/drawable/baseline_search_24.xml new file mode 100644 index 0000000..a5687c6 --- /dev/null +++ b/app/src/main/res/drawable/baseline_search_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_send_24.xml b/app/src/main/res/drawable/baseline_send_24.xml new file mode 100644 index 0000000..3abc6cb --- /dev/null +++ b/app/src/main/res/drawable/baseline_send_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_settings_24.xml b/app/src/main/res/drawable/baseline_settings_24.xml new file mode 100644 index 0000000..298a5a1 --- /dev/null +++ b/app/src/main/res/drawable/baseline_settings_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_share_24.xml b/app/src/main/res/drawable/baseline_share_24.xml new file mode 100644 index 0000000..87cea78 --- /dev/null +++ b/app/src/main/res/drawable/baseline_share_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_thumb_up_off_alt_24.xml b/app/src/main/res/drawable/baseline_thumb_up_off_alt_24.xml new file mode 100644 index 0000000..2fb9a33 --- /dev/null +++ b/app/src/main/res/drawable/baseline_thumb_up_off_alt_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/google_icon.png b/app/src/main/res/drawable/google_icon.png new file mode 100644 index 0000000..d008b72 Binary files /dev/null and b/app/src/main/res/drawable/google_icon.png differ diff --git a/app/src/main/res/drawable/heart1.xml b/app/src/main/res/drawable/heart1.xml new file mode 100644 index 0000000..9ad2327 --- /dev/null +++ b/app/src/main/res/drawable/heart1.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/heart_filled.xml b/app/src/main/res/drawable/heart_filled.xml new file mode 100644 index 0000000..bfc702b --- /dev/null +++ b/app/src/main/res/drawable/heart_filled.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/img.png b/app/src/main/res/drawable/img.png new file mode 100644 index 0000000..4d0508e Binary files /dev/null and b/app/src/main/res/drawable/img.png differ diff --git a/app/src/main/res/drawable/img_1.png b/app/src/main/res/drawable/img_1.png new file mode 100644 index 0000000..68ff23f Binary files /dev/null and b/app/src/main/res/drawable/img_1.png differ diff --git a/app/src/main/res/drawable/img_10.png b/app/src/main/res/drawable/img_10.png new file mode 100644 index 0000000..0f1eea4 Binary files /dev/null and b/app/src/main/res/drawable/img_10.png differ diff --git a/app/src/main/res/drawable/img_2.png b/app/src/main/res/drawable/img_2.png new file mode 100644 index 0000000..7c18bc6 Binary files /dev/null and b/app/src/main/res/drawable/img_2.png differ diff --git a/app/src/main/res/drawable/img_3.png b/app/src/main/res/drawable/img_3.png new file mode 100644 index 0000000..066ec83 Binary files /dev/null and b/app/src/main/res/drawable/img_3.png differ diff --git a/app/src/main/res/drawable/img_4.png b/app/src/main/res/drawable/img_4.png new file mode 100644 index 0000000..3d9d60c Binary files /dev/null and b/app/src/main/res/drawable/img_4.png differ diff --git a/app/src/main/res/drawable/img_5.png b/app/src/main/res/drawable/img_5.png new file mode 100644 index 0000000..bfa4e87 Binary files /dev/null and b/app/src/main/res/drawable/img_5.png differ diff --git a/app/src/main/res/drawable/img_6.png b/app/src/main/res/drawable/img_6.png new file mode 100644 index 0000000..27ec212 Binary files /dev/null and b/app/src/main/res/drawable/img_6.png differ diff --git a/app/src/main/res/drawable/img_7.png b/app/src/main/res/drawable/img_7.png new file mode 100644 index 0000000..0789ff7 Binary files /dev/null and b/app/src/main/res/drawable/img_7.png differ diff --git a/app/src/main/res/drawable/img_8.png b/app/src/main/res/drawable/img_8.png new file mode 100644 index 0000000..704a5d3 Binary files /dev/null and b/app/src/main/res/drawable/img_8.png differ diff --git a/app/src/main/res/drawable/img_9.png b/app/src/main/res/drawable/img_9.png new file mode 100644 index 0000000..64a3d02 Binary files /dev/null and b/app/src/main/res/drawable/img_9.png differ diff --git a/app/src/main/res/drawable/loginback.png b/app/src/main/res/drawable/loginback.png new file mode 100644 index 0000000..e99cf08 Binary files /dev/null and b/app/src/main/res/drawable/loginback.png differ diff --git a/app/src/main/res/drawable/reciever_shape.xml b/app/src/main/res/drawable/reciever_shape.xml new file mode 100644 index 0000000..1e38aac --- /dev/null +++ b/app/src/main/res/drawable/reciever_shape.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/right_round_bg.xml b/app/src/main/res/drawable/right_round_bg.xml new file mode 100644 index 0000000..124eb66 --- /dev/null +++ b/app/src/main/res/drawable/right_round_bg.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sender_shape.xml b/app/src/main/res/drawable/sender_shape.xml new file mode 100644 index 0000000..90f825c --- /dev/null +++ b/app/src/main/res/drawable/sender_shape.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/splash.jpg b/app/src/main/res/drawable/splash.jpg new file mode 100644 index 0000000..6e4ca1e Binary files /dev/null and b/app/src/main/res/drawable/splash.jpg differ diff --git a/app/src/main/res/drawable/youngcouple.png b/app/src/main/res/drawable/youngcouple.png new file mode 100644 index 0000000..14ff127 Binary files /dev/null and b/app/src/main/res/drawable/youngcouple.png differ diff --git a/app/src/main/res/font/aclonica.xml b/app/src/main/res/font/aclonica.xml new file mode 100644 index 0000000..a88a968 --- /dev/null +++ b/app/src/main/res/font/aclonica.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/font/almendra_sc.xml b/app/src/main/res/font/almendra_sc.xml new file mode 100644 index 0000000..2c0afdb --- /dev/null +++ b/app/src/main/res/font/almendra_sc.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/font/amarante.xml b/app/src/main/res/font/amarante.xml new file mode 100644 index 0000000..62cb675 --- /dev/null +++ b/app/src/main/res/font/amarante.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/font/berkshire_swash.xml b/app/src/main/res/font/berkshire_swash.xml new file mode 100644 index 0000000..b2a4424 --- /dev/null +++ b/app/src/main/res/font/berkshire_swash.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/font/bevan.xml b/app/src/main/res/font/bevan.xml new file mode 100644 index 0000000..e023795 --- /dev/null +++ b/app/src/main/res/font/bevan.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/font/courgette.xml b/app/src/main/res/font/courgette.xml new file mode 100644 index 0000000..ce4dbe9 --- /dev/null +++ b/app/src/main/res/font/courgette.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/layout/activity_chat_win.xml b/app/src/main/res/layout/activity_chat_win.xml new file mode 100644 index 0000000..103c3ab --- /dev/null +++ b/app/src/main/res/layout/activity_chat_win.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml new file mode 100644 index 0000000..f3c283e --- /dev/null +++ b/app/src/main/res/layout/activity_comment.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..9bf1888 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + +