Skip to content

Commit

Permalink
About page
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Jan 9, 2018
1 parent 88a1dad commit 2adefd3
Show file tree
Hide file tree
Showing 22 changed files with 1,637 additions and 53 deletions.
10 changes: 10 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
The Stanley application is licensed under the MIT License.

Copyright (c) 2017: Xavier F. GOUCHET

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
![Stanley icon](https://github.com/xgouchet/Stanley/raw/master/Stanley/res/drawable-xhdpi/ic_launcher.png)
![Stanley icon](https://github.com/xgouchet/Stanley/raw/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png)

Stanley
=======
# Stanley

An Android app explorer for developpers (extract the manifest and other info from any installed application).

The official Stanley app will soon be available on the [Google Play Store](https://play.google.com/store/).
> An Android app explorer for developers (extract the manifest and other info from any installed application).
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)
[![Kotlin 1.1.2-4](https://img.shields.io/badge/Kotlin-1.1.51-blue.svg)](http://kotlinlang.org)

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/xaviergouchet)

The official Stanley app is available on the [Google Play Store](https://play.google.com/store/).

## Contributing

Any contributions are welcome. You can [raise an issue](https://github.com/xgouchet/Stanley/issues/new), submit a [pull request](https://github.com/xgouchet/Stanley/pulls), translate the application, or suggest new features.

## Donate

This application is completely free to use, and doesn't bother you with ads. I try my best to make it as good as possible, but only do this on my free time. If you want to support my work, you can click the Donate button below.

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/xaviergouchet)


## Meta

Xavier F. Gouchet – [@xgouchet](https://twitter.com/xgouchet)

Distributed under the MIT license. See [LICENSE.md](LICENSE.md) for more information.

[https://github.com/xgouchet/Stanley](https://github.com/xgouchet/Stanley)
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.google.gms.oss.licenses.plugin'

apply from: "$project.rootDir/dependencies.gradle"

Expand Down Expand Up @@ -67,9 +68,11 @@ dependencies {
androidSupport()
kotlin()
rx()
oss()
aboutPage()

debugTools()

implementation 'com.github.xgouchet:AXML:v1.0'
implementation 'com.github.xgouchet:AXML:v1.0.1'

}
27 changes: 20 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.xgouchet.packageexplorer">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".StanleyApplication"
Expand All @@ -24,15 +24,15 @@

<activity
android:name=".details.app.AppDetailsActivity"
android:label="@string/activity_title_appDetails"
android:enabled="true"
android:exported="false" />
android:exported="false"
android:label="@string/activity_title_appDetails" />

<activity
android:name=".details.apk.ApkDetailsActivity"
android:label="@string/activity_title_apkDetails"
android:enabled="true"
android:exported="true">
android:exported="true"
android:label="@string/activity_title_apkDetails">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -45,11 +45,24 @@
</intent-filter>
</activity>

<activity
android:name=".about.AboutActivity"
android:label="@string/activity_title_about"
android:theme="@style/Theme.AppCompat.Light" />

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.Light" />

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.Light" />

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}"
android:grantUriPermissions="true"
android:exported="false">
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/shareable_paths" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package fr.xgouchet.packageexplorer.about

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import fr.xgouchet.packageexplorer.R
import mehdi.sakout.aboutpage.AboutPage
import mehdi.sakout.aboutpage.Element


class AboutActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val aboutPage = AboutPage(this)
.isRTL(false)
.setDescription("?")
.setImage(R.drawable.about_header)
.addPlayStore(packageName)

.addGroup(getString(R.string.about_contact))
.addEmail(getString(R.string.about_email), getString(R.string.about_email))
.addTwitter("xgouchet")
.addGitHub("xgouchet")

.addGroup(getString(R.string.about_license))
.addItem(Element(getString(R.string.about_copyright), R.drawable.ic_about_copyright))
.addItem(Element(getString(R.string.about_mit), R.drawable.ic_about_opensource))
.addItem(Element(getString(R.string.about_donate), R.drawable.ic_about_donate).apply {
setOnClickListener {
val uri = Uri.parse(getString(R.string.about_donate_url))
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}
})

.addGroup(getString(R.string.about_history))
.addItem(Element(getString(R.string.about_history_v2), null))
.addItem(Element(getString(R.string.about_history_v1), null))
.create()

setContentView(aboutPage)

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import fr.xgouchet.packageexplorer.ui.mvp.BaseActivity
class AppListActivity
: BaseActivity<String, List<AppViewModel>, AppListPresenter, AppListFragment>() {

override fun readIntent(intent: Intent): String {
return ""
override val allowNullIntentData: Boolean = true

override fun readIntent(intent: Intent): String? {
return null
}

override fun instantiatePresenter(): AppListPresenter {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package fr.xgouchet.packageexplorer.applist

import android.content.Intent
import android.os.Bundle
import android.support.v4.view.MenuItemCompat
import android.support.v7.widget.SearchView
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import fr.xgouchet.packageexplorer.R
import fr.xgouchet.packageexplorer.about.AboutActivity
import fr.xgouchet.packageexplorer.applist.sort.AppSort
import fr.xgouchet.packageexplorer.ui.adapter.BaseAdapter
import fr.xgouchet.packageexplorer.ui.mvp.list.BaseListFragment


class AppListFragment : BaseListFragment<AppViewModel, AppListPresenter>() {

override val adapter: BaseAdapter<AppViewModel> = AppAdapter(this)
Expand All @@ -27,7 +30,7 @@ class AppListFragment : BaseListFragment<AppViewModel, AppListPresenter>() {
inflater?.inflate(R.menu.app_list, menu)

menu?.findItem(R.id.action_search)?.let {
val searchView = MenuItemCompat.getActionView(it) as SearchView
val searchView = it.actionView as SearchView
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean = false

Expand All @@ -51,15 +54,24 @@ class AppListFragment : BaseListFragment<AppViewModel, AppListPresenter>() {
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {

when (item?.itemId) {
R.id.sort_by_title -> presenter.setSort(AppSort.TITLE)
R.id.sort_by_package_name -> presenter.setSort(AppSort.PACKAGE_NAME)
R.id.sort_by_install_time -> presenter.setSort(AppSort.INSTALL_TIME)
R.id.sort_by_update_time -> presenter.setSort(AppSort.UPDATE_TIME)
R.id.hide_system_apps -> presenter.setSystemAppsVisible(false)
R.id.show_system_apps -> presenter.setSystemAppsVisible(true)
R.id.about -> {
startActivity(Intent(activity, AboutActivity::class.java))
}
R.id.licenses -> {
OssLicensesMenuActivity.setActivityTitle(getString(R.string.activity_title_licenses))
startActivity(Intent(activity, OssLicensesMenuActivity::class.java))
}
else -> return super.onOptionsItemSelected(item)
}
return super.onOptionsItemSelected(item)
return true
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ import fr.xgouchet.packageexplorer.ui.mvp.BaseActivity
class ApkDetailsActivity
: BaseActivity<Uri, List<AppInfoViewModel>, ApkDetailsPresenter, ApkDetailsFragment>() {

override val allowNullIntentData: Boolean = false

override fun readIntent(intent: Intent): Uri? {
return intent.data
}

override fun instantiatePresenter(): ApkDetailsPresenter {
return ApkDetailsPresenter(this, intentData)
val uri = intentData ?: throw IllegalStateException("Intent data should not be null")
return ApkDetailsPresenter(this, uri)
}

override fun instantiateFragment(): ApkDetailsFragment {
Expand All @@ -33,7 +35,7 @@ class ApkDetailsActivity

override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
intentData.let {
intentData?.let {
title = it.getFileName(this)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class AppDetailsActivity

}

override val allowNullIntentData: Boolean = false

override fun readIntent(intent: Intent): AppViewModel? {
val packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME)
if (packageName.isNullOrBlank()) {
Expand All @@ -35,23 +37,24 @@ class AppDetailsActivity
}

override fun instantiatePresenter(): AppDetailsPresenter {
return AppDetailsPresenter(this, intentData.packageName, intentData.isSystemApp)
val appViewModel = intentData ?: throw IllegalStateException("Expected non null app here")
return AppDetailsPresenter(this, appViewModel.packageName, appViewModel.isSystemApp)
}

override fun instantiateFragment(): AppDetailsFragment {
return AppDetailsFragment()
}

override fun getPresenterKey(): String {
return "app_details/${intentData.packageName}"
val appViewModel = intentData ?: throw IllegalStateException("Expected non null app here")
return "app_details/${appViewModel.packageName}"
}

override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
intentData.let {
intentData?.let {
title = it.title
toolbar.subtitle = it.packageName
// toolbar.navigationIcon = it.icon
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import fr.xgouchet.packageexplorer.R
import timber.log.Timber
import kotlin.properties.Delegates.notNull

abstract class BaseActivity<I, T, out P, out D>
abstract class BaseActivity<IntentDataI, DataD, out PresenterP, out DisplayerD>
: AppCompatActivity()
where I : Any,
P : Presenter<T>,
D : Displayer<T>, D : Fragment {
where IntentDataI : Any,
PresenterP : Presenter<DataD>,
DisplayerD : Displayer<DataD>, DisplayerD : Fragment {


protected lateinit var fragment: Displayer<T>
protected lateinit var presenter: Presenter<T>
abstract val allowNullIntentData: Boolean

protected lateinit var fragment: Displayer<DataD>
protected lateinit var presenter: Presenter<DataD>

protected lateinit var toolbar: Toolbar

protected var intentData: I by notNull()
protected var intentData: IntentDataI? = null
private var isRestored: Boolean = false

// region Activity
Expand All @@ -32,8 +33,8 @@ abstract class BaseActivity<I, T, out P, out D>
setContentView(R.layout.activity_base)
setupHeader()

val data: I? = readIntent(intent)
if (data == null) {
val data: IntentDataI? = readIntent(intent)
if (data == null && !allowNullIntentData) {
Timber.w("Intent data is null, aborting activity")
finish()
return
Expand All @@ -45,7 +46,7 @@ abstract class BaseActivity<I, T, out P, out D>
isRestored = true
presenter = restorePresenter(savedInstanceState)
@Suppress("UNCHECKED_CAST")
fragment = supportFragmentManager.findFragmentById(R.id.fragment_container) as D
fragment = supportFragmentManager.findFragmentById(R.id.fragment_container) as DisplayerD
} else {
presenter = instantiatePresenter()
val displayer = instantiateFragment()
Expand Down Expand Up @@ -106,11 +107,11 @@ abstract class BaseActivity<I, T, out P, out D>

// region Abstract

abstract fun readIntent(intent: Intent): I?
abstract fun readIntent(intent: Intent): IntentDataI?

abstract fun instantiatePresenter(): P
abstract fun instantiatePresenter(): PresenterP

abstract fun instantiateFragment(): D
abstract fun instantiateFragment(): DisplayerD

abstract fun getPresenterKey(): String

Expand All @@ -124,7 +125,7 @@ abstract class BaseActivity<I, T, out P, out D>
}


private fun restorePresenter(savedInstanceState: Bundle): P {
private fun restorePresenter(savedInstanceState: Bundle): PresenterP {
val key = savedInstanceState.getString(PresenterCache.PRESENTER_KEY, null)
val factory = { instantiatePresenter() }

Expand Down
Loading

0 comments on commit 2adefd3

Please sign in to comment.