0% found this document useful (0 votes)
68 views79 pages

Secure Vault Mobile Application

The document describes a mobile application project titled "Secure Share Vault". It was developed by Ashutosh Kumar Singh, a student of MS Engineering College, as part of their sixth semester mini project. The app aims to provide a secure and convenient platform for file sharing across different devices and operating systems. It offers features like private file sharing, transfer history logs, customizable themes and QR code scanning for file sharing. The app is optimized for fast and parallel file sharing without consuming data. Overall, "Secure Share Vault" provides a secure, user-friendly and versatile solution for file sharing catering to individuals and organizations.

Uploaded by

Megha Kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views79 pages

Secure Vault Mobile Application

The document describes a mobile application project titled "Secure Share Vault". It was developed by Ashutosh Kumar Singh, a student of MS Engineering College, as part of their sixth semester mini project. The app aims to provide a secure and convenient platform for file sharing across different devices and operating systems. It offers features like private file sharing, transfer history logs, customizable themes and QR code scanning for file sharing. The app is optimized for fast and parallel file sharing without consuming data. Overall, "Secure Share Vault" provides a secure, user-friendly and versatile solution for file sharing catering to individuals and organizations.

Uploaded by

Megha Kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 79

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNAMA SANGAMA,
BELGAVI – 590018

Mini Project Report


On

“Secure Share Vault Mobile Application”


Submitted in the partial fulfilment of Sixth Semester Mobile Application Development Laboratory
Mini Project Work
BACHELOR OF
ENGINEERING IN
COMPUTER SCIENCE AND ENGINEERING
By
Ashutosh Kumar Singh 1ME20CS009
Under the guidance of
Mrs. Sasi Reka M
Assistant Professor, CSE Dept.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

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.

Signature of Guide Signature of HOD


Mrs. Sasi Reka M Dr. Malatesh S.H,
Assistant Professor, Dept. of CSE HOD, Dept. of CSE

Internal Examiner Name Signature


--------------------------- ------------------
External Examiner Name Signature
--------------------------- -------------------

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.

ASHUTOSH KUMAR SINGH 1ME20CS009


TABLE OF

CONTENTS Page No.

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

5. RESULTS AND SNAPSHOTS 52

6. CONCLUSION AND FUTURE ENCHANCEMENTS 56

7. BIBLIOGRAPHY 57
Chapter 1
INTRODUCTION
1.1 Overview

Mobileapplication development istheprocesstomaking software forsmartphones 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 yourappallthewaypastthepotentialhurdlesofdistribution. Fortunately,
byfollowinga 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-developerto 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.

Dept. of CSE,
Pag 2022-
Secure Share Vault Mobile

1.2 Problem Statement

The aim of this project is to create an application to demonstrate a basic media


player that allowsthe user toforward, backward, playand pause an audio. It also makes
use ofthe indicator in theseek barto movetheaudio forward or backward asrequired.

1.3 Mobile Application Development Need & Importance


Appdevelopment isessential today for an online business. Ifyou want to boost your
sales using technology, app development is truly recommended for everyone. Here listed 4
reasons that you need to know how much it notable is.

1. Accessibilityfrom Varietyof Platforms

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 isvery closeto an afterthought, merely crucial while making theadvertising
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.

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

3. Efficiency and Effectiveness


Effectiveness and efficiency: Business management of internet based use is
conducted with effectiveness and also performance. Can decrease their functional expenses
whilst at the same time improving the effectiveness of their procedures. Can decrease their
producing expenditures, which make your company environment friendly. Threatened
functions offer customers the ability of handling their companies and never have to get the
cost of employing an additional worker for carrying this out train.
Internet based functions will not need customers to install these types of on their hard disk
drives that lead to the decrease of memory space. Moreover, any specific up-to-date
variations can be found immediately for the customers. The dependable and also efficiently
created internet based functions are created to make sure that they are suitable for all of the
different internet browsers, working devices, and alsoequipment.

4. To engage with customers everywhere


You can involve with your all types of customers everywhere by developing your apps
system. Modernandupdatedappsperform multipletaskinbusinessaswellasothersite too.
You should develop your apps system that is really user friendly and easy to access so that
customer can contact anytime from anywhere they are.

1.4 Android Studio


In recent times, Android became the world's most popular operating system for
various reasons. As an Android programmer, I want to share what the Android Studio
is? Android Studio is an IDE for Google Android Development launched on 16th May
2013, during Google's I/O2013event.Android
StudiocontainsalltheAndroidtoolstodesign, test, debug, and profile your application. The
Android Studio uses Gradle to manage your project, a Build Automation Tool.
For developing your first app, you need to download Android Studio for your preferred
platform (Windows , Mac OS X, or Linux) from the Android developers site. Android
Studio can develop and test your application on either a real device or an emulator.

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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 hasmany exciting features thatcan helpyoutodevelopyour 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 arobust static analysis framework and includes over 365
checks across the entirety of the app.

• includes project and code templates that make it easy to add well-
patterns such as a navigation drawer and view pager.

• offers build automation, dependency management, and customizable


configurations.

• integrateswithversion control tools, such asGitHub and Subversion, soyou


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.

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

The user interface


Figure 1.4.1 The Android Studio main window.

• 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.
• Theeditorwindow iswhere youcreate 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 toolwindows.
• 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.

Dept. of CSE, Page 2022 -


Chapter 2
SYSTEM REQUIREMENTS

2.1 Software Requirements

Software requirements deal with defining software resource requirements and


prerequisites that need to be installed on a computer to provide optimal functioning
of an application.

The following are the software requirements for the application:

• Operating System: Windows 10

• Development Environment: Android Studio 4.2

• API: Java Development Kit (JDK) 11

• Core Language: Java, XML for Front-end.

2.2 Hardware Requirements


The most common set of requirements defined by any operating system or
software application is the physical computer resources, also known as hardware.
• CPU: Intel processor with support for Intel VT-x (Intel 64)

• Cores: Dual-Core (Quad-Core recommended)

• RAM: minimum 4GB(>4GBrecommended)

• Secondary Storage: 250GB hard disk space plus at least


IGB for Android SDK, Emulator Systemimages, and
cashes.
• Screen resolution: 1366 x 800

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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

 Web-Based Interface: The application provides a user-friendly web-based interface,


making it accessible from any device with an internet connection.

 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.

Dept. of CSE, Page 8 2022 -


Secure Share Vault Mobile

 Lightweight and Fast: The application is designed to be lightweight, enabling faster


and parallel file sharing without compromising performance.

3.1.1 Data Flow Diagram


Data Flow Diagrams are a Graphical tool used to describe and analyze the movement of data
through a system and future physical implementation of the system. The DFD is a graphical
technique that depicts the information flow and the transforms that are applies as data move
from input to the output.
Level-0 DFD: This Shows outline of the System Models.

Figure 3.1 Level-0 DFD outline of the System Model

Dept. of CSE, Page 9 2022 -


Secure Share Vault Mobile

3.2 XML Code

3.2.1 activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_color"
tools:context=".MainActivity"
tools:openDrawer="end">

<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"

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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" />

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

</androidx.drawerlayout.widget.DrawerLayout>
3.2.2 activity_transfer_history.xml

<?xml version="1.0" encoding="utf-8"?>


<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/transfer_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_color"
tools:context=".TransferHistory">

<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"

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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"

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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"

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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>

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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.

 onUpgrade(SQLiteDatabase db, int oldVersion, int


newVersion): Called when the database needs to be upgraded.
Drops the existing table if it exists.

 addDevice(String id, int type):


Inserts a new device entry into the database with the provided id and type.
Returns true if the insertion is successful, false otherwise.

 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

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

 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.

 sendLog(String action, String key, String value):


This function is used to send log messages to the activity. It broadcasts an intent with log-
related data, including the action, key, and value, to be consumed by the activity. It
allows for logging and monitoring server-related events.

 pushHistory(File f, int itemType):


The pushHistory function adds a file transfer history item to the database. It records
relevant information about the transferred file, such as its name, size, date, and type. This
function is called when a file is transferred, and it updates the transfer history with the
details of the file transfer.

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

4.1 Java Code


4.1 XML Code

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, Page 2022 -


Secure Share Vault Mobile

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;

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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;

public class MainActivity extends AppCompatActivity {


private final String[] PERMISSIONS = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
};

private ImageButton serverBtn,hide_logger_btn;


Utils utils;
String url = "";

Timer progressTimer = new Timer();


boolean isAuthDialogOpened =
false;

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

private ProgressDialog progress;

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

private String serverRoot = null;


private ConstraintLayout settings_view, main_view, qr_view,
logger_wrapper; private TextView settDRoot, settRemDev, settTheme;
private TextView logger;
private TextView
scan_url;

private ImageView
main_bg,second_bg; BroadcastReceiver
updateUIReciver;
List<String> pmode_send_images = new ArrayList<>(), pmode_send_files = new
ArrayList<>(), pmode_send_final_files = new ArrayList<>();
ThemesData themesData = new ThemesData();
private DrawerLayout drawerLayout;
Dialog qrDialog;

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();

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

deviceManager = new
DeviceManager(this);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

qrDialog = new Dialog(this);


serverBtn = findViewById(R.id.serverBtn);
settings_view =
findViewById(R.id.settings_view); main_view =
findViewById(R.id.main_view); qr_view =
findViewById(R.id.qr_view);
settings_view.setVisibility(View.GONE);

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);

ImageButton nav_btn = findViewById(R.id.nav_btn);


nav_btn.setOnClickListener(v -> drawerLayout.openDrawer(GravityCompat.START));

//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);

logger.setOnLongClickListener(v -> true);


clearLog();

fabActionsHandler = new FabActionsHandler(this, this);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

storagePermissionResultLauncher = registerForActivityResult(new
ActivityResultContracts.StartActivityForResult(), result -> {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && requestingStorage) {

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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);
});

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {


initRequestPermissions();

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

} else {
initializeApp();
}

// Initialise Root Setter Dialog


DialogProperties properties = new DialogProperties();
properties.selection_mode = DialogConfigs.SINGLE_MODE;
properties.selection_type = DialogConfigs.DIR_SELECT;
properties.root = Environment.getExternalStorageDirectory();
properties.error_dir = Environment.getExternalStorageDirectory();
if (serverRoot.length() > 0) {
properties.offset = new File(utils.getParent(serverRoot));
} else {
properties.offset = Environment.getExternalStorageDirectory();
}
properties.extensions = null;

IntentFilter filter = new IntentFilter();


filter.addAction("service.to.activity.transfer");
updateUIReciver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, final Intent intent)
{ if (intent != null) {
parseBroadcast(intent);
}
}
};
registerReceiver(updateUIReciver, filter);
FloatingActionButton qrBtn = findViewById(R.id.qrBtn);
qrBtn.setOnClickListener(v -> toggleQRView());
hide_logger_btn.setOnClickListener(v -> {
toggleLogger();
});

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

fabActionsHandler.setFabActionsHandlerListener(new
FabActionsHandler.FabActionsHandlerListener() {

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

@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();

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

}
});

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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);
}
}

ImageButton url_cpy_btn = findViewById(R.id.url_cpy_btn);


ImageButton url_share_btn =
findViewById(R.id.url_share_btn);
url_cpy_btn.setOnClickListener(view -> {
// Copying code
if (url.length() > 0) {
ClipboardManager clipboard = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("ShareVault URL", url);
clipboard.setPrimaryClip(clip);
showSnackbar("URL Copied!");
}else{
showSnackbar("Start ShareVault First!");
}
});
url_share_btn.setOnClickListener(view -> {
if (url.length() > 0) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Sharing Url...");

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

sharingIntent.putExtra(Intent.EXTRA_TEXT, url);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

startActivity(Intent.createChooser(sharingIntent, "Sharing ShareVault Url"));


}else{
showSnackbar("Start ShareVault first!");
}
});
fabActionsHandler.init();
}

@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, Page 2022 -
Secure Share Vault Mobile

// Function For Double Tap Exit


public void exit() {
if(exit==0) {
Toast.makeText(this,"Press One More Time To
Exit!",Toast.LENGTH_LONG).show(); Timer myTimer=new Timer();
myTimer.schedule(new TimerTask()
{ @Override
public void run()
{ exit=0;
}
},2000);
exit++;
}
if(exit==1) {
exit++;
}else if(exit==2) {
finishAffinity();
}
}

@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

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void onActivityResult(int requestCode, final int resultCode, Intent intent)


{ switch (requestCode) {
case Constants.MATISSE_REQ_CODE:
if(resultCode == RESULT_OK) {
pmode_send_images=new ArrayList<>();
List<Uri> mSelected = Matisse.obtainResult(intent);
pmode_send_images=utils.uriListResolve(mSelected);
mergeAndUpdatePFilesList();
}
break;
}
super.onActivityResult(requestCode, resultCode, intent);
}

@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();

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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");

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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, Page 2022 -


Secure Share Vault Mobile

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, Page 2022 -


Secure Share Vault Mobile

});

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

setUp_settingsListener();
}

public void askIgnoreBatteryOptimizations() { if(!


utils.loadSetting(Constants.ASKED_BATTERY_OPT)) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (pm != null && !pm.isIgnoringBatteryOptimizations(getPackageName())) {
Intent intent = new
Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + getPackageName()));
batteryActivityResultLauncher.launch(intent);
}
}
}
}

public boolean checkStoragePermissions() {


if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <
Build.VERSION_CODES.R) {
return ActivityCompat.checkSelfPermission(this,PERMISSIONS[0]) ==
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,PERMISSIONS[1]) ==
PackageManager.PERMISSION_GRANTED;
}
return true;
}

public boolean checkCameraPermission() {


return ActivityCompat.checkSelfPermission(this,Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED;
}

public void requestCameraPermission() {


if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
requestPermissions(new String[]
{Manifest.permission.CAMERA},Constants.CAMERA_REQ_CODE);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void requestStoragePermissions() {


if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
{
try {
if (!Environment.isExternalStorageManager())
{ Intent intent = new
Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("package:"+getPackageName()));
storagePermissionResultLauncher.launch(intent);
}
} catch (Exception e) {
if (!Environment.isExternalStorageManager())
{ Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
storagePermissionResultLauncher.launch(intent);
}
}
}
}

public void initRequestPermissions() {


if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <
Build.VERSION_CODES.R) {
requestPermissions(PERMISSIONS,Constants.STORAGE_REQ_CODE);
}else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
if (!Environment.isExternalStorageManager())
{ requestStoragePermissions();
} else {
initializeApp();
}
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

@Override

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,


@NonNull int[] grantResults) {
if(requestCode == Constants.STORAGE_REQ_CODE)
{ if (!checkStoragePermissions()) {
initRequestPermissions();
return;
}
initializeApp();
}else if(requestCode == Constants.CAMERA_REQ_CODE) {
if(checkCameraPermission()) {
initQrScanner();
}
}else{
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}

public void parseBroadcast(final Intent intent) {


String action=intent.getStringExtra("action");
if(action.equals(Constants.ACTION_URL)) {
runOnUiThread(() -> {
url=intent.getStringExtra("url");
pushLog("Server started at: "+url,true);
if(!utils.loadSetting(Constants.IS_LOGGER_VISIBLE)) {
showSnackbar("Server started at: "+url);
}
});
}else if(action.equals(Constants.ACTION_MSG)) {
runOnUiThread(() -> pushLog(intent.getStringExtra("msg"),true));
}else if(action.equals(Constants.ACTION_PROGRESS)){
changeP(intent.getIntExtra("value",100));
}else if(action.equals(Constants.ACTION_AUTH)) {
showAuthDialog(intent.getStringExtra("device_id"));
}else if(action.equals(Constants.ACTION_UPDATE_UI_STOP))
{ runOnUiThread(()->{
changeUI(Constants.SERVER_OFF);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

});
}
}

private void toggleLogger()


{ Animation animation;
int modifier = logger_wrapper.getHeight() - 115;
utils.saveString(Constants.LOGGER_HEIGHT,String.valueOf(modifier));
animation = utils.loadSetting(Constants.IS_LOGGER_VISIBLE) ? new TranslateAnimation(0,
0,0, modifier) : new TranslateAnimation(0, 0,modifier, 0);
animation.setDuration(500);
animation.setAnimationListener(new Animation.AnimationListener()
{ @Override
public void onAnimationStart(Animation animation) {
if(utils.loadSetting(Constants.IS_LOGGER_VISIBLE)) {
ViewGroup.MarginLayoutParams params =
(ViewGroup.MarginLayoutParams) logger_wrapper.getLayoutParams();
params.bottomMargin = 0;
logger_wrapper.setLayoutParams(params);
}
}

@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);
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

@Override
public void onAnimationRepeat(Animation animation) {}
});
logger_wrapper.startAnimation(animation);

utils.saveSetting(Constants.IS_LOGGER_VISIBLE,!utils.loadSetting(Constants.IS_LOGGER_VISIBLE));
}

private void setUp_settingsListener() {


CardView card1=findViewById(R.id.sett_card1);
CardView card2=findViewById(R.id.sett_card2);
CardView card3=findViewById(R.id.sett_card3);
CardView card4=findViewById(R.id.sett_card4);
CardView card5=findViewById(R.id.sett_card5);
CardView card6=findViewById(R.id.sett_card6);
CardView card7=findViewById(R.id.sett_card7);
CardView card8=findViewById(R.id.sett_card8);
CheckBox settHFCheck=findViewById(R.id.sett_hideF_checkBox);
CheckBox settRMCheck=findViewById(R.id.sett_resMod_checkBox);
CheckBox settFDCheck=findViewById(R.id.sett_frceDwl_checkBox);
CheckBox settPMCheck=findViewById(R.id.sett_pMode_checkBox);
TextView settPort=findViewById(R.id.sett_subtitle8);
ImageButton settResetRoot = findViewById(R.id.sett_reset_root);
card1.setOnClickListener(view -> {
try {
Intent i = new
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
i.addCategory(Intent.CATEGORY_DEFAULT);
Intent fIntent = Intent.createChooser(i, "Choose server
root"); folderPickerResultLauncher.launch(fIntent);
}catch (Exception e) {
Log.d(Constants.LOG_TAG,e.toString());
}
});
settDRoot.setText(serverRoot);
settPort.setText("Port:

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

"+utils.loadInt(Constants.SERVER_PORT,Constants.SERVER_PORT_DEFAULT));

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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 -> {

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

AlertDialog.Builder builder = new


AlertDialog.Builder(MainActivity.this); builder.setTitle("Choose
Theme");
builder.setSingleChoiceItems(themesData.getDisplayList(), currentTheme, (dialog, which) ->
{ currentTheme = which;
});
builder.setPositiveButton("Set", (dialog, which) -> {
utils.saveInt(Constants.WEB_INTERFACE_THEME, currentTheme);
settTheme.setText(themesData.getDisplayItem(currentTheme));
dialog.dismiss();
});
builder.setNegativeButton("Cancel", (dialog, which) -> {
currentTheme = utils.loadInt(Constants.WEB_INTERFACE_THEME,0);
dialog.dismiss();
});
builder.show();
});
card8.setOnClickListener(v-> {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("ShareX Port:");
builder.setMessage("Please enter a port number between 1024 and 65535");
TextInputLayout textInputLayout = new
TextInputLayout(MainActivity.this);

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());

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

if(port >= 1024 && port <= 65535) {


utils.saveInt(Constants.SERVER_PORT, port);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

settPort.setText("Port: " + port);


Toast.makeText(MainActivity.this, "ShareX port changed to " +
port, Toast.LENGTH_LONG).show();
dialog.dismiss();
restartServer();
}else{
Toast.makeText(MainActivity.this, "Please enter a valid port
number", Toast.LENGTH_LONG).show();
}
}
});
builder.setNegativeButton("Cancel", (dialog, which) -> {
dialog.dismiss();
});
builder.show();
});
settResetRoot.setOnClickListener(view -> {
serverRoot = Environment.getExternalStorageDirectory().toString();
utils.saveRoot(serverRoot);
pushLog("Server root changed to " + serverRoot, true);
settDRoot.setText(serverRoot);
restartServer();
});
}

private void toggleSettings() {


qr_view.setVisibility(View.GONE);
if(settings_view.getVisibility()==View.GONE) {
settings_view.setVisibility(View.VISIBLE);
main_view.setVisibility(View.GONE);
}else{
settings_view.setVisibility(View.GONE);
main_view.setVisibility(View.VISIBLE);
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void restartServer() {


if(utils.isServiceRunning(ServerService.class)) {
changeUI(Constants.SERVER_OFF);
stopServer();
pushLog("Restarting server...",
true); new Handler().postDelayed(()
-> {
if(isValidIP()) {
startServer();
changeUI(Constants.SERVER_ON);
}else{
showSnackbar("Make sure your hotspot is open or wifi connected...");

}
}, 2000);
}
}

public void stopServer() {


if(utils.isServiceRunning(ServerService.class)) {
Intent intent = new Intent(MainActivity.this,
ServerService.class); stopService(intent);
}
url="";
fabActionsHandler.setLabels("0 media selected","0 files selected");
deviceManager.clearTmp();
JunkCleaner junkCleaner=new
JunkCleaner(); junkCleaner.execute();
}

public void pushLog(String log,boolean b) {


if(logger==null) {
logger=findViewById(R.id.logger);
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

logger.append("$ "+log+"\n");

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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...
}
}
}

private void clearLog() {


String str = "$ Welcome to "+getString(R.string.app_name)+"\n";
logger.setText(str);
logger.scrollTo(0, 0);
}

private boolean isValidIP() {


WifiApManager wifiApManager=new WifiApManager(getApplicationContext());
return wifiApManager.isWifiApEnabled() || checkWifiOnAndConnected();
}

private boolean checkWifiOnAndConnected()


{ WifiManager wifiManager =
(WifiManager)
getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if(wifiInfo!=null) {
SupplicantState supState = wifiInfo.getSupplicantState();
return supState.toString().equals("COMPLETED");
}else{
return false;
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void startServer() { if(!


utils.isServiceRunning(ServerService.class)) {
Intent intent = new Intent(MainActivity.this,
ServerService.class); startService(intent);
}
}

public void toggleQRView() {


if(qr_view.getVisibility()==View.GONE) {
main_view.setVisibility(View.GONE);
qr_view.setVisibility(View.VISIBLE);
if(url.length()>0) {

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!");
}
}

public void showAbout() {


AlertDialog.Builder builder = new AlertDialog.Builder(this);
final View customLayout = getLayoutInflater().inflate(R.layout.about_view,
null); builder.setView(customLayout);
AlertDialog dialog =
builder.create(); dialog.show();
}
Dept. of CSE, Page 2022 -
Secure Share Vault Mobile

public void changeP(int progress) {


if(progress<=100) {
try {
final ProgressBar pBar;
pBar=findViewById(R.id.progressBar);
if(pBar.getVisibility()==ProgressBar.GONE) {
pBar.setVisibility(View.VISIBLE);
}
pBar.setProgress(progress);
if(progress==100) {
pBar.setVisibility(View.GONE);
}else{

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);
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

}catch (Exception e) {
Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show();
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

private void privateMode() {


boolean b=utils.loadSetting(Constants.PRIVATE_MODE);
ConstraintLayout
topPanel=findViewById(R.id.top_panel); if(b) {
topPanel.setVisibility(View.VISIBLE);
}else{
topPanel.setVisibility(View.GONE);
}
}

private void mergeAndUpdatePFilesList() {

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();
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

private void changeUI(int code) {


if(code==Constants.SERVER_ON) {
serverBtn.setImageResource(R.drawable.ic_stop);
main_bg.setImageResource(R.drawable.trans_off_to_on);
second_bg.setImageResource(R.drawable.bg_red);
((TransitionDrawable) main_bg.getDrawable()).startTransition(200);
}else if(code==Constants.SERVER_OFF) {
serverBtn.setImageResource(R.drawable.ic_start);
main_bg.setImageResource(R.drawable.trans_on_to_off);
second_bg.setImageResource(R.drawable.bg_green);
((TransitionDrawable) main_bg.getDrawable()).startTransition(200);
}
}

private void initQrScanner() {


qrDialog.setContentView(R.layout.qr_scanner_layout);
final QRCodeReaderView qrCodeReaderView=qrDialog.findViewById(R.id.qrdecoderview);
final PointsOverlayLayout pointsOverlayView =
qrDialog.findViewById(R.id.points_overlay_view);
qrCodeReaderView.setOnQRCodeReadListener((text, points) -> {
pointsOverlayView.setPoints(points);
if(text.startsWith("http")) {
qrDialog.dismiss();
if(qrCodeReaderView!=null) {
qrCodeReaderView.stopCamera();
}
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(text));
startActivity(i);
}catch (Exception e) {
//Do Nothing
}
}
});

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

qrCodeReaderView.setAutofocusInterval(2000L);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

qrCodeReaderView.setBackCamera();
qrCodeReaderView.startCamera();
qrDialog.show();
qrDialog.setOnDismissListener(dialog -> {
if(qrCodeReaderView!=null) {
qrCodeReaderView.stopCamera();
}
});
}

public class JunkCleaner extends AsyncTask<Void,Void,Void> {


@Override
protected Void doInBackground(Void... voids) {
File file=new File("/data/data/"+getPackageName()+"/","pFilesList.bin");

File temp=new File(Environment.getExternalStorageDirectory()+"/ShareVault/.temp");


File cache = new File("/data/data/" + getPackageName() + "/cache");
if(temp.exists()) {
utils.deleteFileOrDir(temp);
}
if(cache.exists()) {
utils.deleteFileOrDir(cache);
}
String blnk="";
try {
FileOutputStream fileWriter=new
FileOutputStream(file); fileWriter.write(blnk.getBytes());
fileWriter.close();
}catch (Exception e) {
//Do Nothing...
}
return null;
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public class PListWriter extends AsyncTask<Void,Void,Void> {

@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;
}
}

public class GenerateQR extends AsyncTask<Void,Void,Void> {

ImageView qr_view;

public GenerateQR(ImageView imageView) {


this.qr_view = imageView;
}

@Override
protected Void doInBackground(Void... voids) {
Logo logo = new Logo();
logo.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_logo));

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

logo.setBorderRadius(10);

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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;
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

public void showSnackbar(String msg) {


DrawerLayout drawerLayout=findViewById(R.id.root_container);
Snackbar snackbar = Snackbar.make(drawerLayout, msg,
Snackbar.LENGTH_LONG);
snackbar.setBackgroundTint(Color.parseColor("#000a12"));
snackbar.show();
}

public void showAuthDialog(final String device_id) {


DialogInterface.OnClickListener dialogClickListener = (dialog, which) ->
{
isAuthDialogOpened=false;
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
deviceManager.addDevice(device_id,Constants.DEVICE_TYPE_TEMP);
break;
case DialogInterface.BUTTON_NEGATIVE:
deviceManager.addDevice(device_id,Constants.DEVICE_TYPE_DENIED);
break;
case DialogInterface.BUTTON_NEUTRAL:
deviceManager.addDevice(device_id,Constants.DEVICE_TYPE_PERMANENT);
break;
}
Timer myTimer=new Timer();
myTimer.schedule(new TimerTask()
{
@Override
public void run() {
String count = deviceManager.getRemDevices() + " devices
remembered"; MainActivity.this.runOnUiThread(() ->
settRemDev.setText(count));
}
},500);
};
if(!isAuthDialogOpened) {

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

isAuthDialogOpened=true;
try {
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this)
.setMessage("Incoming new device request!\nAre you sure to allow this device?")

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

.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);
}
}
}
}

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

Chapter 5
Results and Snapshots

 Permission pop-up when application is opened for the first time


A permission pop-up appears when the user opens the Music Player Application for the first
time asking for access to manage all files present on the user’s Device.

Figure 5.1: Storage permission to Figure 5.2: permission to


manage all files. Run in background

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

 Seamlessly Sharing of Files from one Device to another:


when both the devices are on the Same Network, a HTTP Ip address and a
port number 6060 is generated. Through which users can access their files
over the web version.

Figure 5.3: activity to start the file server Figure 5.4: activity to stop the file

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

 Security and Authentication:


Whenever the user visits the URL with the unique IP address every time, it ask for
Authentication approval in the application. It request for the incoming new device.

Figure 5.5: QR is Generated for unique URL Figure 5.6: Request for Confirmation of
new Devices

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

Figure 5.7: Waiting for authentication screen

Figure 5.8: Users Can Access all the Files

Figure 5.9: Users can send and upload Files in the File manager

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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.

Dept. of CSE, Page 2022 -


Secure Share Vault Mobile

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

Dept. of CSE, Page 2022 -

You might also like