Compare commits

..

4 Commits

15 changed files with 123 additions and 51 deletions

View File

@ -46,12 +46,30 @@ You can directly import this project into IntellIJ/Android Studio.
You'll have to: You'll have to:
- Configure Fabric, or [remove it](https://docs.fabric.io/android/fabric/settings/removing.html#). - Configure fabric and add your `apiKey` and `apiSecret` in the `fabric.properties` file.
- Create a firebase project and add the `google-services.json` to the `app/` folder. - Create a firebase project and add the `google-services.json` to the `app/` folder.
- Define the following in `res/values/strings.xml` or create `res/values/secrets.xml` - Define the following some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples)
- mercury: A [Mercury](https://mercury.postlight.com/web-parser/) web parser api key for the internal browser - mercuryApiKey: A [Mercury](https://mercury.postlight.com/web-parser/) web parser api key for the internal browser
- feedback_email: An email to receive users feedback. - feedbackEmail: An email to receive users feedback.
- source_url: an url to the source code, used in the settings - sourceUrl: an url to the source code, used in the settings
- tracker_url: an url to the tracker, used in the settings - trackerUrl: an url to the tracker, used in the settings
- To run your app, you'll have to add `-P appLoginUrl="your.selfoss-instance.url" -P appLoginUsername="Username" -P appLoginPassword="password"`. (These are only used to run the espresso tests. You should be able to use empty strings or fake values to build the app)
### Examples:
#### Inside ~/.gradle/gradle.properties
```
appLoginUrl="URL"
appLoginUsername="LOGIN"
appLoginPassword="PASS"
mercuryApiKey="LONGAPIKEY"
feedbackEmail="EMAIL"
sourceUrl="URLSOURCE"
trackerUrl="URLTRACKER"
```
#### As gradle parameters
```
./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P mercuryApiKey="LONGAPIKEY" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER"
```

2
.gitignore vendored
View File

@ -214,6 +214,4 @@ gradle-app.setting
# End of https://www.gitignore.io/api/java,gradle,android,androidstudio # End of https://www.gitignore.io/api/java,gradle,android,androidstudio
secrets.xml
release/ release/

View File

@ -1,4 +1,14 @@
**1.5.2.13** **1.5.2.17**
- Source code and tracker links weren't being set, and updated the contributing doc.
**1.5.2.15/16**
- Adding an account header on the lateral drawer.
- The account header is only displayed when the setting is enabled.
**1.5.2.13/14**
- Updated glide. - Updated glide.

View File

@ -53,10 +53,16 @@ android {
// tests // tests
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField "String", "MERCURY_KEY", mercuryApiKey
buildConfigField "String", "FEEDBACK_EMAIL", feedbackEmail
buildConfigField "String", "SOURCE_URL", sourceUrl
buildConfigField "String", "TRACKER_URL", trackerUrl
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro' 'proguard-rules.pro'
} }
@ -165,6 +171,7 @@ apply plugin: 'com.google.gms.google-services'
afterEvaluate { afterEvaluate {
initFabricPropertiesIfNeeded() initFabricPropertiesIfNeeded()
initAppLoginPropertiesIfNeeded() initAppLoginPropertiesIfNeeded()
initAppForSecretPropertiesIfNeeded()
} }
def initFabricPropertiesIfNeeded() { def initFabricPropertiesIfNeeded() {
@ -189,3 +196,16 @@ def initAppLoginPropertiesIfNeeded() {
} }
} }
} }
def initAppForSecretPropertiesIfNeeded() {
def propertiesFile = file(System.getProperty("user.home") + '/.gradle/gradle.properties')
if (!propertiesFile.exists()) {
def commentMessage = "This is autogenerated local property from system environment to prevent key to be committed to source control."
ant.propertyfile(file: System.getProperty("user.home") + "/.gradle/gradle.properties", comment: commentMessage) {
entry(key: "mercuryApiKey", value: System.getProperty("mercuryApiKey"))
entry(key: "feedbackEmail", value: System.getProperty("feedbackEmail"))
entry(key: "sourceUrl", value: System.getProperty("sourceUrl"))
entry(key: "trackerUrl", value: System.getProperty("trackerUrl"))
}
}
}

View File

@ -61,3 +61,7 @@
# self signed glidemodule # self signed glidemodule
-keep public class * implements com.bumptech.glide.module.GlideModule -keep public class * implements com.bumptech.glide.module.GlideModule
-dontwarn com.anupcowkur.reservoir.**
-dontwarn javax.annotation.**

View File

@ -66,7 +66,6 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem
import com.ftinc.scoop.Scoop import com.ftinc.scoop.Scoop
import com.mikepenz.materialdrawer.AccountHeader import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder import com.mikepenz.materialdrawer.AccountHeaderBuilder
import com.mikepenz.materialdrawer.holder.DimenHolder
import com.mikepenz.materialdrawer.model.ProfileDrawerItem import com.mikepenz.materialdrawer.model.ProfileDrawerItem
@ -97,6 +96,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private var maybeSourceFilter: Sources? = null private var maybeSourceFilter: Sources? = null
private var maybeSearchFilter: String? = null private var maybeSearchFilter: String? = null
private var userIdentifier: String = "" private var userIdentifier: String = ""
private var displayAccountHeader: Boolean = false
private lateinit var emptyText: TextView private lateinit var emptyText: TextView
private lateinit var recyclerView: RecyclerView private lateinit var recyclerView: RecyclerView
@ -293,11 +293,15 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
fullHeightCards = sharedPref.getBoolean("full_height_cards", false) fullHeightCards = sharedPref.getBoolean("full_height_cards", false)
itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt() itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt()
userIdentifier = sharedPref.getString("unique_id", "") userIdentifier = sharedPref.getString("unique_id", "")
displayAccountHeader = sharedPref.getBoolean("account_header_displaying", false)
} }
private fun handleDrawer(dirtyPref: SharedPreferences) { private fun handleDrawer(dirtyPref: SharedPreferences) {
displayAccountHeader =
val headerResult: AccountHeader = AccountHeaderBuilder() PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean("account_header_displaying", false)
val headerResult: AccountHeader? = if (displayAccountHeader) {
AccountHeaderBuilder()
.withActivity(this) .withActivity(this)
.withHeaderBackground(R.drawable.bg) .withHeaderBackground(R.drawable.bg)
.addProfiles( .addProfiles(
@ -309,11 +313,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
) )
.withSelectionListEnabledForSingleProfile(false) .withSelectionListEnabledForSingleProfile(false)
.build() .build()
} else null
drawer = DrawerBuilder() val drawerBuilder =
DrawerBuilder()
.withActivity(this) .withActivity(this)
.withAccountHeader(headerResult)
.withHeaderHeight(DimenHolder.fromDp(140))
.withRootView(R.id.drawer_layout) .withRootView(R.id.drawer_layout)
.withToolbar(toolbar) .withToolbar(toolbar)
.withActionBarDrawerToggle(true) .withActionBarDrawerToggle(true)
@ -333,7 +337,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
}) })
.build()
if (displayAccountHeader && headerResult != null)
drawerBuilder.withAccountHeader(headerResult)
drawer = drawerBuilder.build()
drawer.addStickyFooterItem( drawer.addStickyFooterItem(
PrimaryDrawerItem() PrimaryDrawerItem()

View File

@ -49,7 +49,7 @@ class MyApp : MultiDexApplication() {
private fun initAmplify() { private fun initAmplify() {
Amplify.initSharedInstance(this) Amplify.initSharedInstance(this)
.setFeedbackEmailAddress(getString(R.string.feedback_email)) .setFeedbackEmailAddress(BuildConfig.FEEDBACK_EMAIL)
.applyAllDefaultRules() .applyAllDefaultRules()
} }

View File

@ -51,7 +51,7 @@ class ReaderActivity : DragDismissActivity() {
val title: TextView = v.findViewById(R.id.title) val title: TextView = v.findViewById(R.id.title)
val content: HtmlTextView = v.findViewById(R.id.content) val content: HtmlTextView = v.findViewById(R.id.content)
val url = intent.getStringExtra("url") val url = intent.getStringExtra("url")
val parser = MercuryApi(getString(R.string.mercury)) val parser = MercuryApi(BuildConfig.MERCURY_KEY)
val browserBtn: ImageButton = v.findViewById(R.id.browserBtn) val browserBtn: ImageButton = v.findViewById(R.id.browserBtn)
val shareBtn: ImageButton = v.findViewById(R.id.shareBtn) val shareBtn: ImageButton = v.findViewById(R.id.shareBtn)

View File

@ -27,6 +27,7 @@ import android.widget.Toast;
import java.util.List; import java.util.List;
import apps.amine.bou.readerforselfoss.BuildConfig;
import apps.amine.bou.readerforselfoss.R; import apps.amine.bou.readerforselfoss.R;
import apps.amine.bou.readerforselfoss.utils.Config; import apps.amine.bou.readerforselfoss.utils.Config;
import com.ftinc.scoop.ui.ScoopSettingsActivity; import com.ftinc.scoop.ui.ScoopSettingsActivity;
@ -242,7 +243,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
findPreference( "trackerLink" ).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference( "trackerLink" ).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
openUrl(Uri.parse(getString(R.string.tracker_url))); openUrl(Uri.parse(BuildConfig.TRACKER_URL));
return true; return true;
} }
}); });
@ -250,7 +251,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
openUrl(Uri.parse(getString(R.string.source_url))); openUrl(Uri.parse(BuildConfig.SOURCE_URL));
return false; return false;
} }
}); });

View File

@ -145,4 +145,6 @@
<string name="read_debug_off">Aucun log quand un article est marqué comme lu</string> <string name="read_debug_off">Aucun log quand un article est marqué comme lu</string>
<string name="summary_debug_identifier">Identifiant de debug</string> <string name="summary_debug_identifier">Identifiant de debug</string>
<string name="unique_id_to_clipboard">Texte copié</string> <string name="unique_id_to_clipboard">Texte copié</string>
<string name="display_header_drawer_summary">Afficher une entête avec l\'url de votre instance de Selfoss en haut du drawer lateral.</string>
<string name="display_header_drawer_title">Entête de compte</string>
</resources> </resources>

View File

@ -145,4 +145,7 @@
<string name="read_debug_off">No log when marking an item as read</string> <string name="read_debug_off">No log when marking an item as read</string>
<string name="summary_debug_identifier">Debug identifier</string> <string name="summary_debug_identifier">Debug identifier</string>
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string> <string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
<string
name="display_header_drawer_summary">Display a header with the selfoss instance url on the lateral drawer.</string>
<string name="display_header_drawer_title">Account header</string>
</resources> </resources>

View File

@ -147,4 +147,7 @@
<string name="read_debug_on">Api calls will be logged when marking an article as read</string> <string name="read_debug_on">Api calls will be logged when marking an article as read</string>
<string name="summary_debug_identifier">Debug identifier</string> <string name="summary_debug_identifier">Debug identifier</string>
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string> <string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
<string
name="display_header_drawer_summary">Display a header with the selfoss instance url on the lateral drawer.</string>
<string name="display_header_drawer_title">Account header</string>
</resources> </resources>

View File

@ -39,6 +39,11 @@
android:title="@string/pref_general_category_displaying"> android:title="@string/pref_general_category_displaying">
</PreferenceCategory> </PreferenceCategory>
<SwitchPreference
android:defaultValue="false"
android:key="account_header_displaying"
android:summary="@string/display_header_drawer_summary"
android:title="@string/display_header_drawer_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="card_view_active" android:key="card_view_active"

View File

@ -7,7 +7,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta4' classpath 'com.android.tools.build:gradle:3.0.0-beta5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

Binary file not shown.