diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 56cc642..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,85 +0,0 @@
-# Built application files
-*.apk
-*.aar
-*.ap_
-*.aab
-
-# Files for the ART/Dalvik VM
-*.dex
-
-# Java class files
-*.class
-
-# Generated files
-bin/
-gen/
-out/
-# Uncomment the following line in case you need and you don't have the release build type files in your app
-# release/
-
-# Gradle files
-.gradle/
-build/
-
-# Local configuration file (sdk path, etc)
-local.properties
-
-# Proguard folder generated by Eclipse
-proguard/
-
-# Log Files
-*.log
-
-# Android Studio Navigation editor temp files
-.navigation/
-
-# Android Studio captures folder
-captures/
-
-# IntelliJ
-*.iml
-.idea/workspace.xml
-.idea/tasks.xml
-.idea/gradle.xml
-.idea/assetWizardSettings.xml
-.idea/dictionaries
-.idea/libraries
-# Android Studio 3 in .gitignore file.
-.idea/caches
-.idea/modules.xml
-# Comment next line if keeping position of elements in Navigation Editor is relevant for you
-.idea/navEditor.xml
-
-# Keystore files
-# Uncomment the following lines if you do not want to check your keystore files in.
-#*.jks
-#*.keystore
-
-# External native build folder generated in Android Studio 2.2 and later
-.externalNativeBuild
-.cxx/
-
-# Google Services (e.g. APIs or Firebase)
-# google-services.json
-
-# Freeline
-freeline.py
-freeline/
-freeline_project_description.json
-
-# fastlane
-fastlane/report.xml
-fastlane/Preview.html
-fastlane/screenshots
-fastlane/test_output
-fastlane/readme.md
-
-# Version control
-vcs.xml
-
-# lint
-lint/intermediates/
-lint/generated/
-lint/outputs/
-lint/tmp/
-# lint/reports/
diff --git a/JavaNetwork/.idea/.gitignore b/JavaNetwork/.idea/.gitignore
new file mode 100644
index 0000000..73f69e0
--- /dev/null
+++ b/JavaNetwork/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/JavaNetwork/.idea/misc.xml b/JavaNetwork/.idea/misc.xml
new file mode 100644
index 0000000..e0844bc
--- /dev/null
+++ b/JavaNetwork/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaNetwork/.idea/modules.xml b/JavaNetwork/.idea/modules.xml
new file mode 100644
index 0000000..eb43eaa
--- /dev/null
+++ b/JavaNetwork/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaNetwork/JavaNetwork.iml b/JavaNetwork/JavaNetwork.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/JavaNetwork/JavaNetwork.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaNetwork/out/production/JavaNetwork/Main.class b/JavaNetwork/out/production/JavaNetwork/Main.class
new file mode 100644
index 0000000..a0b1daa
Binary files /dev/null and b/JavaNetwork/out/production/JavaNetwork/Main.class differ
diff --git a/JavaNetwork/src/Main.java b/JavaNetwork/src/Main.java
new file mode 100644
index 0000000..5d6ffc6
--- /dev/null
+++ b/JavaNetwork/src/Main.java
@@ -0,0 +1,40 @@
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+
+public class Main {
+
+ public static void main(String[] args) throws Exception{
+//get the localhost IP address, if server is running on some other IP, you need to use that
+ //InetAddress host = InetAddress.getLocalHost();
+ Socket socket = null;
+ ObjectOutputStream oos = null;
+ ObjectInputStream ois = null;
+ for(int i=0; i<100;i++){
+ //establish socket connection to server
+ //socket = new Socket(host.getHostName(), 9876);
+ socket = new Socket("192.168.0.101", 8989);
+ //write to socket using ObjectOutputStream
+ oos = new ObjectOutputStream(socket.getOutputStream());
+ System.out.println("Sending request to Socket Server");
+ if(i%5==0)
+ oos.writeObject("exit");
+ else{
+ //oos.writeObject(""+i);
+ oos.writeObject(Integer.valueOf(i).toString());
+ }
+ //read the server response message
+ //ois = new ObjectInputStream(socket.getInputStream());
+ //String message = (String) ois.readObject();
+ //System.out.println("Message: " + message);
+ //close resources
+ //ois.close();
+ oos.close();
+ socket.close();
+ Thread.sleep(3*1000);
+ //Thread.sleep(20);
+ }
+ }
+
+}
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 9037d3f..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2021 Maifee Ul Asad
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/README.md b/README.md
deleted file mode 100644
index e38ebb3..0000000
--- a/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# Chirkut
\ No newline at end of file
diff --git a/chirkut/.gitignore b/chirkut/.gitignore
deleted file mode 100644
index aa724b7..0000000
--- a/chirkut/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-*.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/chirkut/.idea/.gitignore b/chirkut/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/chirkut/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/chirkut/.idea/.name b/chirkut/.idea/.name
deleted file mode 100644
index 2c945a2..0000000
--- a/chirkut/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-Chirkut
\ No newline at end of file
diff --git a/chirkut/.idea/compiler.xml b/chirkut/.idea/compiler.xml
deleted file mode 100644
index 61a9130..0000000
--- a/chirkut/.idea/compiler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/.idea/gradle.xml b/chirkut/.idea/gradle.xml
deleted file mode 100644
index 7e46edd..0000000
--- a/chirkut/.idea/gradle.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/.idea/jarRepositories.xml b/chirkut/.idea/jarRepositories.xml
deleted file mode 100644
index a5f05cd..0000000
--- a/chirkut/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/.idea/misc.xml b/chirkut/.idea/misc.xml
deleted file mode 100644
index fe0fc87..0000000
--- a/chirkut/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/.gitignore b/chirkut/app/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/chirkut/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/chirkut/app/build.gradle b/chirkut/app/build.gradle
deleted file mode 100644
index 32148ad..0000000
--- a/chirkut/app/build.gradle
+++ /dev/null
@@ -1,48 +0,0 @@
-plugins {
- id 'com.android.application'
-}
-
-android {
- compileSdkVersion 30
- buildToolsVersion "30.0.2"
-
- defaultConfig {
- applicationId "com.mua.chirkut"
- minSdkVersion 16
- targetSdkVersion 30
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- dataBinding {
- enabled true
- }
- viewBinding {
- enabled true
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-dependencies {
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'com.google.android.material:material:1.2.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
- testImplementation 'junit:junit:4.13.1'
- implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
- implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
- androidTestImplementation 'androidx.test.ext:junit:1.1.2'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
- implementation "android.arch.persistence.room:runtime:1.1.1"
- annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
-}
\ No newline at end of file
diff --git a/chirkut/app/proguard-rules.pro b/chirkut/app/proguard-rules.pro
deleted file mode 100644
index 481bb43..0000000
--- a/chirkut/app/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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/chirkut/app/src/androidTest/java/com/mua/chirkut/ExampleInstrumentedTest.java b/chirkut/app/src/androidTest/java/com/mua/chirkut/ExampleInstrumentedTest.java
deleted file mode 100644
index 4943f04..0000000
--- a/chirkut/app/src/androidTest/java/com/mua/chirkut/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.mua.chirkut;
-
-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.mua.chirkut", appContext.getPackageName());
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/AndroidManifest.xml b/chirkut/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 2c7ba60..0000000
--- a/chirkut/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/chirkut_icon-playstore.png b/chirkut/app/src/main/chirkut_icon-playstore.png
deleted file mode 100644
index ac08e6a..0000000
Binary files a/chirkut/app/src/main/chirkut_icon-playstore.png and /dev/null differ
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/MainActivity.java b/chirkut/app/src/main/java/com/mua/chirkut/MainActivity.java
deleted file mode 100644
index 319ec7e..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/MainActivity.java
+++ /dev/null
@@ -1,321 +0,0 @@
-package com.mua.chirkut;
-
-import android.annotation.SuppressLint;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.net.wifi.WpsInfo;
-import android.net.wifi.p2p.WifiP2pConfig;
-import android.net.wifi.p2p.WifiP2pDevice;
-import android.net.wifi.p2p.WifiP2pDeviceList;
-import android.net.wifi.p2p.WifiP2pInfo;
-import android.net.wifi.p2p.WifiP2pManager;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Messenger;
-import android.util.Log;
-import android.view.View;
-import android.widget.CompoundButton;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.databinding.DataBindingUtil;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.mua.chirkut.activity.ChatActivity;
-import com.mua.chirkut.adapter.P2PListAdapter;
-import com.mua.chirkut.databinding.ActivityMainBinding;
-import com.mua.chirkut.listener.IncomingMessageListener;
-import com.mua.chirkut.listener.OutgoingMessageListener;
-import com.mua.chirkut.listener.P2PConnectionListener;
-import com.mua.chirkut.listener.P2PDeviceClickListener;
-import com.mua.chirkut.receiver.MessageReceiver;
-import com.mua.chirkut.receiver.WifiDirectBroadcastReceiver;
-import com.mua.chirkut.service.MessagingService;
-import com.mua.chirkut.viewmodel.MainViewModel;
-
-
-public class MainActivity
- extends AppCompatActivity
- implements P2PConnectionListener, P2PDeviceClickListener, IncomingMessageListener{
-
- private final int MAX_CONNECTION_TRY = 2;
- private int connectionRetryCounter = 0;
- private WifiP2pManager mManager;
- private WifiP2pManager.Channel mChannel;
- private WifiDirectBroadcastReceiver mBroadcastReceiver;
- private IntentFilter mIntentFilter;
-
- private ActivityMainBinding mBinding;
- private MainViewModel viewModel;
-
- private P2PListAdapter mP2PListAdapter;
- private RecyclerView mRvP2PList;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
- viewModel = new ViewModelProvider(this).get(MainViewModel.class);
- mBinding.setMain(viewModel);
- mBinding.setLifecycleOwner(this);
-
- init();
- initReceiver();
- initReceiveMessageBroadcast();
- initServiceToggle();
- initManualConnect();
- //startService();
- //todo: disable next line - testing purpose
- //testMessage();
- }
-
-
- void initServiceToggle(){
- mBinding.swServerToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- viewModel.serverStatus.postValue(isChecked);
- if(isChecked){
- startService();
- }else{
- killService();
- }
- }
- });
- }
-
- void initManualConnect(){
- final EditText manualAddress = new EditText(this);
- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.MATCH_PARENT,
- LinearLayout.LayoutParams.MATCH_PARENT);
- manualAddress.setLayoutParams(lp);
-
-
- mBinding.btnManuallyConnect.setOnClickListener(v -> {
- new AlertDialog.Builder(this)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle("Manually connect to a device")
- .setMessage("Thousand apologies from MUA")
- .setView(manualAddress)
- .setPositiveButton("Yes", (dialogInterface, i) ->
- openChat(manualAddress.getText().toString())
- )
- .setNegativeButton("Cancel",(d,i)->{})
- .show();
- });
- }
-
- void startService() {
- Intent serviceIntent = new Intent(this, MessagingService.class);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- startForegroundService(serviceIntent);
- } else {
- startService(serviceIntent);
- }
- }
-
- void killService(){
- Intent serviceIntent = new Intent(this, MessagingService.class);
- stopService(serviceIntent);
- }
-
-
- void testMessage() {
- startActivity(new Intent(this, ChatActivity.class));
- }
-
-
- void initReceiveMessageBroadcast() {
- registerReceiver(
- new MessageReceiver(this),
- new IntentFilter("mua.message"));
- }
-
- void init() {
-
- mIntentFilter = new IntentFilter();
-
- mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
- mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
- mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
- mIntentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
-
- mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
- mChannel = mManager.initialize(this, getMainLooper(), null);
-
- initList();
- closeAll();
- initReceiver();
- startDiscovery();
- startListenIncoming();
- mBinding.pbLoading.show();
- }
-
- private void initList() {
- mP2PListAdapter = new P2PListAdapter(this);
- mRvP2PList = mBinding.rvP2pDevices;
- mRvP2PList.setAdapter(mP2PListAdapter);
- mRvP2PList.setLayoutManager(new LinearLayoutManager(this));
- }
-
- private void initReceiver() {
- mBroadcastReceiver = new WifiDirectBroadcastReceiver(mManager, mChannel, this);
- registerReceiver(mBroadcastReceiver, mIntentFilter);
- }
-
- private void closeAll() {
- mManager.removeGroup(mChannel, new WifiP2pManager.ActionListener() {
- @Override
- public void onSuccess() {
- }
-
- @Override
- public void onFailure(int reason) {
- Toast
- .makeText(
- MainActivity.this,
- "Force closing may resolve this issue.",
- Toast.LENGTH_LONG)
- .show();
- }
- });
- }
-
- public void startListenIncoming() {
- mManager
- .requestConnectionInfo(mChannel,
- info ->
- Log.d("d--mua-lp", info.groupOwnerAddress + " ip address")
- );
- }
-
- void completeExit(){
- Toast.makeText(this,"System will exit completely now",Toast.LENGTH_LONG).show();
- new Thread(){
- @Override
- public void run() {
- try {
- Thread.sleep(2*1000);
- } catch (Exception ignored) { }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- finishAndRemoveTask();
- }else{
- finishAffinity();
- }
- System.exit(-1);
- }
- }.start();
- }
-
- @SuppressLint("MissingPermission")
- public void startDiscovery() {
- mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
- @Override
- public void onSuccess() {
- Toast.makeText(MainActivity.this, "P2P success", Toast.LENGTH_LONG).show();
- }
-
- @Override
- public void onFailure(int reasonCode) {
- if (connectionRetryCounter < MAX_CONNECTION_TRY) {
- Toast
- .makeText(MainActivity.this,
- "P2P failed, " + connectionRetryCounter + " times. Retrying"
- +"\n"
- +"Failure code " + reasonCode,
- Toast.LENGTH_LONG)
- .show();
- startDiscovery();
- connectionRetryCounter++;
- }else{
- //completeExit();
- }
- }
- }
- );
- }
-
- @Override
- public void updateList(WifiP2pDeviceList peerList) {
- mP2PListAdapter.setPeerList(peerList);
- }
-
- @Override
- public void wifiP2PStatus(boolean status) {
- viewModel.p2pStatus.postValue(status ? "Enabled" : "Disabled");
- }
-
- @Override
- public void incomingConnection(WifiP2pInfo wifiP2pInfo) {
- if (wifiP2pInfo.groupOwnerAddress == null) {
- return;
- }
- //todo : bug, the device first opening app is trying to become the host
- //if(!wifiP2pInfo.isGroupOwner || wifiP2pInfo.groupOwnerAddress==null)
- // return;
- new AlertDialog.Builder(this)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle("Incoming Connection Request")
- .setMessage(wifiP2pInfo.groupOwnerAddress + " wants to connect")
- .setPositiveButton("Yes", (dialogInterface, i) ->
- openChat(wifiP2pInfo.groupOwnerAddress.toString())
- )
- .setNegativeButton("No", (dialogInterface, i) -> {
- openChat();
- //todo: notify requester
- }
- )
- .show();
- }
-
- @SuppressLint("MissingPermission")
- @Override
- public void onDeviceClick(WifiP2pDevice device) {
-
- WifiP2pConfig config = new WifiP2pConfig();
- config.deviceAddress = device.deviceAddress;
- config.wps.setup = WpsInfo.PBC;
-
- mManager.connect(mChannel, config, new WifiP2pManager.ActionListener() {
-
- @Override
- public void onSuccess() {
- Log.d("d--mua-lp", "success");
- }
-
- @Override
- public void onFailure(int reason) {
- Log.d("d--mua-lp", "failed : " + reason);
- }
- });
-
- }
-
- private void openChat() {
- Intent intent = new Intent(this, ChatActivity.class);
- startActivity(intent);
- }
-
- private void openChat(String groupOwnerIP) {
- Intent intent = new Intent(this, ChatActivity.class);
- intent.putExtra("GROUP_OWNER_IP", groupOwnerIP);
- startActivity(intent);
- }
-
- @Override
- public void incomingMessage(String address, String message) {
- viewModel.insertChat(address,message,true);
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/activity/ChatActivity.java b/chirkut/app/src/main/java/com/mua/chirkut/activity/ChatActivity.java
deleted file mode 100644
index b049eb2..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/activity/ChatActivity.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.mua.chirkut.activity;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Messenger;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.databinding.DataBindingUtil;
-import androidx.lifecycle.Observer;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.mua.chirkut.BuildConfig;
-import com.mua.chirkut.R;
-import com.mua.chirkut.adapter.ChatAdapter;
-import com.mua.chirkut.databinding.ActivityChatBinding;
-import com.mua.chirkut.listener.OutgoingMessageListener;
-import com.mua.chirkut.model.Message;
-import com.mua.chirkut.network.Client;
-import com.mua.chirkut.network.Server;
-import com.mua.chirkut.service.MessagingService;
-import com.mua.chirkut.viewmodel.ChatViewModel;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ChatActivity
- extends AppCompatActivity {
-
- private ActivityChatBinding mBinding;
- private ChatViewModel viewModel;
-
- private List threads=new ArrayList<>();
-
- private RecyclerView mRvChat;
- private ChatAdapter mChatAdapter;
-
-
- private Messenger messenger;
- private final ServiceConnection mConnection = new ServiceConnection() {
- public void onServiceConnected(ComponentName className, IBinder service) {
- messenger = new Messenger(service);
- }
-
- public void onServiceDisconnected(ComponentName className) {
- messenger = null;
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- mBinding = DataBindingUtil.setContentView(this, R.layout.activity_chat);
- viewModel = new ViewModelProvider(this).get(ChatViewModel.class);
- mBinding.setChat(viewModel);
- mBinding.setLifecycleOwner(this);
-
- initList();
- //todo: disable next line - testing purpose only
- //initMessageTest();
-
- initServerClient();
- initSend();
- bindService();
- }
-
- void bindService(){
- bindService(
- new Intent(this, MessagingService.class),
- mConnection,
- Context.BIND_IMPORTANT);
- }
-
- void setTitle(String title){
- getSupportActionBar().setTitle(title);
- }
-
- void initServerClient(){
- threads.clear();
-
- String val = "";
- try {
- val = getIntent().getExtras().getString("GROUP_OWNER_IP");
- }catch (Exception ignored){ }
-
- viewModel.updateAddress(val);
-
- setTitle(val);
- }
-
- void initMessageTest(){
- mBinding.btnSend.setOnClickListener(
- v -> {
- mChatAdapter.appendMessage(new Message());
- mBinding.rvChat.scrollToPosition(mChatAdapter.getItemCount()-1);
- }
- );
- }
-
- void initIp(){
-
- }
-
- void initSend(){
- mBinding.btnSend.setOnClickListener(v -> {
- String messageString = mBinding.etMessage.getText().toString();
- if(messageString.trim().equals("")){
- return;
- }
- viewModel.insert(viewModel.address.getValue(),messageString);
- mBinding.etMessage.setText("");
- if(messenger!=null){
- android.os.Message message
- = android.os.Message.obtain(
- null,
- 0,
- viewModel.address.getValue()+"-"+messageString);
- try {
- messenger.send(message);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- });
- }
-
- void initList(){
- mChatAdapter = new ChatAdapter();
- mRvChat = mBinding.rvChat;
- mRvChat.setAdapter(mChatAdapter);
- mRvChat.setLayoutManager(new LinearLayoutManager(this));
-
- viewModel.messages.observe(this, messages -> {
- mChatAdapter.setMessageList(messages);
- mBinding.rvChat.scrollToPosition(messages.size() - 1);
- });
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/adapter/BindingAdapters.java b/chirkut/app/src/main/java/com/mua/chirkut/adapter/BindingAdapters.java
deleted file mode 100644
index 3f08b7d..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/adapter/BindingAdapters.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mua.chirkut.adapter;
-
-import android.view.View;
-
-import androidx.databinding.BindingAdapter;
-
-public class BindingAdapters {
-
-
- @BindingAdapter("visibility")
- public static void setVisibility(View view, Boolean visibile) {
- if (visibile)
- view.setVisibility(View.VISIBLE);
- else
- view.setVisibility(View.GONE);
- }
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/adapter/ChatAdapter.java b/chirkut/app/src/main/java/com/mua/chirkut/adapter/ChatAdapter.java
deleted file mode 100644
index ca11cf5..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/adapter/ChatAdapter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.mua.chirkut.adapter;
-
-import android.net.wifi.p2p.WifiP2pDevice;
-import android.net.wifi.p2p.WifiP2pDeviceList;
-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.mua.chirkut.R;
-import com.mua.chirkut.listener.P2PDeviceClickListener;
-import com.mua.chirkut.model.Message;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ChatAdapter
- extends RecyclerView.Adapter {
-
- private List messageList = new ArrayList<>();
-
- public void appendMessage(Message message) {
- messageList.add(message);
- notifyItemRangeChanged(messageList.size()-1,1);
- }
-
-
- public void setMessageList(List messageList){
- this.messageList.clear();
- for(com.mua.chirkut.entity.Message message:messageList){
- this.messageList.add(new Message(message.getMessage(),message.getIncoming(),message.getAddress()));
- }
- notifyDataSetChanged();
- }
-
- @NonNull
- @Override
- public ChatAdapter.AppUsageListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new AppUsageListViewHolder((LayoutInflater.from(parent.getContext()))
- .inflate(R.layout.item_message, parent, false));
- }
-
- @Override
- public void onBindViewHolder(@NonNull ChatAdapter.AppUsageListViewHolder holder, int position) {
- Message message = messageList.get(position);
- holder.message.setText(message.getMessage());
- if(message.isIncoming()){
- holder.viewLeft.setVisibility(View.GONE);
- }else{
- holder.viewRight.setVisibility(View.GONE);
- }
- }
-
- @Override
- public int getItemCount() {
- return messageList.size();
- }
-
- protected class AppUsageListViewHolder extends RecyclerView.ViewHolder {
- private final TextView message;
- private final View viewLeft;
- private final View viewRight;
-
- AppUsageListViewHolder(View view) {
- super(view);
- message = view.findViewById(R.id.tv_message_message);
- viewLeft = view.findViewById(R.id.v_message_left);
- viewRight = view.findViewById(R.id.v_message_right);
- }
- }
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/adapter/P2PListAdapter.java b/chirkut/app/src/main/java/com/mua/chirkut/adapter/P2PListAdapter.java
deleted file mode 100644
index 49bc5fc..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/adapter/P2PListAdapter.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.mua.chirkut.adapter;
-
-import android.net.wifi.p2p.WifiP2pDevice;
-import android.net.wifi.p2p.WifiP2pDeviceList;
-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.mua.chirkut.R;
-import com.mua.chirkut.listener.P2PDeviceClickListener;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class P2PListAdapter
- extends RecyclerView.Adapter {
-
- private WifiP2pDeviceList peerList = new WifiP2pDeviceList();
- private List peerArrayList = new ArrayList<>();
- private P2PDeviceClickListener clickListener;
-
- public P2PListAdapter(P2PDeviceClickListener clickListener) {
- this.clickListener = clickListener;
- }
-
- public P2PListAdapter(WifiP2pDeviceList peerList) {
- this.peerList = peerList;
- peerArrayList = new ArrayList<>(peerList.getDeviceList());
- }
-
- public void setClickListener(P2PDeviceClickListener clickListener) {
- this.clickListener = clickListener;
- }
-
- public void setPeerList(WifiP2pDeviceList peerList) {
- this.peerList = peerList;
- peerArrayList = new ArrayList<>(peerList.getDeviceList());
- notifyDataSetChanged();
- }
-
- @NonNull
- @Override
- public P2PListAdapter.AppUsageListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new AppUsageListViewHolder((LayoutInflater.from(parent.getContext()))
- .inflate(R.layout.item_p2p_device, parent, false));
- }
-
- @Override
- public void onBindViewHolder(@NonNull P2PListAdapter.AppUsageListViewHolder holder, int position) {
- WifiP2pDevice device = peerArrayList.get(position);
- holder.name.setText(device.deviceName);
- holder.address.setText(device.deviceAddress);
- holder.mItemView.setOnClickListener(v -> clickListener.onDeviceClick(device));
- }
-
- @Override
- public int getItemCount() {
- return peerList.getDeviceList().size();
- }
-
- protected class AppUsageListViewHolder extends RecyclerView.ViewHolder {
- private final TextView name;
- private final TextView address;
- private final View mItemView;
-
- AppUsageListViewHolder(View view) {
- super(view);
- name = view.findViewById(R.id.tv_p2p_device_name);
- address = view.findViewById(R.id.tv_p2p_device_address);
-
- mItemView = itemView;
- //WifiP2pDevice device = peerArrayList.get(getAdapterPosition());
- //itemView.setOnClickListener(v -> clickListener.onDeviceClick(device));
- }
- }
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/converter/DateConverter.java b/chirkut/app/src/main/java/com/mua/chirkut/converter/DateConverter.java
deleted file mode 100644
index 80d4bb2..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/converter/DateConverter.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mua.chirkut.converter;
-
-import androidx.room.TypeConverter;
-
-import java.sql.Date;
-
-public class DateConverter {
-
- @TypeConverter
- public static Date toDate(Long dateLong){
- return dateLong == null ? null: new Date(dateLong);
- }
-
- @TypeConverter
- public static Long fromDate(Date date){
- return date == null ? null : date.getTime();
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/dao/MessageDao.java b/chirkut/app/src/main/java/com/mua/chirkut/dao/MessageDao.java
deleted file mode 100644
index c7776be..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/dao/MessageDao.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.mua.chirkut.dao;
-
-import androidx.lifecycle.LiveData;
-import androidx.room.Dao;
-import androidx.room.Insert;
-import androidx.room.OnConflictStrategy;
-import androidx.room.Query;
-
-import com.mua.chirkut.entity.Message;
-
-import java.util.List;
-
-@Dao
-public interface MessageDao {
-
- @Query("SELECT * FROM Message WHERE message_address=:address")
- LiveData> getAll(String address);
-
- @Insert(onConflict = OnConflictStrategy.REPLACE)
- void insert(Message message);
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/database/ApplicationDatabase.java b/chirkut/app/src/main/java/com/mua/chirkut/database/ApplicationDatabase.java
deleted file mode 100644
index e5cd595..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/database/ApplicationDatabase.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.mua.chirkut.database;
-
-
-import android.content.Context;
-
-import androidx.room.Database;
-import androidx.room.Room;
-import androidx.room.RoomDatabase;
-
-import com.mua.chirkut.dao.MessageDao;
-import com.mua.chirkut.entity.Message;
-
-@Database(entities = {Message.class}, version = 1)
-public abstract class ApplicationDatabase extends RoomDatabase {
- private static volatile ApplicationDatabase INSTANCE;
-
- public abstract MessageDao chatDao();
-
- public static ApplicationDatabase getInstance(Context context) {
- if(INSTANCE == null) {
- synchronized(ApplicationDatabase.class) {
- if(INSTANCE == null) {
- INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
- ApplicationDatabase.class, "chirkut.db").build();
- }
- }
- }
- return INSTANCE;
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/entity/Message.java b/chirkut/app/src/main/java/com/mua/chirkut/entity/Message.java
deleted file mode 100644
index ff60011..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/entity/Message.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.mua.chirkut.entity;
-
-import androidx.room.ColumnInfo;
-import androidx.room.Entity;
-import androidx.room.Ignore;
-import androidx.room.PrimaryKey;
-import androidx.room.TypeConverters;
-
-import com.mua.chirkut.converter.DateConverter;
-
-import java.sql.Date;
-
-@Entity(tableName = "message")
-@TypeConverters(DateConverter.class)
-public class Message {
-
- @PrimaryKey(autoGenerate = true)
- @ColumnInfo(name = "message_id")
- private Long chatId;
-
- @ColumnInfo(name = "message_address")
- private String address;
-
- @ColumnInfo(name = "message_message")
- private String message;
-
- @ColumnInfo(name = "message_date")
- private Date date;
-
- @ColumnInfo(name = "message_incoming")
- private Boolean incoming;
-
- public Message(String address, String message, Date date, Boolean incoming) {
- this.address = address;
- this.message = message;
- this.date = date;
- this.incoming = incoming;
- }
-
- @Ignore
- public Message(String address, String message, Boolean incoming) {
- this(address, message, new Date(new java.util.Date().getTime()), incoming);
- }
-
-
- public Long getChatId() {
- return chatId;
- }
-
- public void setChatId(Long chatId) {
- this.chatId = chatId;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public Boolean getIncoming() {
- return incoming;
- }
-
- public void setIncoming(Boolean incoming) {
- this.incoming = incoming;
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/handler/OutGoingHandler.java b/chirkut/app/src/main/java/com/mua/chirkut/handler/OutGoingHandler.java
deleted file mode 100644
index cd074f2..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/handler/OutGoingHandler.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.mua.chirkut.handler;
-
-
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-
-import com.mua.chirkut.listener.OutgoingMessageListener;
-
-public class OutGoingHandler extends Handler {
-
- private final OutgoingMessageListener outgoingMessageListener;
-
- public OutGoingHandler(OutgoingMessageListener outgoingMessageListener) {
- this.outgoingMessageListener = outgoingMessageListener;
- }
-
- @Override
- public void handleMessage(@NonNull Message msg) {
- if(msg.what!=0){
- super.handleMessage(msg);
- }else{
- String data = msg.obj.toString();
- String address = data.substring(0,data.indexOf("-"));
- String message = data.substring(data.indexOf("-"));
- outgoingMessageListener.outgoingMessage(address,message);
- }
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingConnectionListener.java b/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingConnectionListener.java
deleted file mode 100644
index e9c297c..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingConnectionListener.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.mua.chirkut.listener;
-
-import java.net.Socket;
-
-public interface IncomingConnectionListener {
- void incomingSocket(Socket socket);
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingMessageListener.java b/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingMessageListener.java
deleted file mode 100644
index cbd34d0..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/listener/IncomingMessageListener.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.mua.chirkut.listener;
-
-public interface IncomingMessageListener {
- void incomingMessage(String address, String message);
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/listener/OutgoingMessageListener.java b/chirkut/app/src/main/java/com/mua/chirkut/listener/OutgoingMessageListener.java
deleted file mode 100644
index 88012e7..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/listener/OutgoingMessageListener.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.mua.chirkut.listener;
-
-public interface OutgoingMessageListener {
- void outgoingMessage(String address, String message);
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PConnectionListener.java b/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PConnectionListener.java
deleted file mode 100644
index dc2aee2..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PConnectionListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.mua.chirkut.listener;
-
-import android.net.wifi.p2p.WifiP2pDeviceList;
-import android.net.wifi.p2p.WifiP2pInfo;
-
-public interface P2PConnectionListener {
- void updateList(WifiP2pDeviceList peerList);
-
- void wifiP2PStatus(boolean status);
-
- void incomingConnection(WifiP2pInfo wifiP2pInfo);
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PDeviceClickListener.java b/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PDeviceClickListener.java
deleted file mode 100644
index 168ed88..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/listener/P2PDeviceClickListener.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.mua.chirkut.listener;
-
-import android.net.wifi.p2p.WifiP2pDevice;
-
-public interface P2PDeviceClickListener {
- void onDeviceClick(WifiP2pDevice device);
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/model/Message.java b/chirkut/app/src/main/java/com/mua/chirkut/model/Message.java
deleted file mode 100644
index 199090c..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/model/Message.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.mua.chirkut.model;
-
-import java.util.Random;
-
-public class Message {
-
- private String message = "";
- private boolean incoming = false;
- private String senderIp = "";
-
- public Message(String message, boolean isIncoming, String senderIp) {
- this.message = message;
- this.incoming = isIncoming;
- this.senderIp = senderIp;
- }
-
- public Message() {
- this("test"+ new Random().nextGaussian()+"\n"+new Random().nextDouble(),
- new Random().nextBoolean(),
- "ip"+new Random().nextDouble());
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public boolean isIncoming() {
- return incoming;
- }
-
- public void setIncoming(boolean incoming) {
- this.incoming = incoming;
- }
-
- public String getSenderIp() {
- return senderIp;
- }
-
- public void setSenderIp(String senderIp) {
- this.senderIp = senderIp;
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/network/Client.java b/chirkut/app/src/main/java/com/mua/chirkut/network/Client.java
deleted file mode 100644
index d2415dc..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/network/Client.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.mua.chirkut.network;
-
-import com.mua.chirkut.util.Default;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-public class Client{
-
- public Socket socket;
- public String hostAddress;
-
- public Client(String hostAddress) throws IOException {
- this.hostAddress = hostAddress;
- this.socket = new Socket();
- this.socket.connect(new InetSocketAddress(hostAddress, Default.PORT));
-
- }
-
- public void send(String message) throws IOException {
- socket.getOutputStream().write(message.getBytes());
- }
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/network/Server.java b/chirkut/app/src/main/java/com/mua/chirkut/network/Server.java
deleted file mode 100644
index 9bb4859..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/network/Server.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.mua.chirkut.network;
-
-import com.mua.chirkut.listener.IncomingConnectionListener;
-import com.mua.chirkut.listener.IncomingMessageListener;
-import com.mua.chirkut.util.Default;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Server
- implements Runnable, IncomingConnectionListener {
-
- private static Server server = null;
- private final ServerSocket serverSocket;
- private final Map socketMapping = new HashMap<>();
- private final ServerIncomingConnection serverIncomingConnection;
- private final IncomingMessageListener incomingMessageListener;
- private final IncomingConnectionListener incomingConnectionListener;
-
- private Server(IncomingMessageListener incomingMessageListener
- ,IncomingConnectionListener incomingConnectionListener) throws IOException {
- serverSocket = new ServerSocket(Default.PORT);
- serverIncomingConnection = new ServerIncomingConnection(this, this);
- this.incomingMessageListener = incomingMessageListener;
- this.incomingConnectionListener = incomingConnectionListener;
- }
-
- public static Server getServer(
- IncomingMessageListener incomingMessageListener,
- IncomingConnectionListener incomingConnectionListener) {
- if (server == null) {
- try {
- server = new Server(incomingMessageListener,incomingConnectionListener);
- } catch (Exception ignored) { }
- }
- new Thread(server.serverIncomingConnection).start();
- new Thread(Server.server).start();
- return server;
- }
-
- @Override
- public void run() {
- while (true) {
- readAllConnectionMessage();
- }
- }
-
- void readAllConnectionMessage() {
- for (String key : socketMapping.keySet()) {
- Socket socket = socketMapping.get(key);
- String message = readSocketMessage(socket);
- incomingMessageListener.incomingMessage(socket.getInetAddress().getHostAddress(), message);
- }
- }
-
- String readSocketMessage(Socket socket) {
- try {
- String res
- = new BufferedReader(
- new InputStreamReader(socket.getInputStream(), "UTF-8"))
- .readLine();
- return (res == null) ? "" : res;
- } catch (Exception e) {
- return "";
- }
- }
-
- public ServerSocket getServerSocket() {
- return serverSocket;
- }
-
- public Map getSocketMapping() {
- return socketMapping;
- }
-
- @Override
- public void incomingSocket(Socket socket) {
- socketMapping.put(socket.getInetAddress().getHostAddress(), socket);
- incomingConnectionListener.incomingSocket(socket);
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/network/ServerIncomingConnection.java b/chirkut/app/src/main/java/com/mua/chirkut/network/ServerIncomingConnection.java
deleted file mode 100644
index b972b3f..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/network/ServerIncomingConnection.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.mua.chirkut.network;
-
-
-import android.util.Log;
-
-import com.mua.chirkut.listener.IncomingConnectionListener;
-
-import java.net.Socket;
-
-public class ServerIncomingConnection implements Runnable{
-
- private final Server server;
- private final IncomingConnectionListener incomingConnectionListener;
-
- public ServerIncomingConnection(Server server, IncomingConnectionListener incomingConnectionListener) {
- this.server = server;
- this.incomingConnectionListener = incomingConnectionListener;
- }
-
- @Override
- public void run() {
- while (true){
- try {
- Socket socket = server.getServerSocket().accept();
- incomingConnectionListener.incomingSocket(socket);
- } catch (Exception e) {
- break;
- }
- }
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/receiver/MessageReceiver.java b/chirkut/app/src/main/java/com/mua/chirkut/receiver/MessageReceiver.java
deleted file mode 100644
index 551439f..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/receiver/MessageReceiver.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mua.chirkut.receiver;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-
-import com.mua.chirkut.listener.IncomingMessageListener;
-
-public class MessageReceiver extends BroadcastReceiver {
-
- private final IncomingMessageListener incomingMessageListener;
-
- public MessageReceiver(IncomingMessageListener incomingMessageListener) {
- this.incomingMessageListener = incomingMessageListener;
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- Bundle extras = intent.getExtras();
- if (extras != null) {
- String address = extras.getString("address");
- String message = extras.getString("message");
- incomingMessageListener.incomingMessage(address,message);
- }
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/receiver/WifiDirectBroadcastReceiver.java b/chirkut/app/src/main/java/com/mua/chirkut/receiver/WifiDirectBroadcastReceiver.java
deleted file mode 100644
index 5b7bd38..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/receiver/WifiDirectBroadcastReceiver.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.mua.chirkut.receiver;
-
-
-import android.annotation.SuppressLint;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.NetworkInfo;
-import android.net.wifi.p2p.WifiP2pDeviceList;
-import android.net.wifi.p2p.WifiP2pManager;
-import android.util.Log;
-
-import com.mua.chirkut.listener.P2PConnectionListener;
-
-public class WifiDirectBroadcastReceiver extends BroadcastReceiver {
- private final WifiP2pManager mManager;
- private final WifiP2pManager.Channel mChannel;
- private final P2PConnectionListener mP2PConnectionListener;
- private final WifiP2pManager.PeerListListener peerListListener = new WifiP2pManager.PeerListListener() {
- @Override
- public void onPeersAvailable(WifiP2pDeviceList peerList) {
- mP2PConnectionListener.updateList(peerList);
- }
- };
- private boolean mConnected = false;
- private boolean mInitiated = false;
-
- public WifiDirectBroadcastReceiver(WifiP2pManager manager,
- WifiP2pManager.Channel channel,
- P2PConnectionListener p2PConnectionListener) {
- super();
- mManager = manager;
- mChannel = channel;
- mP2PConnectionListener = p2PConnectionListener;
- }
-
- @SuppressLint("MissingPermission")
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
- int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
- if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
- mP2PConnectionListener.wifiP2PStatus(true);
- } else if (state == WifiP2pManager.WIFI_P2P_STATE_DISABLED) {
- mP2PConnectionListener.wifiP2PStatus(false);
- }
- } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
- if (!mConnected) {
- mManager.requestPeers(mChannel, peerListListener);
- }
- } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
- NetworkInfo networkInfo = intent
- .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
- if (networkInfo.isConnected()) {
- mConnected = true;
- mManager.requestConnectionInfo(mChannel, mP2PConnectionListener::incomingConnection);
- } else {
- mConnected = false;
- if (mInitiated) {
- //todo: disconnected
- } else {
- mInitiated = true;
- //todo: viewmodel/view
- }
- }
- }
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/repository/MessageRepository.java b/chirkut/app/src/main/java/com/mua/chirkut/repository/MessageRepository.java
deleted file mode 100644
index 68b98cd..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/repository/MessageRepository.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.mua.chirkut.repository;
-
-
-import android.app.Application;
-import android.os.AsyncTask;
-
-import androidx.lifecycle.LiveData;
-
-import com.mua.chirkut.dao.MessageDao;
-import com.mua.chirkut.database.ApplicationDatabase;
-import com.mua.chirkut.entity.Message;
-
-import java.util.List;
-
-public class MessageRepository {
- private MessageDao messageDao;
-
- public MessageRepository(Application application) {
- ApplicationDatabase db = ApplicationDatabase.getInstance(application);
- messageDao = db.chatDao();
- }
-
- public LiveData> getAllByAddress(String address){
- return messageDao.getAll(address);
- }
-
- public void insert(Message message) {
- new InsertAsyncTask(messageDao).execute(message);
- }
-
- private static class InsertAsyncTask extends AsyncTask {
-
- private MessageDao messageDao;
-
- InsertAsyncTask(MessageDao messageDao) {
- this.messageDao = messageDao;
- }
-
- @Override
- protected Void doInBackground(final Message... params) {
- messageDao.insert(params[0]);
- return null;
- }
- }
-}
\ No newline at end of file
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/service/MessagingService.java b/chirkut/app/src/main/java/com/mua/chirkut/service/MessagingService.java
deleted file mode 100644
index 8a98fb6..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/service/MessagingService.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.mua.chirkut.service;
-
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.Service;
-import android.content.Intent;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.Messenger;
-import android.text.format.Formatter;
-import android.util.Log;
-import android.widget.Toast;
-
-import androidx.annotation.Nullable;
-import androidx.core.app.NotificationCompat;
-
-import com.mua.chirkut.MainActivity;
-import com.mua.chirkut.R;
-import com.mua.chirkut.handler.OutGoingHandler;
-import com.mua.chirkut.listener.IncomingConnectionListener;
-import com.mua.chirkut.listener.IncomingMessageListener;
-import com.mua.chirkut.listener.OutgoingMessageListener;
-import com.mua.chirkut.network.Client;
-import com.mua.chirkut.network.Server;
-
-import java.io.IOException;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Map;
-
-public class MessagingService
- extends Service
- implements IncomingMessageListener, IncomingConnectionListener, OutgoingMessageListener {
-
- private static final String ID = MessagingService.class.getName();
- private final Server server;
- private final Map clientMapping = new HashMap<>();
- private final OutGoingHandler mOutgoingHandler;
- private final Messenger messenger;
-
- public MessagingService() {
- this.server = Server.getServer(this,this);
- mOutgoingHandler = new OutGoingHandler(this);
- messenger = new Messenger(mOutgoingHandler);
- }
-
- @Override
- public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
- startInForeground();
- return START_STICKY;
- }
-
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- return messenger.getBinder();
- }
-
- public MessagingService getService(){
- return this;
- }
-
- private void startInForeground() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel serviceChannel = new NotificationChannel(
- ID,
- "Server Running",
- NotificationManager.IMPORTANCE_HIGH
- );
- NotificationManager manager = getSystemService(NotificationManager.class);
- manager.createNotificationChannel(serviceChannel);
- }
- Intent notificationIntent = new Intent(this, MainActivity.class);
- PendingIntent pendingIntent = PendingIntent.getActivity(this,
- 0, notificationIntent, 0);
-
- WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
- String ipAddress = Formatter.formatIpAddress(wifiManager.getConnectionInfo().getIpAddress());
-
-
- Notification notification = new NotificationCompat.Builder(this, ID)
- .setContentTitle(getString(R.string.app_name))
- .setContentText("Server Running in "+ipAddress)
- .setSmallIcon(R.drawable.ic_launcher_background)
- .setContentIntent(pendingIntent)
- .build();
- startForeground(1, notification);
- }
-
- @Override
- public void incomingMessage(String address, String message) {
- if (message.equals(""))
- return;
-
- Intent intent = new Intent("mua.message");
- intent.putExtra("address", address);
- intent.putExtra("message", message);
- sendBroadcast(intent);
- }
-
-
- public void sendMessage(String address,String message) throws IOException {
- Client client = clientMapping.get(address);
- if (client != null) {
- Toast
- .makeText(
- getApplicationContext(),
- message,
- Toast.LENGTH_LONG)
- .show();
- client.send(message);
- }
- }
-
- @Override
- public void incomingSocket(Socket socket) {
- String address = socket.getInetAddress().getHostAddress();
- try {
- clientMapping.put(address, new Client(address));
- Log.d("d--mua--net-test",address);
- } catch (IOException ignored) { }
- }
-
- @Override
- public void outgoingMessage(String address, String message) {
- try {
- sendMessage(address, message);
- } catch (Exception ignored) { }
- }
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/util/Default.java b/chirkut/app/src/main/java/com/mua/chirkut/util/Default.java
deleted file mode 100644
index 7365cbc..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/util/Default.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.mua.chirkut.util;
-
-public class Default {
- public static final int PORT = 8989;
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/ChatViewModel.java b/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/ChatViewModel.java
deleted file mode 100644
index 3b63da7..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/ChatViewModel.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.mua.chirkut.viewmodel;
-
-import android.app.Application;
-
-import androidx.annotation.NonNull;
-import androidx.lifecycle.AndroidViewModel;
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-import com.mua.chirkut.entity.Message;
-import com.mua.chirkut.repository.MessageRepository;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ChatViewModel extends AndroidViewModel {
-
- private final MessageRepository messageRepository;
- public LiveData> messages = new MutableLiveData<>(new ArrayList<>());
- public MutableLiveData address = new MutableLiveData<>("");
-
- public ChatViewModel(@NonNull Application application) {
- super(application);
- messageRepository = new MessageRepository(application);
- //todo:fix hardcoded
- messages = messageRepository.getAllByAddress(address.getValue());
- }
-
- public void updateAddress(String address){
- this.address.postValue(address);
- messages = messageRepository.getAllByAddress(address);
- }
-
- public void insert(String address,String message){
- messageRepository.insert(new Message(address,message,false));
- }
-
-}
diff --git a/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/MainViewModel.java b/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/MainViewModel.java
deleted file mode 100644
index 233310e..0000000
--- a/chirkut/app/src/main/java/com/mua/chirkut/viewmodel/MainViewModel.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.mua.chirkut.viewmodel;
-
-import android.app.Application;
-
-import androidx.annotation.NonNull;
-import androidx.lifecycle.AndroidViewModel;
-import androidx.lifecycle.MutableLiveData;
-
-import com.mua.chirkut.entity.Message;
-import com.mua.chirkut.repository.MessageRepository;
-
-public class MainViewModel extends AndroidViewModel {
-
- public MutableLiveData p2pStatus = new MutableLiveData<>("");
- public MutableLiveData serverStatus = new MutableLiveData<>(false);
- private final MessageRepository messageRepository;
-
- public MainViewModel(@NonNull Application application) {
- super(application);
- this.messageRepository = new MessageRepository(application);
- }
-
- public void insertChat(String address,String message, Boolean incoming){
- messageRepository.insert(new Message(address,message,incoming));
- }
-}
diff --git a/chirkut/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/chirkut/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 2b068d1..0000000
--- a/chirkut/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/drawable/chirkut_icon_background.xml b/chirkut/app/src/main/res/drawable/chirkut_icon_background.xml
deleted file mode 100644
index ca3826a..0000000
--- a/chirkut/app/src/main/res/drawable/chirkut_icon_background.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/chirkut/app/src/main/res/drawable/ic_launcher_background.xml b/chirkut/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index b5cd46e..0000000
--- a/chirkut/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
diff --git a/chirkut/app/src/main/res/layout/activity_chat.xml b/chirkut/app/src/main/res/layout/activity_chat.xml
deleted file mode 100644
index 5f5301d..0000000
--- a/chirkut/app/src/main/res/layout/activity_chat.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/layout/activity_main.xml b/chirkut/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 235ded7..0000000
--- a/chirkut/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/layout/item_message.xml b/chirkut/app/src/main/res/layout/item_message.xml
deleted file mode 100644
index 84de770..0000000
--- a/chirkut/app/src/main/res/layout/item_message.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/chirkut/app/src/main/res/layout/item_p2p_device.xml b/chirkut/app/src/main/res/layout/item_p2p_device.xml
deleted file mode 100644
index fa0689e..0000000
--- a/chirkut/app/src/main/res/layout/item_p2p_device.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon.xml b/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon.xml
deleted file mode 100644
index d4f34d4..0000000
--- a/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon_round.xml b/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon_round.xml
deleted file mode 100644
index d4f34d4..0000000
--- a/chirkut/app/src/main/res/mipmap-anydpi-v26/chirkut_icon_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index 03339da..0000000
--- a/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index eca70cf..0000000
--- a/chirkut/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon.png b/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon.png
deleted file mode 100644
index d286afc..0000000
Binary files a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_foreground.png b/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_foreground.png
deleted file mode 100644
index fd64cd9..0000000
Binary files a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_foreground.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_round.png b/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_round.png
deleted file mode 100644
index dcf3227..0000000
Binary files a/chirkut/app/src/main/res/mipmap-hdpi/chirkut_icon_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher.png b/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index a571e60..0000000
Binary files a/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 61da551..0000000
Binary files a/chirkut/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon.png b/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon.png
deleted file mode 100644
index 8a30a37..0000000
Binary files a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_foreground.png b/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_foreground.png
deleted file mode 100644
index 33214a1..0000000
Binary files a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_foreground.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_round.png b/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_round.png
deleted file mode 100644
index 481bedd..0000000
Binary files a/chirkut/app/src/main/res/mipmap-mdpi/chirkut_icon_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher.png b/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c41dd28..0000000
Binary files a/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index db5080a..0000000
Binary files a/chirkut/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon.png b/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon.png
deleted file mode 100644
index 7f5230b..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_foreground.png b/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_foreground.png
deleted file mode 100644
index 27c9f4e..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_foreground.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_round.png b/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_round.png
deleted file mode 100644
index 1a9e6b3..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xhdpi/chirkut_icon_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index 6dba46d..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index da31a87..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon.png b/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon.png
deleted file mode 100644
index e8349f4..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_foreground.png b/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_foreground.png
deleted file mode 100644
index 5803566..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_foreground.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_round.png b/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_round.png
deleted file mode 100644
index a39f2eb..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxhdpi/chirkut_icon_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 15ac681..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index b216f2d..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon.png b/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon.png
deleted file mode 100644
index 2bd90b7..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_foreground.png b/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_foreground.png
deleted file mode 100644
index 410701f..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_foreground.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_round.png b/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_round.png
deleted file mode 100644
index 437732f..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxxhdpi/chirkut_icon_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index f25a419..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index e96783c..0000000
Binary files a/chirkut/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/chirkut/app/src/main/res/values-night/themes.xml b/chirkut/app/src/main/res/values-night/themes.xml
deleted file mode 100644
index 716f4c9..0000000
--- a/chirkut/app/src/main/res/values-night/themes.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/values/colors.xml b/chirkut/app/src/main/res/values/colors.xml
deleted file mode 100644
index f8c6127..0000000
--- a/chirkut/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- #FFBB86FC
- #FF6200EE
- #FF3700B3
- #FF03DAC5
- #FF018786
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/values/strings.xml b/chirkut/app/src/main/res/values/strings.xml
deleted file mode 100644
index b5a8e2d..0000000
--- a/chirkut/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Chirkut
-
\ No newline at end of file
diff --git a/chirkut/app/src/main/res/values/themes.xml b/chirkut/app/src/main/res/values/themes.xml
deleted file mode 100644
index 8fc47aa..0000000
--- a/chirkut/app/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/chirkut/app/src/test/java/com/mua/chirkut/ExampleUnitTest.java b/chirkut/app/src/test/java/com/mua/chirkut/ExampleUnitTest.java
deleted file mode 100644
index 4b5b80c..0000000
--- a/chirkut/app/src/test/java/com/mua/chirkut/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mua.chirkut;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/chirkut/build.gradle b/chirkut/build.gradle
deleted file mode 100644
index 4d24be2..0000000
--- a/chirkut/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-buildscript {
- repositories {
- google()
- jcenter()
- }
- dependencies {
- classpath "com.android.tools.build:gradle:4.1.1"
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- google()
- jcenter()
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
\ No newline at end of file
diff --git a/chirkut/gradle.properties b/chirkut/gradle.properties
deleted file mode 100644
index 52f5917..0000000
--- a/chirkut/gradle.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app"s APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
-android.useAndroidX=true
-# Automatically convert third-party libraries to use AndroidX
-android.enableJetifier=true
\ No newline at end of file
diff --git a/chirkut/gradle/wrapper/gradle-wrapper.jar b/chirkut/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index f6b961f..0000000
Binary files a/chirkut/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/chirkut/gradle/wrapper/gradle-wrapper.properties b/chirkut/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 2c155b1..0000000
--- a/chirkut/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Fri Jan 15 12:16:13 BDT 2021
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
diff --git a/chirkut/gradlew b/chirkut/gradlew
deleted file mode 100755
index cccdd3d..0000000
--- a/chirkut/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/chirkut/gradlew.bat b/chirkut/gradlew.bat
deleted file mode 100644
index f955316..0000000
--- a/chirkut/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/chirkut/settings.gradle b/chirkut/settings.gradle
deleted file mode 100644
index 1becbdb..0000000
--- a/chirkut/settings.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-include ':app'
-rootProject.name = "Chirkut"
\ No newline at end of file
diff --git a/files/chirkut_banner.png b/files/chirkut_banner.png
deleted file mode 100644
index a4750db..0000000
Binary files a/files/chirkut_banner.png and /dev/null differ
diff --git a/files/chirkut_icon.png b/files/chirkut_icon.png
deleted file mode 100644
index a746fae..0000000
Binary files a/files/chirkut_icon.png and /dev/null differ