mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +01:00
Merge pull request #39 from Diaspora-for-Android/feature_#38
Feature #38
This commit is contained in:
commit
1d2a428df6
2 changed files with 195 additions and 29 deletions
|
@ -34,13 +34,7 @@
|
|||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="stateHidden" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/diaspora">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:launchMode="singleInstance"
|
||||
|
@ -67,7 +61,6 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>-->
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
@ -76,8 +69,165 @@
|
|||
android:exported="false" >
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/diaspora">
|
||||
|
||||
<!-- Intent from Web Browser / Mail / IM / Clickable Link -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<!--@@@ PODLIST START-->
|
||||
|
||||
<data android:host="austriapod.at" android:scheme="https" />
|
||||
<data android:host="berdaguermontes.eu" android:scheme="https" />
|
||||
<data android:host="berlinspora.de" android:scheme="https" />
|
||||
<data android:host="canfly.org" android:scheme="https" />
|
||||
<data android:host="community.kanalinseln.de" android:scheme="https" />
|
||||
<data android:host="cryptospora.net" android:scheme="https" />
|
||||
<data android:host="d.consumium.org" android:scheme="https" />
|
||||
<data android:host="despora.de" android:scheme="https" />
|
||||
<data android:host="dia.manuelbichler.at" android:scheme="https" />
|
||||
<data android:host="dia.myocastor.de" android:scheme="https" />
|
||||
<data android:host="diapod.net" android:scheme="https" />
|
||||
<data android:host="diapod.org" android:scheme="https" />
|
||||
<data android:host="diasp.ca" android:scheme="https" />
|
||||
<data android:host="diasp.cz" android:scheme="https" />
|
||||
<data android:host="diasp.de" android:scheme="https" />
|
||||
<data android:host="diasp.eu" android:scheme="https" />
|
||||
<data android:host="diasp.eu.com" android:scheme="https" />
|
||||
<data android:host="diasp.nl" android:scheme="https" />
|
||||
<data android:host="diaspod.de" android:scheme="https" />
|
||||
<data android:host="diaspora.alfter.us" android:scheme="https" />
|
||||
<data android:host="diaspora.bohramt.de" android:scheme="https" />
|
||||
<data android:host="diasporabr.com.br" android:scheme="https" />
|
||||
<data android:host="diaspora.com.ar" android:scheme="https" />
|
||||
<data android:host="diaspora.deadhexagon.com" android:scheme="https" />
|
||||
<data android:host="diaspora.digitalismus.org" android:scheme="https" />
|
||||
<data android:host="diaspora.dorf-post.de" android:scheme="https" />
|
||||
<data android:host="diaspora.espiritolivre.org" android:scheme="https" />
|
||||
<data android:host="diaspora-fr.org" android:scheme="https" />
|
||||
<data android:host="diaspora.hzsogood.net" android:scheme="https" />
|
||||
<data android:host="diaspora.kapper.net" android:scheme="https" />
|
||||
<data android:host="diaspora.koehn.com" android:scheme="https" />
|
||||
<data android:host="diaspora.kosebamse.com" android:scheme="https" />
|
||||
<data android:host="diaspora.lebarjack.com" android:scheme="https" />
|
||||
<data android:host="diaspora.mazi.tk" android:scheme="https" />
|
||||
<data android:host="diaspora.moosje.nl" android:scheme="https" />
|
||||
<data android:host="diaspora.net.gr" android:scheme="https" />
|
||||
<data android:host="diaspora.permutationsofchaos.com" android:scheme="https" />
|
||||
<data android:host="diaspora.pimpmypony.eu" android:scheme="https" />
|
||||
<data android:host="diaspora.pingupod.de" android:scheme="https" />
|
||||
<data android:host="diaspora.podzimek.org" android:scheme="https" />
|
||||
<data android:host="diaspora.poleni.com" android:scheme="https" />
|
||||
<data android:host="diasporapr.tk" android:scheme="https" />
|
||||
<data android:host="diaspora.psyco.fr" android:scheme="https" />
|
||||
<data android:host="diaspora.punkbeer.me" android:scheme="https" />
|
||||
<data android:host="diaspora.raven-ip.com" android:scheme="https" />
|
||||
<data android:host="diaspora.retrodigital.net" android:scheme="https" />
|
||||
<data android:host="diaspora.sceal.ie" android:scheme="https" />
|
||||
<data android:host="diaspora.schrauger.com" android:scheme="https" />
|
||||
<data android:host="diaspora.slowb.ro" android:scheme="https" />
|
||||
<data android:host="diaspora.soh.re" android:scheme="https" />
|
||||
<data android:host="diaspora.subsignal.org" android:scheme="https" />
|
||||
<data android:host="diaspora.trash-talk.de" android:scheme="https" />
|
||||
<data android:host="diaspora.undernet.uy" android:scheme="https" />
|
||||
<data android:host="diasporausa.com" android:scheme="https" />
|
||||
<data android:host="diasp.org" android:scheme="https" />
|
||||
<data android:host="espora.social" android:scheme="https" />
|
||||
<data android:host="failure.net" android:scheme="https" />
|
||||
<data android:host="flokk.no" android:scheme="https" />
|
||||
<data android:host="framasphere.org" android:scheme="https" />
|
||||
<data android:host="freehuman.fr" android:scheme="https" />
|
||||
<data android:host="idoru.pl" android:scheme="https" />
|
||||
<data android:host="iliketoast.net" android:scheme="https" />
|
||||
<data android:host="joindiaspora.com" android:scheme="https" />
|
||||
<data android:host="jons.gr" android:scheme="https" />
|
||||
<data android:host="kapok.se" android:scheme="https" />
|
||||
<data android:host="karmasphe.re" android:scheme="https" />
|
||||
<data android:host="kosmospora.net" android:scheme="https" />
|
||||
<data android:host="laba.mba" android:scheme="https" />
|
||||
<data android:host="legends.im" android:scheme="https" />
|
||||
<data android:host="liberdade.digital" android:scheme="https" />
|
||||
<data android:host="libertypod.org" android:scheme="https" />
|
||||
<data android:host="LibertyPod.org" android:scheme="https" />
|
||||
<data android:host="librenet.co.za" android:scheme="https" />
|
||||
<data android:host="librenet.gr" android:scheme="https" />
|
||||
<data android:host="misamigos.online" android:scheme="https" />
|
||||
<data android:host="mondiaspora.net" android:scheme="https" />
|
||||
<data android:host="nerdpol.ch" android:scheme="https" />
|
||||
<data android:host="networkwizard.de" android:scheme="https" />
|
||||
<data android:host="nx-pod.de" android:scheme="https" />
|
||||
<data android:host="parteidervernunft.com" android:scheme="https" />
|
||||
<data android:host="pod.4ray.co" android:scheme="https" />
|
||||
<data android:host="pod.alterworld.info" android:scheme="https" />
|
||||
<data android:host="pod.asap-soft.com" android:scheme="https" />
|
||||
<data android:host="podbay.net" android:scheme="https" />
|
||||
<data android:host="pod.cannyfoxx.me" android:scheme="https" />
|
||||
<data android:host="pod.cyberdungeon.de" android:scheme="https" />
|
||||
<data android:host="pod.dapor.net" android:scheme="https" />
|
||||
<data android:host="pod.datenknoten.me" android:scheme="https" />
|
||||
<data android:host="poddery.com" android:scheme="https" />
|
||||
<data android:host="pod.diaspora.software" android:scheme="https" />
|
||||
<data android:host="pod.dirkomatik.de" android:scheme="https" />
|
||||
<data android:host="pod.disroot.org" android:scheme="https" />
|
||||
<data android:host="pod.gedankenausbruch.com" android:scheme="https" />
|
||||
<data android:host="pod.geraspora.de" android:scheme="https" />
|
||||
<data android:host="pod.gleisnetze.de" android:scheme="https" />
|
||||
<data android:host="pod.goodsharing.at" android:scheme="https" />
|
||||
<data android:host="pod.hashtagueule.fr" android:scheme="https" />
|
||||
<data android:host="pod.hfrc.de" android:scheme="https" />
|
||||
<data android:host="pod.hoizi.net" android:scheme="https" />
|
||||
<data android:host="pod.itabs.nl" android:scheme="https" />
|
||||
<data android:host="pod.jpope.org" android:scheme="https" />
|
||||
<data android:host="pod.kepow.org" android:scheme="https" />
|
||||
<data android:host="pod.liebeleu.de" android:scheme="https" />
|
||||
<data android:host="pod.neikos.me" android:scheme="https" />
|
||||
<data android:host="pod.nomorestars.com" android:scheme="https" />
|
||||
<data android:host="pod.orkz.net" android:scheme="https" />
|
||||
<data android:host="pod.ponk.pink" android:scheme="https" />
|
||||
<data android:host="pod.promedol.com" android:scheme="https" />
|
||||
<data android:host="pod.psynet.su" android:scheme="https" />
|
||||
<data android:host="pod.ros-it.ch" android:scheme="https" />
|
||||
<data android:host="pod.sccn.club" android:scheme="https" />
|
||||
<data android:host="pod.sertelon.fr" android:scheme="https" />
|
||||
<data android:host="pod.storel.li" android:scheme="https" />
|
||||
<data android:host="pod.tchncs.de" android:scheme="https" />
|
||||
<data android:host="pod.thomasdalichow.de" android:scheme="https" />
|
||||
<data android:host="pod.undreaming.org" android:scheme="https" />
|
||||
<data android:host="pubpod.alqualonde.org" android:scheme="https" />
|
||||
<data android:host="realms.the-wizard.co.za" android:scheme="https" />
|
||||
<data android:host="ruhrspora.de" android:scheme="https" />
|
||||
<data android:host="russiandiaspora.org" android:scheme="https" />
|
||||
<data android:host="sechat.org" android:scheme="https" />
|
||||
<data android:host="shrekislove.us" android:scheme="https" />
|
||||
<data android:host="social.acclaro.digital" android:scheme="https" />
|
||||
<data android:host="social.baldr.io" android:scheme="https" />
|
||||
<data android:host="social.daxbau.net" android:scheme="https" />
|
||||
<data android:host="social.elaon.de" android:scheme="https" />
|
||||
<data android:host="socializer.cc" android:scheme="https" />
|
||||
<data android:host="social.mbuto.me" android:scheme="https" />
|
||||
<data android:host="spora.zone" android:scheme="https" />
|
||||
<data android:host="subvillage.de" android:scheme="https" />
|
||||
<data android:host="sysad.org" android:scheme="https" />
|
||||
<data android:host="teki.be" android:scheme="https" />
|
||||
<data android:host="therealtalk.org" android:scheme="https" />
|
||||
<data android:host="thinkopen.net" android:scheme="https" />
|
||||
<data android:host="tippentappen.de" android:scheme="https" />
|
||||
<data android:host="united.zkp.fr" android:scheme="https" />
|
||||
<data android:host="whatsnewz.com" android:scheme="https" />
|
||||
<data android:host="wk3.org" android:scheme="https" />
|
||||
<data android:host="www.datataffel.dk" android:scheme="https" />
|
||||
<data android:host="www.diasporaix.de" android:scheme="https" />
|
||||
|
||||
<!--@@@ PODLIST END-->
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
|
||||
|
||||
</manifest>
|
|
@ -182,11 +182,11 @@ public class MainActivity extends AppCompatActivity
|
|||
podUserProfile.setCallbackHandler(uiHandler);
|
||||
podUserProfile.setListener(this);
|
||||
|
||||
if(appSettings.isProxyEnabled()) {
|
||||
if(!setProxy(appSettings.getProxyHost(), appSettings.getProxyPort())) {
|
||||
Toast.makeText(MainActivity.this, R.string.toast_set_proxy_failed,Toast.LENGTH_SHORT).show();
|
||||
if (appSettings.isProxyEnabled()) {
|
||||
if (!setProxy(appSettings.getProxyHost(), appSettings.getProxyPort())) {
|
||||
Toast.makeText(MainActivity.this, R.string.toast_set_proxy_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else if(appSettings.wasProxyEnabled()) {
|
||||
} else if (appSettings.wasProxyEnabled()) {
|
||||
resetProxy();
|
||||
}
|
||||
|
||||
|
@ -278,8 +278,9 @@ public class MainActivity extends AppCompatActivity
|
|||
webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge");
|
||||
|
||||
//Set proxy
|
||||
if(appSettings.isProxyEnabled()) {
|
||||
if(!setProxy()) Toast.makeText(this, R.string.toast_set_proxy_failed, Toast.LENGTH_LONG).show();
|
||||
if (appSettings.isProxyEnabled()) {
|
||||
if (!setProxy())
|
||||
Toast.makeText(this, R.string.toast_set_proxy_failed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -431,16 +432,30 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String action = intent.getAction();
|
||||
if(ACTION_OPEN_URL.equals(action)) {
|
||||
String url = intent.getStringExtra(URL_MESSAGE);
|
||||
webView.loadUrl(url);
|
||||
} else if(ACTION_CHANGE_ACCOUNT.equals(action)) {
|
||||
String loadUrl = null;
|
||||
|
||||
|
||||
if (ACTION_OPEN_URL.equals(action)) {
|
||||
loadUrl = intent.getStringExtra(URL_MESSAGE);
|
||||
} else if (Intent.ACTION_VIEW.equals(action) && intent.getDataString() != null) {
|
||||
loadUrl = intent.getDataString();
|
||||
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
|
||||
app.resetPodData(webView);
|
||||
Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true);
|
||||
} else if(ACTION_CLEAR_CACHE.equals(action)) {
|
||||
} else if (ACTION_CLEAR_CACHE.equals(action)) {
|
||||
webView.clearCache(true);
|
||||
}
|
||||
|
||||
if (loadUrl != null) {
|
||||
webView.stopLoading();
|
||||
navDrawer.closeDrawers();
|
||||
webView.loadUrl(loadUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -495,7 +510,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if (webView.canGoBack()) {
|
||||
webView.goBack();
|
||||
} else {
|
||||
if(!snackbarExitApp.isShown())
|
||||
if (!snackbarExitApp.isShown())
|
||||
snackbarExitApp.show();
|
||||
}
|
||||
}
|
||||
|
@ -799,7 +814,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if (item != null) {
|
||||
if (notificationCount > 0) {
|
||||
item.setIcon(R.drawable.ic_bell_ring_white_24dp);
|
||||
if(!snackbarNewNotification.isShown() && !webView.getUrl().equals("https://" + podDomain + "/notifications"))
|
||||
if (!snackbarNewNotification.isShown() && !webView.getUrl().equals("https://" + podDomain + "/notifications"))
|
||||
snackbarNewNotification.show();
|
||||
} else {
|
||||
item.setIcon(R.drawable.ic_bell_outline_white_24dp);
|
||||
|
@ -833,7 +848,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if (item != null) {
|
||||
if (conversationCount > 0) {
|
||||
item.setIcon(R.drawable.ic_message_text_white_24dp);
|
||||
if(!snackbarNewNotification.isShown() && !webView.getUrl().equals("https://" + podDomain + "/notifications"))
|
||||
if (!snackbarNewNotification.isShown() && !webView.getUrl().equals("https://" + podDomain + "/notifications"))
|
||||
snackbarNewNotification.show();
|
||||
} else {
|
||||
item.setIcon(R.drawable.ic_message_text_outline_white_24dp);
|
||||
|
@ -977,7 +992,7 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main__layout);
|
||||
if(drawer != null) drawer.closeDrawer(GravityCompat.START);
|
||||
if (drawer != null) drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1001,13 +1016,14 @@ public class MainActivity extends AppCompatActivity
|
|||
/**
|
||||
* Set proxy according to arguments. host must not be "" or null, port must be positive.
|
||||
* Return true on success and update appSettings' proxy related values.
|
||||
*
|
||||
* @param host proxy host (eg. localhost or 127.0.0.1)
|
||||
* @param port proxy port (eg. 8118)
|
||||
* @return success
|
||||
* @throws IllegalArgumentException if arguments do not fit specifications above
|
||||
*/
|
||||
private boolean setProxy(final String host, final int port) {
|
||||
if(host != null && !host.equals("") && port >=0) {
|
||||
if (host != null && !host.equals("") && port >= 0) {
|
||||
//Temporary change thread policy
|
||||
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
|
||||
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
|
@ -1046,7 +1062,7 @@ public class MainActivity extends AppCompatActivity
|
|||
StrictMode.setThreadPolicy(tmp);
|
||||
|
||||
NetCipher.clearProxy();
|
||||
try{
|
||||
try {
|
||||
WebkitProxy.resetProxy(MainActivity.class.getName(), this);
|
||||
} catch (Exception e) {/*Nothing*/}
|
||||
|
||||
|
|
Loading…
Reference in a new issue