Professional Documents
Culture Documents
JNAMA SANGAMA,
BELGAVI – 590018
MS ENGINEERING COLLEGE
NAAC Accredited, Affiliated to VTU, Belagavi, Approved by AICTE New Delhi,Navarathna
Road, Bengaluru- Agrahara, off Intl. Airport. 562110
2022-23
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CERTIFICATE
This is to certify that the mini project work entitled “Secure Share Vault Mobile
Application” carried out by Ashutosh Kumar Singh (1ME19CS009) is bonafide student
of M S ENGINEERING COLLEGE submitted in partial fulfillment for the award of
Bachelor of Engineering in Computer Science and Engineering of Visvesvaraya
Technological University, Belagavi, during the year 2022-2023. It is certified that all
corrections/suggestions indicated for internal assessment have been incorporated in the
report, deposited in the department library. This mini project work report has been
approved as it satisfies the academic requirements in respect of project work prescribed for
Bachelor of Engineering Degree.
Exam Date -
ABSTRACT
In today's interconnected world, mobile development has permeated every aspect of our lives,
revolutionizing industries and transforming the way we interact with technology. As a testament to
the power and versatility of mobile apps, we proudly present our latest mini project "SECURE
SHARE VAULT" a mobile app development project that aims to provide a secure and convenient
platform for file sharing. The app offers a web-based interface, allowing users to access it from
various devices and operating systems, including Windows, Mac, Linux, Android, and iPhone.
It include a private mode for limited file sharing, a transfer history log for tracking shared files, and
the ability to restrict modifications to files and folders. Real-time logs provide users with up-to-date
information on file transfers, while a custom port selection feature allows for flexibility in network
configurations.
The app offers a fast QR scanner for seamless file sharing, along with the option to show or hide
hidden files. Authorized devices can be remembered for quick and easy access. Multiple web
interface themes are available for customization, with 13 built-in options to choose from.
One of the notable advantages of "Secure Share Vault" is its lightweight design, optimized for faster
and parallel file sharing. The app functions efficiently offline and does not consume any data while
sharing files, ensuring cost-effectiveness for users.
Overall, "Secure Share Vault" provides a secure and user-friendly solution for file sharing, catering to
a wide range of devices and operating systems. With its emphasis on privacy, ease of use, and
versatile features, this open-source app is designed to enhance the file sharing experience for
individuals and organizations alike.
It stands as a game-changing solution in the realm of file sharing. With its unwavering commitment
to security, usability, and versatility, this app caters to the evolving needs of individuals and
organizations alike. By seamlessly bridging the gap between different devices and operating systems,
"Secure Share Vault" sets a new standard for efficient, secure, and user-centric file sharing in the
digital landscape
ACKNOWLEDGEMENT
A project work is of immense sheer size and it cannot be proficient by an individual all by them,
ultimately, we are gratifying to a number of individuals whose qualified guidance, and assistance
and encouragement have made it a pleasant venture to undertake thisproject work.
We are grateful to my institution, M S Engineering College with its ideals and inspiration for having
provided us with the facilities, which has made this project work a success.
It is our pleasure to tender our heartfelt thanks to our College Trustees for their vision behind, towards
the successful completion of our course
We would like to express my gratitude to Dr. P Mahadevaswamy, Principal MSEC, who isthe source
of inspiration as well providing an amiable atmosphere to work in.
Further, we would like to express my kind gratitude towards, Dr. Malatesh S.H, HOD, Dept. of CSE,
and the whole department for providing us kindly environment for the successful completion of the
project work.
We also extend our sincere thanks to our project guide, Mrs. Sasi Reka M, Assistant Prof. Dept. of
CSE, for the timely suggestions and cooperation throughout our dissertation.
It’s our duty to thank one and all faculties of CSE Department, who have directly or indirectly
supported to accomplish the project work successfully.
We would also like to thank our friends, who really helped us to complete our project work
successfully.
ABSTRACT I
ACKNOWLEDGEMENT II
1. INTRODUCTION 1
1.1 Overview
1.2 Problem Statement 2
1.3 Mobile Application Development Importance 3
1.4 Android Studio 4
2. SYSTEM REQUIREMENTS 6
2.1 Software Requirements
2.2 Hardware Requirements
3. SYSTEM DESIGN 7
3.1 XML Design
3.2 XML Code
4. IMPLEMENTATION
4.1 Description 16
4.2 Java Code 18
7. BIBLIOGRAPHY 57
Chapter 1
INTRODUCTION
1.1 Overview
Mobile application development is the process to making software for smart phones and
digital assistants, most commonly for Android and iOS. The software can be preinstalled
on the device, downloaded from a mobile app store or accessed through a mobile web
browser. The programming and markup languages used for this kind of software
development include Java, Swift, C# and HTMLS.
Mobile app development is rapidly growing. From retail, telecommunications and e-
commerce to insurance, healthcare and government, organizations across industries must meet
user expectations for real-time, convenient ways to conduct transactions and access
information. Today, mobile devices and the mobile applications that unlock their value are the
most popular way for people and businesses to connect to the internet. To stay relevant,
responsive and successful, organizations need to develop the mobile applications that their
customers, partners and employees demand.
Yet mobile application development might seem daunting. Once you’ve selected the OS
platform or platforms, you need to overcome the limitations of mobile devices and usher
your app all the way past the potential hurdles of distribution. Fortunately, by following a few
basic guidelines and best practices, you can streamline your application development journey.
We can start explaining mobile development, which is not about building phone apps, though
it is a huge part of it. Actually, It’s doing any reasonably development for any kind of mobile
devices such as developing apps for phones, tablets, smart watches, and every form of
wearable devices that run any kind of mobile operating system.
Mobile development presents a reasonably distinctive chance for a one-person
development team to build an actual, usable, significant app end-to-end during a
comparatively short period. However, mobile apps development represents more than just a
chance for the solo-developer to create their own project as it is arguably the longer term of
development, as mobile devices are getting larger and bigger parts of our lives.
You may gain access to nearly every type of online platforms by developing your apps.
Develop apps will help reach into marketplaces as far reaching areas via Google Play,
Blackberry, as well as Apple App Store, Symbian, and other internet marketplaces and
through social media web sites just like Facebook or Myspace, Twitter, among others.
Besides having the ability to mail data to clients, app growth possesses additional exclusive
capabilities, which include coupon codes, evaluation of functions, and also force
announcements. Your visitors within the quickest feasible valuable time, and also obtain an
immediate answer, which assists you examine the advertising tool.
2. Targeted Audience
It’s simple to get obsessed with app ideas. I hear fantastic ideas daily, but generally they’re
strategies that originate around a work or function, instead of a particular target audience. The
audience is very close to an afterthought, merely crucial while making the advertising program.
The a lot more applications I style and also release, the a lot more I’m certain it’s easier to
begin with a particular audience and also produce suggestions depending on the
requirements of this target audience. Mobile apps permit the users to have functional
access to products, information, process, and services that they would demand in real-
time.
Android Studio can be installed on Windows operating systems, OSX and Linux and
is recommended by Google itself that the hardware must have at least 4 GB of
memory and lGB of free hard disk space, but we recommend that you have more
memory because it was noted that Android Studio is still a little slow. You must have
Java installed on the machine via the JDK (Java Development Kit), not the JRE, as
it is usually installed, once to develop on Android is necessary for all Java
development classes to be present on the machine.
Android Studio has many exciting features that can help you to develop your Android application
like:
• Powerful code editor with smart editing and code re-factoring.
• Emulator to show your code output in various resolutions, including
Nexus 4, Nexus 7, Nexus 10, and many other android phones.
• Gradle based build support.
• Maven Support.
• Template-based wizards.
• Dracula Theme Environment to enjoy your coding experience.
• provides a robust static analysis framework and includes over 365 different
lint
checks across the entirety of the app.
• includes project and code templates that make it easy to add well-
established
patterns such as a navigation drawer and view pager.
• integrates with version control tools, such as GitHub and Subversion, so you
can
keep your team in sync with project and build changes.
• provides a unified environment where you can build apps for Android
phones, tablets, Android Wear, Android TV, and Android Auto
One can experience all the awesome features by using Android Studio in-hand.
• The toolbar lets you carry out a wide range of actions, including
running your app and launching Android tools.
• The navigation bar helps you navigate through your project and
open files for editing. It provides a more compact view of the
structure visible in the Project window.
• The editor window is where you create and modify code. Depending
on the current file type, the editor can change.
• The tool window bar runs around the outside of the IDE window
and contains the buttons that allow you to expand or collapse
individual tool windows.
• The tool windows give you access to specific tasks like project
management, search, version control, and more.
• The status bar displays the status of your project and the IDE itself, as well
as any warnings or messages.
Chapter 3
SYSTEM DESIGN
3.1 XML Design
XML provides a structured and flexible format for storing and transmitting data, allowing
for seamless integration with various systems and platforms. The XML design in Secure Share
Vault follows a well-defined structure to organize and manage the application's data effectively.
File Structure:
The XML design starts with a root element that encapsulates the entire file. Within the root
element, various child elements are used to represent different aspects of Secure Share Vault's
functionality. These elements are carefully organized to maintain data integrity and ease of
processing.
Configuration Settings:
Secure Share Vault's XML design includes elements dedicated to storing configuration settings.
These elements encompass options such as private mode settings, port selection, and interface
theme preferences. This allows users to customize their experience and tailor the application to
their specific needs.
Transfer History:
The XML design includes elements to capture and store the transfer history of shared files. Each
transfer event is represented as a child element within the transfer history element. These
elements contain relevant information such as the sender, recipient, file details, and timestamps.
This structured representation allows for easy retrieval and analysis of past transfers.
User Authorization:
To maintain security and control access to the application, Secure Share Vault's XML design
incorporates elements for user authorization. These elements store information about authorized
devices, including device identifiers and access permissions. By leveraging XML, the application
can efficiently manage and validate user access to ensure secure file sharing.
Logging and Activity:
Real-time logs and activity tracking are essential features in Secure Share Vault. The XML design
includes elements to store log entries, capturing information about file transfers, system events,
and user interactions. These elements record details such as timestamps, log levels, and specific
activities performed, facilitating comprehensive auditing and troubleshooting
Hidden Files:
Secure Share Vault provides an option to show or hide hidden files during file sharing. The XML
design incorporates elements to represent hidden files and their visibility status. These elements
enable seamless toggling of hidden files, ensuring a user-friendly experience while maintaining
data privacy.
FEATURES
• Private Mode: Secure Share Vault offers a private mode for limited file sharing, allowing
users to control access to specific files or folders.
• Transfer History: Users can easily view their transfer history, providing a record of all
shared files for reference and tracking purposes.
• File and Folder Restrictions: The app enables users to restrict modifications to files and
folders, ensuring the integrity and security of shared data.
• Real-Time Logs: Secure Share Vault provides real-time logs, offering users detailed
information about file transfers and system activity.
• Custom Port Selection: Users have the flexibility to select custom ports for file sharing,
enhancing security and customization options.
• Fastest QR Scanner: The application incorporates a fast QR scanner, enabling seamless and
efficient file sharing by quickly scanning QR codes.
• Show/Hide Hidden Files: Secure Share Vault allows users to easily toggle the visibility of
hidden files, providing control over the shared content.
• Authorized Devices: The app remembers authorized devices, streamlining the sharing
process and ensuring secure connections.
• Multiple Web Interface Themes: Users can choose from a variety of 13 built-in web
interface themes, customizing the look and feel of the application.
• Cross-Platform Compatibility: Secure Share Vault is compatible with Windows, Mac, Linux,
Android, and iPhone platforms, ensuring broad accessibility.
• Lightweight and Fast: The application is designed to be lightweight, enabling faster and
parallel file sharing without compromising performance.
3.2.1 activity_main.xml
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/main_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<include
layout="@layout/main_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/settings_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone">
<include
layout="@layout/settings_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/qr_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone">
<include
layout="@layout/qr_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/bg_color"
android:theme="@style/ProductSansStyle"
app:headerLayout="@layout/drawer_header"
app:itemIconTint="@color/txt_color"
app:itemTextColor="@color/txt_color"
app:menu="@menu/menu" />
</androidx.drawerlayout.widget.DrawerLayout>
3.2.2 activity_transfer_history.xml
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/bg_color_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:fontFamily="@font/product_sans"
android:text="History"
android:textColor="@color/txt_color"
android:textSize="34sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/btn_clear_hist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/ripple_bg"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_delete_swipe"
app:tint="@color/txt_color" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:background="@color/bg_color"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
</androidx.recyclerview.widget.RecyclerView>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/blank_screen"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/bg_color"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.45">
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/product_sans"
android:text="No transfer history found..."
android:textColor="@color/txt_color_secondary"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="150dp"
android:layout_height="150dp"
android:alpha="0.5"
android:tint="@color/txt_color_secondary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_blank"
tools:ignore="VectorDrawableCompat" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Chapter 4
IMPLEMENTATION
4.1 Description
• DeviceManager(Context ):
Constructor method for the DeviceManager class.
• onCreate(SQLiteDatabase db):
Called when the database is created for the first time.
Creates a table named D_LIST with columns for ID, DEVICE_ID, and DEVICE_TYPE.
• getRemDevices():
Retrieves the count of devices from the database where the DEVICE_TYPE is equal to a
constant value defined in Constants.DEVICE_TYPE_PERMANENT.
• isDeviceExist(String id):
Checks if a device with the provided id exists in the database and has a DEVICE_TYPE
value not equal to a constant value defined in Constants.DEVICE_TYPE_DENIED.
Returns true if the device exists, false otherwise.
• isDeviceDenied(String id):
Checks if a device with the provided id exists in the database and has a DEVICE_TYPE
value equal to a constant value defined in Constants.DEVICE_TYPE_DENIED.
Returns true if the device is denied, false otherwise.
• clearAll():
Deletes all rows from the table in the database.
• clearTmp():
Deletes rows from the table in the database where the DEVICE_TYPE is equal to a constant
value defined in Constants.DEVICE_TYPE_TEMP or
Constants.DEVICE_TYPE_DENIED
• WifiApManager(Context context):
Constructor method for the WifiApManager class.
Initializes the WifiManager instance using the WIFI_SERVICE from the provided context.
• getWifiApState():
Retrieves the state of the Wi-Fi hotspot.
Uses reflection to invoke the getWifiApState method from the WifiManager class.
Handles compatibility fix for Android 4 by adjusting the returned value.
Returns an enum constant indicating the Wi-Fi hotspot state.
• isWifiApEnabled():
Checks whether the Wi-Fi hotspot is enabled or disabled.
Calls the getWifiApState method and compares the returned state with the enabled state.
• setAllowHiddenMedia(boolean allowHiddenMedia):
This function determines whether hidden media files should be allowed or not. By passing a
boolean value, you can enable or disable the serving of hidden media files. Hidden media
files are typically files that start with a dot (.) and are marked as hidden on the file system.
• serve(IHTTPSession session):
The serve function is responsible for handling HTTP requests. It takes an IHTTPSession
object representing the incoming request and generates an appropriate response based on the
requested URI and parameters. It determines how to serve files, handle file uploads, and
respond to other types of requests.
4.2.1 MainActivity.java
package com.ashutosh.sharevault;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.TransitionDrawable;
import android.net.Uri;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Build;
Dept. of CSE, MSEC Page 18 2022 - 23
Secure Share Vault Mobile application
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.InputType;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import com.developer.filepicker.model.DialogConfigs;
import com.developer.filepicker.model.DialogProperties;
import com.developer.filepicker.view.FilePickerDialog;
import com.dlazaro66.qrcodereaderview.QRCodeReaderView;
import com.github.sumimakito.awesomeqr.AwesomeQrRenderer;
import com.github.sumimakito.awesomeqr.RenderResult;
import com.github.sumimakito.awesomeqr.option.RenderOption;
import com.github.sumimakito.awesomeqr.option.logo.Logo;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
FabActionsHandler fabActionsHandler;
DeviceManager deviceManager;
ActivityResultLauncher<Intent> storagePermissionResultLauncher;
ActivityResultLauncher<Intent> folderPickerResultLauncher;
ActivityResultLauncher<Intent> batteryActivityResultLauncher;
int exit = 0;
int currentTheme;
boolean requestingStorage = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logger = findViewById(R.id.logger);
logger_wrapper = findViewById(R.id.logger_wrapper);
hide_logger_btn = findViewById(R.id.hide_logger_btn);
logger.setMovementMethod(new ScrollingMovementMethod());
utils = new Utils(this);
serverRoot = utils.loadRoot();
deviceManager = new DeviceManager(this);
main_view.setVisibility(View.VISIBLE);
qr_view.setVisibility(View.GONE);
main_bg = findViewById(R.id.main_bg);
second_bg = findViewById(R.id.second_bg);
scan_url = findViewById(R.id.scan_url);
drawerLayout = findViewById(R.id.root_container);
//Settings Components
settDRoot = findViewById(R.id.sett_subtitle1);
settRemDev = findViewById(R.id.sett_subtitle6);
settTheme = findViewById(R.id.sett_subtitle7);
String dev_count = deviceManager.getRemDevices() + " devices remembered";
settRemDev.setText(dev_count);
settTheme.setText(themesData.getDisplayItem(utils.loadInt(Constants.WEB_INTERFACE_THEME,0)));
currentTheme = utils.loadInt(Constants.WEB_INTERFACE_THEME,0);
storagePermissionResultLauncher = registerForActivityResult(new
ActivityResultContracts.StartActivityForResult(), result -> {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && requestingStorage) {
if(Environment.isExternalStorageManager()) {
requestingStorage = false;
initializeApp();
}else{
requestStoragePermissions();
}
}else{
requestingStorage = true;
}
});
folderPickerResultLauncher = registerForActivityResult(new
ActivityResultContracts.StartActivityForResult(), result -> {
if(result.getResultCode() == Activity.RESULT_OK) {
try {
Uri uri = result.getData().getData();
String decode = URLDecoder.decode(uri.toString(), "UTF-8");
File f = new File(Environment.getExternalStorageDirectory(),decode.split(":")[2]);
serverRoot = f.getAbsolutePath();
utils.saveRoot(serverRoot);
pushLog("Server root changed to " + serverRoot, true);
settDRoot.setText(serverRoot);
restartServer();
}catch (Exception e) {
Log.d(Constants.LOG_TAG,"Err2: "+e);
}
}
});
batteryActivityResultLauncher = registerForActivityResult(new
ActivityResultContracts.StartActivityForResult(), result -> {
utils.saveSetting(Constants.ASKED_BATTERY_OPT,true);
});
} else {
initializeApp();
}
fabActionsHandler.setFabActionsHandlerListener(new
FabActionsHandler.FabActionsHandlerListener() {
Dept. of CSE, MSEC Page 24 2022 - 23
Secure Share Vault Mobile application
@Override
public void onClickImageSelect() {
try {
Matisse.from(MainActivity.this)
.choose(MimeType.ofAll(), false)
.countable(true)
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
.maxSelectable(200)
.theme(R.style.Matisse_Dracula)
.imageEngine(new Glide4Engine())
.forResult(Constants.MATISSE_REQ_CODE);
} catch (Exception e) {
pushLog(e.toString(), true);
}
fabActionsHandler.hideFab();
}
@Override
public void onClickFilesSelect() {
DialogProperties properties = new DialogProperties();
properties.selection_mode = DialogConfigs.MULTI_MODE;
properties.selection_type = DialogConfigs.FILE_SELECT;
properties.root = new File(Environment.getExternalStorageDirectory().toString());
properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
properties.offset = new File(Environment.getExternalStorageDirectory().toString());
FilePickerDialog filesPicker = new FilePickerDialog(MainActivity.this, properties);
filesPicker.setTitle("Select files to send");
filesPicker.setDialogSelectionListener(files -> {
pmode_send_files = Arrays.asList(files);
mergeAndUpdatePFilesList();
});
filesPicker.show();
fabActionsHandler.hideFab();
}
});
if(utils.loadSetting(Constants.IS_LOGGER_VISIBLE)) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)
logger_wrapper.getLayoutParams();
params.bottomMargin = 0;
logger_wrapper.setLayoutParams(params);
hide_logger_btn.setImageResource(R.drawable.ic_caret_down);
}else{
if(utils.loadString(Constants.LOGGER_HEIGHT) != null) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)
logger_wrapper.getLayoutParams();
params.bottomMargin = -(Integer.parseInt(utils.loadString(Constants.LOGGER_HEIGHT)));
logger_wrapper.setLayoutParams(params);
hide_logger_btn.setImageResource(R.drawable.ic_caret_up);
}
}
@Override
protected void onPause() {
try {
if(qrDialog!=null) {
qrDialog.dismiss();
}
}catch (Exception e) {
// DO Nothing...
}
super.onPause();
}
@Override
protected void onDestroy() {
unregisterReceiver(updateUIReciver);
super.onDestroy();
}
@Override
public void onBackPressed() {
if(settings_view.getVisibility()==View.VISIBLE) {
toggleSettings();
}else if(qr_view.getVisibility()==View.VISIBLE) {
toggleQRView();
}else{
exit();
}
}
Dept. of CSE, MSEC Page 27 2022 - 23
Secure Share Vault Mobile application
@Override
protected void onResume() {
try {
IntentFilter filter = new IntentFilter();
filter.addAction("service.to.activity.transfer");
registerReceiver(updateUIReciver, filter);
}catch (Exception e) {
//Do Nothing!
}
privateMode();
super.onResume();
}
@Override
@Override
protected void onStart() {
privateMode();
super.onStart();
}
@SuppressLint("SdCardPath")
public void initializeApp() {
if(utils.isServiceRunning(ServerService.class)) {
changeUI(Constants.SERVER_ON);
String u=utils.loadString(Constants.TEMP_URL);
if(u!=null) {
url=u;
pushLog("Server running at: "+url,false);
}
}
serverBtn.setOnClickListener(view -> {
if (!utils.isServiceRunning(ServerService.class)) {
if(isValidIP()) {
pushLog("Starting server...", true);
startServer();
changeUI(Constants.SERVER_ON);
}else{
showSnackbar("Make sure your hotspot is open or wifi connected...");
}
} else {
pushLog("Stopping server...",true);
stopServer();
changeUI(Constants.SERVER_OFF);
}
});
File f=new
File(String.format("/data/data/%s/%s/index.html",getPackageName(),Constants.NEW_DIR));
if(!f.exists() || Constants.DEBUG) {
WebInterfaceSetup webInterfaceSetup=new WebInterfaceSetup(getPackageName(), this);
webInterfaceSetup.setupListeners=new WebInterfaceSetup.SetupListeners() {
@Override
public void onSetupCompeted(boolean status) {
progress.cancel();
if(!status) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(utils.getSpannableFont("Error"));
builder.setMessage(utils.getSpannableFont("Something went wrong!"));
builder.setPositiveButton("OK", (dialog, id) -> {
dialog.dismiss();
finishAffinity();
});
AlertDialog alert = builder.create();
alert.setCancelable(false);
alert.setCanceledOnTouchOutside(false);
alert.show();
}
try {
IntentFilter filter = new IntentFilter();
filter.addAction("service.to.activity.transfer");
registerReceiver(updateUIReciver, filter);
}catch (Exception e) {
//Do Nothing!
}
if(!Constants.DEBUG) {
showAbout();
}
askIgnoreBatteryOptimizations();
}
@Override
public void onSetupStarted(boolean updating) {
progress=new ProgressDialog( MainActivity.this);
try {
progress.setTitle(utils.getSpannableFont(getResources().getString(R.string.app_name)));
if(updating) {
progress.setMessage(utils.getSpannableFont("Updating App Content\nPlease Wait..."));
}else{
progress.setMessage(utils.getSpannableFont("Preparing App For First Use\nPlease
Wait..."));
}
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setIndeterminate(true);
progress.setProgress(0);
progress.setCancelable(false);
progress.setCanceledOnTouchOutside(false);
progress.show();
}catch (Exception e) {
Log.d(Constants.LOG_TAG,e.toString());
}
}
};
webInterfaceSetup.execute();
}else{
askIgnoreBatteryOptimizations();
}
Dept. of CSE, MSEC Page 31 2022 - 23
Secure Share Vault Mobile application
NavigationView navigationView=findViewById(R.id.navigationView);
navigationView.setNavigationItemSelectedListener(item -> {
int itemId = item.getItemId();
if(itemId == R.id.settings) {
toggleSettings();
}else if(itemId == R.id.scan_qr) {
if(checkCameraPermission()) {
initQrScanner();
}else{
requestCameraPermission();
}
}else if(itemId == R.id.trans_hist) {
Intent intent=new Intent(MainActivity.this,TransferHistory.class);
startActivity(intent);
}else if(itemId == R.id.clear_log) {
clearLog();
}else if(itemId == R.id.privacy_policy) {
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(Constants.PRIVACY_POLICY_URL));
startActivity(i);
}catch (Exception e) {
//Do Nothing
}
}else if(itemId == R.id.feedback) {
Intent email = new
Intent(Intent.ACTION_SENDTO,Uri.fromParts("mailto",Constants.FEEDBACK_MAIL,null));
email.putExtra(Intent.EXTRA_SUBJECT, "ShareX Feedback");
email.putExtra(Intent.EXTRA_TEXT, "Any feedback, query or suggestion...");
startActivity(Intent.createChooser(email, "Send Feedback"));
}else if(itemId == R.id.about) {
showAbout();
}
drawerLayout.closeDrawer(GravityCompat.START);
return true;
});
Dept. of CSE, MSEC Page 32 2022 - 23
Secure Share Vault Mobile application
setUp_settingsListener();
}
@Override
});
}
}
@Override
public void onAnimationEnd(Animation animation) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)
logger_wrapper.getLayoutParams();
if(utils.loadSetting(Constants.IS_LOGGER_VISIBLE)) {
params.bottomMargin = 0;
hide_logger_btn.setImageResource(R.drawable.ic_caret_down);
}else{
params.bottomMargin = -modifier;
hide_logger_btn.setImageResource(R.drawable.ic_caret_up);
}
logger_wrapper.setLayoutParams(params);
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
logger_wrapper.startAnimation(animation);
utils.saveSetting(Constants.IS_LOGGER_VISIBLE,!utils.loadSetting(Constants.IS_LOGGER_VISIBLE));
}
settHFCheck.setChecked(utils.loadSetting(Constants.LOAD_HIDDEN_MEDIA));
settHFCheck.setOnCheckedChangeListener((compoundButton, b) -> {
utils.saveSetting(Constants.LOAD_HIDDEN_MEDIA,b);
restartServer();
});
card2.setOnClickListener(v -> settHFCheck.setChecked(!settHFCheck.isChecked()));
settRMCheck.setChecked(utils.loadSetting(Constants.RESTRICT_MODIFY));
settRMCheck.setOnCheckedChangeListener((compoundButton, b) -> {
utils.saveSetting(Constants.RESTRICT_MODIFY,b);
restartServer();
});
card3.setOnClickListener(v -> settRMCheck.setChecked(!settRMCheck.isChecked()));
settFDCheck.setChecked(utils.loadSetting(Constants.FORCE_DOWNLOAD));
settFDCheck.setOnCheckedChangeListener((compoundButton, b) ->
utils.saveSetting(Constants.FORCE_DOWNLOAD,b));
card4.setOnClickListener(v -> settFDCheck.setChecked(!settFDCheck.isChecked()));
settPMCheck.setOnCheckedChangeListener((compoundButton, b) -> {
utils.saveSetting(Constants.PRIVATE_MODE,b);
restartServer();
privateMode();
});
settPMCheck.setChecked(utils.loadSetting(Constants.PRIVATE_MODE));
card5.setOnClickListener(v -> settPMCheck.setChecked(!settPMCheck.isChecked()));
card6.setOnClickListener(v -> {
deviceManager.clearAll();
showSnackbar("All remembered devices cleared!");
Timer myTimer=new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
MainActivity.this.runOnUiThread(() ->
settRemDev.setText(deviceManager.getRemDevices()+" devices remembered"));
}
},500);
});
card7.setOnClickListener(v -> {
textInputLayout.setPadding(getResources().getDimensionPixelOffset(R.dimen.dp_19),0,getResources().get
DimensionPixelOffset(R.dimen.dp_19),0);
final EditText input = new EditText(MainActivity.this);
input.setText(String.valueOf(utils.loadInt(Constants.SERVER_PORT,Constants.SERVER_PORT_DEFAU
LT)));
input.setInputType(InputType.TYPE_CLASS_NUMBER |
InputType.TYPE_NUMBER_VARIATION_NORMAL);
textInputLayout.addView(input);
builder.setView(textInputLayout);
builder.setPositiveButton("Set", (dialog, which) -> {
if(input.getText().toString().length()>0) {
int port = Integer.parseInt(input.getText().toString());
if(port >= 1024 && port <= 65535) {
utils.saveInt(Constants.SERVER_PORT, port);
}
}, 2000);
}
}
if(b) {
try {
int scrollAmount = logger.getLayout().getLineTop(logger.getLineCount()) - logger.getHeight();
if (scrollAmount > 0) {
logger.scrollTo(0, scrollAmount + 46);
} else {
logger.scrollTo(0, 0);
}
}catch (Exception e) {
//Do Nothing...
}
}
}
TextView scan_url=findViewById(R.id.scan_url);
scan_url.setText(url);
ImageView qr_view=findViewById(R.id.qr_img);
GenerateQR generateQR=new GenerateQR(qr_view);
generateQR.execute();
}
}else{
main_view.setVisibility(View.VISIBLE);
qr_view.setVisibility(View.GONE);
ImageView qr_view=findViewById(R.id.qr_img);
qr_view.setImageResource(R.drawable.ic_logo);
scan_url.setText("Start ShareX First!");
}
}
try {
progressTimer.cancel();
}catch (Exception e) {
//Do nothing...
}
progressTimer=new Timer();
progressTimer.schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
changeP(100);
}
});
}
},3000);
}
}catch (Exception e) {
Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show();
}
}
Dept. of CSE, MSEC Page 44 2022 - 23
Secure Share Vault Mobile application
pmode_send_final_files=new ArrayList<>();
if(pmode_send_images.size()>0) {
pmode_send_final_files.addAll(pmode_send_images);
for(String path:pmode_send_files) {
if(!pmode_send_final_files.contains(path)) {
pmode_send_final_files.add(path);
}
}
}else{
pmode_send_final_files.addAll(pmode_send_files);
for(String path:pmode_send_images) {
if(!pmode_send_final_files.contains(path)) {
pmode_send_final_files.add(path);
}
}
}
fabActionsHandler.setLabels(pmode_send_images.size()+" media selected",pmode_send_files.size()+"
files selected");
PListWriter pListWriter=new PListWriter();
pListWriter.execute();
}
qrCodeReaderView.setBackCamera();
qrCodeReaderView.startCamera();
qrDialog.show();
qrDialog.setOnDismissListener(dialog -> {
if(qrCodeReaderView!=null) {
qrCodeReaderView.stopCamera();
}
});
}
@Override
protected Void doInBackground(Void... voids) {
File file=new File("/data/data/"+getPackageName()+"/","pFilesList.bin");
StringBuffer data=new StringBuffer();
for(String path : pmode_send_final_files) {
data.append(path);
data.append("\n");
}
try {
FileOutputStream fileWriter=new FileOutputStream(file);
fileWriter.write(data.toString().getBytes());
fileWriter.close();
}catch (Exception e) {
//Do Nothing...
}
return null;
}
}
ImageView qr_view;
@Override
protected Void doInBackground(Void... voids) {
Logo logo = new Logo();
logo.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo));
logo.setBorderRadius(10);
logo.setBorderWidth(10);
logo.setScale(0.2f);
logo.setClippingRect(new RectF(0, 0, 200, 200));
com.github.sumimakito.awesomeqr.option.color.Color color=new
com.github.sumimakito.awesomeqr.option.color.Color();
color.setLight(Color.parseColor("#ffffff"));
color.setDark(Color.parseColor("#000000"));
color.setBackground(Color.parseColor("#ffffff"));
color.setAuto(false);
RenderOption renderOption = new RenderOption();
renderOption.setContent(url);
renderOption.setSize(800);
renderOption.setBorderWidth(20);
renderOption.setEcl(ErrorCorrectionLevel.H);
renderOption.setPatternScale(1.0f);
renderOption.setClearBorder(true);
renderOption.setRoundedPatterns(true);
renderOption.setColor(color);
renderOption.setLogo(logo);
try {
RenderResult render = AwesomeQrRenderer.render(renderOption);
if (render.getBitmap() != null) {
runOnUiThread(() -> {
RoundedBitmapDrawable dr =
RoundedBitmapDrawableFactory.create(getResources(),render.getBitmap());
dr.setCornerRadius(15f);
qr_view.setImageDrawable(dr);
});
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
.setPositiveButton("Allow", dialogClickListener)
.setNegativeButton("Don't Allow", dialogClickListener)
.setNeutralButton("Always allow this device", dialogClickListener)
.setTitle("Request Confirmation")
.setIcon(R.drawable.ic_logo)
.setCancelable(false).show();
TextView textView = dialog.findViewById(android.R.id.message);
TextView textView2 = dialog.findViewById(android.R.id.button1);
TextView textView3 = dialog.findViewById(android.R.id.button2);
TextView textView4 = dialog.findViewById(android.R.id.button3);
TextView textView5 = dialog.findViewById(getResources().getIdentifier( "alertTitle", "id",
"android" ));
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/product_sans.ttf");
textView.setTypeface(face);
textView2.setTypeface(face, Typeface.BOLD);
textView3.setTypeface(face, Typeface.BOLD);
textView4.setTypeface(face, Typeface.BOLD);
textView5.setTypeface(face, Typeface.BOLD);
} catch (Exception e) {
Log.d(Constants.LOG_TAG, "Dialog Error: " + e);
}
}
}
}
Chapter 5
Results and Snapshots
Figure 5.3: activity to start the file server Figure 5.4: activity to stop the file
Figure 5.5: QR is Generated for unique URL Figure 5.6: Request for Confirmation of
new Devices
Figure 5.9: Users can send and upload Files in the File manager
Chapter 6
Conclusion and Future Enhancements
CONCLUSION
Share Vault, developed using Android Studio, is a feature-rich and intuitive file sharing application.
Its web-based interface allows for easy access and efficient file sharing across various platforms,
including Windows, Mac, Linux, Android, and iPhone. The application's private mode ensures
limited file sharing, while the ability to view transfer history and real-time logs adds transparency
and accountability. Users can customize their experience through multiple web interface themes
and enjoy the convenience of a fast QR scanner. Share Vault’s lightweight design enables fast and
parallel file sharing, even in offline mode, without utilizing data.
FUTURE SCOPE
Looking ahead, future enhancements for Share Vault could focus on further bolstering security
features, such as implementing additional encryption and authentication mechanisms. Collaborative
capabilities, including real-time editing and version control, could facilitate seamless teamwork on
shared files. Integration with popular cloud storage services would provide users with expanded
storage options and accessibility. Advanced file management functionalities, including
organization, synchronization, and search capabilities, would enhance user productivity and
efficiency. Continuously optimizing performance and addressing user feedback and bug fixes
would ensure a reliable and user-friendly file sharing experience. By pursuing these enhancements,
Share Vault can evolve into a comprehensive and versatile solution for secure and efficient file
sharing across devices and platforms.
BIBLIOGRAPHY
[1] Android Programming Tutorials, 3rd Edition. By Mark L. Murphy
[2] https://developer.android.com/training/data-storage/manage-all-files
[3] https://developer.android.com/training/secure-file-sharing/share-file
[4] https://en.wikipedia.org/wiki/Android_Studio
[5] Mastering Android Application Development By Antonio Pachon Ruiz · 2015