Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Commit

Permalink
2020-02-01 Version 1.0.2: Refactored project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
fartem committed Feb 1, 2020
1 parent 5818cea commit dbc781d
Show file tree
Hide file tree
Showing 111 changed files with 427 additions and 429 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0.1"
versionName "1.0.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.DeviceBatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.DeviceBatteryInfo
import org.junit.Assert.assertEquals
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.cpu.DeviceCPUInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.cpu.DeviceCPUInfo
import org.junit.Assert.assertNotNull
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.display.DeviceDisplayInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.display.DeviceDisplayInfo
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.DeviceGPUIInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.DeviceGPUIInfo
import org.junit.Assert.assertNotNull
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.jvm.DeviceJVMInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.jvm.DeviceJVMInfo
import org.junit.Assert.assertEquals
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.ram.DeviceRAMInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.ram.DeviceRAMInfo
import org.junit.Assert.assertTrue
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.pixel.api27

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.system.DeviceSystemInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.system.DeviceSystemInfo
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.DeviceBatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.DeviceBatteryInfo
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test

class Api22BatteryInfoTest : BaseInfoTest() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.cpu.DeviceCPUInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.cpu.DeviceCPUInfo
import org.junit.Assert.assertNotNull
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.display.DeviceDisplayInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.display.DeviceDisplayInfo
import org.junit.Assert.*
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.DeviceGPUIInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.DeviceGPUIInfo
import org.junit.Assert.assertNotNull
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.jvm.DeviceJVMInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.jvm.DeviceJVMInfo
import org.junit.Assert.assertEquals
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.ram.DeviceRAMInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.ram.DeviceRAMInfo
import org.junit.Assert.assertTrue
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.info.travisci.api22

import com.smlnskgmail.jaman.deviceinfo.info.BaseInfoTest
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.system.DeviceSystemInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.system.DeviceSystemInfo
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.renderer.DeviceGPUActivity" />
<activity android:name="com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.renderer.DeviceGPUActivity" />
</application>

</manifest>
42 changes: 27 additions & 15 deletions app/src/main/java/com/smlnskgmail/jaman/deviceinfo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package com.smlnskgmail.jaman.deviceinfo
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.ui.ViewPager2WithTabs
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.DeviceBatteryPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.cpu.DeviceCPUPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.display.DeviceDisplayPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.DeviceGPUPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.renderer.DeviceGPUActivity
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.gpu.renderer.GPURequestCode
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.jvm.DeviceJVMPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.ram.DeviceRAMPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.system.DeviceSystemPage
import com.smlnskgmail.jaman.deviceinfo.logic.preferences.common.FirstLaunchPreferenceUnit
import com.smlnskgmail.jaman.deviceinfo.logic.preferences.types.BooleanPreference
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.ui.ViewPager2WithTabs
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.DeviceBatteryPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.cpu.DeviceCPUPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.display.DeviceDisplayPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.DeviceGPUPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.renderer.DeviceGPUActivity
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.gpu.renderer.GPURequestCode
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.jvm.DeviceJVMPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.ram.DeviceRAMPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.system.DeviceSystemPage
import com.smlnskgmail.jaman.deviceinfo.logic.preferences.api.PreferenceValue
import com.smlnskgmail.jaman.deviceinfo.logic.preferences.impl.shared.BooleanPreference
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
Expand All @@ -35,7 +35,7 @@ class MainActivity : AppCompatActivity() {

private fun isFirstLaunch() = BooleanPreference(
this,
FirstLaunchPreferenceUnit()
FirstLaunchPreferenceValue()
).value()

private fun firstLaunch() {
Expand Down Expand Up @@ -68,15 +68,27 @@ class MainActivity : AppCompatActivity() {
DeviceDisplayPage()
)

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
override fun onActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == GPURequestCode().requestCode()) {
BooleanPreference(
this,
FirstLaunchPreferenceUnit()
FirstLaunchPreferenceValue()
).save(false)
loadInfoPages()
}
}

private inner class FirstLaunchPreferenceValue : PreferenceValue<Boolean> {

override fun key() = "first_launch"

override fun defaultValue() = true

}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface BatteryInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface CPUInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface DisplayInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface GPUIInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface JVMInfo {

fun jvmName(): String

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

interface RAMInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info
package com.smlnskgmail.jaman.deviceinfo.logic.info.api

@SuppressWarnings("TooManyFunctions")
interface SystemInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.ui.Page2
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.recycler.InfoAdapter
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.ui.Page2
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoAdapter
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoItem
import kotlinx.android.synthetic.main.fragment_list.*

abstract class BaseListInfoPage : Page2() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery

import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.BatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.BatteryInfo

class DeviceBatteryInfo(private val context: Context) :
BatteryInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery

import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.BaseListInfoPage
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler.BatteryActionInfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler.BatteryHealthInfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler.BatteryPluggedInfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.BatteryInfo

class DeviceBatteryPage : BaseListInfoPage() {

override fun infoItems(): List<InfoItem> {
val batteryInfo: BatteryInfo = DeviceBatteryInfo(context!!)
return listOf(
BatteryHealthInfoItem(
context!!,
batteryInfo
),
BatteryActionInfoItem(
context!!,
batteryInfo
),
BatteryPluggedInfoItem(
context!!,
batteryInfo
)
)
}

override fun pageTitleResId() = R.string.page_title_battery

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.recycler
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler

import android.content.Context
import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.BatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.BatteryInfo

class BatteryActionInfoItem(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.recycler
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler

import android.content.Context
import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.BatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.BatteryInfo

class BatteryHealthInfoItem(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.battery.recycler
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.battery.recycler

import android.content.Context
import com.smlnskgmail.jaman.deviceinfo.R
import com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.BatteryInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.recycler.InfoItem
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.BatteryInfo

class BatteryPluggedInfoItem(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.smlnskgmail.jaman.deviceinfo.logic.info.realizations.mainpager.pages.cpu
package com.smlnskgmail.jaman.deviceinfo.logic.info.impl.androidsdk.pages.cpu

import com.smlnskgmail.jaman.deviceinfo.logic.info.CPUInfo
import com.smlnskgmail.jaman.deviceinfo.logic.info.api.CPUInfo
import com.smlnskgmail.jaman.deviceinfo.support.handlers.NullHandle
import java.io.File
import java.io.FileFilter
Expand Down
Loading

0 comments on commit dbc781d

Please sign in to comment.