Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions ImageSteganographyLibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'
android {
compileSdkVersion 26



compileSdkVersion 34
namespace "com.ayush.imagesteganographylibrary"
buildFeatures {
viewBinding true
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"



}

buildTypes {
Expand All @@ -24,6 +20,14 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

configurations.all {
Expand All @@ -34,8 +38,6 @@ configurations.all {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Expand Down
3 changes: 1 addition & 2 deletions ImageSteganographyLibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ayush.imagesteganographylibrary" />
<manifest />
30 changes: 23 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 26
compileSdkVersion 34
namespace "com.ayush.steganography"
buildFeatures {
viewBinding true
}

defaultConfig {
applicationId "com.ayush.steganography"
minSdkVersion 19
targetSdkVersion 26
minSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}

}

configurations.all {
Expand All @@ -28,10 +42,12 @@ configurations.all {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.core:core-ktx:1.13.1'

implementation project(':ImageSteganographyLibrary')

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':ImageSteganographyLibrary')
}
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ayush.steganography">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand All @@ -23,7 +22,7 @@

<provider
android:authorities="it.steganography.fileprovider"
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
Expand Down
60 changes: 14 additions & 46 deletions app/src/main/java/com/ayush/steganography/Decode.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,44 @@
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import com.ayush.imagesteganographylibrary.Text.AsyncTaskCallback.TextDecodingCallback;
import com.ayush.imagesteganographylibrary.Text.ImageSteganography;
import com.ayush.imagesteganographylibrary.Text.TextDecoding;

import com.ayush.steganography.databinding.ActivityDecodeBinding;
import java.io.IOException;

public class Decode extends AppCompatActivity implements TextDecodingCallback {

private ActivityDecodeBinding binding;
private static final int SELECT_PICTURE = 100;
private static final String TAG = "Decode Class";
//Initializing the UI components
private TextView textView;
private ImageView imageView;
private EditText message;
private EditText secret_key;
private Uri filepath;
//Bitmap
private Bitmap original_image;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityDecodeBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setContentView(R.layout.activity_decode);

//Instantiation of UI components
textView = findViewById(R.id.whether_decoded);

imageView = findViewById(R.id.imageview);

message = findViewById(R.id.message);
secret_key = findViewById(R.id.secret_key);

Button choose_image_button = findViewById(R.id.choose_image_button);
Button decode_button = findViewById(R.id.decode_button);

//Choose Image Button
choose_image_button.setOnClickListener(new View.OnClickListener() {
binding.chooseImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImageChooser();
}
});

//Decode Button
decode_button.setOnClickListener(new View.OnClickListener() {
binding.decodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (filepath != null) {

//Making the ImageSteganography object
ImageSteganography imageSteganography = new ImageSteganography(secret_key.getText().toString(),
ImageSteganography imageSteganography = new ImageSteganography( binding.secretKey.getText().toString(),
original_image);

//Making the TextDecoding object
Expand All @@ -74,8 +53,6 @@ public void onClick(View view) {
}
}
});


}

private void ImageChooser() {
Expand All @@ -88,20 +65,16 @@ private void ImageChooser() {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

//Image set to imageView
if (requestCode == SELECT_PICTURE && resultCode == RESULT_OK && data != null && data.getData() != null) {

filepath = data.getData();
try {
original_image = MediaStore.Images.Media.getBitmap(getContentResolver(), filepath);

imageView.setImageBitmap(original_image);
binding.imageview.setImageBitmap(original_image);
} catch (IOException e) {
Log.d(TAG, "Error : " + e);
}
}

}

@Override
Expand All @@ -111,24 +84,19 @@ public void onStartTextEncoding() {

@Override
public void onCompleteTextEncoding(ImageSteganography result) {

//By the end of textDecoding

if (result != null) {
if (!result.isDecoded())
textView.setText("No message found");
binding.whetherDecoded.setText("No message found");
else {
if (!result.isSecretKeyWrong()) {
textView.setText("Decoded");
message.setText("" + result.getMessage());
binding.whetherDecoded.setText("Decoded");
binding.message.setText("" + result.getMessage());
} else {
textView.setText("Wrong secret key");
binding.whetherDecoded.setText("Wrong secret key");
}
}
} else {
textView.setText("Select Image First");
binding.whetherDecoded.setText("Select Image First");
}


}
}
Loading