mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 21:32:07 +01:00
Merged upstream changes 0.1.2
This commit is contained in:
commit
7618e1529f
10 changed files with 222 additions and 28 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,3 +1,16 @@
|
||||||
|
# v0.1.2 (2016-06-05)
|
||||||
|
- Extract and show aspects (by @gsantner)
|
||||||
|
- Cache last podlist
|
||||||
|
- Better sharing from app
|
||||||
|
- Collapsing top menu
|
||||||
|
- ProgressBar material, Improve search dialog
|
||||||
|
- fix keyboard. #4
|
||||||
|
- Reworked sharing from activity #12
|
||||||
|
- toolbar/actions/menu changes, replaced fab
|
||||||
|
- Refactor layout & menu files, dialogs
|
||||||
|
- Lots of refactoring; Reworked Splash,PodSelectionActivity; Switch Pod; Clear settings;
|
||||||
|
- Activity transitions, usability MainActivity, green accent color
|
||||||
|
|
||||||
# v0.1.1
|
# v0.1.1
|
||||||
- Sharing updated (by @scoute-dich)
|
- Sharing updated (by @scoute-dich)
|
||||||
- Screenshotting updated
|
- Screenshotting updated
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
![1](https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android/v0.1.1/Screenshots/Screenshot_20160303-194540.png)
|
<table>
|
||||||
![2](https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android/v0.1.1/Screenshots/Screenshot_20160303-194559.png)
|
<tr>
|
||||||
![3](https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android/v0.1.1/Screenshots/Screenshot_20160303-194608.png)
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806540/ada77adc-2b45-11e6-86a0-23467d4c5fc2.png" height="60%" width="60%"></td>
|
||||||
![4](https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android/v0.1.1/Screenshots/Screenshot_20160303-194621.png)
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806541/ada7f908-2b45-11e6-8c88-5e141ae1786f.png" height="60%" width="60%"></td>
|
||||||
![5](https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android/v0.1.1/Screenshots/Screenshot_20160303-194752.png)
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806544/adab9630-2b45-11e6-8337-0a84bd9c195d.png" height="60%" width="60%"></td>
|
||||||
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806542/adaa1580-2b45-11e6-95d9-ab4317dc0e05.png" height="60%" width="60%"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806543/adaada24-2b45-11e6-96b2-9cb391aad0f9.png" height="60%" width="60%"></td>
|
||||||
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806545/adac1114-2b45-11e6-8875-5ba414cb1fbd.png" height="60%" width="60%"></td>
|
||||||
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806546/adc6caae-2b45-11e6-86f9-48402b752000.png" height="60%" width="60%"></td>
|
||||||
|
<td><img src="https://cloud.githubusercontent.com/assets/6735650/15806547/adc73890-2b45-11e6-9e46-3bb6b2ecc1c9.png" height="60%" width="60%"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
|
@ -10,8 +10,8 @@ android {
|
||||||
applicationId "com.github.dfa.diaspora_android"
|
applicationId "com.github.dfa.diaspora_android"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 2
|
versionCode 3
|
||||||
versionName "0.1.1"
|
versionName "0.1.2"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
||||||
import com.github.dfa.diaspora_android.ui.CustomWebViewClient;
|
import com.github.dfa.diaspora_android.ui.CustomWebViewClient;
|
||||||
import com.github.dfa.diaspora_android.util.AvatarImageLoader;
|
import com.github.dfa.diaspora_android.util.AvatarImageLoader;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ public class App extends Application {
|
||||||
private AppSettings appSettings;
|
private AppSettings appSettings;
|
||||||
private AvatarImageLoader avatarImageLoader;
|
private AvatarImageLoader avatarImageLoader;
|
||||||
private CookieManager cookieManager;
|
private CookieManager cookieManager;
|
||||||
|
private PodUserProfile podUserProfile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
@ -29,6 +31,7 @@ public class App extends Application {
|
||||||
final Context c = getApplicationContext();
|
final Context c = getApplicationContext();
|
||||||
appSettings = new AppSettings(c);
|
appSettings = new AppSettings(c);
|
||||||
avatarImageLoader = new AvatarImageLoader(c);
|
avatarImageLoader = new AvatarImageLoader(c);
|
||||||
|
podUserProfile = new PodUserProfile(this);
|
||||||
|
|
||||||
|
|
||||||
// Get cookie manager
|
// Get cookie manager
|
||||||
|
@ -61,6 +64,10 @@ public class App extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PodUserProfile getPodUserProfile(){
|
||||||
|
return podUserProfile;
|
||||||
|
}
|
||||||
|
|
||||||
public AppSettings getSettings() {
|
public AppSettings getSettings() {
|
||||||
return appSettings;
|
return appSettings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
app = (App) getApplication();
|
app = (App) getApplication();
|
||||||
appSettings = app.getSettings();
|
appSettings = app.getSettings();
|
||||||
podUserProfile = new PodUserProfile(app, uiHandler, this);
|
podUserProfile = app.getPodUserProfile();
|
||||||
|
podUserProfile.setCallbackHandler(uiHandler);
|
||||||
|
podUserProfile.setListener(this);
|
||||||
|
|
||||||
//Orbot integration
|
//Orbot integration
|
||||||
OrbotHelper.requestStartTor(this.getApplicationContext());
|
OrbotHelper.requestStartTor(this.getApplicationContext());
|
||||||
|
@ -256,7 +258,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress > 60) {
|
if (progress > 60) {
|
||||||
Helpers.hideTopBar(wv);
|
Helpers.applyDiasporaMobileSiteChanges(wv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress == 100) {
|
if (progress == 100) {
|
||||||
|
@ -887,7 +889,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
case R.id.nav_aspects: {
|
case R.id.nav_aspects: {
|
||||||
if (Helpers.isOnline(MainActivity.this)) {
|
if (Helpers.isOnline(MainActivity.this)) {
|
||||||
webView.loadUrl("https://" + podDomain + "/aspects");
|
// webView.loadUrl("https://" + podDomain + "/aspects");
|
||||||
|
Helpers.showAspectList(webView, app);
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class ShareActivity extends MainActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress > 60) {
|
if (progress > 60) {
|
||||||
Helpers.hideTopBar(wv);
|
Helpers.applyDiasporaMobileSiteChanges(wv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress == 100) {
|
if (progress == 100) {
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.github.dfa.diaspora_android.data;
|
package com.github.dfa.diaspora_android.data;
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by gsantner on 20.03.16. Part of Diaspora for Android.
|
* Created by gsantner on 20.03.16. Part of Diaspora for Android.
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +21,10 @@ public class AppSettings {
|
||||||
prefPod = this.context.getSharedPreferences("pod0", Context.MODE_PRIVATE);
|
prefPod = this.context.getSharedPreferences("pod0", Context.MODE_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Context getApplicationContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
public void clearPodSettings() {
|
public void clearPodSettings() {
|
||||||
prefPod.edit().clear().apply();
|
prefPod.edit().clear().apply();
|
||||||
}
|
}
|
||||||
|
@ -37,11 +45,11 @@ public class AppSettings {
|
||||||
pref.edit().putBoolean(key, value).apply();
|
pref.edit().putBoolean(key, value).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStringArray(SharedPreferences pref, String key, String[] values){
|
private void setStringArray(SharedPreferences pref, String key, Object[] values) {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for(String value : values){
|
for (Object value : values) {
|
||||||
sb.append("%%%");
|
sb.append("%%%");
|
||||||
sb.append(value);
|
sb.append(value.toString());
|
||||||
}
|
}
|
||||||
setString(pref, key, sb.toString().replaceFirst("%%%", ""));
|
setString(pref, key, sb.toString().replaceFirst("%%%", ""));
|
||||||
}
|
}
|
||||||
|
@ -65,6 +73,7 @@ public class AppSettings {
|
||||||
private static final String PODUSERPROFILE_NAME = "podUserProfile_name";
|
private static final String PODUSERPROFILE_NAME = "podUserProfile_name";
|
||||||
private static final String PODUSERPROFILE_ID = "podUserProfile_guid";
|
private static final String PODUSERPROFILE_ID = "podUserProfile_guid";
|
||||||
private static final String PODDOMAIN = "podDomain";
|
private static final String PODDOMAIN = "podDomain";
|
||||||
|
private static final String PODUSERPROFILE_ASPECTS = "podUserProfile_aspects";
|
||||||
private static final String IS_PROXY_ORBOT = "proxyViaOrbot";
|
private static final String IS_PROXY_ORBOT = "proxyViaOrbot";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,4 +150,16 @@ public class AppSettings {
|
||||||
public void setProxyOrbot(boolean active) {
|
public void setProxyOrbot(boolean active) {
|
||||||
prefApp.edit().putBoolean(PREF.IS_PROXY_ORBOT, active).commit();
|
prefApp.edit().putBoolean(PREF.IS_PROXY_ORBOT, active).commit();
|
||||||
}
|
}
|
||||||
|
public void setPodAspects(PodAspect[] aspects) {
|
||||||
|
setStringArray(prefPod, PREF.PODUSERPROFILE_ASPECTS, aspects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PodAspect[] getPodAspects() {
|
||||||
|
String[] s= getStringArray(prefPod, PREF.PODUSERPROFILE_ASPECTS);
|
||||||
|
PodAspect[] aspects = new PodAspect[s.length];
|
||||||
|
for(int i=0; i < aspects.length; i++){
|
||||||
|
aspects[i] = new PodAspect(s[i]);
|
||||||
|
}
|
||||||
|
return aspects;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.github.dfa.diaspora_android.data;
|
||||||
|
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.App;
|
||||||
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by gregor on 05.06.16.
|
||||||
|
*/
|
||||||
|
public class PodAspect {
|
||||||
|
public long id;
|
||||||
|
public String name;
|
||||||
|
public boolean selected;
|
||||||
|
|
||||||
|
public PodAspect(long id, String name, boolean selected) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.selected = selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PodAspect(String shareabletext) {
|
||||||
|
// fromShareAbleText
|
||||||
|
String[] str = shareabletext.split("%");
|
||||||
|
selected = Integer.parseInt(str[0]) == 1;
|
||||||
|
id = Long.parseLong(str[1]);
|
||||||
|
name = shareabletext.substring(shareabletext.indexOf(str[1]) + str[1].length() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PodAspect(JSONObject json) throws JSONException {
|
||||||
|
if (json.has("id")) {
|
||||||
|
id = json.getLong("id");
|
||||||
|
}
|
||||||
|
if (json.has("name")) {
|
||||||
|
name = json.getString("name");
|
||||||
|
}
|
||||||
|
if (json.has("selected")) {
|
||||||
|
selected = json.getBoolean("selected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJsonString() {
|
||||||
|
JSONObject j = new JSONObject();
|
||||||
|
try {
|
||||||
|
j.put("id", id);
|
||||||
|
j.put("name", name);
|
||||||
|
j.put("selected", selected);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
}
|
||||||
|
return j.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHtmlLink(final App app) {
|
||||||
|
final AppSettings appSettings = app.getSettings();
|
||||||
|
return String.format(Locale.getDefault(),
|
||||||
|
"<a href='https://%s/aspects?a_ids[]=%d' style='color: #000000; text-decoration: none;'>%s</a>",
|
||||||
|
appSettings.getPodDomain(), id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return toShareAbleText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o instanceof PodAspect) {
|
||||||
|
return ((PodAspect) o).id == id;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toShareAbleText() {
|
||||||
|
return String.format(Locale.getDefault(), "%d%%%d%%%s", selected ? 1 : 0, id, name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import 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 org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ public class PodUserProfile {
|
||||||
private String avatarUrl;
|
private String avatarUrl;
|
||||||
private String guid;
|
private String guid;
|
||||||
private String name;
|
private String name;
|
||||||
|
private PodAspect[] podAspects;
|
||||||
private int notificationCount;
|
private int notificationCount;
|
||||||
private int unreadMessagesCount;
|
private int unreadMessagesCount;
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ public class PodUserProfile {
|
||||||
avatarUrl = appSettings.getAvatarUrl();
|
avatarUrl = appSettings.getAvatarUrl();
|
||||||
guid = appSettings.getProfileId();
|
guid = appSettings.getProfileId();
|
||||||
name = appSettings.getName();
|
name = appSettings.getName();
|
||||||
|
podAspects = appSettings.getPodAspects();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PodUserProfile(App app, Handler callbackHandler, WebUserProfileChangedListener listener) {
|
public PodUserProfile(App app, Handler callbackHandler, WebUserProfileChangedListener listener) {
|
||||||
|
@ -83,7 +86,14 @@ public class PodUserProfile {
|
||||||
|
|
||||||
// Unread message count
|
// Unread message count
|
||||||
if (json.has("unread_messages_count") && loadUnreadMessagesCount(json.getInt("unread_messages_count"))) {
|
if (json.has("unread_messages_count") && loadUnreadMessagesCount(json.getInt("unread_messages_count"))) {
|
||||||
|
appSettings.setPodAspects(podAspects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aspect
|
||||||
|
if (json.has("aspects") && loadAspects(json.getJSONArray("aspects"))) {
|
||||||
|
appSettings.setPodAspects(podAspects);
|
||||||
|
}
|
||||||
|
|
||||||
isWebUserProfileLoaded = true;
|
isWebUserProfileLoaded = true;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.d(App.TAG, e.getMessage());
|
Log.d(App.TAG, e.getMessage());
|
||||||
|
@ -117,6 +127,10 @@ public class PodUserProfile {
|
||||||
return unreadMessagesCount;
|
return unreadMessagesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PodAspect[] getAspects() {
|
||||||
|
return podAspects;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private property setters
|
* Private property setters
|
||||||
*/
|
*/
|
||||||
|
@ -173,6 +187,14 @@ public class PodUserProfile {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean loadAspects(final JSONArray jsonAspects) throws JSONException {
|
||||||
|
podAspects = new PodAspect[jsonAspects.length()];
|
||||||
|
for (int i = 0; i < jsonAspects.length(); i++) {
|
||||||
|
podAspects[i] = new PodAspect(jsonAspects.getJSONObject(i));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean loadUnreadMessagesCount(final int unreadMessagesCount) {
|
private boolean loadUnreadMessagesCount(final int unreadMessagesCount) {
|
||||||
if (this.unreadMessagesCount != unreadMessagesCount) {
|
if (this.unreadMessagesCount != unreadMessagesCount) {
|
||||||
this.unreadMessagesCount = unreadMessagesCount;
|
this.unreadMessagesCount = unreadMessagesCount;
|
||||||
|
@ -188,6 +210,22 @@ public class PodUserProfile {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Handler getCallbackHandler() {
|
||||||
|
return callbackHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallbackHandler(Handler callbackHandler) {
|
||||||
|
this.callbackHandler = callbackHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebUserProfileChangedListener getListener() {
|
||||||
|
return listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(WebUserProfileChangedListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not implemented / not needed yet:
|
* Not implemented / not needed yet:
|
||||||
* string "diasporaAddress"
|
* string "diasporaAddress"
|
||||||
|
@ -195,10 +233,6 @@ public class PodUserProfile {
|
||||||
* boolean "admin"
|
* boolean "admin"
|
||||||
* int "following_count"
|
* int "following_count"
|
||||||
* boolean "moderator"
|
* boolean "moderator"
|
||||||
* array "aspects"
|
|
||||||
* int "id"
|
|
||||||
* string "name"
|
|
||||||
* boolean "selected"
|
|
||||||
*
|
*
|
||||||
* array "services"
|
* array "services"
|
||||||
* ? ?
|
* ? ?
|
||||||
|
|
|
@ -28,8 +28,10 @@ import android.net.NetworkInfo;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
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.data.PodAspect;
|
||||||
|
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
||||||
|
|
||||||
public class Helpers {
|
public class Helpers {
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ public class Helpers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hideTopBar(final WebView wv) {
|
public static void applyDiasporaMobileSiteChanges(final WebView wv) {
|
||||||
wv.loadUrl("javascript: ( function() {" +
|
wv.loadUrl("javascript: ( function() {" +
|
||||||
" document.documentElement.style.paddingBottom = '260px';" +
|
" document.documentElement.style.paddingBottom = '260px';" +
|
||||||
" document.getElementById('main').style.paddingTop = '5px';" +
|
" document.getElementById('main').style.paddingTop = '5px';" +
|
||||||
|
@ -81,6 +83,7 @@ public class Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getUserProfile(final WebView wv) {
|
public static void getUserProfile(final WebView wv) {
|
||||||
|
// aspects":[{"id":124934,"name":"Friends","selected":true},{"id":124937,"name":"Liked me","selected":false},{"id":124938,"name":"Follow","selected":false},{"id":128327,"name":"Nur ich","selected":false}]
|
||||||
wv.loadUrl("javascript: ( function() {" +
|
wv.loadUrl("javascript: ( function() {" +
|
||||||
" if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" +
|
" if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" +
|
||||||
" var userProfile = JSON.stringify(gon.user);" +
|
" var userProfile = JSON.stringify(gon.user);" +
|
||||||
|
@ -88,4 +91,25 @@ public class Helpers {
|
||||||
" } " +
|
" } " +
|
||||||
"})();");
|
"})();");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showAspectList(final WebView wv, final App app) {
|
||||||
|
wv.stopLoading();
|
||||||
|
PodUserProfile profile = app.getPodUserProfile();
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
int intColor = ContextCompat.getColor(app, R.color.colorAccent);
|
||||||
|
String strColor = String.format("#%06X", (0xFFFFFF & intColor));
|
||||||
|
|
||||||
|
sb.append("<html><body style='width:80%; margin-left:auto;margin-right:auto; font-size: 400%;'><center><b>");
|
||||||
|
sb.append(String.format("<h1 style='color: %s; text-shadow: 4px 4px 12px #000000;'>%s</h1>", strColor, app.getString(R.string.jb_aspects)));
|
||||||
|
sb.append("</b></center>");
|
||||||
|
// Content
|
||||||
|
for (PodAspect aspect : profile.getAspects()) {
|
||||||
|
sb.append("» ");
|
||||||
|
sb.append(aspect.toHtmlLink(app));
|
||||||
|
sb.append("</br></br>");
|
||||||
|
}
|
||||||
|
// End
|
||||||
|
sb.append("</body></html>");
|
||||||
|
wv.loadData(sb.toString(), "text/html", "UTF-16");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue