Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
G00fY2 committed Jul 6, 2019
2 parents e867b8b + 0cbca41 commit 0e69ffb
Show file tree
Hide file tree
Showing 23 changed files with 141 additions and 60 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center"><a href="#"><img src="https://raw.githubusercontent.com/G00fY2/DeveloperWidget/gh-pages/media/app_icon.png" alt="DeveloperWidget Icon" height="160px"></a></p>

# Developer Widget [![Build Status](https://travis-ci.com/G00fY2/DeveloperWidget.svg?branch=develop)](https://travis-ci.com/G00fY2/DeveloperWidget) [![Release](https://img.shields.io/github/release/G00fY2/DeveloperWidget.svg)](https://github.com/G00fY2/DeveloperWidget/releases) [![API](https://img.shields.io/badge/API-14%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=14) [![License](https://img.shields.io/github/license/G00fY2/DeveloperWidget.svg)](https://github.com/G00fY2/DeveloperWidget/blob/develop/LICENSE)
# Developer Widget [![Build Status](https://travis-ci.com/G00fY2/DeveloperWidget.svg?branch=develop)](https://travis-ci.com/G00fY2/DeveloperWidget) [![Release](https://img.shields.io/github/release/G00fY2/DeveloperWidget.svg)](https://github.com/G00fY2/DeveloperWidget/releases) [![API](https://img.shields.io/badge/API-14%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=14)

**Small Android app that offers a widget to show device data, manage installed apps and list locally stored APK files.**

Expand All @@ -13,30 +13,29 @@
[<img src="https://raw.githubusercontent.com/G00fY2/DeveloperWidget/gh-pages/media/store_screenshot_5.png" width=160>](https://raw.githubusercontent.com/G00fY2/DeveloperWidget/gh-pages/media/store_screenshot_5.png)

## Description
The app was built from a developer for developers. You may know the hassle of having multiple physical devices running different software. This app will help you keep track of important device information as well as organize your apps and local APK files. Never again will you struggle to find APK files using a file browser or search for the app settings menu on a custom manufacturer UI.
The app was built from a developer for developers. You may know the hassle of having multiple physical devices running different software. This app will help you keep track of important device information as well as organize your apps and local APK files. You will never again struggle to find APK files using a file browser or search for the app settings menu on a custom manufacturer UI.

The main feature of the app is an 4x1 (horizontally resizable) homescreen widget that shows dynamically fetched device data and allows you to browse your installed apps and local APK files.

### Features
* Homescreen widget with customizable device name
* Overview of dynamically fetched device data
* device model, system, cpu, memory, display, hardware features, software
* Share/export the data
* Browse all installed (non system) apps and filter them by **package name**
* Opens the specific Android app settings
* Save multiple filters per widget by *enter* and *confirm* a search term
* Save multiple filters per widget
* Wildcard support (e.g. **`com.*xyz`**)
* Option to temporary disable the filter
* Manage local APK files
* Scan internal storage and SD-cards for valid (parsable) APK files
* Scan internal storage and SD-cards for APK files
* Show file name, modification time, file size, app name, debuggable flag, versionname and versioncode
* Directly install them from within the app
* Delete files by long clicking
* Delete files by long pressing
* Offers useful app shortcuts starting from API 25
* Native language settings shortcut
* Native Android developer settings shortcut
* Custom installed apps browser shortcut
* Android developer settings shortcut
* Language settings shortcut
* Browse installed apps shortcut
* Manage local APK files shortcut
* Material design with **Dark mode support** (can be controlled by the user)
* Material design with **Dark mode support** (can be toggled by the user)
* Allow hiding the launcher icon (< API 29)
* Written in Kotlin using Coroutines and Dagger
* No internet permission
Expand Down
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android {
targetSdkVersion rootProject.targetSdkVersion
versionCode versioning.getVersionCode()
versionName versioning.getVersionName()

vectorDrawables.useSupportLibrary = true
}
signingConfigs {
release {
Expand Down Expand Up @@ -74,6 +76,7 @@ dependencies {

// UI
implementation "com.google.android.material:material:$materialVersion"
implementation "androidx.vectordrawable:vectordrawable:$vectorDrawableVersion"

// Misc
implementation "com.jakewharton.timber:timber:$timberVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.view.MotionEvent
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.widget.TooltipCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.ViewCompat
Expand Down Expand Up @@ -194,7 +195,7 @@ class AppsActivity : BaseActivity(R.layout.activity_apps, true), AppsContract.Ap
}

private fun initClearDrawable(): Drawable? {
return ResourcesCompat.getDrawable(resources, R.drawable.ic_clear, null)?.apply {
return AppCompatResources.getDrawable(this, R.drawable.ic_clear)?.apply {
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
colorFilter =
BlendModeColorFilter(ResourcesCompat.getColor(resources, R.color.iconTintColor, null), SRC_IN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import android.view.View
import android.view.View.OnFocusChangeListener
import android.view.inputmethod.EditorInfo
import android.webkit.WebView
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.getSystemService
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.marginBottom
import androidx.recyclerview.widget.LinearLayoutManager
import com.g00fy2.developerwidget.R
import com.g00fy2.developerwidget.activities.about.AboutActivity
Expand Down Expand Up @@ -73,6 +75,16 @@ class WidgetConfigActivity : BaseActivity(R.layout.activity_widget_config), Widg
}

setActionbarElevationListener(widget_config_root_scrollview)
widget_config_root_scrollview.viewTreeObserver.addOnScrollChangedListener {
val scrollableRange =
widget_config_root_scrollview.computeVerticalScrollRange() - widget_config_root_scrollview.height
val fabOffset = (share_fab.height / 2) + share_fab.marginBottom
if (widget_config_root_scrollview.scrollY < scrollableRange - fabOffset) {
share_fab.hide()
} else {
share_fab.show()
}
}

adapter = DeviceDataAdapter()
recyclerview.setHasFixedSize(false)
Expand Down Expand Up @@ -202,6 +214,7 @@ class WidgetConfigActivity : BaseActivity(R.layout.activity_widget_config), Widg
true
}
}
share_fab.setOnClickListener { presenter.shareDeviceData()}
}

private fun toggleDeviceNameEdit(editable: Boolean) {
Expand Down Expand Up @@ -268,7 +281,7 @@ class WidgetConfigActivity : BaseActivity(R.layout.activity_widget_config), Widg
).size

private fun initEditDrawable(): Drawable? {
return ResourcesCompat.getDrawable(resources, R.drawable.ic_edit, null)?.apply {
return AppCompatResources.getDrawable(this, R.drawable.ic_edit)?.apply {
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
colorFilter =
BlendModeColorFilter(ResourcesCompat.getColor(resources, R.color.iconTintColor, null), BlendMode.SRC_IN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ interface WidgetConfigContract {
fun showManuallyAddWidgetNotice()

fun showHomescreen()

fun shareDeviceData()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.g00fy2.developerwidget.data.DeviceDataSource
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import timber.log.Timber
import javax.inject.Inject

class WidgetConfigPresenterImpl @Inject constructor() : BasePresenterImpl(),
Expand Down Expand Up @@ -95,5 +96,24 @@ class WidgetConfigPresenterImpl @Inject constructor() : BasePresenterImpl(),
)
}

override fun shareDeviceData() {
launch {
withContext(Dispatchers.IO) {
getDeviceData()
}.let { intentController.shareDeviceData(formatDeviceDataString(it)) }
}
}

private fun formatDeviceDataString(data: List<Pair<String, DeviceDataItem>>): String {
return data.joinToString("") {
if (it.second.isHeader) {
"\n" + stringController.getString(it.second.title) + "\n"
} else {
stringController.getString(it.second.title) + ": \t" + it.second.value.replace("\n", " ") + "\n"
}
}.removeSurrounding("\n")
}


override fun showManuallyAddWidgetNotice() = toastController.showToast(R.string.manually_add_widget)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ interface IntentController {
fun sendMailToDeveloper()

fun showHomescreen()

fun shareDeviceData(data: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ class IntentControllerImpl @Inject constructor() : IntentController {
})
}

override fun shareDeviceData(data: String) {
startActivity(Intent.createChooser(Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, data)
type = "text/plain"
}, context.getString(R.string.share_device_data)))
}

private fun startActivity(intent: Intent) {
if (intent.resolveActivity(context.packageManager) != null) {
context.startActivity(intent)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.g00fy2.developerwidget.data.device.display

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Point
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.util.DisplayMetrics
import android.view.WindowManager
import androidx.core.content.getSystemService
Expand All @@ -16,12 +15,13 @@ class DisplayDataProvider {

companion object {

@SuppressLint("NewApi")
fun getResolution(context: Context): Point? {
context.getSystemService<WindowManager>()?.defaultDisplay?.let { windowManager ->
Point().let { point ->
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
try {
windowManager.getRealSize(point)
} else {
} catch (e: NoSuchMethodError) {
windowManager.getSize(point)
}
return point
Expand All @@ -30,12 +30,13 @@ class DisplayDataProvider {
return null
}

@SuppressLint("NewApi")
fun geDisplayDpi(context: Context): String {
context.getSystemService<WindowManager>()?.defaultDisplay?.let { windowManager ->
DisplayMetrics().let { displayMetrics ->
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
try {
windowManager.getRealMetrics(displayMetrics)
} else {
} catch (e: NoSuchMethodError) {
windowManager.getMetrics(displayMetrics)
}
return displayMetrics.xdpi.roundToInt().toString() + " / " + displayMetrics.ydpi.roundToInt() + " dpi"
Expand All @@ -45,11 +46,19 @@ class DisplayDataProvider {
}

fun getDisplayRatio(resolution: Point): String {
val resX = min(resolution.x, resolution.y)
val resY = max(resolution.x, resolution.y)
val gcd = gcd(resX, resY)
if (resolution.x > resolution.y) {
val temp = resolution.x
resolution.x = resolution.y
resolution.y = temp
}
val gcd = gcd(resolution.x, resolution.y)

val result = if (resolution.y / gcd == 8) {
(resolution.y / gcd * 2).toString() + ":" + (resolution.x / gcd * 2)
} else {
(resolution.y / gcd).toString() + ":" + (resolution.x / gcd)
}

val result = (resY / gcd).toString() + ":" + (resX / gcd)
val altResult =
if ((resolution.x / gcd) > 9 && ((resolution.y / gcd / 2.0f) % 1.0f) == 0.5f && ((resolution.x / gcd / 2.0f) % 1.0f) == 0.0f) {
NumberFormat.getInstance().let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import android.content.Intent
import android.util.SparseArray
import android.widget.RemoteViews
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.graphics.drawable.toBitmap
import com.g00fy2.developerwidget.BuildConfig
import com.g00fy2.developerwidget.R
import com.g00fy2.developerwidget.activities.apkinstall.ApkActivity
Expand Down Expand Up @@ -108,6 +110,14 @@ class WidgetProviderImpl : AppWidgetProvider(), WidgetProvider {
data[DeviceDataSourceImpl.SDK]?.let { sdk ->
views.setTextViewText(R.id.sdk_int_textview, context.getString(sdk.title) + " " + sdk.value)
}
views.setImageViewBitmap(
R.id.apps_imageview,
AppCompatResources.getDrawable(context, R.drawable.ic_apps_grid)?.toBitmap()
)
views.setImageViewBitmap(
R.id.apk_imageview,
AppCompatResources.getDrawable(context, R.drawable.ic_apps)?.toBitmap()
)
}

private fun updateWidgetButtonIntents(widgetId: Int, views: RemoteViews) {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_share.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="18dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="18dp">
<path
android:fillColor="#FFFFFF"
android:pathData="M18 16.08c-0.76 0-1.44 0.3-1.96 0.77L8.91 12.7C8.96 12.47 9 12.24 9 12s-0.04-0.47-0.09-0.7l7.05-4.11C16.5 7.69 17.21 8 18 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 0.24 0.04 0.47 0.09 0.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c0.79 0 1.5-0.31 2.04-0.81l7.12 4.16c-0.05 0.21-0.08 0.43-0.08 0.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_gravity="center"
android:src="@drawable/ic_launcher_foreground"
app:srcCompat="@drawable/ic_launcher_foreground"
tools:ignore="ContentDescription"
/>
</FrameLayout>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_apk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
android:contentDescription="@string/clear"
android:focusable="true"
android:scaleType="center"
android:src="@drawable/ic_clear"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_clear"
/>

<ImageView
Expand All @@ -60,9 +60,9 @@
android:contentDescription="@string/delete"
android:focusable="true"
android:scaleType="center"
android:src="@drawable/ic_delete"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_delete"
/>

<androidx.constraintlayout.widget.Group
Expand Down Expand Up @@ -92,12 +92,12 @@
android:layout_width="96dp"
android:layout_height="96dp"
android:contentDescription="@string/no_apps_found"
android:src="@drawable/ic_sad"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="@+id/cancel_textview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:srcCompat="@drawable/ic_sad"
/>

<ProgressBar
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_apps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
>

Expand Down Expand Up @@ -41,8 +42,8 @@
android:contentDescription="@string/filter"
android:focusable="true"
android:scaleType="center"
android:src="@drawable/ic_filter"
android:tint="@color/iconTintColor"
app:srcCompat="@drawable/ic_filter"
/>
</LinearLayout>

Expand Down Expand Up @@ -136,8 +137,8 @@
android:layout_height="96dp"
android:layout_gravity="center"
android:contentDescription="@string/no_apps_found"
android:src="@drawable/ic_sad"
android:visibility="invisible"
app:srcCompat="@drawable/ic_sad"
/>

<ProgressBar
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/res/layout/activity_widget_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,22 @@
android:layout_height="wrap_content"
android:paddingBottom="8dp"
app:layout_constraintTop_toBottomOf="@+id/top_view"
>
/>

</androidx.recyclerview.widget.RecyclerView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/share_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:tint="@color/backgroundColor"
app:rippleColor="@color/rippleBackground"
app:backgroundTint="@color/colorAccent"
app:fabCustomSize="40dp"
app:srcCompat="@drawable/ic_share"
/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
Expand Down
Loading

0 comments on commit 0e69ffb

Please sign in to comment.