Skip to content

Commit

Permalink
merge latest changes from original app
Browse files Browse the repository at this point in the history
  • Loading branch information
Schabi committed Mar 21, 2018
2 parents c9ed20f + 2b71e82 commit 587f3c4
Show file tree
Hide file tree
Showing 38 changed files with 460 additions and 481 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ allprojects {
maven { url 'https://jitpack.io' }
jcenter()
google()
maven { url 'https://clojars.org/repo' }
}
}
4 changes: 4 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<<<<<<< HEAD
#Fri Feb 23 12:52:38 CET 2018
=======
#Thu Mar 08 12:50:31 MSK 2018
>>>>>>> 2b71e821ec9ddddeb1328334577dd04fa8609fb0
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
24 changes: 14 additions & 10 deletions org.fox.ttrss/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "org.fox.tttrss"
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
minSdkVersion 16
targetSdkVersion 23 // we're not targeting SDK 25 because of this: https://issuetracker.google.com/issues/37103380#makechanges
targetSdkVersion 27 // we're not targeting SDK 25 because of this: https://issuetracker.google.com/issues/37103380#makechanges
}

lintOptions {
Expand All @@ -35,17 +35,21 @@ dependencies {
compile 'com.bogdwellers:pinchtozoom:0.1'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:support-v4:27.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:customtabs:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.shamanland:fab:0.0.8'
compile 'ch.acra:acra:4.9.2'
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
compile 'me.relex:circleindicator:1.2.2@aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
annotationProcessor 'frankiesardo:icepick-processor:3.2.0'
compile 'com.github.livefront:bridge:v1.1.1'
}
9 changes: 2 additions & 7 deletions org.fox.ttrss/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="465"
android:versionName="1.231">
android:versionCode="469"
android:versionName="1.235">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down Expand Up @@ -265,11 +265,6 @@
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:theme="@style/DarkDialogTheme" />
<activity
android:name=".YoutubePlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/title_activity_video_player" >
</activity>
</application>

</manifest>
19 changes: 19 additions & 0 deletions org.fox.ttrss/src/main/java/org/fox/ttrss/Application.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package org.fox.ttrss;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.livefront.bridge.Bridge;
import com.livefront.bridge.SavedStateHandler;

import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;

import icepick.Icepick;

@ReportsCrashes(mode = ReportingInteractionMode.SILENT,
excludeMatchingSharedPreferencesKeys = {"password"},
resDialogText = R.string.crash_dialog_text,
Expand All @@ -33,6 +40,18 @@ public final void onCreate() {
ACRA.init(this);
}

Bridge.initialize(getApplicationContext(), new SavedStateHandler() {
@Override
public void saveInstanceState(@NonNull Object target, @NonNull Bundle state) {
Icepick.saveInstanceState(target, state);
}

@Override
public void restoreInstanceState(@NonNull Object target, @Nullable Bundle state) {
Icepick.restoreInstanceState(target, state);
}
});

m_singleton = this;
}

Expand Down
56 changes: 30 additions & 26 deletions org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.text.Html;
import android.util.Log;
Expand Down Expand Up @@ -43,11 +42,13 @@
import java.text.SimpleDateFormat;
import java.util.Date;

public class ArticleFragment extends Fragment {
import icepick.State;

public class ArticleFragment extends StateSavedFragment {
private final String TAG = this.getClass().getSimpleName();

private SharedPreferences m_prefs;
private Article m_article;
@State protected Article m_article;
private DetailActivity m_activity;
private WebView m_web;
protected View m_customView;
Expand Down Expand Up @@ -158,11 +159,6 @@ public void onCreateContextMenu(ContextMenu menu, View v,
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {

if (savedInstanceState != null) {
m_article = savedInstanceState.getParcelable("article");
//m_fsviewShown = savedInstanceState.getBoolean("fsviewShown");
}

final View view = inflater.inflate(R.layout.fragment_article, container, false);

/* if (m_fsviewShown) {
Expand All @@ -171,7 +167,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bun
} */

m_contentView = view.findViewById(R.id.article_scrollview);
m_customViewContainer = (FrameLayout) view.findViewById(R.id.article_fullscreen_video);
m_customViewContainer = view.findViewById(R.id.article_fullscreen_video);

/* if (m_article.id == HeadlinesFragment.ARTICLE_SPECIAL_TOP_CHANGED) {
TextView statusMessage = (TextView) view.findViewById(R.id.article_status_message);
Expand All @@ -184,7 +180,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bun
return view;
} */

NotifyingScrollView scrollView = (NotifyingScrollView) view.findViewById(R.id.article_scrollview);
NotifyingScrollView scrollView = view.findViewById(R.id.article_scrollview);
m_fab = view.findViewById(R.id.article_fab);

if (scrollView != null && m_activity.isSmallScreen()) {
Expand Down Expand Up @@ -228,7 +224,7 @@ public void onClick(View view) {
m_articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
m_articleSmallFontSize = Math.max(10, Math.min(18, m_articleFontSize - 2));

TextView title = (TextView)view.findViewById(R.id.title);
TextView title = view.findViewById(R.id.title);

if (title != null) {

Expand Down Expand Up @@ -257,7 +253,23 @@ public void onClick(View v) {

}

ImageView share = (ImageView)view.findViewById(R.id.share);
ImageView attachments = view.findViewById(R.id.attachments);

if (attachments != null) {
if (m_article.attachments != null && m_article.attachments.size() > 0) {
attachments.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
m_activity.displayAttachments(m_article);
}
});

} else {
attachments.setVisibility(View.GONE);
}
}

ImageView share = view.findViewById(R.id.share);

if (share != null) {
share.setOnClickListener(new OnClickListener() {
Expand All @@ -268,7 +280,7 @@ public void onClick(View v) {
});
}

TextView comments = (TextView)view.findViewById(R.id.comments);
TextView comments = view.findViewById(R.id.comments);

if (comments != null) {
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
Expand Down Expand Up @@ -297,7 +309,7 @@ public void onClick(View v) {
}
}

TextView note = (TextView)view.findViewById(R.id.note);
TextView note = view.findViewById(R.id.note);

if (note != null) {
if (m_article.note != null && !"".equals(m_article.note)) {
Expand All @@ -309,7 +321,7 @@ public void onClick(View v) {

}

TextView dv = (TextView)view.findViewById(R.id.date);
TextView dv = view.findViewById(R.id.date);

if (dv != null) {
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_articleSmallFontSize);
Expand All @@ -319,7 +331,7 @@ public void onClick(View v) {
dv.setText(df.format(d));
}

TextView tagv = (TextView)view.findViewById(R.id.tags);
TextView tagv = view.findViewById(R.id.tags);

if (tagv != null) {
tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_articleSmallFontSize);
Expand All @@ -346,7 +358,7 @@ public void onClick(View v) {
}
}

m_web = (WebView)view.findViewById(R.id.article_content);
m_web = view.findViewById(R.id.article_content);

m_web.setWebViewClient(new WebViewClient() {
@Override
Expand Down Expand Up @@ -461,7 +473,7 @@ protected void renderContent(Bundle savedInstanceState) {
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
"body { padding : 0px; margin : 0px; line-height : 130%; word-wrap: break-word; }" +
"img, video, iframe { max-width : 100%; width : auto; height : auto; }" +
" table { width : 100%; }" +
cssOverride +
Expand Down Expand Up @@ -563,14 +575,6 @@ public void onDestroy() {
super.onDestroy();
}

@Override
public void onSaveInstanceState (Bundle out) {
super.onSaveInstanceState(out);

out.setClassLoader(getClass().getClassLoader());
out.putParcelable("article", m_article);
}

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Expand Down
40 changes: 12 additions & 28 deletions org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@

import java.util.HashMap;

public class ArticlePager extends Fragment {
import icepick.State;

public class ArticlePager extends StateSavedFragment {

private final String TAG = "ArticlePager";
private PagerAdapter m_adapter;
private HeadlinesEventListener m_listener;
private Article m_article;
private ArticleList m_articles = new ArticleList(); //m_articles = Application.getInstance().m_loadedArticles;
@State protected Article m_article;
@State protected ArticleList m_articles = new ArticleList(); //m_articles = Application.getInstance().m_loadedArticles;
private OnlineActivity m_activity;
private String m_searchQuery = "";
private Feed m_feed;
@State protected Feed m_feed;
private SharedPreferences m_prefs;
private int m_firstId = 0;
@State protected int m_firstId = 0;
private boolean m_refreshInProgress;
private boolean m_lazyLoadDisabled;

Expand Down Expand Up @@ -108,29 +110,22 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
View view = inflater.inflate(R.layout.article_pager, container, false);

if (savedInstanceState != null) {
m_article = savedInstanceState.getParcelable("article");

if (! (m_activity instanceof DetailActivity)) {
m_articles = savedInstanceState.getParcelable("articles");
} else {
if (m_activity instanceof DetailActivity) {
m_articles = ((DetailActivity)m_activity).m_articles;
}

m_feed = savedInstanceState.getParcelable("feed");
m_firstId = savedInstanceState.getInt("firstId");
}

m_adapter = new PagerAdapter(getActivity().getSupportFragmentManager());

ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager);
ViewPager pager = view.findViewById(R.id.article_pager);

int position = m_articles.indexOf(m_article);

m_listener.onArticleSelected(m_article, false);

pager.setAdapter(m_adapter);

UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_pager_indicator);
UnderlinePageIndicator indicator = view.findViewById(R.id.article_pager_indicator);
indicator.setViewPager(pager);

pager.setCurrentItem(position);
Expand Down Expand Up @@ -200,7 +195,7 @@ protected void onPostExecute(JsonElement result) {
if (isDetached() || !isAdded()) return;

if (!append) {
ViewPager pager = (ViewPager) getView().findViewById(R.id.article_pager);
ViewPager pager = getView().findViewById(R.id.article_pager);
pager.setCurrentItem(0);

m_articles.clear();
Expand Down Expand Up @@ -338,17 +333,6 @@ public void onClick(View v) {
req.execute(map);
}

@Override
public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);

out.setClassLoader(getClass().getClassLoader());
out.putParcelable("article", m_article);
out.putParcelable("articles", m_articles);
out.putParcelable("feed", m_feed);
out.putInt("firstId", m_firstId);
}

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Expand Down Expand Up @@ -379,7 +363,7 @@ public void setActiveArticle(Article article) {

int position = m_articles.indexOf(m_article);

ViewPager pager = (ViewPager) getView().findViewById(R.id.article_pager);
ViewPager pager = getView().findViewById(R.id.article_pager);

pager.setCurrentItem(position);
}
Expand Down
Loading

0 comments on commit 587f3c4

Please sign in to comment.