1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-06-26 05:24:52 +02:00

improved share activity

This commit is contained in:
scoute-dich 2016-03-19 23:20:22 +01:00
parent a49f558e9a
commit 849b8151a5
2 changed files with 30 additions and 6 deletions

View file

@ -37,7 +37,7 @@
<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_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -20,6 +20,7 @@
package de.baumann.diaspora;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
@ -249,11 +250,10 @@ public class ShareActivity extends MainActivity {
finish();
Snackbar.make(swipeView, R.string.please_reload, Snackbar.LENGTH_INDEFINITE).show();
Intent i = new Intent(ShareActivity.this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
overridePendingTransition(0, 0);
return false;
}
@ -282,11 +282,10 @@ public class ShareActivity extends MainActivity {
finish();
Snackbar.make(swipeView, R.string.please_reload, Snackbar.LENGTH_INDEFINITE).show();
Intent i = new Intent(ShareActivity.this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
overridePendingTransition(0, 0);
return false;
}
@ -294,7 +293,7 @@ public class ShareActivity extends MainActivity {
webView.loadUrl("javascript:(function() { " +
"document.getElementsByTagName('textarea')[0].style.height='110px'; " +
"document.getElementsByTagName('textarea')[0].innerHTML = ' > " + extraText + " [shared with #DiasporaWebApp]'; " +
"document.getElementsByTagName('textarea')[0].innerHTML = '> " + extraText + " *[shared with #DiasporaWebApp]*'; " +
" if(document.getElementById(\"main_nav\")) {" +
" document.getElementById(\"main_nav\").parentNode.removeChild(" +
" document.getElementById(\"main_nav\"));" +
@ -319,6 +318,31 @@ public class ShareActivity extends MainActivity {
}
@Override
public void onActivityResult (int requestCode, int resultCode, Intent data) {
if(requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
super.onActivityResult(requestCode, resultCode, data);
return;
}
Uri[] results = null;
if(resultCode == Activity.RESULT_OK) {
if(data == null) {
if(mCameraPhotoPath != null) {
results = new Uri[]{Uri.parse(mCameraPhotoPath)};
}
} else {
String dataString = data.getDataString();
if (dataString != null) {
results = new Uri[]{Uri.parse(dataString)};
}
}
}
mFilePathCallback.onReceiveValue(results);
mFilePathCallback = null;
}
private File createImageFile() throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";