implement licensing
This commit is contained in:
parent
6440c73b1e
commit
a9b3ea9e5d
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="31"
|
android:versionCode="32"
|
||||||
android:versionName="0.1.30">
|
android:versionName="0.2.0">
|
||||||
<uses-sdk android:minSdkVersion="4" />
|
<uses-sdk android:minSdkVersion="4" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
@ -90,4 +90,5 @@
|
|||||||
<string name="error_invalid_api_url">Error: invalid API URL</string>
|
<string name="error_invalid_api_url">Error: invalid API URL</string>
|
||||||
<string name="combined_mode_summary">Displays full article text inline, instead of a separate panel</string>
|
<string name="combined_mode_summary">Displays full article text inline, instead of a separate panel</string>
|
||||||
<string name="combined_mode">Combined mode</string>
|
<string name="combined_mode">Combined mode</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -30,7 +30,6 @@
|
|||||||
<CheckBoxPreference android:defaultValue="false" android:title="@string/browse_cats_like_feeds" android:key="browse_cats_like_feeds"
|
<CheckBoxPreference android:defaultValue="false" android:title="@string/browse_cats_like_feeds" android:key="browse_cats_like_feeds"
|
||||||
android:summary="@string/browse_cats_like_feeds_summary" />
|
android:summary="@string/browse_cats_like_feeds_summary" />
|
||||||
<CheckBoxPreference android:defaultValue="false" android:summary="@string/combined_mode_summary" android:title="@string/combined_mode" android:key="combined_mode" />
|
<CheckBoxPreference android:defaultValue="false" android:summary="@string/combined_mode_summary" android:title="@string/combined_mode" android:key="combined_mode" />
|
||||||
<CheckBoxPreference android:defaultValue="false" android:summary="@string/enable_ads_summary" android:title="@string/enable_ads" android:key="enable_ads" />
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import org.fox.ttrss.ArticleOps.RelativeArticle;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@ -159,10 +160,9 @@ public class ArticleFragment extends Fragment implements OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AdView av = (AdView)view.findViewById(R.id.ad);
|
AdView av = (AdView)view.findViewById(R.id.ad);
|
||||||
boolean enableAds = m_prefs.getBoolean("enable_ads", false);
|
|
||||||
|
|
||||||
if (av != null) {
|
if (av != null) {
|
||||||
if (enableAds) {
|
if (!((MainActivity)getActivity()).getLicensed()) {
|
||||||
AdRequest request = new AdRequest();
|
AdRequest request = new AdRequest();
|
||||||
request.addTestDevice(AdRequest.TEST_EMULATOR);
|
request.addTestDevice(AdRequest.TEST_EMULATOR);
|
||||||
av.loadAd(request);
|
av.loadAd(request);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.fox.ttrss;
|
package org.fox.ttrss;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -46,11 +48,11 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
private boolean m_smallScreenMode;
|
private boolean m_smallScreenMode;
|
||||||
private boolean m_unreadOnly = true;
|
private boolean m_unreadOnly = true;
|
||||||
private boolean m_unreadArticlesOnly = true;
|
private boolean m_unreadArticlesOnly = true;
|
||||||
//private boolean m_canLoadMore = true;
|
|
||||||
private boolean m_compatMode = false;
|
private boolean m_compatMode = false;
|
||||||
private boolean m_enableCats = false;
|
private boolean m_enableCats = false;
|
||||||
|
private int m_isLicensed = -1;
|
||||||
private int m_apiLevel = 0;
|
private int m_apiLevel = 0;
|
||||||
|
|
||||||
public void updateHeadlines() {
|
public void updateHeadlines() {
|
||||||
HeadlinesFragment frag = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
HeadlinesFragment frag = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
||||||
if (frag != null) {
|
if (frag != null) {
|
||||||
@ -58,6 +60,10 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getLicensed() {
|
||||||
|
return m_isLicensed == 1;
|
||||||
|
}
|
||||||
|
|
||||||
public int getApiLevel() {
|
public int getApiLevel() {
|
||||||
return m_apiLevel;
|
return m_apiLevel;
|
||||||
}
|
}
|
||||||
@ -299,9 +305,9 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
m_activeFeed = savedInstanceState.getParcelable("activeFeed");
|
m_activeFeed = savedInstanceState.getParcelable("activeFeed");
|
||||||
m_selectedArticle = savedInstanceState.getParcelable("selectedArticle");
|
m_selectedArticle = savedInstanceState.getParcelable("selectedArticle");
|
||||||
m_unreadArticlesOnly = savedInstanceState.getBoolean("unreadArticlesOnly");
|
m_unreadArticlesOnly = savedInstanceState.getBoolean("unreadArticlesOnly");
|
||||||
//m_canLoadMore = savedInstanceState.getBoolean("canLoadMore");
|
|
||||||
m_activeCategory = savedInstanceState.getParcelable("activeCategory");
|
m_activeCategory = savedInstanceState.getParcelable("activeCategory");
|
||||||
m_apiLevel = savedInstanceState.getInt("apiLevel");
|
m_apiLevel = savedInstanceState.getInt("apiLevel");
|
||||||
|
m_isLicensed = savedInstanceState.getInt("isLicensed");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enableCats = m_prefs.getBoolean("enable_cats", false);
|
m_enableCats = m_prefs.getBoolean("enable_cats", false);
|
||||||
@ -323,6 +329,16 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
if (!m_compatMode) {
|
if (!m_compatMode) {
|
||||||
new TransitionHelper((LinearLayout)findViewById(R.id.main));
|
new TransitionHelper((LinearLayout)findViewById(R.id.main));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<PackageInfo> pkgs = getPackageManager().getInstalledPackages(0);
|
||||||
|
|
||||||
|
for (PackageInfo p : pkgs) {
|
||||||
|
if ("org.fox.ttrss.key".equals(p.packageName)) {
|
||||||
|
m_isLicensed = 1;
|
||||||
|
Log.d(TAG, "license apk found");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_smallScreenMode) {
|
if (m_smallScreenMode) {
|
||||||
if (m_selectedArticle != null) {
|
if (m_selectedArticle != null) {
|
||||||
@ -392,9 +408,9 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
out.putParcelable("activeFeed", m_activeFeed);
|
out.putParcelable("activeFeed", m_activeFeed);
|
||||||
out.putParcelable("selectedArticle", m_selectedArticle);
|
out.putParcelable("selectedArticle", m_selectedArticle);
|
||||||
out.putBoolean("unreadArticlesOnly", m_unreadArticlesOnly);
|
out.putBoolean("unreadArticlesOnly", m_unreadArticlesOnly);
|
||||||
//out.putBoolean("canLoadMore", m_canLoadMore);
|
|
||||||
out.putParcelable("activeCategory", m_activeCategory);
|
out.putParcelable("activeCategory", m_activeCategory);
|
||||||
out.putInt("apiLevel", m_apiLevel);
|
out.putInt("apiLevel", m_apiLevel);
|
||||||
|
out.putInt("isLicensed", m_isLicensed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -761,10 +777,6 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public void setCanLoadMore(boolean canLoadMore) {
|
|
||||||
m_canLoadMore = canLoadMore;
|
|
||||||
} */
|
|
||||||
|
|
||||||
public void initMainMenu() {
|
public void initMainMenu() {
|
||||||
if (m_menu != null) {
|
if (m_menu != null) {
|
||||||
if (m_sessionId != null) {
|
if (m_sessionId != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user