1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-22 19:08:03 +01:00

version 1.2 see changelog

This commit is contained in:
scoute-dich 2016-03-19 10:52:12 +01:00
parent 1ed671183e
commit a49f558e9a
7 changed files with 111 additions and 22 deletions

View file

@ -1,3 +1,7 @@
### v1.2
- using strings in podactivity
- improved share activity
### v1.1
- new about app and help dialogs
- better snackbar integration

View file

@ -9,8 +9,8 @@ android {
applicationId "de.baumann.diaspora"
minSdkVersion 15
targetSdkVersion 23
versionCode 10
versionName "1.1.1"
versionCode 15
versionName "1.2"
}
buildTypes {
release {

View file

@ -45,12 +45,14 @@
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/new_post"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait" >
<intent-filter android:label="@string/diaspora"
android:icon="@drawable/ic_launcher">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="text/*" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>

View file

@ -148,7 +148,6 @@ public class MainActivity extends AppCompatActivity
R.color.fab_big);
webView = (WebView)findViewById(R.id.webView);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.addJavascriptInterface(new JavaScriptInterface(), "NotificationCounter");
if (savedInstanceState != null) {

View file

@ -168,7 +168,7 @@ public class PodsActivity extends ActionBarActivity {
new AlertDialog.Builder(PodsActivity.this)
.setTitle(getString(R.string.confirmation))
.setMessage(getString(R.string.confirm_pod)+podDomain+"?")
.setPositiveButton("YES",
.setPositiveButton(R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
@ -199,7 +199,7 @@ public class PodsActivity extends ActionBarActivity {
finish();
}
})
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@TargetApi(11)
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();

View file

@ -29,6 +29,8 @@ import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@ -49,7 +51,6 @@ import java.util.Date;
import de.baumann.diaspora.utils.Helpers;
public class ShareActivity extends MainActivity {
private WebView webView;
@ -57,28 +58,34 @@ public class ShareActivity extends MainActivity {
private String podDomain;
private ValueCallback<Uri[]> mFilePathCallback;
private String mCameraPhotoPath;
private TextView txtTitle;
private com.getbase.floatingactionbutton.FloatingActionsMenu fab;
private ProgressBar progressBar;
private SwipeRefreshLayout swipeView;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
progressBar = (ProgressBar)findViewById(R.id.progressBar);
txtTitle.setOnClickListener(new View.OnClickListener() {
swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe);
swipeView.setColorSchemeResources(R.color.colorPrimary,
R.color.fab_big);
toolbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
public void onClick(View view) {
if (Helpers.isOnline(ShareActivity.this)) {
txtTitle.setText(R.string.jb_stream);
Intent i = new Intent(ShareActivity.this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
finish();
Intent intent = new Intent(ShareActivity.this, MainActivity.class);
startActivityForResult(intent, 100);
overridePendingTransition(0, 0);
} else {
Snackbar.make(v, R.string.no_internet, Snackbar.LENGTH_SHORT).show();
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_INDEFINITE).show();
}
}
});
@ -87,7 +94,7 @@ public class ShareActivity extends MainActivity {
SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE);
podDomain = config.getString("podDomain", null);
com.getbase.floatingactionbutton.FloatingActionsMenu fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions);
fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions);
fab.setVisibility(View.GONE);
webView = (WebView)findViewById(R.id.webView);
@ -130,6 +137,18 @@ public class ShareActivity extends MainActivity {
}
});
swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (Helpers.isOnline(ShareActivity.this)) {
webView.reload();
} else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_INDEFINITE).show();
swipeView.setRefreshing(false);
}
}
});
/*
* WebChromeClient
@ -230,7 +249,7 @@ public class ShareActivity extends MainActivity {
finish();
Snackbar.make(webView, R.string.please_reload, Snackbar.LENGTH_LONG).show();
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);
@ -242,7 +261,40 @@ public class ShareActivity extends MainActivity {
webView.loadUrl("javascript:(function() { " +
"document.getElementsByTagName('textarea')[0].style.height='110px'; " +
"document.getElementsByTagName('textarea')[0].innerHTML = '[" + extraSubject + "](" + extraText + ") #ViaDiasporaNativeWebApp'; " +
"document.getElementsByTagName('textarea')[0].innerHTML = '[" + extraSubject + "] (" + extraText + ") shared with #DiasporaWebApp'; " +
" if(document.getElementById(\"main_nav\")) {" +
" document.getElementById(\"main_nav\").parentNode.removeChild(" +
" document.getElementById(\"main_nav\"));" +
" } else if (document.getElementById(\"main-nav\")) {" +
" document.getElementById(\"main-nav\").parentNode.removeChild(" +
" document.getElementById(\"main-nav\"));" +
" }" +
"})();");
}
if (extras.containsKey(Intent.EXTRA_TEXT)) {
final String extraText = (String) extras.get(Intent.EXTRA_TEXT);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
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);
return false;
}
});
webView.loadUrl("javascript:(function() { " +
"document.getElementsByTagName('textarea')[0].style.height='110px'; " +
"document.getElementsByTagName('textarea')[0].innerHTML = ' > " + extraText + " [shared with #DiasporaWebApp]'; " +
" if(document.getElementById(\"main_nav\")) {" +
" document.getElementById(\"main_nav\").parentNode.removeChild(" +
" document.getElementById(\"main_nav\"));" +
@ -294,8 +346,8 @@ public class ShareActivity extends MainActivity {
if (Helpers.isOnline(ShareActivity.this)) {
webView.reload();
return true;
} else {
Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_INDEFINITE).show();
} else {
Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_SHORT).show();
return false;
}
}
@ -303,4 +355,32 @@ public class ShareActivity extends MainActivity {
return super.onOptionsItemSelected(item);
}
}
@Override
public void onBackPressed() {
fab.collapse();
if (webView.canGoBack()) {
webView.goBack();
setTitle(R.string.app_name);
Snackbar snackbar = Snackbar
.make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG)
.setAction(R.string.yes, new View.OnClickListener() {
@Override
public void onClick(View view) {
moveTaskToBack(true);
}
});
snackbar.show();
} else {
Snackbar snackbar = Snackbar
.make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG)
.setAction(R.string.yes, new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
snackbar.show();
}
}
}

View file

@ -136,6 +136,10 @@
&lt;i>For more informations visit the Projectsite on github:&lt;br>
https://github.com/scoute-dich/Diaspora&lt;/i>&lt;br>&lt;br>
&lt;b>v1.2:&lt;/b>&lt;br>
&#8226; using strings in podactivity&lt;br>
&#8226; improved share activity&lt;br>&lt;br>
&lt;b>v1.1:&lt;/b>&lt;br>
&#8226; new about app and help dialogs&lt;br>
&#8226; better snackbar integration&lt;br>&lt;br>