Browse Source

bbparser init

pull/61/merge
Thodoris1999 6 years ago
parent
commit
278d9875c4
  1. 2
      app/build.gradle
  2. 14
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
  3. 12
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/BBParser.java

2
app/build.gradle

@ -65,7 +65,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.10.3' //TODO: Warning: upgrading from 1.10.3 will break stuff!
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation("com.mikepenz:materialdrawer:6.0.7@aar") {
implementation("com.mikepenz:materialdrawer:6.1.1@aar") {
transitive = true
}
implementation 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'

14
app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

@ -117,16 +117,18 @@ public class SessionManager {
setPersistentCookieSession(); //Store cookies
//Edit SharedPreferences, save session's data
SharedPreferences.Editor editor = sharedPrefs.edit();
setLoginScreenAsDefault(false);
sharedPrefs.edit().putBoolean(LOGGED_IN, true).apply();
sharedPrefs.edit().putString(USERNAME, extractUserName(document)).apply();
sharedPrefs.edit().putInt(USER_ID, extractUserId(document)).apply();
editor.putBoolean(LOGGED_IN, true);
editor.putString(USERNAME, extractUserName(document));
editor.putInt(USER_ID, extractUserId(document));
String avatar = extractAvatarLink(document);
if (avatar != null) {
sharedPrefs.edit().putBoolean(HAS_AVATAR, true).apply();
sharedPrefs.edit().putString(AVATAR_LINK, extractAvatarLink(document)).apply();
editor.putBoolean(HAS_AVATAR, true);
editor.putString(AVATAR_LINK, avatar);
} else
sharedPrefs.edit().putBoolean(HAS_AVATAR, false).apply();
editor.putBoolean(HAS_AVATAR, false);
editor.apply();
sharedPrefs.edit().putString(LOGOUT_LINK, extractLogoutLink(document)).apply();

12
app/src/main/java/gr/thmmy/mthmmy/utils/parsing/BBParser.java

@ -0,0 +1,12 @@
package gr.thmmy.mthmmy.utils.parsing;
import android.text.SpannableStringBuilder;
import android.text.SpannedString;
public class BBParser {
public static final String[] supportedTags = {"b"};
public SpannedString bb2span(String bb) {
SpannableStringBuilder builder = new SpannableStringBuilder(bb);
}
}
Loading…
Cancel
Save