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

Merge pull request #79 from Diaspora-for-Android/poddy_as_podsource

Use Poddy as podsource
This commit is contained in:
Gregor Santner 2016-10-14 01:37:28 +02:00 committed by GitHub
commit 72189af353
80 changed files with 2976 additions and 570 deletions

View file

@ -6,7 +6,7 @@ android:
- tools - tools
- tools # TODO https://github.com/travis-ci/travis-ci/issues/6193 - tools # TODO https://github.com/travis-ci/travis-ci/issues/6193
- platform-tools - platform-tools
- build-tools-24.0.2 - build-tools-24.0.3
- android-24 - android-24
- extra-android-m2repository - extra-android-m2repository
before_cache: before_cache:

View file

@ -3,7 +3,7 @@ apply plugin: 'android-apt'
android { android {
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "24.0.2" buildToolsVersion "24.0.3"
defaultConfig { defaultConfig {
applicationId "com.github.dfa.diaspora_android" applicationId "com.github.dfa.diaspora_android"

View file

@ -66,7 +66,15 @@
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<!--@@@ PODLIST START--> <!--@@@ PODLIST START-->
<data android:host="joindiaspora.com" android:scheme="https" />
<data android:host="diasporaaqmjixh5.onion" android:scheme="http" />
<data android:host="pod.geraspora.de" android:scheme="https" />
<data android:host="diasp.org" android:scheme="https" />
<data android:host="framasphere.org" android:scheme="https" />
<data android:host="nerdpol.ch" android:scheme="https" />
<data android:host="despora.de" android:scheme="https" />
<data android:host="sechat.org" android:scheme="https" />
<data android:host="sechatqpscuj2npx.onion" android:scheme="http" />
<data android:host="austriapod.at" android:scheme="https" /> <data android:host="austriapod.at" android:scheme="https" />
<data android:host="berdaguermontes.eu" android:scheme="https" /> <data android:host="berdaguermontes.eu" android:scheme="https" />
<data android:host="berlinspora.de" android:scheme="https" /> <data android:host="berlinspora.de" android:scheme="https" />
@ -74,7 +82,6 @@
<data android:host="community.kanalinseln.de" android:scheme="https" /> <data android:host="community.kanalinseln.de" android:scheme="https" />
<data android:host="cryptospora.net" android:scheme="https" /> <data android:host="cryptospora.net" android:scheme="https" />
<data android:host="d.consumium.org" 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.manuelbichler.at" android:scheme="https" />
<data android:host="dia.myocastor.de" android:scheme="https" /> <data android:host="dia.myocastor.de" android:scheme="https" />
<data android:host="diapod.net" android:scheme="https" /> <data android:host="diapod.net" android:scheme="https" />
@ -86,17 +93,16 @@
<data android:host="diasp.eu.com" android:scheme="https" /> <data android:host="diasp.eu.com" android:scheme="https" />
<data android:host="diasp.nl" android:scheme="https" /> <data android:host="diasp.nl" android:scheme="https" />
<data android:host="diaspod.de" android:scheme="https" /> <data android:host="diaspod.de" android:scheme="https" />
<data android:host="diaspora-fr.org" android:scheme="https" />
<data android:host="diaspora.alfter.us" android:scheme="https" /> <data android:host="diaspora.alfter.us" android:scheme="https" />
<data android:host="diaspora.bohramt.de" android:scheme="https" /> <data android:host="diaspora.bohramt.de" android:scheme="https" />
<data android:host="diasporabrazil.org" 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.com.ar" android:scheme="https" />
<data android:host="diaspora.deadhexagon.com" android:scheme="https" /> <data android:host="diaspora.deadhexagon.com" android:scheme="https" />
<data android:host="diaspora.digi-merc.org" android:scheme="https" />
<data android:host="diaspora.digitalismus.org" 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.dorf-post.de" android:scheme="https" />
<data android:host="diaspora.espiritolivre.org" android:scheme="https" /> <data android:host="diaspora.espiritolivre.org" android:scheme="https" />
<data android:host="diaspora.fr33.co" android:scheme="https" /> <data android:host="diaspora.fr33.co" android:scheme="https" />
<data android:host="diaspora-fr.org" android:scheme="https" />
<data android:host="diaspora.horwood.biz" android:scheme="https" /> <data android:host="diaspora.horwood.biz" android:scheme="https" />
<data android:host="diaspora.hzsogood.net" 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.kapper.net" android:scheme="https" />
@ -104,15 +110,14 @@
<data android:host="diaspora.kosebamse.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.lebarjack.com" android:scheme="https" />
<data android:host="diaspora.mazi.tk" android:scheme="https" /> <data android:host="diaspora.mazi.tk" android:scheme="https" />
<data android:host="diaspora.microdata.co.uk" android:scheme="https" />
<data android:host="diaspora.moosje.nl" 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.net.gr" android:scheme="https" />
<data android:host="diasporanet.tk" android:scheme="https" />
<data android:host="diaspora.permutationsofchaos.com" 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.pimpmypony.eu" android:scheme="https" />
<data android:host="diaspora.pingupod.de" 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.podzimek.org" android:scheme="https" />
<data android:host="diaspora.poleni.com" 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.psyco.fr" android:scheme="https" />
<data android:host="diaspora.punkbeer.me" 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.raven-ip.com" android:scheme="https" />
@ -126,10 +131,14 @@
<data android:host="diaspora.u4u.org" android:scheme="https" /> <data android:host="diaspora.u4u.org" android:scheme="https" />
<data android:host="diaspora.undernet.uy" android:scheme="https" /> <data android:host="diaspora.undernet.uy" android:scheme="https" />
<data android:host="diaspora.unixcorn.org" android:scheme="https" /> <data android:host="diaspora.unixcorn.org" android:scheme="https" />
<data android:host="diasporausa.com" android:scheme="https" />
<data android:host="diaspora.weenmebrown.com" android:scheme="https" /> <data android:host="diaspora.weenmebrown.com" android:scheme="https" />
<data android:host="diaspora.xcelor8.com" android:scheme="https" /> <data android:host="diaspora.xcelor8.com" android:scheme="https" />
<data android:host="diasp.org" android:scheme="https" /> <data android:host="diasporabr.com.br" android:scheme="https" />
<data android:host="diasporabrazil.org" android:scheme="https" />
<data android:host="diasporanet.tk" android:scheme="https" />
<data android:host="diasporapr.tk" android:scheme="https" />
<data android:host="diasporausa.com" android:scheme="https" />
<data android:host="diasporing.ch" android:scheme="https" />
<data android:host="dissociateduse.rs" android:scheme="https" /> <data android:host="dissociateduse.rs" android:scheme="https" />
<data android:host="distributed.chat" android:scheme="https" /> <data android:host="distributed.chat" android:scheme="https" />
<data android:host="eat.egregious.ly" android:scheme="https" /> <data android:host="eat.egregious.ly" android:scheme="https" />
@ -138,50 +147,43 @@
<data android:host="espora.social" android:scheme="https" /> <data android:host="espora.social" android:scheme="https" />
<data android:host="failure.net" android:scheme="https" /> <data android:host="failure.net" android:scheme="https" />
<data android:host="flokk.no" 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="freehuman.fr" android:scheme="https" />
<data android:host="friendica.tk" android:scheme="https" /> <data android:host="friendica.tk" android:scheme="https" />
<data android:host="home.enslaver.net" android:scheme="https" /> <data android:host="home.enslaver.net" android:scheme="https" />
<data android:host="idoru.pl" android:scheme="https" /> <data android:host="idoru.pl" android:scheme="https" />
<data android:host="iliketoast.net" 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="jons.gr" android:scheme="https" />
<data android:host="kapok.se" android:scheme="https" /> <data android:host="kapok.se" android:scheme="https" />
<data android:host="karmasphe.re" android:scheme="https" /> <data android:host="karmasphe.re" android:scheme="https" />
<data android:host="kosmospora.net" android:scheme="https" /> <data android:host="kosmospora.net" android:scheme="https" />
<data android:host="laba.mba" 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="liberdade.digital" android:scheme="https" />
<data android:host="libertypod.org" 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.co.za" android:scheme="https" />
<data android:host="librenet.gr" android:scheme="https" /> <data android:host="librenet.gr" android:scheme="https" />
<data android:host="londor.be" android:scheme="https" /> <data android:host="londor.be" android:scheme="https" />
<data android:host="lubiora.de" android:scheme="https" />
<data android:host="misamigos.online" android:scheme="https" /> <data android:host="misamigos.online" android:scheme="https" />
<data android:host="mondiaspora.net" 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="networkwizard.de" android:scheme="https" />
<data android:host="nx-pod.de" android:scheme="https" /> <data android:host="nx-pod.de" android:scheme="https" />
<data android:host="parteidervernunft.com" android:scheme="https" /> <data android:host="parteidervernunft.com" android:scheme="https" />
<data android:host="pe.spbstu.ru" android:scheme="https" />
<data android:host="pod.4ray.co" android:scheme="https" /> <data android:host="pod.4ray.co" android:scheme="https" />
<data android:host="pod.8n1.org" android:scheme="https" /> <data android:host="pod.8n1.org" android:scheme="https" />
<data android:host="pod.alterworld.info" 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="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.cannyfoxx.me" android:scheme="https" />
<data android:host="pod.comin.dk" android:scheme="https" /> <data android:host="pod.comin.dk" android:scheme="https" />
<data android:host="pod.cyberdungeon.de" 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.dapor.net" android:scheme="https" />
<data android:host="pod.datenknoten.me" 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.diaspora.software" android:scheme="https" />
<data android:host="pod.dirkomatik.de" 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.disroot.org" android:scheme="https" />
<data android:host="pod.dobs.at" android:scheme="https" /> <data android:host="pod.dobs.at" android:scheme="https" />
<data android:host="pod.dragondreaming.de" android:scheme="https" /> <data android:host="pod.dragondreaming.de" android:scheme="https" />
<data android:host="pod.gaialabs.ch" android:scheme="https" />
<data android:host="pod.gedankenausbruch.com" 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.gleisnetze.de" android:scheme="https" />
<data android:host="pod.goodsharing.at" 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.hashtagueule.fr" android:scheme="https" />
@ -200,32 +202,33 @@
<data android:host="pod.psynet.su" android:scheme="https" /> <data android:host="pod.psynet.su" android:scheme="https" />
<data android:host="pod.readme.is" android:scheme="https" /> <data android:host="pod.readme.is" android:scheme="https" />
<data android:host="pod.richtig.koeln" android:scheme="https" /> <data android:host="pod.richtig.koeln" android:scheme="https" />
<data android:host="podricing.pw" android:scheme="https" /> <data android:host="pod.roocita.com" android:scheme="https" />
<data android:host="pod.ros-it.ch" 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.sccn.club" android:scheme="https" />
<data android:host="pod.sertelon.fr" android:scheme="https" /> <data android:host="pod.sertelon.fr" android:scheme="https" />
<data android:host="pod.shouldit.work" android:scheme="https" /> <data android:host="pod.shouldit.work" android:scheme="https" />
<data android:host="pod.skisso.com" android:scheme="https" />
<data android:host="pod.storel.li" 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.tchncs.de" android:scheme="https" />
<data android:host="pod.thomasdalichow.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="pod.undreaming.org" android:scheme="https" />
<data android:host="pod.volt.io" android:scheme="https" />
<data android:host="podbay.net" android:scheme="https" />
<data android:host="poddery.com" android:scheme="https" />
<data android:host="podricing.pw" android:scheme="https" />
<data android:host="pubpod.alqualonde.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="realms.the-wizard.co.za" android:scheme="https" />
<data android:host="revreso.de" android:scheme="https" /> <data android:host="revreso.de" android:scheme="https" />
<data android:host="ruhrspora.de" android:scheme="https" /> <data android:host="ruhrspora.de" android:scheme="https" />
<data android:host="russiandiaspora.org" 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="shrekislove.us" android:scheme="https" />
<data android:host="social.acclaro.digital" 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.baldr.io" android:scheme="https" />
<data android:host="social.daxbau.net" android:scheme="https" /> <data android:host="social.daxbau.net" android:scheme="https" />
<data android:host="social.elaon.de" android:scheme="https" /> <data android:host="social.elaon.de" android:scheme="https" />
<data android:host="socializer.cc" android:scheme="https" />
<data android:host="social.lanham.id.au" android:scheme="https" /> <data android:host="social.lanham.id.au" android:scheme="https" />
<data android:host="social.mbuto.me" android:scheme="https" /> <data android:host="social.mbuto.me" android:scheme="https" />
<data android:host="social.sum7.de" android:scheme="https" /> <data android:host="social.sum7.de" android:scheme="https" />
<data android:host="spora.com.ua" android:scheme="https" /> <data android:host="socializer.cc" android:scheme="https" />
<data android:host="spora.zone" android:scheme="https" /> <data android:host="spora.zone" android:scheme="https" />
<data android:host="subvillage.de" android:scheme="https" /> <data android:host="subvillage.de" android:scheme="https" />
<data android:host="sysad.org" android:scheme="https" /> <data android:host="sysad.org" android:scheme="https" />
@ -238,7 +241,10 @@
<data android:host="wk3.org" android:scheme="https" /> <data android:host="wk3.org" android:scheme="https" />
<data android:host="www.datataffel.dk" android:scheme="https" /> <data android:host="www.datataffel.dk" android:scheme="https" />
<data android:host="www.diasporaix.de" android:scheme="https" /> <data android:host="www.diasporaix.de" android:scheme="https" />
<data android:host="diaspora.hofud.com" android:scheme="https" />
<data android:host="diaspora.softwarelivre.org" android:scheme="https" />
<data android:host="confetticake.club" android:scheme="https" />
<data android:host="diaspora.mike-jones.me.uk" android:scheme="https" />
<!--@@@ PODLIST END--> <!--@@@ PODLIST END-->
</intent-filter> </intent-filter>
@ -246,4 +252,4 @@
</application> </application>
</manifest> </manifest>

View file

@ -63,7 +63,7 @@ import butterknife.ButterKnife;
* Activity that holds some fragments that show information about the app in a tab layout * Activity that holds some fragments that show information about the app in a tab layout
*/ */
public class AboutActivity extends ThemedActivity public class AboutActivity extends ThemedActivity
implements IntellihideToolbarActivityListener { implements IntellihideToolbarActivityListener {
private SectionsPagerAdapter mSectionsPagerAdapter; private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager; private ViewPager mViewPager;
@ -108,7 +108,7 @@ implements IntellihideToolbarActivityListener {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if(getAppSettings().isIntellihideToolbars()) { if (getAppSettings().isIntellihideToolbars()) {
this.enableToolbarHiding(); this.enableToolbarHiding();
} else { } else {
this.disableToolbarHiding(); this.disableToolbarHiding();
@ -310,6 +310,7 @@ implements IntellihideToolbarActivityListener {
Bundle savedInstanceState) { Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false); View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
App app = (App) getActivity().getApplication();
logBox.setOnLongClickListener(new View.OnLongClickListener() { logBox.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
@ -338,6 +339,9 @@ implements IntellihideToolbarActivityListener {
osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE)); osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE));
deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL)); deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL));
podDomain.setText(getString(R.string.fragment_debug__pod_domain, urls.getPodUrl())); podDomain.setText(getString(R.string.fragment_debug__pod_domain, urls.getPodUrl()));
if (app.getSettings().getPod() != null) {
podDomain.setText(getString(R.string.fragment_debug__pod_domain, app.getSettings().getPod().getName()));
}
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -68,15 +68,15 @@ import com.github.dfa.diaspora_android.fragment.HashtagListFragment;
import com.github.dfa.diaspora_android.fragment.PodSelectionFragment; import com.github.dfa.diaspora_android.fragment.PodSelectionFragment;
import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener; import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener;
import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver; import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver; import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver;
import com.github.dfa.diaspora_android.ui.BadgeDrawable; import com.github.dfa.diaspora_android.ui.BadgeDrawable;
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener; import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper; import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper; import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.util.WebHelper; import com.github.dfa.diaspora_android.util.WebHelper;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -181,7 +181,7 @@ public class MainActivity extends ThemedActivity
@Override @Override
public void setTitle(int rId) { public void setTitle(int rId) {
CustomFragment top = getTopFragment(); CustomFragment top = getTopFragment();
if(top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) { if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
MainActivity.this.setTitle(rId); MainActivity.this.setTitle(rId);
} }
} }
@ -189,14 +189,15 @@ public class MainActivity extends ThemedActivity
@Override @Override
public void setTitle(String title) { public void setTitle(String title) {
CustomFragment top = getTopFragment(); CustomFragment top = getTopFragment();
if(top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) { if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
MainActivity.this.setTitle(title); MainActivity.this.setTitle(title);
} }
} }
}); });
if (!appSettings.hasPodDomain()) { if (!appSettings.hasPod()) {
AppLog.d(this, "We have no pod. Show PodSelectionFragment"); AppLog.d(this, "We have no pod. Show PodSelectionFragment");
updateNavigationViewEntryVisibilities();
showFragment(getFragment(PodSelectionFragment.TAG)); showFragment(getFragment(PodSelectionFragment.TAG));
} else { } else {
AppLog.d(this, "Pod found. Handle intents."); AppLog.d(this, "Pod found. Handle intents.");
@ -246,6 +247,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Show DiasporaStreamFragment if necessary and load URL url * Show DiasporaStreamFragment if necessary and load URL url
*
* @param url URL to load in the DiasporaStreamFragment * @param url URL to load in the DiasporaStreamFragment
*/ */
public void openDiasporaUrl(String url) { public void openDiasporaUrl(String url) {
@ -259,6 +261,7 @@ public class MainActivity extends ThemedActivity
* Get an instance of the CustomFragment with the tag fragmentTag. * Get an instance of the CustomFragment with the tag fragmentTag.
* If there was no instance so far, create a new one and add it to the FragmentManagers pool. * If there was no instance so far, create a new one and add it to the FragmentManagers pool.
* If there is no Fragment with the corresponding Tag, return the top fragment. * If there is no Fragment with the corresponding Tag, return the top fragment.
*
* @param fragmentTag tag * @param fragmentTag tag
* @return corresponding Fragment * @return corresponding Fragment
*/ */
@ -294,6 +297,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Show the Fragment fragment in R.id.fragment_container. If the fragment was already visible, do nothing. * Show the Fragment fragment in R.id.fragment_container. If the fragment was already visible, do nothing.
*
* @param fragment Fragment to show * @param fragment Fragment to show
*/ */
protected void showFragment(CustomFragment fragment) { protected void showFragment(CustomFragment fragment) {
@ -342,8 +346,8 @@ public class MainActivity extends ThemedActivity
if (!appSettings.getName().equals("")) { if (!appSettings.getName().equals("")) {
navheaderTitle.setText(appSettings.getName()); navheaderTitle.setText(appSettings.getName());
} }
if (!appSettings.getPodDomain().equals("")) { if (appSettings.getPod() != null) {
navheaderDescription.setText(appSettings.getPodDomain()); navheaderDescription.setText(appSettings.getPod().getName());
} }
String avatarUrl = appSettings.getAvatarUrl(); String avatarUrl = appSettings.getAvatarUrl();
if (!avatarUrl.equals("")) { if (!avatarUrl.equals("")) {
@ -376,10 +380,16 @@ public class MainActivity extends ThemedActivity
navMenu.findItem(R.id.nav_mentions).setVisible(appSettings.isVisibleInNavMentions()); navMenu.findItem(R.id.nav_mentions).setVisible(appSettings.isVisibleInNavMentions());
navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile()); navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile());
navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities()); navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities());
// Top bar
if (!appSettings.hasPod()) {
navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), false);
}
} }
/** /**
* Forward incoming intents to handleIntent() * Forward incoming intents to handleIntent()
*
* @param intent incoming * @param intent incoming
*/ */
@Override @Override
@ -390,6 +400,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Handle intents and execute intent specific actions * Handle intents and execute intent specific actions
*
* @param intent intent to get handled * @param intent intent to get handled
*/ */
private void handleIntent(Intent intent) { private void handleIntent(Intent intent) {
@ -418,6 +429,7 @@ public class MainActivity extends ThemedActivity
} }
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) { } else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
AppLog.v(this, "Reset pod data and show PodSelectionFragment"); AppLog.v(this, "Reset pod data and show PodSelectionFragment");
appSettings.setPod(null);
app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView()); app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView());
showFragment(getFragment(PodSelectionFragment.TAG)); showFragment(getFragment(PodSelectionFragment.TAG));
} else if (ACTION_CLEAR_CACHE.equals(action)) { } else if (ACTION_CLEAR_CACHE.equals(action)) {
@ -462,6 +474,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Return the fragment which is currently displayed in R.id.fragment_container * Return the fragment which is currently displayed in R.id.fragment_container
*
* @return top fragment or null if there is none displayed * @return top fragment or null if there is none displayed
*/ */
private CustomFragment getTopFragment() { private CustomFragment getTopFragment() {
@ -545,6 +558,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Clear and repopulate top and bottom toolbar. * Clear and repopulate top and bottom toolbar.
* Also add menu items of the displayed fragment * Also add menu items of the displayed fragment
*
* @param menu top toolbar * @param menu top toolbar
* @return boolean * @return boolean
*/ */
@ -575,12 +589,14 @@ public class MainActivity extends ThemedActivity
/** /**
* Set the notification and messages counter in the top toolbar * Set the notification and messages counter in the top toolbar
*
* @param menu menu * @param menu menu
* @return boolean * @return boolean
*/ */
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem item; MenuItem item;
updateNavigationViewEntryVisibilities();
if ((item = menu.findItem(R.id.action_notifications)) != null) { if ((item = menu.findItem(R.id.action_notifications)) != null) {
LayerDrawable icon = (LayerDrawable) item.getIcon(); LayerDrawable icon = (LayerDrawable) item.getIcon();
@ -596,6 +612,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Handle clicks on the optionsmenu * Handle clicks on the optionsmenu
*
* @param item item * @param item item
* @return boolean * @return boolean
*/ */
@ -694,6 +711,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Update the profile name in the navigation slider * Update the profile name in the navigation slider
*
* @param name name * @param name name
*/ */
@Override @Override
@ -704,6 +722,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Update the profile picture in the navigation slider * Update the profile picture in the navigation slider
*
* @param avatarUrl url of the new profile pic * @param avatarUrl url of the new profile pic
*/ */
@Override @Override
@ -714,6 +733,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Handle hashtag clicks. Open the new-post-url and inject the clicked hashtag into the post-editor * Handle hashtag clicks. Open the new-post-url and inject the clicked hashtag into the post-editor
*
* @param intent intent * @param intent intent
*/ */
private void handleHashtag(Intent intent) { private void handleHashtag(Intent intent) {
@ -728,6 +748,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Open the new-post-url and inject text that was shared into the app into the post editors text field * Open the new-post-url and inject text that was shared into the app into the post editors text field
*
* @param intent shareTextIntent * @param intent shareTextIntent
*/ */
private void handleSendText(Intent intent) { private void handleSendText(Intent intent) {
@ -786,6 +807,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Share an image shared to the app via diaspora * Share an image shared to the app via diaspora
*
* @param intent shareImageIntent * @param intent shareImageIntent
*/ */
//TODO: Implement some day //TODO: Implement some day
@ -802,6 +824,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Invalidate the top toolbar to update the notification counter * Invalidate the top toolbar to update the notification counter
*
* @param notificationCount new notification count * @param notificationCount new notification count
*/ */
@Override @Override
@ -813,6 +836,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Invalidate the top toolbar to update the unread messages counter * Invalidate the top toolbar to update the unread messages counter
*
* @param unreadMessageCount new unread messages count * @param unreadMessageCount new unread messages count
*/ */
@Override @Override
@ -945,8 +969,9 @@ public class MainActivity extends ThemedActivity
/** /**
* React to results of requestPermission * React to results of requestPermission
* @param requestCode resCode *
* @param permissions requested permissions * @param requestCode resCode
* @param permissions requested permissions
* @param grantResults granted results * @param grantResults granted results
*/ */
@Override @Override
@ -970,6 +995,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Return the string that will be shared into the new-post-editor * Return the string that will be shared into the new-post-editor
*
* @return String * @return String
*/ */
public String getTextToBeShared() { public String getTextToBeShared() {
@ -978,6 +1004,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Set the string that will be shared into the new-post-editor * Set the string that will be shared into the new-post-editor
*
* @param textToBeShared * @param textToBeShared
*/ */
public void setTextToBeShared(String textToBeShared) { public void setTextToBeShared(String textToBeShared) {

View file

@ -41,9 +41,10 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener; import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
import com.github.dfa.diaspora_android.util.theming.ColorPalette;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.util.theming.ColorPalette;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper; import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import butterknife.BindView; import butterknife.BindView;
@ -63,6 +64,7 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
private ProxyHandler.ProxySettings oldProxySettings; private ProxyHandler.ProxySettings oldProxySettings;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -140,11 +142,11 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePreference(findPreference(key)); updatePreference(findPreference(key));
if(key.equals(getString(R.string.pref_key__intellihide_toolbars))) { if (key.equals(getString(R.string.pref_key__intellihide_toolbars))) {
if(sharedPreferences.getBoolean(getString(R.string.pref_key__intellihide_toolbars), false)) { if (sharedPreferences.getBoolean(getString(R.string.pref_key__intellihide_toolbars), false)) {
((SettingsActivity)getActivity()).enableToolbarHiding(); ((SettingsActivity) getActivity()).enableToolbarHiding();
} else { } else {
((SettingsActivity)getActivity()).disableToolbarHiding(); ((SettingsActivity) getActivity()).disableToolbarHiding();
} }
} }
} }
@ -168,7 +170,7 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
App app = ((App) getActivity().getApplication()); App app = ((App) getActivity().getApplication());
AppSettings appSettings = app.getSettings(); AppSettings appSettings = app.getSettings();
if(Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) { if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) {
Window window = ((PreferenceScreen) preference).getDialog().getWindow(); Window window = ((PreferenceScreen) preference).getDialog().getWindow();
if (window != null) { if (window != null) {
@ -178,7 +180,7 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
} }
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
String podDomain = appSettings.getPodDomain(); DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(app.getSettings());
switch (preference.getTitleRes()) { switch (preference.getTitleRes()) {
case R.string.pref_title__primary_color: { case R.string.pref_title__primary_color: {
@ -193,17 +195,17 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
} }
case R.string.pref_title__personal_settings: { case R.string.pref_title__personal_settings: {
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit"); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getPersonalSettingsUrl());
break; break;
} }
case R.string.pref_title__manage_tags: { case R.string.pref_title__manage_tags: {
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/tag_followings/manage"); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageTagsUrl());
break; break;
} }
case R.string.pref_title__manage_contacts: { case R.string.pref_title__manage_contacts: {
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/contacts"); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageContactsUrl());
break; break;
} }
case R.string.pref_title__change_account: { case R.string.pref_title__change_account: {
@ -229,8 +231,7 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
return true; return true;
} }
case R.string.pref_title__clear_cache: case R.string.pref_title__clear_cache: {
{
intent.setAction(MainActivity.ACTION_CLEAR_CACHE); intent.setAction(MainActivity.ACTION_CLEAR_CACHE);
break; break;
} }
@ -250,10 +251,11 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
/** /**
* Show a colorPicker Dialog * Show a colorPicker Dialog
*
* @param type 1 -> Primary Color, 2 -> Accent Color * @param type 1 -> Primary Color, 2 -> Accent Color
*/ */
public void showColorPickerDialog(final int type) { public void showColorPickerDialog(final int type) {
final AppSettings appSettings = ((App)getActivity().getApplication()).getSettings(); final AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
final Context context = getActivity(); final Context context = getActivity();
//Inflate dialog layout //Inflate dialog layout
@ -278,10 +280,10 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
base.setOnColorChangedListener(new OnColorChangedListener() { base.setOnColorChangedListener(new OnColorChangedListener() {
@Override @Override
public void onColorChanged(int i) { public void onColorChanged(int i) {
AppLog.d(this, "Selected Base color changed: "+i); AppLog.d(this, "Selected Base color changed: " + i);
shade.setColors(ColorPalette.getColors(context, i)); shade.setColors(ColorPalette.getColors(context, i));
titleBackground.setBackgroundColor(i); titleBackground.setBackgroundColor(i);
if(i == current[0]) { if (i == current[0]) {
shade.setSelectedColor(current[1]); shade.setSelectedColor(current[1]);
titleBackground.setBackgroundColor(shade.getColor()); titleBackground.setBackgroundColor(shade.getColor());
} }
@ -300,12 +302,12 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
if(type == 1) { if (type == 1) {
appSettings.setPrimaryColorSettings(base.getColor(), shade.getColor()); appSettings.setPrimaryColorSettings(base.getColor(), shade.getColor());
if(Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
getActivity().getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor()); getActivity().getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
} }
((ThemedActivity)getActivity()).applyColorToViews(); ((ThemedActivity) getActivity()).applyColorToViews();
} else { } else {
appSettings.setAccentColorSettings(base.getColor(), shade.getColor()); appSettings.setAccentColorSettings(base.getColor(), shade.getColor());
} }
@ -327,10 +329,10 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
@Override @Override
protected void onStop() { protected void onStop() {
ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings(); ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
if(!oldProxySettings.equals(newProxySettings)) { if (!oldProxySettings.equals(newProxySettings)) {
AppLog.d(this, "ProxySettings changed."); AppLog.d(this, "ProxySettings changed.");
//Proxy on-off? => Restart app //Proxy on-off? => Restart app
if(oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) { if (oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) {
Intent restartActivity = new Intent(SettingsActivity.this, MainActivity.class); Intent restartActivity = new Intent(SettingsActivity.this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(SettingsActivity.this, 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent pendingIntent = PendingIntent.getActivity(SettingsActivity.this, 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) SettingsActivity.this.getSystemService(Context.ALARM_SERVICE); AlarmManager mgr = (AlarmManager) SettingsActivity.this.getSystemService(Context.ALARM_SERVICE);

View file

@ -37,7 +37,7 @@ import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
public abstract class ThemedActivity extends AppCompatActivity { public abstract class ThemedActivity extends AppCompatActivity {
protected AppSettings getAppSettings() { protected AppSettings getAppSettings() {
return ((App)getApplication()).getSettings(); return ((App) getApplication()).getSettings();
} }
@Override @Override
@ -48,6 +48,7 @@ public abstract class ThemedActivity extends AppCompatActivity {
updateRecentAppColor(); updateRecentAppColor();
applyColorToViews(); applyColorToViews();
} }
protected abstract void applyColorToViews(); protected abstract void applyColorToViews();
/** /**
@ -64,10 +65,10 @@ public abstract class ThemedActivity extends AppCompatActivity {
* Update primary color in recent apps overview * Update primary color in recent apps overview
*/ */
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateRecentAppColor(){ private void updateRecentAppColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BitmapDrawable drawable = ((BitmapDrawable) getDrawable(R.drawable.ic_launcher)); BitmapDrawable drawable = ((BitmapDrawable) getDrawable(R.drawable.ic_launcher));
if(drawable != null) { if (drawable != null) {
setTaskDescription(new ActivityManager.TaskDescription( setTaskDescription(new ActivityManager.TaskDescription(
getResources().getString(R.string.app_name), getResources().getString(R.string.app_name),
drawable.getBitmap(), drawable.getBitmap(),

View file

@ -19,8 +19,13 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod.DiasporaPodUrl;
import com.github.dfa.diaspora_android.util.ProxyHandler; import com.github.dfa.diaspora_android.util.ProxyHandler;
import org.json.JSONException;
import org.json.JSONObject;
/** /**
* Settings * Settings
* Created by gsantner (https://gsantner.github.io/) on 20.03.16. Part of Diaspora for Android. * Created by gsantner (https://gsantner.github.io/) on 20.03.16. Part of Diaspora for Android.
@ -29,6 +34,7 @@ public class AppSettings {
private final SharedPreferences prefApp; private final SharedPreferences prefApp;
private final SharedPreferences prefPod; private final SharedPreferences prefPod;
private final Context context; private final Context context;
private DiasporaPod currentPod0Cached;
public AppSettings(Context context) { public AppSettings(Context context) {
this.context = context.getApplicationContext(); this.context = context.getApplicationContext();
@ -135,24 +141,44 @@ public class AppSettings {
setString(prefPod, R.string.pref_key__podprofile_name, name); setString(prefPod, R.string.pref_key__podprofile_name, name);
} }
public String getPodDomain() {
return getString(prefPod, R.string.pref_key__poddomain, ""); // TODO: Remove legacy at some time ;)
public void upgradeLegacyPoddomain() {
String legacy = getString(prefPod, R.string.pref_key__poddomain_legacy, "");
if (!legacy.equals("")) {
DiasporaPod pod = new DiasporaPod();
pod.setName(legacy);
pod.getPodUrls().add(new DiasporaPodUrl().setHost(legacy));
setPod(pod);
}
} }
public void setPodDomain(String podDomain) { public DiasporaPod getPod() {
setString(prefPod, R.string.pref_key__poddomain, podDomain); upgradeLegacyPoddomain();
if (currentPod0Cached == null) {
String pref = getString(prefPod, R.string.pref_key__current_pod_0, "");
try {
currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref));
} catch (JSONException e) {
currentPod0Cached = null;
}
}
return currentPod0Cached;
} }
public boolean hasPodDomain() { public void setPod(DiasporaPod pod) {
return !getString(prefPod, R.string.pref_key__poddomain, "").equals(""); try {
setString(prefPod, R.string.pref_key__current_pod_0,
pod == null ? null : pod.toJson().toString());
currentPod0Cached = pod;
} catch (JSONException ignored) {
}
} }
public String[] getPreviousPodlist() { public boolean hasPod() {
return getStringArray(prefApp, R.string.pref_key__previous_podlist); upgradeLegacyPoddomain();
} return !getString(prefPod, R.string.pref_key__current_pod_0, "").equals("");
public void setPreviousPodlist(String[] pods) {
setStringArray(prefApp, R.string.pref_key__previous_podlist, pods);
} }
public void setPodAspects(PodAspect[] aspects) { public void setPodAspects(PodAspect[] aspects) {
@ -238,6 +264,7 @@ public class AppSettings {
public void setProxyHttpHost(String value) { public void setProxyHttpHost(String value) {
setString(prefApp, R.string.pref_key__http_proxy_host, value); setString(prefApp, R.string.pref_key__http_proxy_host, value);
} }
/** /**
* Default value: 0 * Default value: 0
* *

View file

@ -0,0 +1,516 @@
package com.github.dfa.diaspora_android.data;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* Created by gsantner (https://gsantner.github.io/ on 30.09.16.
* DiasporaPodList - List container for DiasporaPod's, with methods to merge with other DiasporaPodLists
* DiasporaPod - Data container for a Pod, can include N DiasporaPodUrl's
* DiasporaPodUrl - A Url of an DiasporaPod
* For all Classes a loading and saving to JSON method is available
*/
public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, Serializable {
private List<DiasporaPod> pods = new ArrayList<>();
private boolean trackMergeChanges = false;
private Integer trackAddedIndexStart = -1;
private List<Integer> trackUpdatedIndexes = new ArrayList<>();
private boolean keepOldNameDuringMerge = false;
private long timestamp;
public DiasporaPodList() {
}
/**
* Load DiasporaPodList from Json
*
* @param json Json Object
*/
public DiasporaPodList fromJson(JSONObject json) throws JSONException {
JSONArray jarr;
pods.clear();
if (json.has("pods")) {
jarr = json.getJSONArray("pods");
for (int i = 0; i < jarr.length(); i++) {
DiasporaPod pod = new DiasporaPod().fromJson(jarr.getJSONObject(i));
pods.add(pod);
}
}
if (json.has("timestamp")) {
timestamp = json.getLong("timestamp");
}
return this;
}
/**
* Convert DiasporaPodList to JSON
*/
public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject();
JSONArray jpods = new JSONArray();
for (DiasporaPod pod : pods) {
jpods.put(pod.toJson());
}
json.put("pods", jpods);
json.put("timestamp", System.currentTimeMillis());
return json;
}
/**
* Merge newer entries into this podlist
* Will add new pods, and update data of pods with data from the new list
*
* @param newPodList Another podlist
*/
public void mergeWithNewerEntries(final DiasporaPodList newPodList) throws JSONException {
if (isTrackMergeChanges()) {
trackAddedIndexStart = -1;
trackUpdatedIndexes.clear();
}
for (DiasporaPod newPod : newPodList) {
int index = pods.indexOf(newPod);
if (index >= 0) {
DiasporaPod updatePodBak = new DiasporaPod().fromJson(pods.get(index).toJson());
DiasporaPod updatePod = pods.get(index);
updatePod.fromJson(newPod.toJson());
// Restore Pod id (if was set to zero)
if (updatePodBak.getId() != 0 && updatePod.getId() == 0) {
updatePod.setId(updatePodBak.getId());
}
if (updatePodBak.getActive6() != 0 && updatePod.getActive6() == 0) {
updatePod.setActive6(updatePodBak.getActive6());
}
if (updatePodBak.getScore() != 0 && updatePod.getScore() == 0) {
updatePod.setScore(updatePodBak.getScore());
}
if (!updatePodBak.getName().equals("") && keepOldNameDuringMerge) {
updatePod.setName(updatePodBak.getName());
}
if (isTrackMergeChanges()) {
trackUpdatedIndexes.add(index);
}
} else {
pods.add(newPod);
if (isTrackMergeChanges() && trackAddedIndexStart == -1) {
trackAddedIndexStart = pods.size() - 1;
}
}
}
}
/**
* Sort the pod list
*/
public void sortPods() {
Collections.sort(pods);
}
/**
* Iterator for Iterable interface (forEach, ..)
*/
public Iterator<DiasporaPod> iterator() {
return pods.iterator();
}
public int size() {
return pods.size();
}
public int indexOf(DiasporaPod pod) {
return pods.indexOf(pod);
}
public List<DiasporaPod> getPods() {
return pods;
}
public void setPods(List<DiasporaPod> pods) {
this.pods = pods;
}
public DiasporaPod getPodAt(int index) {
if (index >= 0 && index < pods.size()) {
return pods.get(index);
}
return null;
}
public boolean isTrackMergeChanges() {
return trackMergeChanges;
}
public void setTrackMergeChanges(boolean trackMergeChanges) {
this.trackMergeChanges = trackMergeChanges;
}
public Integer getTrackAddedIndexStart() {
return trackAddedIndexStart;
}
public List<Integer> getTrackUpdatedIndexes() {
return trackUpdatedIndexes;
}
public boolean isKeepOldNameDuringMerge() {
return keepOldNameDuringMerge;
}
public void setKeepOldNameDuringMerge(boolean keepOldNameDuringMerge) {
this.keepOldNameDuringMerge = keepOldNameDuringMerge;
}
/*
*
*
*
*
*
*/
public static class DiasporaPod implements Iterable<DiasporaPodList.DiasporaPod.DiasporaPodUrl>, Comparable<DiasporaPod>, Serializable {
private List<DiasporaPodUrl> podUrls = new ArrayList<>();
private List<String> mainLangs = new ArrayList<>();
private String name = "";
private int score = 0;
private int id = 0;
private long active6 = 0;
public DiasporaPod() {
}
/**
* Load a DiasporaPod from JSON
*
* @param json Json Object
*/
public DiasporaPod fromJson(JSONObject json) throws JSONException {
JSONArray jarr;
if (json.has("name")) {
name = json.getString("name");
}
if (json.has("mainLangs")) {
jarr = json.getJSONArray("mainLangs");
for (int i = 0; i < jarr.length(); i++) {
String val = jarr.getString(i);
if (!mainLangs.contains(val)) {
mainLangs.add(val);
}
}
}
if (json.has("podUrls")) {
jarr = json.getJSONArray("podUrls");
for (int i = 0; i < jarr.length(); i++) {
DiasporaPodUrl podUrl = new DiasporaPodUrl().fromJson(jarr.getJSONObject(i));
if (!podUrls.contains(podUrl)) {
podUrls.add(podUrl);
}
}
}
if (json.has("score")) {
score = json.getInt("score");
}
if (json.has("active6")) {
active6 = json.getLong("active6");
}
if (json.has("id")) {
id = json.getInt("id");
}
return this;
}
/**
* Convert DiasporaPod to JSON
*/
public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject();
json.put("name", name);
json.put("score", score);
json.put("active6", active6);
json.put("id", id);
// Pod urls
JSONArray jarr = new JSONArray();
for (DiasporaPodUrl value : podUrls) {
jarr.put(value.toJson());
}
json.put("podUrls", jarr);
// main langs
jarr = new JSONArray();
for (String value : mainLangs) {
jarr.put(value);
}
json.put("mainLangs", jarr);
return json;
}
@Override
public boolean equals(Object o) {
boolean ret = false;
if (o instanceof DiasporaPod) {
DiasporaPod otherPod = (DiasporaPod) o;
// Check if id is equal
ret = this.id != 0 && this.id == otherPod.id;
// Check if host is the same (fallback if id is 0)
if (!ret) {
for (DiasporaPodUrl podUrl : podUrls) {
for (DiasporaPodUrl otherPodUrl : otherPod.getPodUrls()) {
if (podUrl.getBaseUrl().equals(otherPodUrl.getBaseUrl())) {
ret = true;
}
}
}
}
}
return ret;
}
@Override
public int compareTo(DiasporaPod otherPod) {
if (otherPod != null) {
List<DiasporaPodUrl> myPodUrls = getPodUrls();
List<DiasporaPodUrl> otherPodUrls = otherPod.getPodUrls();
if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) {
return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost());
}
}
return name.compareTo(otherPod.getName());
}
@Override
public String toString() {
return name + "(" + id + ")";
}
/**
* Iterator for Iterable interface (forEach, ..)
*/
public Iterator<DiasporaPodUrl> iterator() {
return podUrls.iterator();
}
/*
* Getter & Setter
*/
public List<DiasporaPodUrl> getPodUrls() {
return podUrls;
}
public DiasporaPod setPodUrls(List<DiasporaPodUrl> podUrls) {
this.podUrls = podUrls;
return this;
}
public List<String> getMainLangs() {
return mainLangs;
}
public DiasporaPod setMainLangs(List<String> mainLangs) {
this.mainLangs = mainLangs;
return this;
}
public DiasporaPod appendMainLangs(String... values) {
for (String mainLang : values) {
this.mainLangs.add(mainLang);
}
return this;
}
/**
* Returns the first DiasporaPodUrl in the list
*/
public DiasporaPodUrl getPodUrl() {
if (podUrls.size() > 0) {
return podUrls.get(0);
}
return null;
}
public DiasporaPod appendPodUrls(DiasporaPodUrl... values) {
for (DiasporaPodUrl value : values) {
this.podUrls.add(value);
}
return this;
}
public String getName() {
return name;
}
public DiasporaPod setName(String name) {
this.name = name;
return this;
}
public int getScore() {
return score;
}
public DiasporaPod setScore(int score) {
this.score = score;
return this;
}
public long getActive6() {
return active6;
}
public DiasporaPod setActive6(long active6) {
this.active6 = active6;
return this;
}
public int getId() {
return id;
}
public DiasporaPod setId(int id) {
this.id = id;
return this;
}
/*
*
*
*
*
*
*/
public static class DiasporaPodUrl implements Serializable {
private String host = "";
private String protocol = "https";
private Integer port = 443;
public DiasporaPodUrl() {
}
public DiasporaPodUrl(JSONObject json) throws JSONException {
fromJson(json);
}
/**
* Get the base url
*
* @return
*/
public String getBaseUrl() {
return protocol + "://" + host + (isPortNeeded() ? port : "");
}
/**
* Convert JSON to DiasporaPodList
*
* @param json JSON Object
*/
public DiasporaPodUrl fromJson(JSONObject json) throws JSONException {
if (json.has("host")) {
host = json.getString("host");
}
if (json.has("protocol")) {
protocol = json.getString("protocol");
}
if (json.has("port")) {
port = json.getInt("port");
}
return this;
}
/***
* Convert DiasporaPodList to JSON
*/
public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject();
json.put("host", host);
if (!protocol.equals("https")) {
json.put("protocol", protocol);
}
if (port != 443) {
json.put("port", port);
}
return json;
}
/**
* Set default values for https
*/
public void setHttpsDefaults() {
setProtocol("https");
setPort(443);
}
/**
* Set default values for http
*/
public void setHttpDefaults() {
setProtocol("http");
setPort(80);
}
/**
* Tells if the ports needs to shown
*/
public boolean isPortNeeded() {
return !((port == 80 && protocol.equals("http")) || (port == 443 && protocol.equals("https")));
}
@Override
public String toString() {
return getBaseUrl();
}
@Override
public boolean equals(Object o) {
if (o instanceof DiasporaPodUrl) {
return getBaseUrl().equals(((DiasporaPodUrl) o).getBaseUrl());
}
return false;
}
/*
* GETTER & SETTER
*/
public String getHost() {
return host;
}
public DiasporaPodUrl setHost(String host) {
this.host = host;
return this;
}
public String getProtocol() {
return protocol;
}
public DiasporaPodUrl setProtocol(String protocol) {
this.protocol = protocol;
return this;
}
public Integer getPort() {
return port;
}
public DiasporaPodUrl setPort(Integer port) {
this.port = port;
return this;
}
}
}
}

View file

@ -70,8 +70,8 @@ public class PodAspect {
public String toHtmlLink(final App app) { public String toHtmlLink(final App app) {
final AppSettings appSettings = app.getSettings(); final AppSettings appSettings = app.getSettings();
return String.format(Locale.getDefault(), return String.format(Locale.getDefault(),
"<a href='https://%s/aspects?a_ids[]=%d' style='color: #000000; text-decoration: none;'>%s</a>", "<a href='%s/aspects?a_ids[]=%d' style='color: #000000; text-decoration: none;'>%s</a>",
appSettings.getPodDomain(), id, name); appSettings.getPod().getPodUrl().getBaseUrl(), id, name);
} }
@Override @Override

View file

@ -20,11 +20,9 @@ package com.github.dfa.diaspora_android.data;
import android.os.Handler; import android.os.Handler;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.Log;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener; import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener;
import com.github.dfa.diaspora_android.util.AppLog;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -128,7 +126,7 @@ public class PodUserProfile {
isWebUserProfileLoaded = true; isWebUserProfileLoaded = true;
} catch (JSONException e) { } catch (JSONException e) {
AppLog.d(this, e.getMessage()); AppLog.d(this, e.getMessage());
isWebUserProfileLoaded = false; isWebUserProfileLoaded = false;
} }
lastLoaded = System.currentTimeMillis(); lastLoaded = System.currentTimeMillis();
@ -173,6 +171,7 @@ public class PodUserProfile {
/** /**
* Sets the avatar, returns true if this was a new one, false if already the old one * Sets the avatar, returns true if this was a new one, false if already the old one
*
* @param avatarUrl url * @param avatarUrl url
* @return true if new avatar url * @return true if new avatar url
*/ */

View file

@ -41,10 +41,10 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.activity.MainActivity;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.ui.ContextMenuWebView; import com.github.dfa.diaspora_android.ui.ContextMenuWebView;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import com.github.dfa.diaspora_android.webview.CustomWebViewClient; import com.github.dfa.diaspora_android.webview.CustomWebViewClient;
import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient; import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient;
@ -78,7 +78,7 @@ public class BrowserFragment extends ThemedFragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AppLog.d(this, "onCreateView()"); AppLog.d(this, "onCreateView()");
if(rootLayout == null) { if (rootLayout == null) {
rootLayout = inflater.inflate(R.layout.browser__fragment, container, false); rootLayout = inflater.inflate(R.layout.browser__fragment, container, false);
} }
return rootLayout; return rootLayout;
@ -89,21 +89,21 @@ public class BrowserFragment extends ThemedFragment {
AppLog.d(this, "onViewCreated()"); AppLog.d(this, "onViewCreated()");
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
if(this.appSettings == null) { if (this.appSettings == null) {
this.appSettings = ((App) getActivity().getApplication()).getSettings(); this.appSettings = ((App) getActivity().getApplication()).getSettings();
} }
if(this.webView == null) { if (this.webView == null) {
this.webView = (ContextMenuWebView) view.findViewById(R.id.webView); this.webView = (ContextMenuWebView) view.findViewById(R.id.webView);
this.applyWebViewSettings(); this.applyWebViewSettings();
ProxyHandler.getInstance().addWebView(webView); ProxyHandler.getInstance().addWebView(webView);
} }
if(this.progressBar == null) { if (this.progressBar == null) {
this.progressBar = (ProgressBar) view.findViewById(R.id.progressBar); this.progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
} }
if(pendingUrl != null) { if (pendingUrl != null) {
loadUrl(pendingUrl); loadUrl(pendingUrl);
pendingUrl = null; pendingUrl = null;
} }
@ -149,7 +149,7 @@ public class BrowserFragment extends ThemedFragment {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if(webView != null) { if (webView != null) {
webSettings.setMinimumFontSize(appSettings.getMinimumFontSize()); webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages()); webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
} }
@ -188,8 +188,8 @@ public class BrowserFragment extends ThemedFragment {
String fileSaveName = hasToShareScreenshot ? ".DfA_share.jpg" : String.format("DfA_%s.jpg", dateFormat.format(dateNow)); String fileSaveName = hasToShareScreenshot ? ".DfA_share.jpg" : String.format("DfA_%s.jpg", dateFormat.format(dateNow));
if (!fileSaveDirectory.exists()) { if (!fileSaveDirectory.exists()) {
if(!fileSaveDirectory.mkdirs()) { if (!fileSaveDirectory.mkdirs()) {
AppLog.w(this, "Could not mkdir "+fileSaveDirectory.getAbsolutePath()); AppLog.w(this, "Could not mkdir " + fileSaveDirectory.getAbsolutePath());
} }
} }
@ -248,7 +248,7 @@ public class BrowserFragment extends ThemedFragment {
} }
public boolean onBackPressed() { public boolean onBackPressed() {
if(webView.canGoBack()) { if (webView.canGoBack()) {
webView.goBack(); webView.goBack();
return true; return true;
} }
@ -256,17 +256,17 @@ public class BrowserFragment extends ThemedFragment {
} }
public void loadUrl(String url) { public void loadUrl(String url) {
if(getWebView() != null) { if (getWebView() != null) {
AppLog.v(this, "loadUrl(): load "+url); AppLog.v(this, "loadUrl(): load " + url);
getWebView().loadUrlNew(url); getWebView().loadUrlNew(url);
} else { } else {
AppLog.v(this, "loadUrl(): WebView null: Set pending url to "+url); AppLog.v(this, "loadUrl(): WebView null: Set pending url to " + url);
pendingUrl = url; pendingUrl = url;
} }
} }
public String getUrl() { public String getUrl() {
if(getWebView() != null) { if (getWebView() != null) {
return getWebView().getUrl(); return getWebView().getUrl();
} else { } else {
return pendingUrl; return pendingUrl;
@ -275,7 +275,7 @@ public class BrowserFragment extends ThemedFragment {
public void reloadUrl() { public void reloadUrl() {
AppLog.v(this, "reloadUrl()"); AppLog.v(this, "reloadUrl()");
if(getWebView() != null) { if (getWebView() != null) {
getWebView().reload(); getWebView().reload();
} }
} }

View file

@ -34,6 +34,7 @@ public abstract class CustomFragment extends Fragment {
/** /**
* We have an optionsMenu * We have an optionsMenu
*
* @param savedInstanceState state * @param savedInstanceState state
*/ */
@Override @Override
@ -44,13 +45,15 @@ public abstract class CustomFragment extends Fragment {
/** /**
* Return the tag used to identify the Fragment. * Return the tag used to identify the Fragment.
*
* @return tag * @return tag
*/ */
public abstract String getFragmentTag(); public abstract String getFragmentTag();
/** /**
* Add fragment-dependent options to the bottom options toolbar * Add fragment-dependent options to the bottom options toolbar
* @param menu bottom menu *
* @param menu bottom menu
* @param inflater inflater * @param inflater inflater
*/ */
public abstract void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater); public abstract void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater);
@ -58,6 +61,7 @@ public abstract class CustomFragment extends Fragment {
/** /**
* Return true if the fragment reacted to a back button press, false else. * Return true if the fragment reacted to a back button press, false else.
* In case the fragment returned false, the parent activity should handle the backPress. * In case the fragment returned false, the parent activity should handle the backPress.
*
* @return did we react to the back press? * @return did we react to the back press?
*/ */
public abstract boolean onBackPressed(); public abstract boolean onBackPressed();

View file

@ -44,12 +44,12 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.activity.MainActivity;
import com.github.dfa.diaspora_android.data.PodUserProfile; import com.github.dfa.diaspora_android.data.PodUserProfile;
import com.github.dfa.diaspora_android.webview.DiasporaStreamWebChromeClient;
import com.github.dfa.diaspora_android.webview.FileUploadWebChromeClient;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers; import com.github.dfa.diaspora_android.util.Helpers;
import com.github.dfa.diaspora_android.util.WebHelper; import com.github.dfa.diaspora_android.util.WebHelper;
import com.github.dfa.diaspora_android.webview.DiasporaStreamWebChromeClient;
import com.github.dfa.diaspora_android.webview.FileUploadWebChromeClient;
import org.json.JSONException; import org.json.JSONException;
@ -79,9 +79,9 @@ public class DiasporaStreamFragment extends BrowserFragment {
webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge"); webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge");
if(((MainActivity)getActivity()).getTextToBeShared() != null) { if (((MainActivity) getActivity()).getTextToBeShared() != null) {
loadUrl(urls.getNewPostUrl()); loadUrl(urls.getNewPostUrl());
} else if(webView.getUrl() == null) { } else if (webView.getUrl() == null) {
loadUrl(urls.getStreamUrl()); loadUrl(urls.getStreamUrl());
} }
} }
@ -98,11 +98,11 @@ public class DiasporaStreamFragment extends BrowserFragment {
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
AppLog.d(this, "onActivityResult(): "+requestCode); AppLog.d(this, "onActivityResult(): " + requestCode);
switch (requestCode) { switch (requestCode) {
case MainActivity.INPUT_FILE_REQUEST_CODE_NEW: case MainActivity.INPUT_FILE_REQUEST_CODE_NEW:
case MainActivity.INPUT_FILE_REQUEST_CODE_OLD: case MainActivity.INPUT_FILE_REQUEST_CODE_OLD:
AppLog.v(this, "INPUT_FILE_REQUEST_CODE: "+requestCode); AppLog.v(this, "INPUT_FILE_REQUEST_CODE: " + requestCode);
onImageUploadResult(requestCode, resultCode, data); onImageUploadResult(requestCode, resultCode, data);
return; return;
} }
@ -114,7 +114,7 @@ public class DiasporaStreamFragment extends BrowserFragment {
AppLog.d(this, "StreamFragment.onOptionsItemSelected()"); AppLog.d(this, "StreamFragment.onOptionsItemSelected()");
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_reload: { case R.id.action_reload: {
if(WebHelper.isOnline(getContext())) { if (WebHelper.isOnline(getContext())) {
reloadUrl(); reloadUrl();
return true; return true;
} else { } else {
@ -226,18 +226,19 @@ public class DiasporaStreamFragment extends BrowserFragment {
protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() { protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() {
@Override @Override
public String getSharedText() { public String getSharedText() {
return ((MainActivity)getActivity()).getTextToBeShared(); return ((MainActivity) getActivity()).getTextToBeShared();
} }
@Override @Override
public void setSharedText(String shared) { public void setSharedText(String shared) {
((MainActivity)getActivity()).setTextToBeShared(shared); ((MainActivity) getActivity()).setTextToBeShared(shared);
} }
}; };
protected FileUploadWebChromeClient.FileUploadCallback fileUploadCallback = new FileUploadWebChromeClient.FileUploadCallback() { protected FileUploadWebChromeClient.FileUploadCallback fileUploadCallback = new FileUploadWebChromeClient.FileUploadCallback() {
@Override @Override
public boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { public boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if(Build.VERSION.SDK_INT >= 23) { if (Build.VERSION.SDK_INT >= 23) {
int hasWRITE_EXTERNAL_STORAGE = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); int hasWRITE_EXTERNAL_STORAGE = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) { if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) {
if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
@ -261,7 +262,8 @@ public class DiasporaStreamFragment extends BrowserFragment {
} }
} }
AppLog.v(this, "onOpenFileChooser"); AppLog.v(this, "onOpenFileChooser");
if (imageUploadFilePathCallbackNew != null) imageUploadFilePathCallbackNew.onReceiveValue(null); if (imageUploadFilePathCallbackNew != null)
imageUploadFilePathCallbackNew.onReceiveValue(null);
imageUploadFilePathCallbackNew = filePathCallback; imageUploadFilePathCallbackNew = filePathCallback;
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) { if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) {
@ -271,7 +273,7 @@ public class DiasporaStreamFragment extends BrowserFragment {
photoFile = Helpers.createImageFile(); photoFile = Helpers.createImageFile();
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
} catch (IOException ex) { } catch (IOException ex) {
AppLog.e(this, "ERROR creating temp file: "+ ex.toString()); AppLog.e(this, "ERROR creating temp file: " + ex.toString());
// Error occurred while creating the File // Error occurred while creating the File
Snackbar.make(webView, R.string.unable_to_load_image, Snackbar.LENGTH_LONG).show(); Snackbar.make(webView, R.string.unable_to_load_image, Snackbar.LENGTH_LONG).show();
return false; return false;
@ -321,7 +323,7 @@ public class DiasporaStreamFragment extends BrowserFragment {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JavascriptInterface @JavascriptInterface
public void setUserProfile(final String webMessage) throws JSONException { public void setUserProfile(final String webMessage) throws JSONException {
PodUserProfile pup = ((App)getActivity().getApplication()).getPodUserProfile(); PodUserProfile pup = ((App) getActivity().getApplication()).getPodUserProfile();
AppLog.v(this, "StreamFragment.JavaScriptInterface.setUserProfile()"); AppLog.v(this, "StreamFragment.JavaScriptInterface.setUserProfile()");
if (pup.isRefreshNeeded()) { if (pup.isRefreshNeeded()) {
AppLog.v(this, "PodUserProfile needs refresh; Try to parse JSON"); AppLog.v(this, "PodUserProfile needs refresh; Try to parse JSON");
@ -334,7 +336,7 @@ public class DiasporaStreamFragment extends BrowserFragment {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JavascriptInterface @JavascriptInterface
public void contentHasBeenShared() { public void contentHasBeenShared() {
((MainActivity)getActivity()).setTextToBeShared(null); ((MainActivity) getActivity()).setTextToBeShared(null);
} }
} }

View file

@ -94,9 +94,9 @@ public class HashtagListFragment extends CustomFragment {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
int itemPosition = followedTagsRecyclerView.getChildLayoutPosition(view); int itemPosition = followedTagsRecyclerView.getChildLayoutPosition(view);
if(itemPosition > -1 && itemPosition < followedTags.length) { if (itemPosition > -1 && itemPosition < followedTags.length) {
String tag = followedTags[itemPosition]; String tag = followedTags[itemPosition];
((MainActivity)getActivity()).openDiasporaUrl(urls.getSearchTagsUrl(tag)); ((MainActivity) getActivity()).openDiasporaUrl(urls.getSearchTagsUrl(tag));
} }
} }
}; };

View file

@ -18,20 +18,16 @@
*/ */
package com.github.dfa.diaspora_android.fragment; package com.github.dfa.diaspora_android.fragment;
import android.app.AlertDialog;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.text.Editable; import android.support.v4.view.MenuItemCompat;
import android.text.SpannableString; import android.support.v7.widget.SearchView;
import android.text.TextWatcher;
import android.text.util.Linkify;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -41,74 +37,98 @@ import android.view.ViewGroup;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.activity.MainActivity;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.data.DiasporaPodList;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.task.GetPodsService; import com.github.dfa.diaspora_android.task.GetPodsService;
import com.github.dfa.diaspora_android.ui.PodSelectionDialog;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.WebHelper; import com.github.dfa.diaspora_android.util.Helpers;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/** /**
* Fragment that lets the user choose a Pod * Fragment that lets the user choose a Pod
* Created by vanitas on 01.10.16. * Created by vanitas on 01.10.16.
*/ */
public class PodSelectionFragment extends CustomFragment { public class PodSelectionFragment extends CustomFragment implements SearchView.OnQueryTextListener, PodSelectionDialog.PodSelectionDialogResultListener {
public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionFragment"; public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionFragment";
protected EditText editFilter; @BindView(R.id.podselection__fragment__listpods)
protected ListView listPods; protected ListView listViewPod;
protected ImageView selectPodButton;
protected App app; protected App app;
protected AppSettings appSettings; protected AppSettings appSettings;
private DiasporaPodList podList;
private ArrayAdapter<String> listViewPodAdapter;
private String filterString = "";
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AppLog.d(this, "onCreateView()"); AppLog.d(this, "onCreateView()");
return inflater.inflate(R.layout.podselection__fragment, container, false); View view = inflater.inflate(R.layout.podselection__fragment, container, false);
ButterKnife.bind(this, view);
return view;
} }
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
this.app = (App) getActivity().getApplication(); app = (App) getActivity().getApplication();
this.appSettings = app.getSettings(); appSettings = app.getSettings();
this.editFilter = (EditText) view.findViewById(R.id.podselection__edit_filter); // Load local podlist
this.listPods = (ListView) view.findViewById(R.id.podselection__listpods); podList = new DiasporaPodList();
this.selectPodButton = (ImageView) view.findViewById(R.id.podselection__button_select_pod); mergePodlistWithRessources(podList);
podList.setTrackMergeChanges(true);
updateListedPods();
listPods.setTextFilterEnabled(true);
listPods.setOnItemClickListener(new AdapterView.OnItemClickListener() { listViewPod.setTextFilterEnabled(true);
@Override listViewPod.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
showPodConfirmationDialog((String) listPods.getAdapter().getItem(i)); String text = ((TextView) view).getText().toString();
} for (DiasporaPod pod : podList) {
}); if (pod.getPodUrl().getHost().equals(text)) {
setListedPods(appSettings.getPreviousPodlist()); showPodSelectionDialog(pod);
LocalBroadcastManager.getInstance(getContext()).registerReceiver(podListReceiver, new IntentFilter(GetPodsService.MESSAGE_PODS_RECEIVED)); return;
if (!WebHelper.isOnline(getContext())) { }
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
}
selectPodButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (editFilter.getText().length() > 4 && editFilter.getText().toString().contains("")) {
showPodConfirmationDialog(editFilter.getText().toString());
} else {
Snackbar.make(listPods, R.string.valid_pod, Snackbar.LENGTH_LONG).show();
} }
} }
}); });
LocalBroadcastManager.getInstance(getContext()).registerReceiver(podListReceiver, new IntentFilter(GetPodsService.MESSAGE_PODS_RECEIVED));
Helpers.showInfoIfUserNotConnectedToInternet(getContext(), listViewPod);
}
public void mergePodlistWithRessources(DiasporaPodList podlist) {
String sPodlist = Helpers.readTextfileFromRawRessource(getContext(), R.raw.podlist, "", "");
try {
JSONObject jPodlist = new JSONObject(sPodlist);
podlist.mergeWithNewerEntries(new DiasporaPodList().fromJson(jPodlist));
} catch (JSONException e) {
e.printStackTrace();
}
}
@OnClick(R.id.podselection__fragment__button_use_custom_pod)
public void onPodButtonClicked(View v) {
showPodSelectionDialog(new DiasporaPod());
} }
@Override @Override
@ -116,28 +136,20 @@ public class PodSelectionFragment extends CustomFragment {
return TAG; return TAG;
} }
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
/* Nothing to do */
}
@Override
public boolean onBackPressed() {
return false;
}
private final BroadcastReceiver podListReceiver = new BroadcastReceiver() { private final BroadcastReceiver podListReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent.hasExtra("pods")) { if (intent.hasExtra(GetPodsService.EXTRA_PODLIST)) {
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
String[] pods = extras.getStringArray("pods"); DiasporaPodList newPods = (DiasporaPodList) extras.get(GetPodsService.EXTRA_PODLIST);
if (pods != null && pods.length > 0) { if (newPods != null && newPods.getPods().size() > 0) {
app.getSettings().setPreviousPodlist(pods); try {
setListedPods(pods); podList.mergeWithNewerEntries(newPods);
updateListedPods();
} catch (JSONException ignored) {
}
} else { } else {
setListedPods(app.getSettings().getPreviousPodlist()); Snackbar.make(listViewPod, R.string.podlist_error, Snackbar.LENGTH_SHORT).show();
Snackbar.make(listPods, R.string.podlist_error, Snackbar.LENGTH_SHORT).show();
} }
} }
} }
@ -150,83 +162,30 @@ public class PodSelectionFragment extends CustomFragment {
getContext().startService(i); getContext().startService(i);
} }
private void updateListedPods() {
private void setListedPods(String[] listedPodsArr) {
final ArrayList<String> listedPodsList = new ArrayList<>(); final ArrayList<String> listedPodsList = new ArrayList<>();
for (String pod : listedPodsArr) { for (DiasporaPod pod : this.podList) {
listedPodsList.add(pod.toLowerCase()); listedPodsList.add(pod.getPodUrl().getHost());
} }
final ArrayAdapter<String> adapter = new ArrayAdapter<>( listViewPodAdapter = new ArrayAdapter<>(
getContext(), getContext(),
android.R.layout.simple_list_item_1, android.R.layout.simple_list_item_1,
listedPodsList); listedPodsList);
// save index and top position // save index and top position
int index = listPods.getFirstVisiblePosition(); int index = listViewPod.getFirstVisiblePosition();
View v = listPods.getChildAt(0); View v = listViewPod.getChildAt(0);
int top = (v == null) ? 0 : (v.getTop() - listPods.getPaddingTop()); int top = (v == null) ? 0 : (v.getTop() - listViewPod.getPaddingTop());
listPods.setAdapter(adapter); listViewPod.setAdapter(listViewPodAdapter);
listPods.setSelectionFromTop(index, top); listViewPod.setSelectionFromTop(index, top);
adapter.getFilter().filter(editFilter.getText()); listViewPodAdapter.getFilter().filter(filterString);
editFilter.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
(adapter).getFilter().filter(s.toString());
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void afterTextChanged(Editable s) {
}
});
} }
private void showPodConfirmationDialog(final String selectedPod) { private void showPodSelectionDialog(final DiasporaPod selectedPod) {
// Make a clickable link PodSelectionDialog dialog = PodSelectionDialog.newInstance(selectedPod, this);
final SpannableString dialogMessage = new SpannableString(getString(R.string.confirm_pod, selectedPod)); dialog.show(getFragmentManager(), PodSelectionDialog.TAG);
Linkify.addLinks(dialogMessage, Linkify.ALL);
// Check if online
if (!WebHelper.isOnline(getContext())) {
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
return;
}
// Show dialog
new AlertDialog.Builder(getContext())
.setTitle(getString(R.string.confirmation))
.setMessage(dialogMessage)
.setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
onPodSelectionConfirmed(selectedPod);
}
})
.setNegativeButton(android.R.string.no, null)
.show();
}
private void onPodSelectionConfirmed(String selectedPod) {
app.getSettings().setPodDomain(selectedPod);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().removeSessionCookies(null);
} else {
//noinspection deprecation
CookieManager.getInstance().removeAllCookie();
//noinspection deprecation
CookieManager.getInstance().removeSessionCookie();
}
} catch (Exception e) {
e.printStackTrace();
}
((MainActivity)getActivity()).openDiasporaUrl(new DiasporaUrlHelper(appSettings).getPodUrl());
} }
@Override @Override
@ -238,6 +197,13 @@ public class PodSelectionFragment extends CustomFragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.podselection__menu, menu); inflater.inflate(R.menu.podselection__menu, menu);
MenuItem searchItem = menu.findItem(R.id.podselection__action_search);
if (searchItem != null) {
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setOnQueryTextListener(this);
}
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
} }
@ -245,16 +211,67 @@ public class PodSelectionFragment extends CustomFragment {
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_reload: { case R.id.action_reload: {
if (WebHelper.isOnline(getContext())) { if (!Helpers.showInfoIfUserNotConnectedToInternet(getContext(), listViewPod)) {
Intent i = new Intent(getContext(), GetPodsService.class); Intent i = new Intent(getContext(), GetPodsService.class);
getContext().startService(i); getContext().startService(i);
return true; return true;
} else {
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
return false;
} }
} }
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
}
@Override
public boolean onQueryTextChange(String newText) {
if (listViewPodAdapter != null) {
(listViewPodAdapter).getFilter().filter(newText);
}
return true;
}
@Override
public void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted) {
System.out.println(accepted + ": " + pod.toString());
if (accepted) {
app.getSettings().setPod(pod);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().removeSessionCookies(null);
} else {
//noinspection deprecation
CookieManager.getInstance().removeAllCookie();
//noinspection deprecation
CookieManager.getInstance().removeSessionCookie();
}
} catch (Exception e) {
e.printStackTrace();
}
MainActivity mainActivity = (MainActivity) getActivity();
DiasporaUrlHelper urlHelper = new DiasporaUrlHelper(appSettings);
mainActivity.invalidateOptionsMenu();
mainActivity.openDiasporaUrl(urlHelper.getSignInUrl());
}
}
/*
* Dummy implementations
*/
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
}
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onBackPressed() {
return false;
}
}

View file

@ -29,7 +29,7 @@ import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
public abstract class ThemedFragment extends CustomFragment { public abstract class ThemedFragment extends CustomFragment {
protected AppSettings getAppSettings() { protected AppSettings getAppSettings() {
return ((App)getActivity().getApplication()).getSettings(); return ((App) getActivity().getApplication()).getSettings();
} }
protected abstract void applyColorToViews(); protected abstract void applyColorToViews();

View file

@ -58,7 +58,7 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL); String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL);
url = Uri.parse(sUrl); url = Uri.parse(sUrl);
} catch (Exception _ignored) { } catch (Exception _ignored) {
AppLog.v(this, "Could not open Chrome Custom Tab (bad URL)"); AppLog.v(this, "Could not open Chrome Custom Tab (bad URL)");
return; return;
} }

View file

@ -24,24 +24,24 @@ import android.os.AsyncTask;
import android.os.IBinder; import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import com.github.dfa.diaspora_android.data.DiasporaPodList;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import org.json.JSONArray; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher; import info.guardianproject.netcipher.NetCipher;
public class GetPodsService extends Service { public class GetPodsService extends Service {
public static final String EXTRA_PODLIST = "pods";
public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived"; public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived";
public static final String PODDY_PODLIST_URL = "https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/podList/podlist.json";
public GetPodsService() { public GetPodsService() {
} }
@ -53,75 +53,48 @@ public class GetPodsService extends Service {
} }
private void getPods() { private void getPods() {
/* AsyncTask<Void, Void, DiasporaPodList> getPodsAsync = new AsyncTask<Void, Void, DiasporaPodList>() {
* Most of the code in this AsyncTask is from the file getPodlistTask.java
* from the app "Diaspora Webclient".
* A few modifications and adaptations were made by me.
* Source:
* https://github.com/voidcode/Diaspora-Webclient/blob/master/src/com/voidcode/diasporawebclient/getPodlistTask.java
* Thanks to Terkel Sørensen ; License : GPLv3
*/
AsyncTask<Void, Void, String[]> getPodsAsync = new AsyncTask<Void, Void, String[]>() {
@Override @Override
protected String[] doInBackground(Void... params) { protected DiasporaPodList doInBackground(Void... params) {
StringBuilder sb = new StringBuilder();
// TODO: Update deprecated code BufferedReader br = null;
StringBuilder builder = new StringBuilder();
//HttpClient client = new DefaultHttpClient();
List<String> list = null;
HttpsURLConnection connection;
InputStream inStream;
try { try {
connection = NetCipher.getHttpsURLConnection("https://podupti.me/api.php?key=4r45tg&format=json"); HttpsURLConnection con = NetCipher.getHttpsURLConnection(PODDY_PODLIST_URL);
int statusCode = connection.getResponseCode(); if (con.getResponseCode() == HttpsURLConnection.HTTP_OK) {
if (statusCode == 200) { br = new BufferedReader(new InputStreamReader(con.getInputStream()));
inStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(inStream));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = br.readLine()) != null) {
builder.append(line); sb.append(line);
} }
try { // Parse JSON & return pod list
inStream.close(); JSONObject json = new JSONObject(sb.toString());
} catch (IOException e) {/*Nothing to do*/} return new DiasporaPodList().fromJson(json);
connection.disconnect();
} else { } else {
AppLog.e(this, "Failed to download list of pods"); AppLog.e(this, "Failed to download list of pods");
} }
} catch (IOException e) { } catch (IOException | JSONException e) {
//TODO handle json buggy feed
e.printStackTrace(); e.printStackTrace();
} } finally {
//Parse the JSON Data if (br != null) {
try { try {
JSONObject jsonObjectAll = new JSONObject(builder.toString()); br.close();
JSONArray jsonArrayAll = jsonObjectAll.getJSONArray("pods"); } catch (IOException ignored) {
AppLog.d(this, "Number of entries " + jsonArrayAll.length()); }
list = new ArrayList<>();
for (int i = 0; i < jsonArrayAll.length(); i++) {
JSONObject jo = jsonArrayAll.getJSONObject(i);
if (jo.getString("secure").equals("true"))
list.add(jo.getString("domain"));
} }
} catch (Exception e) {
//TODO Handle Parsing errors here
e.printStackTrace();
} }
if (list != null)
return list.toArray(new String[list.size()]); // Could not fetch list of pods :(
else return new DiasporaPodList();
return null;
} }
@Override @Override
protected void onPostExecute(String[] pods) { protected void onPostExecute(DiasporaPodList pods) {
if (pods == null) {
pods = new DiasporaPodList();
}
Intent broadcastIntent = new Intent(MESSAGE_PODS_RECEIVED); Intent broadcastIntent = new Intent(MESSAGE_PODS_RECEIVED);
broadcastIntent.putExtra("pods", pods != null ? pods : new String[0]); broadcastIntent.putExtra(EXTRA_PODLIST, pods);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(broadcastIntent); LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(broadcastIntent);
stopSelf(); stopSelf();
} }

View file

@ -22,12 +22,9 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.util.AppLog;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -80,7 +77,7 @@ public class ImageDownloadTask extends AsyncTask<String, Void, Bitmap> {
connection.disconnect(); connection.disconnect();
} catch (Exception e) { } catch (Exception e) {
AppLog.e(this, e.getMessage()); AppLog.e(this, e.getMessage());
} finally { } finally {
try { try {
if (out != null) { if (out != null) {

View file

@ -20,13 +20,11 @@ package com.github.dfa.diaspora_android.task;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.Log;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.data.PodUserProfile; import com.github.dfa.diaspora_android.data.PodUserProfile;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -62,7 +60,7 @@ public class ProfileFetchTask extends AsyncTask<Void, Void, Void> {
String extractedProfileData = null; String extractedProfileData = null;
final CookieManager cookieManager = app.getCookieManager(); final CookieManager cookieManager = app.getCookieManager();
String cookies = cookieManager.getCookie(urls.getPodUrl()); String cookies = cookieManager.getCookie(urls.getPodUrl());
AppLog.d(this, cookies); AppLog.d(this, cookies);
HttpsURLConnection connection; HttpsURLConnection connection;
InputStream inStream; InputStream inStream;
@ -88,10 +86,10 @@ public class ProfileFetchTask extends AsyncTask<Void, Void, Void> {
} }
} }
try{ try {
br.close(); br.close();
inStream.close(); inStream.close();
} catch (IOException e){/*Nothing*/} } catch (IOException e) {/*Nothing*/}
connection.disconnect(); connection.disconnect();
@ -103,7 +101,7 @@ public class ProfileFetchTask extends AsyncTask<Void, Void, Void> {
if (extractedProfileData != null) { if (extractedProfileData != null) {
PodUserProfile profile = new PodUserProfile(app); PodUserProfile profile = new PodUserProfile(app);
profile.parseJson(extractedProfileData); profile.parseJson(extractedProfileData);
AppLog.d(this, "Extracted new_messages (service):" + profile.getUnreadMessagesCount()); AppLog.d(this, "Extracted new_messages (service):" + profile.getUnreadMessagesCount());
} }
return null; return null;

View file

@ -20,12 +20,10 @@ package com.github.dfa.diaspora_android.task;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.Log;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -79,13 +77,13 @@ public class StatisticsFetchTask extends AsyncTask<Void, Void, Void> {
BufferedReader br = new BufferedReader(new InputStreamReader(inStream)); BufferedReader br = new BufferedReader(new InputStreamReader(inStream));
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
AppLog.d(this, "STATS: "+line); AppLog.d(this, "STATS: " + line);
} }
try{ try {
br.close(); br.close();
inStream.close(); inStream.close();
} catch (IOException e){/*Nothing*/} } catch (IOException e) {/*Nothing*/}
connection.disconnect(); connection.disconnect();

View file

@ -47,7 +47,7 @@ public class BottomBarBehavior extends CoordinatorLayout.Behavior<LinearLayout>
if (defaultDependencyTop == -1) { if (defaultDependencyTop == -1) {
defaultDependencyTop = dependency.getTop(); defaultDependencyTop = dependency.getTop();
} }
if(dependency.getTop()<0) if (dependency.getTop() < 0)
child.setTranslationY(-dependency.getTop() + defaultDependencyTop); child.setTranslationY(-dependency.getTop() + defaultDependencyTop);
else else
child.setTranslationY(defaultDependencyTop); child.setTranslationY(defaultDependencyTop);

View file

@ -217,7 +217,7 @@ public class ContextMenuWebView extends NestedWebView {
} }
} }
public void loadUrlNew(String url){ public void loadUrlNew(String url) {
stopLoading(); stopLoading();
loadUrl(url); loadUrl(url);
} }

View file

@ -64,16 +64,16 @@ public class HtmlTextView extends TextView {
/** /**
* Linkify, format markdown and escape the displayed text. * Linkify, format markdown and escape the displayed text.
*/ */
private void init(){ private void init() {
formatHtmlAndCustomTags(); formatHtmlAndCustomTags();
} }
public void setTextFormatted(String text){ public void setTextFormatted(String text) {
setText(text); setText(text);
formatHtmlAndCustomTags(); formatHtmlAndCustomTags();
} }
private void formatHtmlAndCustomTags(){ private void formatHtmlAndCustomTags() {
setText(new SpannableString(Html.fromHtml(getText().toString()))); setText(new SpannableString(Html.fromHtml(getText().toString())));
Linkify.TransformFilter filter = new Linkify.TransformFilter() { Linkify.TransformFilter filter = new Linkify.TransformFilter() {
public final String transformUrl(final Matcher match, String url) { public final String transformUrl(final Matcher match, String url) {

View file

@ -9,6 +9,8 @@ import android.support.design.widget.AppBarLayout;
public interface IntellihideToolbarActivityListener { public interface IntellihideToolbarActivityListener {
int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP; int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP;
void enableToolbarHiding(); void enableToolbarHiding();
void disableToolbarHiding(); void disableToolbarHiding();
} }

View file

@ -0,0 +1,195 @@
package com.github.dfa.diaspora_android.ui;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatDialogFragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod.DiasporaPodUrl;
import org.json.JSONException;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemSelected;
/**
* Created by gsantner (https://gsantner.github.io) on 06.10.16.
*/
public class PodSelectionDialog extends AppCompatDialogFragment {
public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionDialog";
public static interface PodSelectionDialogResultListener {
void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted);
}
public static PodSelectionDialog newInstance(PodSelectionDialogResultListener resultListener) {
return newInstance(new DiasporaPod(), resultListener);
}
public static PodSelectionDialog newInstance(DiasporaPod pod, PodSelectionDialogResultListener resultListener) {
PodSelectionDialog dialog = new PodSelectionDialog();
dialog.setPod(pod);
dialog.setResultListener(resultListener);
return dialog;
}
/*
//
//
//
//
//
//
*/
@BindView(R.id.podselection__dialog__edit_podaddress)
EditText editPodAddress;
@BindView(R.id.podselection__dialog__edit_podname)
EditText editPodName;
@BindView(R.id.podselection__dialog__radiogroup_protocol)
RadioGroup radiogrpProtocol;
@BindView(R.id.podselection__dialog__text_profile)
TextView textProfile;
@BindView(R.id.podselection__dialog__spinner_profile)
Spinner spinnerProfile;
private PodSelectionDialogResultListener resultListener;
private View root;
private DiasporaPod pod = new DiasporaPod();
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
// Bind UI
root = inflater.inflate(R.layout.podselection__dialog, null);
ButterKnife.bind(this, root);
editPodName.setText(pod.getName());
List<DiasporaPodUrl> podUrls = pod.getPodUrls();
if (podUrls.size() > 0) {
uiLoadDiasporaUrl(0);
}
if (podUrls.size() > 1) {
textProfile.setVisibility(View.VISIBLE);
spinnerProfile.setVisibility(View.VISIBLE);
String[] podUrlss = new String[podUrls.size()];
for (int i = 0; i < podUrls.size(); podUrlss[i] = podUrls.get(i++).getBaseUrl()) ;
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, podUrlss);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerProfile.setAdapter(spinnerAdapter);
}
builder.setView(root);
return builder.create();
}
@OnItemSelected(R.id.podselection__dialog__spinner_profile)
public void spinnerItemSelected(Spinner spinner, int position) {
uiLoadDiasporaUrl(position);
}
public void uiLoadDiasporaUrl(int wantedPodUrlPos) {
List<DiasporaPodUrl> podUrls = pod.getPodUrls();
if (podUrls.size() == 0) {
return;
}
wantedPodUrlPos = wantedPodUrlPos < podUrls.size() ? wantedPodUrlPos : 0;
DiasporaPodUrl url1 = podUrls.get(wantedPodUrlPos);
editPodAddress.setText(url1.getHost());
radiogrpProtocol.check(url1.getProtocol().equals("https")
? R.id.podselection__dialog__radio_https : R.id.podselection__dialog__radio_http);
}
@OnClick({R.id.podselection__dialog__btn_ok, R.id.podselection__dialog__btn_cancel})
public void onResultButtonClicked(View view) {
boolean POSITIVE_PRESSED = view.getId() == R.id.podselection__dialog__btn_ok;
if (POSITIVE_PRESSED) {
if (!checkInputs()) {
return;
}
DiasporaPodUrl podUrl = new DiasporaPodUrl();
if (radiogrpProtocol.getCheckedRadioButtonId() == R.id.podselection__dialog__radio_https) {
podUrl.setHttpsDefaults();
} else {
podUrl.setHttpDefaults();
}
podUrl.setHost(editPodAddress.getText().toString());
pod.setName(editPodName.getText().toString());
pod.getPodUrls().clear();
pod.getPodUrls().add(podUrl);
getDialog().dismiss();
publishResult(POSITIVE_PRESSED);
} else {
getDialog().cancel();
publishResult(POSITIVE_PRESSED);
}
}
public boolean checkInputs() {
boolean ok = true;
String s = editPodAddress.getText().toString();
if (TextUtils.isEmpty(s) || s.length() < 3) {
editPodAddress.setError(getString(R.string.missing_value));
ok = false;
}
s = editPodName.getText().toString();
if (TextUtils.isEmpty(s) || s.length() < 3) {
editPodName.setError(getString(R.string.missing_value));
ok = false;
}
return ok;
}
public void publishResult(boolean accepted) {
if (resultListener != null) {
resultListener.onPodSelectionDialogResult(pod, accepted);
}
}
/*
* GETTER & SETTER
*/
public PodSelectionDialogResultListener getResultListener() {
return resultListener;
}
public void setResultListener(PodSelectionDialogResultListener resultListener) {
this.resultListener = resultListener;
}
public DiasporaPod getPod() {
return pod;
}
public void setPod(DiasporaPod pod) {
try {
this.pod = new DiasporaPod().fromJson(pod.toJson());
} catch (JSONException ignored) {
}
}
}

View file

@ -16,7 +16,7 @@
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.util; package com.github.dfa.diaspora_android.util;
import android.content.Context; import android.content.Context;

View file

@ -26,7 +26,6 @@ import android.support.customtabs.CustomTabsClient;
import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsServiceConnection; import android.support.customtabs.CustomTabsServiceConnection;
import android.support.customtabs.CustomTabsSession; import android.support.customtabs.CustomTabsSession;
import android.util.Log;
import java.util.List; import java.util.List;
@ -43,10 +42,10 @@ public class CustomTabActivityHelper {
/** /**
* Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView * Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView
* *
* @param activity The host activity * @param activity The host activity
* @param customTabsIntent a CustomTabsIntent to be used if Custom Tabs is available * @param customTabsIntent a CustomTabsIntent to be used if Custom Tabs is available
* @param uri the Uri to be opened * @param uri the Uri to be opened
* @param fallback a CustomTabFallback to be used if Custom Tabs is not available * @param fallback a CustomTabFallback to be used if Custom Tabs is not available
*/ */
public static void openCustomTab(Activity activity, public static void openCustomTab(Activity activity,
CustomTabsIntent customTabsIntent, CustomTabsIntent customTabsIntent,
@ -68,6 +67,7 @@ public class CustomTabActivityHelper {
/** /**
* Unbinds the Activity from the Custom Tabs Service * Unbinds the Activity from the Custom Tabs Service
*
* @param activity the activity that is connected to the service * @param activity the activity that is connected to the service
*/ */
public void unbindCustomTabsService(Activity activity) { public void unbindCustomTabsService(Activity activity) {
@ -93,6 +93,7 @@ public class CustomTabActivityHelper {
/** /**
* Register a Callback to be called when connected or disconnected from the Custom Tabs Service * Register a Callback to be called when connected or disconnected from the Custom Tabs Service
*
* @param connectionCallback * @param connectionCallback
*/ */
public void setConnectionCallback(ConnectionCallback connectionCallback) { public void setConnectionCallback(ConnectionCallback connectionCallback) {
@ -101,6 +102,7 @@ public class CustomTabActivityHelper {
/** /**
* Binds the Activity to the Custom Tabs Service * Binds the Activity to the Custom Tabs Service
*
* @param activity the activity to be binded to the service * @param activity the activity to be binded to the service
*/ */
public void bindCustomTabsService(Activity activity) { public void bindCustomTabsService(Activity activity) {
@ -161,9 +163,8 @@ public class CustomTabActivityHelper {
*/ */
public interface CustomTabFallback { public interface CustomTabFallback {
/** /**
*
* @param activity The Activity that wants to open the Uri * @param activity The Activity that wants to open the Uri
* @param uri The uri to be opened by the fallback * @param uri The uri to be opened by the fallback
*/ */
void openUri(Activity activity, Uri uri); void openUri(Activity activity, Uri uri);
} }

View file

@ -26,7 +26,6 @@ import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.support.customtabs.CustomTabsService; import android.support.customtabs.CustomTabsService;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
@ -47,13 +46,14 @@ public class CustomTabsHelper {
private static String sPackageNameToUse; private static String sPackageNameToUse;
private CustomTabsHelper() {} private CustomTabsHelper() {
}
/** /**
* Goes through all apps that handle VIEW intents and have a warmup service. Picks * Goes through all apps that handle VIEW intents and have a warmup service. Picks
* the one chosen by the user if there is one, otherwise makes a best effort to return a * the one chosen by the user if there is one, otherwise makes a best effort to return a
* valid package name. * valid package name.
* * <p>
* This is <strong>not</strong> threadsafe. * This is <strong>not</strong> threadsafe.
* *
* @param context {@link Context} to use for accessing {@link PackageManager}. * @param context {@link Context} to use for accessing {@link PackageManager}.
@ -107,6 +107,7 @@ public class CustomTabsHelper {
/** /**
* Used to check whether there is a specialized handler for a given intent. * Used to check whether there is a specialized handler for a given intent.
*
* @param intent The intent to check with. * @param intent The intent to check with.
* @return Whether there is a specialized handler for the given intent. * @return Whether there is a specialized handler for the given intent.
*/ */
@ -127,7 +128,7 @@ public class CustomTabsHelper {
return true; return true;
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
AppLog.e(TAG, "Runtime exception while getting specialized handlers"); AppLog.e(TAG, "Runtime exception while getting specialized handlers");
} }
return false; return false;
} }

View file

@ -21,6 +21,7 @@ package com.github.dfa.diaspora_android.util;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.data.PodAspect; import com.github.dfa.diaspora_android.data.PodAspect;
/** /**
@ -31,7 +32,6 @@ import com.github.dfa.diaspora_android.data.PodAspect;
public class DiasporaUrlHelper { public class DiasporaUrlHelper {
private final AppSettings settings; private final AppSettings settings;
public static final String HTTPS = "https://";
public static final String SUBURL_NOTIFICATIONS = "/notifications"; public static final String SUBURL_NOTIFICATIONS = "/notifications";
public static final String SUBURL_POSTS = "/posts/"; public static final String SUBURL_POSTS = "/posts/";
public static final String SUBURL_STREAM = "/stream"; public static final String SUBURL_STREAM = "/stream";
@ -49,6 +49,10 @@ public class DiasporaUrlHelper {
public static final String SUBURL_FOLOWED_TAGS = "/followed_tags"; public static final String SUBURL_FOLOWED_TAGS = "/followed_tags";
public static final String SUBURL_ASPECTS = "/aspects"; public static final String SUBURL_ASPECTS = "/aspects";
public static final String SUBURL_STATISTICS = "/statistics"; public static final String SUBURL_STATISTICS = "/statistics";
public static final String SUBURL_PERSONAL_SETTINGS = "/user/edit";
public static final String SUBURL_MANAGE_TAGS = "/tag_followings/manage";
public static final String SUBURL_SIGN_IN = "/users/sign_in";
public static final String SUBURL_MANAGE_CONTACTS = "/contacts";
public static final String URL_BLANK = "about:blank"; public static final String URL_BLANK = "about:blank";
public DiasporaUrlHelper(AppSettings settings) { public DiasporaUrlHelper(AppSettings settings) {
@ -56,17 +60,22 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url of the pod set in AppSettings. * Return a url of the pod set in AppSettings.
* Eg. https://pod.geraspora.de * Eg. https://pod.geraspora.de
* *
* @return https://(pod-domain.tld) * @return https://(pod-domain.tld)
*/ */
public String getPodUrl() { public String getPodUrl() {
return HTTPS + settings.getPodDomain(); DiasporaPod pod = settings.getPod();
if (pod != null) {
return pod.getPodUrl().getBaseUrl();
}
return "http://127.0.0.1";
} }
/** /**
* Return a https url that points to the stream of the configured diaspora account * Return a url that points to the stream of the configured diaspora account
* *
* @return https://(pod-domain.tld)/stream * @return https://(pod-domain.tld)/stream
*/ */
@ -75,7 +84,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the notifications feed of the configured diaspora account * Return a url that points to the notifications feed of the configured diaspora account
* *
* @return https://(pod-domain.tld)/notifications * @return https://(pod-domain.tld)/notifications
*/ */
@ -84,7 +93,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Returns a https url that points to the post with the id postId * Returns a url that points to the post with the id postId
* *
* @return https://(pod-domain.tld)/posts/(postId) * @return https://(pod-domain.tld)/posts/(postId)
*/ */
@ -93,7 +102,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the conversations overview of the registered diaspora account * Return a url that points to the conversations overview of the registered diaspora account
* *
* @return https://(pod-domain.tld)/conversations * @return https://(pod-domain.tld)/conversations
*/ */
@ -102,7 +111,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the new-post form that lets the user create a new post * Return a url that points to the new-post form that lets the user create a new post
* *
* @return https://(pod-domain.tld)/status_messages/new * @return https://(pod-domain.tld)/status_messages/new
*/ */
@ -111,7 +120,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that shows the profile of the currently registered diaspora account * Return a url that shows the profile of the currently registered diaspora account
* *
* @return https://(pod-domain.tld)/people/(profileId) * @return https://(pod-domain.tld)/people/(profileId)
*/ */
@ -120,7 +129,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that shows the profile of the user with user id profileId * Return a url that shows the profile of the user with user id profileId
* *
* @param profileId Id of the profile to be shown * @param profileId Id of the profile to be shown
* @return https://(pod-domain.tld)/people/(profileId) * @return https://(pod-domain.tld)/people/(profileId)
@ -130,7 +139,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the activities feed of the currently registered diaspora account * Return a url that points to the activities feed of the currently registered diaspora account
* *
* @return https://(pod-domain.tld)/activity * @return https://(pod-domain.tld)/activity
*/ */
@ -139,7 +148,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the feed of posts that were liked by the currently registered diaspora account * Return a url that points to the feed of posts that were liked by the currently registered diaspora account
* *
* @return https://(pod-domain.tld)/liked * @return https://(pod-domain.tld)/liked
*/ */
@ -148,7 +157,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the stream of posts that were commented by the currently registered diaspora account * Return a url that points to the stream of posts that were commented by the currently registered diaspora account
* *
* @return https://(pod-domain.tld)/commented * @return https://(pod-domain.tld)/commented
*/ */
@ -157,7 +166,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the stream of posts in which the currently registered diaspora account has been mentioned in * Return a url that points to the stream of posts in which the currently registered diaspora account has been mentioned in
* *
* @return https://(pod-domain.tld)/mentions * @return https://(pod-domain.tld)/mentions
*/ */
@ -166,7 +175,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the stream of public posts * Return a url that points to the stream of public posts
* *
* @return https://(pod-domain.tld)/public * @return https://(pod-domain.tld)/public
*/ */
@ -175,7 +184,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that toggles between mobile and desktop view when opened * Return a url that toggles between mobile and desktop view when opened
* *
* @return https://(pod-domain.tld)/mobile/toggle * @return https://(pod-domain.tld)/mobile/toggle
*/ */
@ -184,7 +193,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that queries posts for the given hashtag query * Return a url that queries posts for the given hashtag query
* *
* @param query hashtag to be searched * @param query hashtag to be searched
* @return https://(pod-domain.tld)/tags/query * @return https://(pod-domain.tld)/tags/query
@ -194,7 +203,7 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that queries user accounts for query * Return a url that queries user accounts for query
* *
* @param query search term * @param query search term
* @return https://(pod-domain.tld)/people.mobile?q=(query) * @return https://(pod-domain.tld)/people.mobile?q=(query)
@ -204,13 +213,50 @@ public class DiasporaUrlHelper {
} }
/** /**
* Return a https url that points to the statistics page of the pod. * Return a url that points to the statistics page of the pod.
*
* @return https://(pod-domain.tld)/statistics * @return https://(pod-domain.tld)/statistics
*/ */
public String getStatisticsUrl() { public String getStatisticsUrl() {
return getPodUrl() + SUBURL_STATISTICS; return getPodUrl() + SUBURL_STATISTICS;
} }
/**
* Return a url that points to the sign in page of the pod.
*
* @return https://(pod-domain.tld)/users/sign_in
*/
public String getSignInUrl() {
return getPodUrl() + SUBURL_SIGN_IN;
}
/**
* Return a url that points to the personal settings page of the pod.
*
* @return https://(pod-domain.tld)/user/edit
*/
public String getPersonalSettingsUrl() {
return getPodUrl() + SUBURL_PERSONAL_SETTINGS;
}
/**
* Return a url that points to the manage tags page of the pod.
*
* @return https://(pod-domain.tld)/tag_followings/manage
*/
public String getManageTagsUrl() {
return getPodUrl() + SUBURL_MANAGE_TAGS;
}
/**
* Return a url that points to the manage tags page of the pod.
*
* @return https://(pod-domain.tld)/contacts
*/
public String getManageContactsUrl() {
return getPodUrl() + SUBURL_MANAGE_CONTACTS;
}
/** /**
* Returns the url of the blank WebView * Returns the url of the blank WebView
* *

View file

@ -26,8 +26,9 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.support.design.widget.Snackbar;
import android.view.View;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -72,7 +73,7 @@ public class Helpers {
// Create an image file name // Create an image file name
String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date()); String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_"; String imageFileName = "JPEG_" + timeStamp + "_";
AppLog.d(Helpers.class, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath()); AppLog.d(Helpers.class, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
File storageDir = Environment.getExternalStoragePublicDirectory( File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES); Environment.DIRECTORY_PICTURES);
return new File( return new File(
@ -120,18 +121,32 @@ public class Helpers {
public static void printBundle(Bundle savedInstanceState, String k) { public static void printBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) { for (String key : savedInstanceState.keySet()) {
AppLog.d("SAVED", key + " is a key in the bundle " + k); AppLog.d("SAVED", key + " is a key in the bundle " + k);
Object bun = savedInstanceState.get(key); Object bun = savedInstanceState.get(key);
if (bun != null) { if (bun != null) {
if (bun instanceof Bundle) { if (bun instanceof Bundle) {
printBundle((Bundle) bun, k + "." + key); printBundle((Bundle) bun, k + "." + key);
} else if (bun instanceof byte[]) { } else if (bun instanceof byte[]) {
AppLog.d("SAVED", "Key: " + k + "." + key + ": " + Arrays.toString((byte[]) bun)); AppLog.d("SAVED", "Key: " + k + "." + key + ": " + Arrays.toString((byte[]) bun));
} else { } else {
AppLog.d("SAVED", "Key: " + k + "." + key + ": " + bun.toString()); AppLog.d("SAVED", "Key: " + k + "." + key + ": " + bun.toString());
} }
} }
} }
} }
} }
/**
* Show Information if user is offline, returns true if is not connected to internet
*
* @param context Context
* @param anchor A view anchor
*/
public static boolean showInfoIfUserNotConnectedToInternet(Context context, View anchor) {
boolean isOnline = WebHelper.isOnline(context);
if (!isOnline) {
Snackbar.make(anchor, R.string.no_internet, Snackbar.LENGTH_LONG).show();
}
return !isOnline;
}
} }

View file

@ -43,8 +43,9 @@ public class Log extends Observable {
private Log() { private Log() {
this(null); this(null);
} }
private Log(AppSettings appSettings) { private Log(AppSettings appSettings) {
if(appSettings != null) { if (appSettings != null) {
//TODO: Store/Restore logBuffer between app starts //TODO: Store/Restore logBuffer between app starts
logBuffer = new ArrayList<>(); logBuffer = new ArrayList<>();
} else { } else {
@ -55,17 +56,17 @@ public class Log extends Observable {
} }
public static Log getInstance() { public static Log getInstance() {
if(instance == null) instance = new Log(); if (instance == null) instance = new Log();
return instance; return instance;
} }
public static Log getInstance(AppSettings appSettings) { public static Log getInstance(AppSettings appSettings) {
if(instance == null) instance = new Log(appSettings); if (instance == null) instance = new Log(appSettings);
return instance; return instance;
} }
private static String time() { private static String time() {
return getInstance().dateFormat.format(new Date())+": "; return getInstance().dateFormat.format(new Date()) + ": ";
} }
public static void d(String tag, String msg) { public static void d(String tag, String msg) {
@ -116,23 +117,23 @@ public class Log extends Observable {
public synchronized static String getLogBuffer() { public synchronized static String getLogBuffer() {
String out = ""; String out = "";
for(String s : getInstance().logBuffer) { for (String s : getInstance().logBuffer) {
out = out + s + "\n"; out = out + s + "\n";
} }
return out; return out;
} }
private void notifyLogBufferChanged() { private void notifyLogBufferChanged() {
if(observers == null) return; if (observers == null) return;
for(Observer o : observers) { for (Observer o : observers) {
if(o != null) { if (o != null) {
o.update(this, null); o.update(this, null);
} }
} }
} }
private synchronized void addLogEntry(String msg) { private synchronized void addLogEntry(String msg) {
logBuffer.add(time()+msg); logBuffer.add(time() + msg);
while (logBuffer.size() > MAX_BUFFER_SIZE) { while (logBuffer.size() > MAX_BUFFER_SIZE) {
logBuffer.remove(0); logBuffer.remove(0);
} }

View file

@ -46,7 +46,7 @@ public class ProxyHandler {
} }
public static ProxyHandler getInstance() { public static ProxyHandler getInstance() {
if(instance == null) { if (instance == null) {
instance = new ProxyHandler(); instance = new ProxyHandler();
} }
return instance; return instance;
@ -77,7 +77,7 @@ public class ProxyHandler {
public void addWebView(WebView wv) { public void addWebView(WebView wv) {
AppLog.d(this, "AddWebView"); AppLog.d(this, "AddWebView");
if(wv != null && !webViews.contains(wv)) { if (wv != null && !webViews.contains(wv)) {
webViews.add(wv); webViews.add(wv);
updateWebViewProxySettings(wv, wv.getContext()); updateWebViewProxySettings(wv, wv.getContext());
} }
@ -89,7 +89,7 @@ public class ProxyHandler {
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy(); StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(tmp); StrictMode.setThreadPolicy(tmp);
if(appSettings.isProxyEnabled()) { if (appSettings.isProxyEnabled()) {
if (wv != null) { if (wv != null) {
try { try {
WebkitProxy.setProxy(MainActivity.class.getName(), context.getApplicationContext(), wv, appSettings.getProxyHost(), appSettings.getProxyPort()); WebkitProxy.setProxy(MainActivity.class.getName(), context.getApplicationContext(), wv, appSettings.getProxyHost(), appSettings.getProxyPort());

View file

@ -16,7 +16,7 @@
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.util; package com.github.dfa.diaspora_android.util;
import android.content.Context; import android.content.Context;
@ -46,14 +46,14 @@ public class WebHelper {
return ni != null && ni.isConnectedOrConnecting(); return ni != null && ni.isConnectedOrConnecting();
} }
public static String replaceUrlWithMarkdown(String url){ public static String replaceUrlWithMarkdown(String url) {
if( url != null && URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)){ if (url != null && URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
return "<" + url + ">"; return "<" + url + ">";
} }
return url; return url;
} }
public static String escapeHtmlText(String text){ public static String escapeHtmlText(String text) {
text = Html.escapeHtml(text); text = Html.escapeHtml(text);
text = text.replace("\n", "&#10;"); text = text.replace("\n", "&#10;");
return text; return text;
@ -95,7 +95,7 @@ public class WebHelper {
"})();"); "})();");
} }
public static void shareTextIntoWebView(final WebView webView, String sharedText){ public static void shareTextIntoWebView(final WebView webView, String sharedText) {
sharedText = sharedText.replace("'", "&apos;").replace("\"", "&quot;"); sharedText = sharedText.replace("'", "&apos;").replace("\"", "&quot;");
webView.loadUrl("javascript:(function() { " + webView.loadUrl("javascript:(function() { " +
" document.documentElement.style.paddingBottom = '500px';" + " document.documentElement.style.paddingBottom = '500px';" +
@ -139,16 +139,17 @@ public class WebHelper {
// Content // Content
AppSettings appSettings = app.getSettings(); AppSettings appSettings = app.getSettings();
String pod0BaseUrl = appSettings.getPod().getPodUrl().getBaseUrl();
sb.append("<span style='margin-left: 30px; '></span>&raquo; &nbsp;"); sb.append("<span style='margin-left: 30px; '></span>&raquo; &nbsp;");
sb.append(String.format(Locale.getDefault(), sb.append(String.format(Locale.getDefault(),
"<a href='https://%s/followed_tags' style='color: #000000; text-decoration: none;'><b>%s</b></a>", "<a href='%s/followed_tags' style='color: #000000; text-decoration: none;'><b>%s</b></a>",
appSettings.getPodDomain(), app.getString(R.string.all_tags))); pod0BaseUrl, app.getString(R.string.all_tags)));
sb.append("<hr style='height:5px;' />"); sb.append("<hr style='height:5px;' />");
for (String tag: profile.getFollowedTags()) { for (String tag : profile.getFollowedTags()) {
sb.append("<span style='margin-left: 30px; '></span>&raquo; &nbsp;"); sb.append("<span style='margin-left: 30px; '></span>&raquo; &nbsp;");
sb.append(String.format(Locale.getDefault(), sb.append(String.format(Locale.getDefault(),
"<a href='https://%s/tags/%s' style='color: #000000; text-decoration: none;'>#%s</a>", "<a href='%s/tags/%s' style='color: #000000; text-decoration: none;'>#%s</a>",
appSettings.getPodDomain(), tag, tag)); pod0BaseUrl, tag, tag));
sb.append("<hr style='height:5px;' />"); sb.append("<hr style='height:5px;' />");
} }

View file

@ -12,7 +12,7 @@ import com.github.dfa.diaspora_android.R;
*/ */
public class ColorPalette { public class ColorPalette {
public static int[] getAccentColors(Context context){ public static int[] getAccentColors(Context context) {
return new int[]{ return new int[]{
ContextCompat.getColor(context, R.color.md_red_500), ContextCompat.getColor(context, R.color.md_red_500),
ContextCompat.getColor(context, R.color.md_purple_500), ContextCompat.getColor(context, R.color.md_purple_500),
@ -30,7 +30,7 @@ public class ColorPalette {
}; };
} }
public static int getObscuredColor(int c){ public static int getObscuredColor(int c) {
float[] hsv = new float[3]; float[] hsv = new float[3];
int color = c; int color = c;
Color.colorToHSV(color, hsv); Color.colorToHSV(color, hsv);
@ -39,14 +39,14 @@ public class ColorPalette {
return color; return color;
} }
public static int getTransparentColor(int color, int alpha){ public static int getTransparentColor(int color, int alpha) {
return ColorUtils.setAlphaComponent(color, alpha); return ColorUtils.setAlphaComponent(color, alpha);
} }
public static int[] getTransparencyShadows(int color) { public static int[] getTransparencyShadows(int color) {
int[] shadows = new int[10]; int[] shadows = new int[10];
for (int i=0; i<10;i++) for (int i = 0; i < 10; i++)
shadows[i]= (ColorPalette.getTransparentColor(color, ((100-(i*10))*255) /100)); shadows[i] = (ColorPalette.getTransparentColor(color, ((100 - (i * 10)) * 255) / 100));
return shadows; return shadows;
} }

View file

@ -47,51 +47,52 @@ public class ThemeHelper {
} }
public static ThemeHelper getInstance(AppSettings appSettings) { public static ThemeHelper getInstance(AppSettings appSettings) {
if(instance == null) { if (instance == null) {
instance = new ThemeHelper(appSettings); instance = new ThemeHelper(appSettings);
} }
return instance; return instance;
} }
public static ThemeHelper getInstance() { public static ThemeHelper getInstance() {
if(instance == null) throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettings) before it can be used!"); if (instance == null)
throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettings) before it can be used!");
return instance; return instance;
} }
public static void updateEditTextColor(EditText editText) { public static void updateEditTextColor(EditText editText) {
if(editText != null) { if (editText != null) {
editText.setHighlightColor(getInstance().appSettings.getAccentColor()); editText.setHighlightColor(getInstance().appSettings.getAccentColor());
} }
} }
public static void updateCheckBoxColor(CheckBox checkBox) { public static void updateCheckBoxColor(CheckBox checkBox) {
if(checkBox != null) { if (checkBox != null) {
checkBox.setHighlightColor(getInstance().appSettings.getAccentColor()); checkBox.setHighlightColor(getInstance().appSettings.getAccentColor());
} }
} }
public static void updateTabLayoutColor(TabLayout tabLayout) { public static void updateTabLayoutColor(TabLayout tabLayout) {
if(tabLayout != null) { if (tabLayout != null) {
tabLayout.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); tabLayout.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
tabLayout.setSelectedTabIndicatorColor(getInstance().appSettings.getAccentColor()); tabLayout.setSelectedTabIndicatorColor(getInstance().appSettings.getAccentColor());
} }
} }
public static void updateTextViewColor(TextView textView) { public static void updateTextViewColor(TextView textView) {
if(textView != null) { if (textView != null) {
textView.setHighlightColor(getInstance().appSettings.getAccentColor()); textView.setHighlightColor(getInstance().appSettings.getAccentColor());
textView.setLinkTextColor(getInstance().appSettings.getAccentColor()); textView.setLinkTextColor(getInstance().appSettings.getAccentColor());
} }
} }
public static void updateToolbarColor(Toolbar toolbar) { public static void updateToolbarColor(Toolbar toolbar) {
if(toolbar != null) { if (toolbar != null) {
toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
} }
} }
public static void updateActionMenuViewColor(ActionMenuView actionMenuView) { public static void updateActionMenuViewColor(ActionMenuView actionMenuView) {
if(actionMenuView != null) { if (actionMenuView != null) {
actionMenuView.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); actionMenuView.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
} }
} }
@ -105,7 +106,7 @@ public class ThemeHelper {
} }
public static void setPrimaryColorAsBackground(View view) { public static void setPrimaryColorAsBackground(View view) {
if(view != null) { if (view != null) {
view.setBackgroundColor(getPrimaryColor()); view.setBackgroundColor(getPrimaryColor());
} }
} }
@ -115,13 +116,13 @@ public class ThemeHelper {
} }
public static void updateActionBarColor(ActionBar actionBar) { public static void updateActionBarColor(ActionBar actionBar) {
if(actionBar != null) { if (actionBar != null) {
actionBar.setBackgroundDrawable(new ColorDrawable(getInstance().appSettings.getPrimaryColor())); actionBar.setBackgroundDrawable(new ColorDrawable(getInstance().appSettings.getPrimaryColor()));
} }
} }
public static void updateProgressBarColor(ProgressBar progressBar) { public static void updateProgressBarColor(ProgressBar progressBar) {
if(progressBar != null && progressBar.getProgressDrawable() != null) { if (progressBar != null && progressBar.getProgressDrawable() != null) {
progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN); progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);
} }
} }

View file

@ -19,7 +19,6 @@
package com.github.dfa.diaspora_android.webview; package com.github.dfa.diaspora_android.webview;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import android.webkit.WebView; import android.webkit.WebView;
@ -39,7 +38,7 @@ public class CustomWebViewClient extends WebViewClient {
//Open non-diaspora links in customtab/external browser //Open non-diaspora links in customtab/external browser
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (!url.contains(app.getSettings().getPodDomain())) { if (!url.contains(app.getSettings().getPod().getPodUrl().getHost())) {
Intent i = new Intent(MainActivity.ACTION_OPEN_EXTERNAL_URL); Intent i = new Intent(MainActivity.ACTION_OPEN_EXTERNAL_URL);
i.putExtra(MainActivity.EXTRA_URL, url); i.putExtra(MainActivity.EXTRA_URL, url);
LocalBroadcastManager.getInstance(app.getApplicationContext()).sendBroadcast(i); LocalBroadcastManager.getInstance(app.getApplicationContext()).sendBroadcast(i);
@ -57,7 +56,7 @@ public class CustomWebViewClient extends WebViewClient {
if (cookies != null) { if (cookies != null) {
cookieManager.setCookie(url, cookies); cookieManager.setCookie(url, cookies);
cookieManager.setCookie("https://" + app.getSettings().getPodDomain(), cookies); cookieManager.setCookie(app.getSettings().getPod().getPodUrl().getBaseUrl(), cookies);
//for (String c : cookies.split(";")) { //for (String c : cookies.split(";")) {
//AppLog.d(this, "Cookie: " + c.split("=")[0] + " Value:" + c.split("=")[1]); //AppLog.d(this, "Cookie: " + c.split("=")[0] + " Value:" + c.split("=")[1]);
//} //}

View file

@ -39,7 +39,7 @@ public class DiasporaStreamWebChromeClient extends FileUploadWebChromeClient {
@Override @Override
public void onProgressChanged(WebView wv, int progress) { public void onProgressChanged(WebView wv, int progress) {
super.onProgressChanged(wv, progress); super.onProgressChanged(wv, progress);
if (progress > 0 && progress <= 60) { if (progress > 10 && progress <= 60) {
WebHelper.getUserProfile(wv); WebHelper.getUserProfile(wv);
WebHelper.optimizeMobileSiteLayout(wv); WebHelper.optimizeMobileSiteLayout(wv);
} }
@ -57,6 +57,7 @@ public class DiasporaStreamWebChromeClient extends FileUploadWebChromeClient {
public interface SharedTextCallback { public interface SharedTextCallback {
String getSharedText(); String getSharedText();
void setSharedText(String shared); void setSharedText(String shared);
} }
} }

View file

@ -42,8 +42,7 @@ public class FileUploadWebChromeClient extends ProgressBarWebChromeClient {
//For Android 4.1/4.2 only. DO NOT REMOVE! //For Android 4.1/4.2 only. DO NOT REMOVE!
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
{
fileUploadCallback.legacyImageUpload(uploadMsg, acceptType, capture); fileUploadCallback.legacyImageUpload(uploadMsg, acceptType, capture);
} }
@ -54,6 +53,7 @@ public class FileUploadWebChromeClient extends ProgressBarWebChromeClient {
public interface FileUploadCallback { public interface FileUploadCallback {
boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams); boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams);
void legacyImageUpload(ValueCallback<Uri> uploadMsg, String acceptType, String capture); void legacyImageUpload(ValueCallback<Uri> uploadMsg, String acceptType, String capture);
} }
} }

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -16,24 +15,23 @@
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<LinearLayout <LinearLayout
android:id="@+id/appbar_linear_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/appbar_linear_layout"
android:orientation="vertical"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways|snap" app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay"> app:popupTheme="@style/AppTheme.PopupOverlay">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/main__topbar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/main__topbar"/>
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tabs" android:id="@+id/tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>

View file

@ -19,16 +19,16 @@
<TextView <TextView
android:id="@+id/fragment_about__app_name" android:id="@+id/fragment_about__app_name"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center"
android:text="@string/diaspora_for_android" android:text="@string/diaspora_for_android"
style="@android:style/TextAppearance.DeviceDefault.Large"/> android:textAlignment="center" />
<TextView <TextView
android:id="@+id/fragment_about__app_version"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_about__app_version"/>
<android.support.v4.widget.Space <android.support.v4.widget.Space
android:layout_width="match_parent" android:layout_width="match_parent"
@ -36,10 +36,10 @@
<com.github.dfa.diaspora_android.ui.HtmlTextView <com.github.dfa.diaspora_android.ui.HtmlTextView
android:id="@+id/fragment_about__about_text" android:id="@+id/fragment_about__about_text"
style="@android:style/TextAppearance.DeviceDefault.Small"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_about__about_content" android:linksClickable="true"
style="@android:style/TextAppearance.DeviceDefault.Small" android:text="@string/fragment_about__about_content" />
android:linksClickable="true" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>

View file

@ -20,74 +20,77 @@
<!-- APP SECTION --> <!-- APP SECTION -->
<TextView <TextView
android:id="@+id/fragment_debug__section_app" android:id="@+id/fragment_debug__section_app"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_debug__section_app" android:text="@string/fragment_debug__section_app" />
style="@android:style/TextAppearance.DeviceDefault.Large"/>
<TextView <TextView
android:id="@+id/fragment_debug__package_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_debug__package_name"/>
<TextView <TextView
android:id="@+id/fragment_debug__app_version"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_debug__app_version"/>
<!-- DEVICE SECTION --> <!-- DEVICE SECTION -->
<TextView <TextView
android:id="@+id/fragment_debug__section_device" android:id="@+id/fragment_debug__section_device"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_debug__section_device"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
style="@android:style/TextAppearance.DeviceDefault.Large"/> android:text="@string/fragment_debug__section_device" />
<TextView <TextView
android:id="@+id/fragment_debug__android_version"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_debug__android_version"/>
<TextView <TextView
android:id="@+id/fragment_debug__device_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_debug__device_name"/>
<!-- POD SECTION --> <!-- POD SECTION -->
<TextView <TextView
android:id="@+id/fragment_debug__section_pod" android:id="@+id/fragment_debug__section_pod"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_debug__section_pod"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
style="@android:style/TextAppearance.DeviceDefault.Large"/> android:text="@string/fragment_debug__section_pod" />
<TextView <TextView
android:id="@+id/fragment_debug__pod_domain"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/fragment_debug__pod_domain"/>
<!-- LOG SECTION --> <!-- LOG SECTION -->
<TextView <TextView
android:id="@+id/fragment_debug__section_log" android:id="@+id/fragment_debug__section_log"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_debug__section_log"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
style="@android:style/TextAppearance.DeviceDefault.Large"/> android:text="@string/fragment_debug__section_log" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/fragment_debug__log_box"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clickable="true" android:clickable="true"
android:longClickable="true" android:longClickable="true" />
android:id="@+id/fragment_debug__log_box" />
</HorizontalScrollView> </HorizontalScrollView>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -16,32 +16,33 @@
<android.support.v4.widget.Space <android.support.v4.widget.Space
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/activity_vertical_margin" /> android:layout_height="@dimen/activity_vertical_margin" />
<TextView <TextView
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_license__copyright_years" android:text="@string/fragment_license__copyright_years" />
style="@android:style/TextAppearance.DeviceDefault.Large"/>
<com.github.dfa.diaspora_android.ui.HtmlTextView <com.github.dfa.diaspora_android.ui.HtmlTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragment_license__licensetext" android:id="@+id/fragment_license__licensetext"
android:text="@string/fragment_license__license_content"
style="@android:style/TextAppearance.DeviceDefault.Small" style="@android:style/TextAppearance.DeviceDefault.Small"
android:linksClickable="true" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="@string/fragment_license__license_content" />
<TextView <TextView
style="@android:style/TextAppearance.DeviceDefault.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_license__3rd_party_libs_title"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
style="@android:style/TextAppearance.DeviceDefault.Large"/> android:text="@string/fragment_license__3rd_party_libs_title" />
<com.github.dfa.diaspora_android.ui.HtmlTextView <com.github.dfa.diaspora_android.ui.HtmlTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fragment_license__3rdparty" android:id="@+id/fragment_license__3rdparty"
style="@android:style/TextAppearance.DeviceDefault.Small" style="@android:style/TextAppearance.DeviceDefault.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="true" /> android:linksClickable="true" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -15,6 +14,6 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="7dp" android:layout_height="7dp"
android:indeterminate="false" android:indeterminate="false"
android:progressDrawable="@drawable/progressbar"/> android:progressDrawable="@drawable/progressbar" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,35 +1,38 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/color_picker_dialog__title_background" android:id="@+id/color_picker_dialog__title_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/color_picker_dialog__title" android:id="@+id/color_picker_dialog__title"
android:layout_margin="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse" android:layout_margin="20dp"
/> android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse" />
</FrameLayout> </FrameLayout>
<uz.shift.colorpicker.LineColorPicker <uz.shift.colorpicker.LineColorPicker
android:id="@+id/color_picker_dialog__base_picker" android:id="@+id/color_picker_dialog__base_picker"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="20dp"
android:layout_margin="10dp" android:layout_margin="10dp"
app:orientation="horizontal"/> android:layout_marginTop="20dp"
app:orientation="horizontal" />
<uz.shift.colorpicker.LineColorPicker <uz.shift.colorpicker.LineColorPicker
android:id="@+id/color_picker_dialog__shade_picker" android:id="@+id/color_picker_dialog__shade_picker"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginTop="30dp"
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
app:orientation="horizontal"/> android:layout_marginTop="30dp"
app:orientation="horizontal" />
</LinearLayout> </LinearLayout>

View file

@ -1,27 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/fragment_followed_tags__recycler_view" android:id="@+id/fragment_followed_tags__recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<!-- Offset --> <!-- Offset -->
<android.support.v4.widget.Space <android.support.v4.widget.Space
android:id="@+id/spacer" android:id="@+id/spacer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/bottom_toolbar_height"/> android:layout_height="@dimen/bottom_toolbar_height" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>

View file

@ -19,10 +19,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:itemTextColor="@color/primary_text"
app:paddingEnd="0dp"
app:paddingStart="0dp"
app:headerLayout="@layout/main__nav_header" app:headerLayout="@layout/main__nav_header"
app:menu="@menu/main__navdrawer" /> app:itemTextColor="@color/primary_text"
app:menu="@menu/main__navdrawer"
app:paddingEnd="0dp"
app:paddingStart="0dp" />
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -19,7 +18,7 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap" app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay"/> app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
@ -27,7 +26,7 @@
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -43,7 +42,7 @@
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:theme="@style/BottomToolbarMenuOverflowStyle" android:theme="@style/BottomToolbarMenuOverflowStyle"
app:layout_scrollFlags="scroll|enterAlways|snap" app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/Theme.AppCompat.NoActionBar"/> app:popupTheme="@style/Theme.AppCompat.NoActionBar" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>

View file

@ -3,18 +3,18 @@
android:id="@+id/nav_drawer" android:id="@+id/nav_drawer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="110dp" android:layout_height="110dp"
android:background="@color/colorPrimary"
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.AppCompat.Dark">
<!-- <!--
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/header" /> android:src="@drawable/header" />
--> -->
<LinearLayout <LinearLayout
android:id="@+id/nav_profile_picture" android:id="@+id/nav_profile_picture"

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/podselection__dialog__text_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/profile"
android:textAppearance="@style/AppTheme.TextAppearance.Caption"
android:visibility="gone" />
<Spinner
android:id="@+id/podselection__dialog__spinner_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin_half"
android:visibility="gone" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin_half"
android:text="@string/pod_name"
android:textAppearance="@style/AppTheme.TextAppearance.Caption" />
<EditText
android:id="@+id/podselection__dialog__edit_podname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin_half"
android:ems="10"
android:hint="@string/pod_name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:text="Geraspora" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin_half"
android:text="@string/pod_address"
android:textAppearance="@style/AppTheme.TextAppearance.Caption" />
<EditText
android:id="@+id/podselection__dialog__edit_podaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin_half"
android:ems="10"
android:hint="@string/pod_address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:text="pod.geraspora.de" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin_half"
android:text="@string/http_protocol"
android:textAppearance="@style/AppTheme.TextAppearance.Caption" />
<RadioGroup
android:id="@+id/podselection__dialog__radiogroup_protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin_half"
android:checkedButton="@+id/podselection__dialog__radio_https"
android:orientation="horizontal">
<RadioButton
android:id="@+id/podselection__dialog__radio_http"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="http" />
<RadioButton
android:id="@+id/podselection__dialog__radio_https"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="https" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/podselection__dialog__btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/cancel" />
<Button
android:id="@+id/podselection__dialog__btn_ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/ok" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -4,62 +4,29 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior">
tools:showIn="@layout/podselection__fragment">
<ListView <Button
android:id="@+id/podselection__listpods" android:id="@+id/podselection__fragment__button_use_custom_pod"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/podselection__podupti_notice"
android:layout_below="@+id/podselection__edit_filter"
android:choiceMode="singleChoice" />
<EditText
android:id="@+id/podselection__edit_filter"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/textView" android:text="@string/podselection__custom_pod"
android:layout_toStartOf="@+id/podselection__button_select_pod" tools:text="Benutzerdefinierter Pod" />
android:hint="@string/filter_hint"
android:inputType="textUri|textWebEditText" />
<ImageView
android:id="@+id/podselection__button_select_pod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/podselection__listpods"
android:layout_alignEnd="@+id/podselection__listpods"
android:layout_alignTop="@+id/podselection__edit_filter"
android:contentDescription="@string/confirm_url"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="@drawable/ic_arrow_forward_black_48px" />
<TextView <ListView
android:id="@+id/podselection__podupti_notice" android:id="@+id/podselection__fragment__listpods"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" android:layout_below="@+id/podselection__fragment__button_use_custom_pod"
android:autoLink="web" android:choiceMode="singleChoice" />
android:text="@string/podlist_source_note"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/podselection__listpods"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="0dp"
android:gravity="center_vertical"
android:text="@string/prefix_https"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,23 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recycler_view__list_item__root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<View <View
android:id="@+id/recycler_view__list_item__divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="@color/divider"/> android:background="@color/divider" />
<TextView <TextView
android:id="@+id/recycler_view__list_item__text" android:id="@+id/recycler_view__list_item__text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large" /> android:layout_marginEnd="@dimen/activity_horizontal_margin"
<View android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_width="match_parent" android:layout_marginTop="12dp"
android:layout_height="1dp" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:background="@color/divider"/> android:textColor="@color/primary_text"
tools:text="Very much text" />
</LinearLayout> </LinearLayout>

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/settings__appbar" android:id="@+id/settings__appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,13 +17,13 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap" app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay"/> app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/settings__fragment_container" android:id="@+id/settings__fragment_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout> </LinearLayout>

View file

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_height="match_parent"
android:paddingStart="@dimen/activity_horizontal_margin_half" android:paddingEnd="@dimen/activity_horizontal_margin_half"> android:layout_gravity="center_horizontal"
android:orientation="vertical"
android:paddingEnd="@dimen/activity_horizontal_margin_half"
android:paddingStart="@dimen/activity_horizontal_margin_half">
<EditText <EditText
android:id="@+id/dialog_search__input" android:id="@+id/dialog_search__input"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/app_hashtag" android:hint="@string/app_hashtag"
/> android:maxLines="1" />
</LinearLayout> </LinearLayout>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="none"> <group android:checkableBehavior="none" android:id="@+id/nav_group__pod">
<item <item
android:id="@+id/nav_stream" android:id="@+id/nav_stream"
android:icon="@drawable/ic_stream" android:icon="@drawable/ic_stream"

View file

@ -1,6 +1,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/podselection__action_search"
android:icon="@drawable/ic_search_white_48px"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always|collapseActionView" />
<item <item
android:id="@+id/action_reload" android:id="@+id/action_reload"
android:icon="@drawable/ic_refresh_white_48px" android:icon="@drawable/ic_refresh_white_48px"

File diff suppressed because it is too large Load diff

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -15,12 +16,6 @@
<string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string> <string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string>
<string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string> <string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string>
<!-- Themes --> <!-- Themes -->
<string name="pref_title__themes">Farbschema</string>
<string name="pref_desc__themes">Einstellungen des Farbdesigns</string>
<string name="pref_title__primary_color">Primärfarbe</string>
<string name="pref_desc__primary_color">Färbung der Werkzeugleisten</string>
<string name="pref_title__accent_color">Akzentfarbe</string>
<string name="pref_desc__accent_color">Färbung der Details</string>
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Schriftgröße</string> <string name="pref_title__font_size">Schriftgröße</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -30,9 +25,6 @@
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__sub_proxy">Proxy</string> <string name="pref_title__sub_proxy">Proxy</string>
<string name="pref_title__proxy_enabled">Aktiviere Netzwerkproxy</string> <string name="pref_title__proxy_enabled">Aktiviere Netzwerkproxy</string>
<string name="pref_desc__http_proxy_enabled">Nutze einen Proxyserver, um Firewalls zu umgehen</string>
<string name="pref_title__http_proxy_host">Host</string>
<string name="pref_title__http_proxy_port">Port</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string> <string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string>
<string name="pref_desc__chrome_custom_tabs_enabled">Externe Links mit Chrome Custom Tabs öffnen. Chromium oder Google Chrome muss für dieses Feature installiert sein.\nWICHTIGER HINWEIS: Chrome Custom Tabs verwenden die konfigurierten Proxy-Server nicht!</string> <string name="pref_desc__chrome_custom_tabs_enabled">Externe Links mit Chrome Custom Tabs öffnen. Chromium oder Google Chrome muss für dieses Feature installiert sein.\nWICHTIGER HINWEIS: Chrome Custom Tabs verwenden die konfigurierten Proxy-Server nicht!</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">Control deslizante de navegación</string> <string name="pref_title__sub_nav_slider">Control deslizante de navegación</string>
<string name="pref_desc__sub_nav_slider">Control de visibilidad de las entradas en el cajón de navegación</string> <string name="pref_desc__sub_nav_slider">Control de visibilidad de las entradas en el cajón de navegación</string>
<string name="pref_cat__visibility_nav_items">Elemento visibilidad</string> <string name="pref_cat__visibility_nav_items">Elemento visibilidad</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Tamaño de letra</string> <string name="pref_title__font_size">Tamaño de letra</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -22,9 +24,6 @@
<string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string> <string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">Activar Proxy</string> <string name="pref_title__proxy_enabled">Activar Proxy</string>
<string name="pref_desc__http_proxy_enabled">El tráfico proxificado de Diaspora para evitar firewalls.\nPuede necesitar reiniciarse</string>
<string name="pref_title__http_proxy_host">Anfitrión</string>
<string name="pref_title__http_proxy_port">Puerto</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Configuración personal</string> <string name="pref_title__personal_settings">Configuración personal</string>

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">Barre de défilement</string> <string name="pref_title__sub_nav_slider">Barre de défilement</string>
<string name="pref_desc__sub_nav_slider">Contrôles de la visibilité des entrées dans le volet de navigation</string> <string name="pref_desc__sub_nav_slider">Contrôles de la visibilité des entrées dans le volet de navigation</string>
<string name="pref_cat__visibility_nav_items">Visibilité de lélément</string> <string name="pref_cat__visibility_nav_items">Visibilité de lélément</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Taille de la police</string> <string name="pref_title__font_size">Taille de la police</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -21,13 +23,16 @@
<string name="pref_title__load_images">Charger les images</string> <string name="pref_title__load_images">Charger les images</string>
<string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string> <string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__http_proxy_load_tor_preset">Charger la pré-configuration Tor</string>
<string name="pref_desc__http_proxy_load_tor_preset">Charger les paramètres proxy pour Tor (Orbot) HTTP Proxy</string>
<string name="pref_title__sub_proxy">Proxy</string> <string name="pref_title__sub_proxy">Proxy</string>
<string name="pref_title__proxy_enabled">Activer Proxy</string> <string name="pref_title__proxy_enabled">Activer Proxy</string>
<string name="pref_desc__http_proxy_enabled">Serveur Proxy.\n(Nécessite un redémarrage)</string> <string name="pref_desc__http_proxy_enabled">Proxy pour diaspora pour contourner les pare-feux.\nPeut nécessiter un redémarrage</string>
<string name="pref_title__http_proxy_host">Hôte</string> <string name="pref_title__http_proxy_host">Hôte</string>
<string name="pref_title__http_proxy_port">Port</string> <string name="pref_title__http_proxy_port">Port</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<string name="pref_title__chrome_custom_tabs_enabled">Onglets personnalisés de Chrome</string> <string name="pref_title__chrome_custom_tabs_enabled">Onglets personnalisés de Chrome</string>
<string name="pref_desc__chrome_custom_tabs_enabled">Ouvrir les liens externes avec les onglets personnalisés de Chrome. Chomium ou Google Chrome doit être installé pour cette fonctionnalité. \nNOTE IMPORTANTE : les onglets personnalisés de Chrome n\'utilisent pas les serveurs proxy configurés !</string>
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Paramètres personnels</string> <string name="pref_title__personal_settings">Paramètres personnels</string>
<string name="pref_desc__personal_settings">Ouvrir vos paramètres de compte diaspora</string> <string name="pref_desc__personal_settings">Ouvrir vos paramètres de compte diaspora</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">Menù di navigazione</string> <string name="pref_title__sub_nav_slider">Menù di navigazione</string>
<string name="pref_desc__sub_nav_slider">Controlla la visibilità degli elementi nel menù di navigazione</string> <string name="pref_desc__sub_nav_slider">Controlla la visibilità degli elementi nel menù di navigazione</string>
<string name="pref_cat__visibility_nav_items">Visibilità degli elementi</string> <string name="pref_cat__visibility_nav_items">Visibilità degli elementi</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Dimensione font</string> <string name="pref_title__font_size">Dimensione font</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -23,11 +25,11 @@
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__sub_proxy">Proxy</string> <string name="pref_title__sub_proxy">Proxy</string>
<string name="pref_title__proxy_enabled">Attiva proxy</string> <string name="pref_title__proxy_enabled">Attiva proxy</string>
<string name="pref_desc__http_proxy_enabled">Traffico del proxy di Diaspora per bypassare i firewall.\nPuò essere necessario il riavvio dell\'app</string>
<string name="pref_title__http_proxy_host">Host</string> <string name="pref_title__http_proxy_host">Host</string>
<string name="pref_title__http_proxy_port">Porta</string> <string name="pref_title__http_proxy_port">Porta</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<string name="pref_title__chrome_custom_tabs_enabled">Schede personalizzate di Chrome</string> <string name="pref_title__chrome_custom_tabs_enabled">Schede personalizzate di Chrome</string>
<string name="pref_desc__chrome_custom_tabs_enabled">Apri collegamenti esterni con le schede personalizzate di Chrome. Chromium o Google Chrome devono essere installati per questa funzione. \nNOTA IMPORTANTE: le schede personalizzate di Chrome non usano i server proxy configurabili!</string>
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Impostazioni personali</string> <string name="pref_title__personal_settings">Impostazioni personali</string>
<string name="pref_desc__personal_settings">Apri le impostazioni del tuo account Diaspora</string> <string name="pref_desc__personal_settings">Apri le impostazioni del tuo account Diaspora</string>

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">ナビゲーション スライダー</string> <string name="pref_title__sub_nav_slider">ナビゲーション スライダー</string>
<string name="pref_desc__sub_nav_slider">ナビゲーションドロワー内のエントリーの表示を制御します</string> <string name="pref_desc__sub_nav_slider">ナビゲーションドロワー内のエントリーの表示を制御します</string>
<string name="pref_cat__visibility_nav_items">アイテムの表示</string> <string name="pref_cat__visibility_nav_items">アイテムの表示</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">フォントサイズ</string> <string name="pref_title__font_size">フォントサイズ</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -21,6 +23,8 @@
<string name="pref_title__load_images">画像の読み込み</string> <string name="pref_title__load_images">画像の読み込み</string>
<string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string> <string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__http_proxy_load_tor_preset">Tor プリセットを読み込む</string>
<string name="pref_desc__http_proxy_load_tor_preset">Tor (Orbot) HTTP プロキシのプロキシ設定を読み込みます</string>
<string name="pref_title__sub_proxy">プロキシ</string> <string name="pref_title__sub_proxy">プロキシ</string>
<string name="pref_title__proxy_enabled">プロキシを有効にする</string> <string name="pref_title__proxy_enabled">プロキシを有効にする</string>
<string name="pref_desc__http_proxy_enabled">Diaspora の通信をプロキシして、ファイアウォールに回避します。\n再起動が必要になることがあります</string> <string name="pref_desc__http_proxy_enabled">Diaspora の通信をプロキシして、ファイアウォールに回避します。\n再起動が必要になることがあります</string>
@ -28,6 +32,7 @@
<string name="pref_title__http_proxy_port">ポート</string> <string name="pref_title__http_proxy_port">ポート</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<string name="pref_title__chrome_custom_tabs_enabled">Chrome カスタムタブ</string> <string name="pref_title__chrome_custom_tabs_enabled">Chrome カスタムタブ</string>
<string name="pref_desc__chrome_custom_tabs_enabled">Chrome のカスタム タブで外部リンクを開きます。この機能は Chromium または Google Chrome をインストールする必要があります。\n重要な注意: Chrome のカスタム タブは構成されているプロキシ サーバーを使用しません!</string>
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">個人用設定</string> <string name="pref_title__personal_settings">個人用設定</string>
<string name="pref_desc__personal_settings">Diaspora アカウント設定を開きます</string> <string name="pref_desc__personal_settings">Diaspora アカウント設定を開きます</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">നാവിഗേഷൻ സ്ലൈഡർ</string> <string name="pref_title__sub_nav_slider">നാവിഗേഷൻ സ്ലൈഡർ</string>
<string name="pref_desc__sub_nav_slider">നാവിഗേഷൻ ഡ്രാവറിൽ കാണേണ്ട എൻട്രികൾ നിയന്ത്രിക്കൂ</string> <string name="pref_desc__sub_nav_slider">നാവിഗേഷൻ ഡ്രാവറിൽ കാണേണ്ട എൻട്രികൾ നിയന്ത്രിക്കൂ</string>
<string name="pref_cat__visibility_nav_items">ഇനത്തിന്റെ കാഴ്ച</string> <string name="pref_cat__visibility_nav_items">ഇനത്തിന്റെ കാഴ്ച</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">ഫോണ്ട് സൈസ്</string> <string name="pref_title__font_size">ഫോണ്ട് സൈസ്</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -22,9 +24,6 @@
<string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string> <string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string> <string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string>
<string name="pref_desc__http_proxy_enabled">ഫയർവാളുകളെ മറികടക്കാൻ ഡയസ്പോറ ട്രാഫിക് പ്രോക്സി ചെയ്യൂ.\nപുനരാരഭിക്കേണ്ടി വന്നേക്കാം</string>
<string name="pref_title__http_proxy_host">ആഥിതേയൻ</string>
<string name="pref_title__http_proxy_port">പോർട്ട്</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">സ്വകാര്യ സജ്ജീകരണങ്ങൾ</string> <string name="pref_title__personal_settings">സ്വകാര്യ സജ്ജീകരണങ്ങൾ</string>

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -13,6 +14,7 @@
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<string name="pref_title__sub_nav_slider">Navigatie Slider</string> <string name="pref_title__sub_nav_slider">Navigatie Slider</string>
<string name="pref_cat__visibility_nav_items">Item Zichtbaarheid</string> <string name="pref_cat__visibility_nav_items">Item Zichtbaarheid</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Lettergrootte</string> <string name="pref_title__font_size">Lettergrootte</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -21,9 +23,6 @@
<string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string> <string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">Proxy inschakelen</string> <string name="pref_title__proxy_enabled">Proxy inschakelen</string>
<string name="pref_desc__http_proxy_enabled">Gebruik een Proxy voor Diaspora om de firewalls te omzeilen.\nRestart nodig</string>
<string name="pref_title__http_proxy_host">Host</string>
<string name="pref_title__http_proxy_port">Poort</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Persoonlijke instellingen</string> <string name="pref_title__personal_settings">Persoonlijke instellingen</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -11,6 +12,7 @@
<string name="pref_cat__pod_settings">Ustawienia poda</string> <string name="pref_cat__pod_settings">Ustawienia poda</string>
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Rozmiar czcionki</string> <string name="pref_title__font_size">Rozmiar czcionki</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">Controle deslizante de navegação</string> <string name="pref_title__sub_nav_slider">Controle deslizante de navegação</string>
<string name="pref_desc__sub_nav_slider">Visibilidade do controle de entradas na gaveta de navegação</string> <string name="pref_desc__sub_nav_slider">Visibilidade do controle de entradas na gaveta de navegação</string>
<string name="pref_cat__visibility_nav_items">Visibilidade de item</string> <string name="pref_cat__visibility_nav_items">Visibilidade de item</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Tamanho da fonte</string> <string name="pref_title__font_size">Tamanho da fonte</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -22,9 +24,6 @@
<string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string> <string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">Habilitar o Proxy</string> <string name="pref_title__proxy_enabled">Habilitar o Proxy</string>
<string name="pref_desc__http_proxy_enabled">Usar proxy para o tráfego da diáspora para contornar firewalls.\nPode requerer reinicialização</string>
<string name="pref_title__http_proxy_host">Servidor</string>
<string name="pref_title__http_proxy_port">Porta</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Configurações pessoais</string> <string name="pref_title__personal_settings">Configurações pessoais</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,6 +2,7 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
@ -14,6 +15,7 @@
<string name="pref_title__sub_nav_slider">Слайдер навигации</string> <string name="pref_title__sub_nav_slider">Слайдер навигации</string>
<string name="pref_desc__sub_nav_slider">Управление видимостью записей в ящике навигации</string> <string name="pref_desc__sub_nav_slider">Управление видимостью записей в ящике навигации</string>
<string name="pref_cat__visibility_nav_items">Видимость элемента</string> <string name="pref_cat__visibility_nav_items">Видимость элемента</string>
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Размер шрифта</string> <string name="pref_title__font_size">Размер шрифта</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
@ -22,9 +24,6 @@
<string name="pref_desc__load_images">Отключить загрузку изображений для экономии траффика</string> <string name="pref_desc__load_images">Отключить загрузку изображений для экономии траффика</string>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">Использовать прокси</string> <string name="pref_title__proxy_enabled">Использовать прокси</string>
<string name="pref_desc__http_proxy_enabled">Перенаправить трафик Диаспоры в обход брандмауэров.\nМожет потребовать перезапуска</string>
<string name="pref_title__http_proxy_host">Хост</string>
<string name="pref_title__http_proxy_port">Порт</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->
<string name="pref_title__personal_settings">Личные настройки</string> <string name="pref_title__personal_settings">Личные настройки</string>

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -2,12 +2,14 @@
<!--Generated by crowdin.com--> <!--Generated by crowdin.com-->
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<!-- Themes -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- PodProfile --> <!-- PodProfile -->
<!-- More --> <!-- More -->
<!-- Category Titles --> <!-- Category Titles -->
<!-- Visuals --> <!-- Visuals -->
<!-- Navigiation Slider --> <!-- Navigiation Slider -->
<!-- Themes -->
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Key Names (Untranslatable) --> <!-- Key Names (Untranslatable) -->
<string name="pref_key__poddomain" translatable="false">podDomain</string> <string name="pref_key__poddomain_legacy" translatable="false">podDomain</string>
<string name="pref_key__previous_podlist" translatable="false">previousPodlist</string> <string name="pref_key__current_pod_0" translatable="false">pref_key__current_pod_0</string>
<string name="pref_key__font_size" translatable="false">pref_key_font_size</string> <string name="pref_key__font_size" translatable="false">pref_key_font_size</string>
<string name="pref_key__intellihide_toolbars" translatable="false">pref_key_intellihide_toolbars</string> <string name="pref_key__intellihide_toolbars" translatable="false">pref_key_intellihide_toolbars</string>
<string name="pref_catkey__pod_settings" translatable="false">pref_key_category_pod_settings</string> <string name="pref_catkey__pod_settings" translatable="false">pref_key_category_pod_settings</string>

View file

@ -34,6 +34,7 @@
<string name="title_activity_pods">Select Pod</string> <string name="title_activity_pods">Select Pod</string>
<string name="filter_hint">Enter pod domain</string> <string name="filter_hint">Enter pod domain</string>
<string name="confirm_url">Confirm pod url</string> <string name="confirm_url">Confirm pod url</string>
<string name="search_for_pod">Search for Pod…</string>
<string name="podlist_source_note">Note: The podlist is populated by secure pods listed on https://podupti.me. You can enter in the edit field any pod not listed.</string> <string name="podlist_source_note">Note: The podlist is populated by secure pods listed on https://podupti.me. You can enter in the edit field any pod not listed.</string>
<string name="valid_pod">Please enter a valid domain name</string> <string name="valid_pod">Please enter a valid domain name</string>
<string name="podlist_error">Error: Could not retrieve list of pods!</string> <string name="podlist_error">Error: Could not retrieve list of pods!</string>
@ -103,4 +104,9 @@
Diaspora. In the permissions section you can grant the \"write storage permission\".</string> Diaspora. In the permissions section you can grant the \"write storage permission\".</string>
<string name="permission_denied">Permission denied.</string> <string name="permission_denied">Permission denied.</string>
<string name="permission_granted_try_again">Permission granted. Please try again.</string> <string name="permission_granted_try_again">Permission granted. Please try again.</string>
<string name="podselection__custom_pod">Custom Pod</string>
<string name="pod_name">Pod name</string>
<string name="http_protocol">Protocol</string>
<string name="pod_address">Pod address</string>
<string name="missing_value">Missing value</string>
</resources> </resources>

View file

@ -30,4 +30,8 @@
<item name="android:background">@color/white</item> <item name="android:background">@color/white</item>
</style> </style>
<style name="AppTheme.TextAppearance.Caption" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">@color/accent</item>
</style>
</resources> </resources>