added sharing and covertext

This commit is contained in:
Kevin Froman 2018-01-08 03:14:29 -06:00
parent b9e5537c1d
commit 7b146a198e
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
5 changed files with 68 additions and 13 deletions

View File

@ -27,17 +27,7 @@
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -4,6 +4,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/Snow10.iml" filepath="$PROJECT_DIR$/Snow10.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/snow10-android.iml" filepath="$PROJECT_DIR$/snow10-android.iml" />
</modules>
</component>
</project>

View File

@ -40,7 +40,12 @@
<div class="modal-body">
<br>
<pre id='output'></pre>
<div class='center'><button class="btn btn-success" data-clipboard-action="copy" data-clipboard-target="#output">Copy to Clipboard</button></div>
<center>
<div class="btn-group">
<button class="btn btn-primary" id="share">Share</button>
<button class="btn btn-success" data-clipboard-action="copy" data-clipboard-target="#output">Copy to Clipboard</button>
</div>
</center>
<div id='copyFeedback' class='center'></div>
</div>
<div class="modal-footer">
@ -63,6 +68,8 @@
<p class='center'>Bytes: <span id='countBytes'>0</span></p><br>
<div class='center'><button class='btn btn-sm btn-default dataItem' id='clearInputButton'>Clear Input <i class='fa fa-cross'></i></button></div>
<br>
<div class='center'><label>Text to hide inside: <input type='text' placeholder='Visible non-secret text' id='visibleText'></label></div>
<br>
<div class='center'>
<label>Use Zero-Width Characters <input type='checkbox' id='useZeroWidthCharacters' checked></label>
<br><br>

View File

@ -12,6 +12,18 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$('#share').click(function(){
console.log(AndroidFunction);
AndroidFunction.share($('#output').val());
$.bootstrapGrowl('shared', {type: 'success'})
});
function split2(str, delim) {
var parts=str.split(delim);
return [parts[0], parts.splice(1,parts.length).join(delim)];
}
var clipboard = new Clipboard('.btn');
var zero = '';
@ -173,7 +185,13 @@ function go(mode) {
}
// convert result to binary
output = textToBin(encodeURIComponent(input));
$('#output').text(replaceAll(replaceAll(output.toString(), "1", one), "0", zero));
output = replaceAll(replaceAll(output.toString(), "1", one), "0", zero);
coverText = $('#visibleText').val();
coverText = split2(coverText);
partOne = coverText[0];
partTwo = coverText[1];
$('#output').val(partOne + output + partTwo);
console.log(partOne + output + partTwo);
}
else
{

View File

@ -1,5 +1,6 @@
package net.chaoswebs.snow10;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
@ -8,6 +9,7 @@ import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -25,11 +27,47 @@ public class MainActivity extends AppCompatActivity {
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
public class JavascriptInterface{
Context mContext;
JavascriptInterface(Context c) {
mContext = c;
}
public void share(String action){
Intent intent2 = new Intent(); intent2.setAction(Intent.ACTION_SEND);
intent2.setType("text/plain");
intent2.putExtra(Intent.EXTRA_TEXT, action );
startActivity(Intent.createChooser(intent2, "Share via"));
}
}
*/
public class JavaScriptInterface {
Context mContext;
/** Instantiate the interface and set the context */
JavaScriptInterface(Context c) {
mContext = c;
}
/** Show a toast from the web page */
@JavascriptInterface
public void share(String action){
Intent intent2 = new Intent(); intent2.setAction(Intent.ACTION_SEND);
intent2.setType("text/plain");
intent2.putExtra(Intent.EXTRA_TEXT, action );
startActivity(Intent.createChooser(intent2, "Share via"));
}
}
private WebView view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
@ -50,6 +88,7 @@ public class MainActivity extends AppCompatActivity {
});
view.getSettings().setJavaScriptEnabled(true);
view.addJavascriptInterface(new JavaScriptInterface(this), "AndroidFunction");
view.loadUrl("file:///android_asset/index.html");
setContentView(view);
}