diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 0cce9f1..79bd5d6 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -12,6 +12,6 @@ - + \ No newline at end of file diff --git a/.idea/other.xml b/.idea/other.xml new file mode 100644 index 0000000..f3d4a2e --- /dev/null +++ b/.idea/other.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/AndroidInfoLib/build.gradle b/AndroidInfoLib/build.gradle index fe4219c..393c45d 100644 --- a/AndroidInfoLib/build.gradle +++ b/AndroidInfoLib/build.gradle @@ -31,6 +31,8 @@ android { } dependencies { + implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.10" + implementation 'androidx.appcompat:appcompat:1.5.1' // Network @@ -39,7 +41,6 @@ dependencies { implementation "com.squareup.okhttp3:okhttp:4.9.3" implementation "com.squareup.okhttp3:logging-interceptor:4.9.3" - testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformation.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformation.kt index d0bdb55..a1f6fec 100644 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformation.kt +++ b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformation.kt @@ -71,4 +71,6 @@ interface DeviceInformation { fun getBatteryInformation(): BatteryInformation fun getSARInformation(): SARInformation + + fun getInfoById(id: Int, context: Context): Map } \ No newline at end of file diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformationFactory.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformationFactory.kt index c38a4e3..e8df2c9 100644 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformationFactory.kt +++ b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/DeviceInformationFactory.kt @@ -17,6 +17,7 @@ package com.udfsoft.androidinfo.lib import android.Manifest +import android.annotation.SuppressLint import android.content.Context import androidx.annotation.RequiresPermission import androidx.annotation.WorkerThread @@ -30,6 +31,7 @@ import com.udfsoft.androidinfo.lib.command.codecs.GetCodecsInformationCommand import com.udfsoft.androidinfo.lib.command.cpu.GetCpuInformationCommand import com.udfsoft.androidinfo.lib.command.design.GetNetworkDesignInformationCommand import com.udfsoft.androidinfo.lib.command.display.GetDisplayInformationCommand +import com.udfsoft.androidinfo.lib.command.entity.MenuIds import com.udfsoft.androidinfo.lib.command.general.GetGeneralInformationCommand import com.udfsoft.androidinfo.lib.command.gpu.GetGPUInformationCommand import com.udfsoft.androidinfo.lib.command.network.GetNetworkTechnologiesInformationCommand @@ -44,6 +46,7 @@ import com.udfsoft.androidinfo.lib.di.NetworkFactory import com.udfsoft.androidinfo.lib.entity.CPUInformation import com.udfsoft.androidinfo.lib.entity.OSInformation import com.udfsoft.androidinfo.lib.entity.RAMInformation +import com.udfsoft.androidinfo.lib.util.asMap @WorkerThread object DeviceInformationFactory : DeviceInformation { @@ -112,4 +115,30 @@ object DeviceInformationFactory : DeviceInformation { override fun getBatteryInformation() = GetBatteryInformationCommand(api).invoke(Unit) override fun getSARInformation() = GetSARInformationCommand(api).invoke(Unit) + + @SuppressLint("MissingPermission") + override fun getInfoById(id: Int, context: Context): Map = + when (MenuIds.findMenuIdByIndex(id)) { + MenuIds.MENU_ID_GENERAL -> getGeneralInformation().asMap() + MenuIds.MENU_ID_DESIGN -> getDesignInformation().asMap() + MenuIds.MENU_ID_SIM -> getSIMCardInformation(context).asMap() + MenuIds.MENU_ID_MOBILE_NETWORK -> getNetworkTechnologiesInformation(context).asMap() + MenuIds.MENU_ID_OS -> getOSInformation().asMap() + MenuIds.MENU_ID_PROCESSOR -> getCPUInformation().asMap() + MenuIds.MENU_ID_GPU -> getGPUInformation().asMap() + MenuIds.MENU_ID_MEMORY -> getRAMInformation(context).asMap() + MenuIds.MENU_ID_STORAGE -> getStorageInformation().asMap() + MenuIds.MENU_ID_DISPLAY -> getDisplayInformation(context).asMap() + MenuIds.MENU_ID_SENSORS -> getSensorsInformation().asMap() + MenuIds.MENU_ID_REAR_CAMERA -> getRearCameraInformation().asMap() + MenuIds.MENU_ID_FRONT_CAMERA -> getFrontCameraInformation().asMap() + MenuIds.MENU_ID_AUDIO -> getAudioInformation().asMap() + MenuIds.MENU_ID_WIRELESS -> getWirelessInformation().asMap() + MenuIds.MENU_ID_USB -> getUSBInformation().asMap() + MenuIds.MENU_ID_BROWSER -> getBrowserInformation().asMap() + MenuIds.MENU_ID_CODECS -> getCodecsInformation().asMap() + MenuIds.MENU_ID_BATTERY -> getBatteryInformation().asMap() + MenuIds.MENU_ID_SAR -> getSARInformation().asMap() + else -> throw UnsupportedOperationException() + } } \ No newline at end of file diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/command/entity/MenuIds.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/command/entity/MenuIds.kt index fc1fd46..f6322ea 100644 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/command/entity/MenuIds.kt +++ b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/command/entity/MenuIds.kt @@ -21,6 +21,9 @@ enum class MenuIds(val menuId: Int) { MENU_ID_BROWSER(22000), MENU_ID_CODECS(23000), MENU_ID_BATTERY(25000), - MENU_ID_SAR(26000), - MENU_ID_ADDITIONAL_FEATURES(27000) + MENU_ID_SAR(26000); + + companion object { + fun findMenuIdByIndex(index: Int) = values().firstOrNull { it.ordinal == index } + } } \ No newline at end of file diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/BluetoothInformation.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/BluetoothInformation.kt deleted file mode 100644 index a4c6d63..0000000 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/BluetoothInformation.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.udfsoft.androidinfo.lib.entity - -class BluetoothInformation { - -} diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/ConnectivityInformation.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/ConnectivityInformation.kt deleted file mode 100644 index f91a564..0000000 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/entity/ConnectivityInformation.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.udfsoft.androidinfo.lib.entity - -class ConnectivityInformation { - -} diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/network/interceptor/StaticHeadersInterceptor.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/network/interceptor/StaticHeadersInterceptor.kt index 7bf0a7a..89755cb 100644 --- a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/network/interceptor/StaticHeadersInterceptor.kt +++ b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/network/interceptor/StaticHeadersInterceptor.kt @@ -1,6 +1,6 @@ package com.udfsoft.androidinfo.lib.network.interceptor -import android.content.Context +import android.os.Build import com.udfsoft.androidinfo.lib.BuildConfig import com.udfsoft.androidinfo.lib.network.Headers.ACCEPT import com.udfsoft.androidinfo.lib.network.Headers.ACCEPT_LANGUAGE @@ -25,8 +25,8 @@ class StaticHeadersInterceptor : Interceptor { .addHeader(CONTENT_TYPE, APPLICATION_JSON_CONTENT_TYPE) .addHeader(USER_AGENT, userAgent) .addHeader(ACCEPT_LANGUAGE, Locale.getDefault().language) - .addHeader(DEVICE_BRAND_KEY, "xiaomi")//Build.BRAND) - .addHeader(DEVICE_MODEL_KEY, "redmi note 7") //Build.MODEL) + .addHeader(DEVICE_BRAND_KEY, Build.BRAND) + .addHeader(DEVICE_MODEL_KEY, Build.MODEL) return chain.proceed(requestBuilder.build()) } diff --git a/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/util/OtherExtensions.kt b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/util/OtherExtensions.kt new file mode 100644 index 0000000..2324afe --- /dev/null +++ b/AndroidInfoLib/src/main/java/com/udfsoft/androidinfo/lib/util/OtherExtensions.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.lib.util + +import kotlin.reflect.full.memberProperties + +inline fun T.asMap(): Map { + val props = T::class.memberProperties.associateBy { it.name } + return props.keys.associateWith { props[it]?.get(this) } +} \ No newline at end of file diff --git a/README.md b/README.md index ec922e2..461f309 100644 --- a/README.md +++ b/README.md @@ -1 +1,66 @@ -# AndroidInfoLib \ No newline at end of file +# AndroidInfoLib + +This is a library that will help you get all the information from android + +[![](https://jitpack.io/v/LiteSoftware/SectorProgressBar.svg)](https://jitpack.io/#LiteSoftware/SectorProgressBar) + + + +## How to use +1. Add this in your root `build.gradle` at the end of `repositories` in `allprojects` section: +```groovy +allprojects { + repositories { + maven { url 'https://jitpack.io' } + } +} +``` + +2. Then add this dependency to your **module-level** `build.gradle` in `dependencies` section: +```groovy +implementation 'com.github.LiteSoftware:SectorProgressBar:$version' +``` + +3. Call any of the methods below to get information about your android +```kotlin +DeviceInformationFactory.getGeneralInformation() +DeviceInformationFactory.getRAMInformation(context) +DeviceInformationFactory.getOSInformation() +DeviceInformationFactory.getCPUInformation() +DeviceInformationFactory.getSIMCardInformation(context) +DeviceInformationFactory.getDisplayInformation(context) +DeviceInformationFactory.getNetworkTechnologiesInformation(context) +DeviceInformationFactory.getDesignInformation() +DeviceInformationFactory.getStorageInformation() +DeviceInformationFactory.getGPUInformation() +DeviceInformationFactory.getSensorsInformation() +DeviceInformationFactory.getRearCameraInformation() +DeviceInformationFactory.getFrontCameraInformation() +DeviceInformationFactory.getAudioInformation() +DeviceInformationFactory.getWirelessInformation() +DeviceInformationFactory.getUSBInformation() +DeviceInformationFactory.getBrowserInformation() +DeviceInformationFactory.getCodecsInformation() +DeviceInformationFactory.getBatteryInformation() +DeviceInformationFactory.getSARInformation() +``` + +--- + +## License + +``` + Copyright 2022 Javavirys. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +``` diff --git a/sample/build.gradle b/sample/build.gradle index 25c5d39..b4e40cf 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -30,6 +30,10 @@ android { kotlinOptions { jvmTarget = '1.8' } + buildFeatures { + viewBinding true + dataBinding true + } } dependencies { @@ -42,11 +46,13 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-livedata:2.5.1' implementation "androidx.core:core-ktx:1.9.0" - implementation "androidx.activity:activity-ktx:1.6.0" - implementation "androidx.fragment:fragment-ktx:1.5.3" + implementation "androidx.activity:activity-ktx:1.6.1" + implementation "androidx.fragment:fragment-ktx:1.5.4" // Widgets - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation "androidx.constraintlayout:constraintlayout:2.1.4" + implementation "androidx.recyclerview:recyclerview:1.2.1" + implementation "com.google.android.material:material:1.7.0" // Tests testImplementation 'junit:junit:4.13.2' diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/MainActivity.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/MainActivity.kt index c9feb52..979b384 100644 --- a/sample/src/main/java/com/udfsoft/androidinfo/sample/MainActivity.kt +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/MainActivity.kt @@ -18,6 +18,7 @@ package com.udfsoft.androidinfo.sample import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.commitNow import com.udfsoft.androidinfo.sample.ui.main.MainFragment class MainActivity : AppCompatActivity() { @@ -26,9 +27,9 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) if (savedInstanceState == null) { - supportFragmentManager.beginTransaction() - .replace(R.id.container, MainFragment.newInstance()) - .commitNow() + supportFragmentManager.commitNow { + replace(R.id.container, MainFragment.newInstance()) + } } } } \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItem.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItem.kt new file mode 100644 index 0000000..d122f5a --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItem.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.core.entity + +import androidx.annotation.DrawableRes + +data class MenuItem( + val id: Int, + val name: String, + @DrawableRes val logoId: Int +) diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItemEnum.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItemEnum.kt new file mode 100644 index 0000000..c23ba22 --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/core/entity/MenuItemEnum.kt @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.core.entity + +import androidx.annotation.DrawableRes +import com.udfsoft.androidinfo.sample.R + +enum class MenuItemEnum( + val title: String, + @DrawableRes val logoId: Int +) { + + General("General", R.drawable.ic_general), + Design("Design", R.drawable.ic_launcher_foreground), + SIMCard("SIM card", R.drawable.ic_launcher_foreground), + MobileNetworkTechnologies("Mobile network technologies", R.drawable.ic_launcher_foreground), + OperatingSystem("Operating system", R.drawable.ic_launcher_foreground), + CPU("CPU", R.drawable.ic_launcher_foreground), + GPU("GPU", R.drawable.ic_launcher_foreground), + RAM("RAM", R.drawable.ic_launcher_foreground), + Storage("Storage", R.drawable.ic_launcher_foreground), + Display("Display", R.drawable.ic_launcher_foreground), + Sensors("Sensors", R.drawable.ic_launcher_foreground), + RearCamera("Rear camera", R.drawable.ic_launcher_foreground), + FrontCamera("Front camera", R.drawable.ic_launcher_foreground), + Audio("Audio", R.drawable.ic_launcher_foreground), + WirelessTechnology("Wireless technology", R.drawable.ic_launcher_foreground), + USB("USB", R.drawable.ic_launcher_foreground), + Browser("Browser", R.drawable.ic_launcher_foreground); +} diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapAdapter.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapAdapter.kt new file mode 100644 index 0000000..e41d55c --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapAdapter.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.adapter + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.udfsoft.androidinfo.sample.R + +class MapAdapter : RecyclerView.Adapter() { + + private val items = mutableMapOf() + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MapViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.layout_info_item, parent, false) + return MapViewHolder(view) + } + + override fun onBindViewHolder(holder: MapViewHolder, position: Int) { + val name = items.keys.elementAt(position) + holder.onBind(name to items[name]) + } + + override fun getItemCount() = items.size + + @SuppressLint("NotifyDataSetChanged") + fun setItems(map: Map) { + items.clear() + items.putAll(map) + notifyDataSetChanged() + } +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapViewHolder.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapViewHolder.kt new file mode 100644 index 0000000..ffd1bbe --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MapViewHolder.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.adapter + +import android.view.View +import android.widget.TextView +import androidx.core.view.ViewCompat +import androidx.recyclerview.widget.RecyclerView +import com.udfsoft.androidinfo.sample.R + +class MapViewHolder( + view: View +) : RecyclerView.ViewHolder(view) { + + private val nameTextView: TextView = ViewCompat.requireViewById(itemView, R.id.nameTextView) + + private val valueTextView: TextView = ViewCompat.requireViewById(itemView, R.id.valueTextView) + + fun onBind(item: Pair) { + val name = item.first.replaceFirstChar { it.uppercase() } + nameTextView.text = name + valueTextView.text = item.second.toString() + } +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemAdapter.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemAdapter.kt new file mode 100644 index 0000000..ad73f80 --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemAdapter.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.adapter + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.udfsoft.androidinfo.sample.R +import com.udfsoft.androidinfo.sample.core.entity.MenuItem + +class MenuItemAdapter( + private val onItemClick: (MenuItem) -> Unit +) : RecyclerView.Adapter() { + + private val items = mutableListOf() + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MenuItemViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.layout_menu_item, parent, false) + return MenuItemViewHolder(view, onItemClick) + } + + override fun onBindViewHolder(holder: MenuItemViewHolder, position: Int) = + holder.onBind(items[position]) + + override fun getItemCount() = items.size + + @SuppressLint("NotifyDataSetChanged") + fun setItems(users: List) { + items.clear() + items.addAll(users) + notifyDataSetChanged() + } + +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemViewHolder.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemViewHolder.kt new file mode 100644 index 0000000..0741c8d --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/adapter/MenuItemViewHolder.kt @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.adapter + +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import androidx.core.view.ViewCompat +import androidx.recyclerview.widget.RecyclerView +import com.udfsoft.androidinfo.sample.R +import com.udfsoft.androidinfo.sample.core.entity.MenuItem + +class MenuItemViewHolder( + view: View, + private val onItemClick: (MenuItem) -> Unit +) : RecyclerView.ViewHolder(view) { + + private val nameTextView: TextView = ViewCompat.requireViewById(itemView, R.id.nameTextView) + + private val logoImageView: ImageView = + ViewCompat.requireViewById(itemView, R.id.logoImageView) + + fun onBind(item: MenuItem) { + itemView.setOnClickListener { + onItemClick(item) + } + nameTextView.text = item.name + logoImageView.setImageResource(item.logoId) + } +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsFragment.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsFragment.kt new file mode 100644 index 0000000..43928ad --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsFragment.kt @@ -0,0 +1,140 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.details + +import android.Manifest +import android.content.pm.PackageManager +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Toast +import androidx.activity.result.contract.ActivityResultContracts +import androidx.core.app.ActivityCompat +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels +import com.udfsoft.androidinfo.sample.R +import com.udfsoft.androidinfo.sample.databinding.FragmentDetailsBinding +import com.udfsoft.androidinfo.sample.ui.adapter.MapAdapter + +class DetailsFragment : Fragment(R.layout.fragment_details) { + + private val viewModel by viewModels() + + private lateinit var binding: FragmentDetailsBinding + + private val requestPermissionLauncher = + registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { + val grantedPermissions = it.values.filter { isGranted -> isGranted }.size + val isGranted = grantedPermissions == 3 + if (isGranted) { + loadInformation() + } else { + Toast.makeText(requireContext(), "Permissions denied!", Toast.LENGTH_SHORT).show() + } + } + + private fun loadInformation() { + if (ActivityCompat.checkSelfPermission( + requireContext(), + Manifest.permission.READ_SMS + ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission( + requireContext(), + Manifest.permission.READ_PHONE_NUMBERS + ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission( + requireContext(), + Manifest.permission.READ_PHONE_STATE + ) != PackageManager.PERMISSION_GRANTED + ) { + Toast.makeText(requireContext(), "Permissions denied!", Toast.LENGTH_SHORT).show() + launchRequestPermissions() + return + } + val menuId = requireArguments().getInt(MENU_ID_KEY) + viewModel.loadInformation(requireActivity(), menuId) + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ) = FragmentDetailsBinding.inflate(inflater, container, false).also { + binding = it + }.root + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + initLiveData() + requestPermissions() + } + + private fun requestPermissions() { + if (ActivityCompat.shouldShowRequestPermissionRationale( + requireActivity(), Manifest.permission.READ_PHONE_STATE + ) && ActivityCompat.shouldShowRequestPermissionRationale( + requireActivity(), Manifest.permission.READ_SMS + ) && ActivityCompat.shouldShowRequestPermissionRationale( + requireActivity(), "android.permission.READ_PHONE_NUMBERS" + ) + ) { + launchRequestPermissions() + } else { + launchRequestPermissions() + } + } + + private fun launchRequestPermissions() { + requestPermissionLauncher.launch( + arrayOf( + Manifest.permission.READ_PHONE_STATE, + Manifest.permission.READ_SMS, + "android.permission.READ_PHONE_NUMBERS" + ) + ) + } + + private fun initLiveData() { + viewModel.getInformationLiveData().observe(viewLifecycleOwner) { + Log.d(TAG, it.toString()) + binding.infoRecyclerView.adapter = MapAdapter().apply { + setItems(it) + } + } + + viewModel.getProgressLiveData().observe(viewLifecycleOwner) { + binding.progress.isVisible = it + } + } + + companion object { + + private val TAG = DetailsFragment::class.simpleName + + private const val MENU_ID_KEY = "MENU_ID_KEY" + + fun newInstance( + menuId: Int + ) = DetailsFragment().apply { + arguments = bundleOf( + MENU_ID_KEY to menuId + ) + } + } +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsViewModel.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsViewModel.kt new file mode 100644 index 0000000..7ff431f --- /dev/null +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/details/DetailsViewModel.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Javavirys + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.udfsoft.androidinfo.sample.ui.details + +import android.Manifest +import android.content.Context +import androidx.annotation.RequiresPermission +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.udfsoft.androidinfo.lib.DeviceInformationFactory +import com.udfsoft.androidinfo.sample.util.toLiveData +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +class DetailsViewModel : ViewModel() { + + private val progressLiveData = MutableLiveData() + + private val informationLiveData = MutableLiveData>() + + @RequiresPermission( + allOf = [Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_SMS, "android.permission.READ_PHONE_NUMBERS"] + ) + fun loadInformation(context: Context, menuId: Int) = viewModelScope.launch(Dispatchers.IO) { + progressLiveData.postValue(true) + informationLiveData.postValue(DeviceInformationFactory.getInfoById(menuId, context)) + progressLiveData.postValue(false) + } + + fun getInformationLiveData() = informationLiveData.toLiveData() + + fun getProgressLiveData() = progressLiveData.toLiveData() +} \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainFragment.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainFragment.kt index f6a38b4..cce33ff 100644 --- a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainFragment.kt +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainFragment.kt @@ -16,165 +16,55 @@ package com.udfsoft.androidinfo.sample.ui.main -import android.Manifest -import android.content.pm.PackageManager import android.os.Bundle import android.util.Log +import android.view.LayoutInflater import android.view.View -import android.widget.Toast -import androidx.activity.result.contract.ActivityResultContracts -import androidx.core.app.ActivityCompat +import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.fragment.app.commit import androidx.fragment.app.viewModels import com.udfsoft.androidinfo.sample.R +import com.udfsoft.androidinfo.sample.core.entity.MenuItem +import com.udfsoft.androidinfo.sample.databinding.FragmentMainBinding +import com.udfsoft.androidinfo.sample.ui.adapter.MenuItemAdapter +import com.udfsoft.androidinfo.sample.ui.details.DetailsFragment class MainFragment : Fragment(R.layout.fragment_main) { private val viewModel by viewModels() - private val requestPermissionLauncher = - registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { - val grantedPermissions = it.values.filter { isGranted -> isGranted }.size - val isGranted = grantedPermissions == 3 - if (isGranted) { - loadInformation() - } else { - Toast.makeText(requireContext(), "Permissions denied!", Toast.LENGTH_SHORT).show() - } - } - - private fun loadInformation() { - if (ActivityCompat.checkSelfPermission( - requireContext(), - Manifest.permission.READ_SMS - ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission( - requireContext(), - Manifest.permission.READ_PHONE_NUMBERS - ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission( - requireContext(), - Manifest.permission.READ_PHONE_STATE - ) != PackageManager.PERMISSION_GRANTED - ) { - Toast.makeText(requireContext(), "Permissions denied!", Toast.LENGTH_SHORT).show() - launchRequestPermissions() - return - } - viewModel.loadInformation(requireActivity()) - } + private lateinit var binding: FragmentMainBinding + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ) = FragmentMainBinding.inflate(inflater, container, false).also { + binding = it + }.root override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initLiveData() - requestPermissions() - } - - private fun requestPermissions() { - if (ActivityCompat.shouldShowRequestPermissionRationale( - requireActivity(), Manifest.permission.READ_PHONE_STATE - ) && ActivityCompat.shouldShowRequestPermissionRationale( - requireActivity(), Manifest.permission.READ_SMS - ) && ActivityCompat.shouldShowRequestPermissionRationale( - requireActivity(), "android.permission.READ_PHONE_NUMBERS" - ) - ) { - launchRequestPermissions() - } else { - launchRequestPermissions() - } - } - - private fun launchRequestPermissions() { - requestPermissionLauncher.launch( - arrayOf( - Manifest.permission.READ_PHONE_STATE, - Manifest.permission.READ_SMS, - "android.permission.READ_PHONE_NUMBERS" - ) - ) + viewModel.loadMenu() } - private fun initLiveData() { - viewModel.getGeneralInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getRAMInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getOSInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getCPUInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getSIMCardInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getDisplayInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getNetworkTechnologiesInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getDesignInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getStorageInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getGPUInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getSensorsInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getRearCameraInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getFrontCameraInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getAudioInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getWirelessInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getUSBInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getBrowserInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getCodecsInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } - - viewModel.getBatteryInformationLiveData().observe(viewLifecycleOwner) { + viewModel.getMenuLiveData().observe(viewLifecycleOwner) { Log.d(TAG, it.toString()) + binding.menuRecyclerView.adapter = MenuItemAdapter(::onMenuItemClick).apply { + setItems(it) + } } + } - viewModel.getSARInformationLiveData().observe(viewLifecycleOwner) { - Log.d(TAG, it.toString()) - } + private fun onMenuItemClick(item: MenuItem) { + requireActivity().supportFragmentManager + .commit { + replace(R.id.container, DetailsFragment.newInstance(item.id)) + addToBackStack(null) + } } companion object { diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainViewModel.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainViewModel.kt index a8fceac..3e6f370 100644 --- a/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainViewModel.kt +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/ui/main/MainViewModel.kt @@ -16,129 +16,22 @@ package com.udfsoft.androidinfo.sample.ui.main -import android.Manifest -import android.content.Context -import androidx.annotation.RequiresPermission -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.udfsoft.androidinfo.lib.DeviceInformationFactory -import com.udfsoft.androidinfo.lib.entity.* +import com.udfsoft.androidinfo.sample.core.entity.MenuItem +import com.udfsoft.androidinfo.sample.core.entity.MenuItemEnum +import com.udfsoft.androidinfo.sample.util.listLiveData import com.udfsoft.androidinfo.sample.util.toLiveData -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch class MainViewModel : ViewModel() { - private val generalInformationLiveData = MutableLiveData() + private val menuLiveData = listLiveData() - private val ramInformationLiveData = MutableLiveData() - - private val osInformationLiveData = MutableLiveData() - - private val cpuInformationLiveData = MutableLiveData() - - private val simCardInformationLiveData = MutableLiveData() - - private val displayInformationLiveData = MutableLiveData() - - private val networkTechnologiesInformationLiveData = - MutableLiveData() - - private val designInformationLiveData = MutableLiveData() - - private val storageInformationLiveData = MutableLiveData() - - private val gpuInformationLiveData = MutableLiveData() - - private val sensorsInformationLiveData = MutableLiveData() - - private val rearCameraInformationLiveData = MutableLiveData() - - private val frontCameraInformationLiveData = MutableLiveData() - - private val audioInformationLiveData = MutableLiveData() - - private val wirelessInformationLiveData = MutableLiveData() - - private val usbInformationLiveData = MutableLiveData() - - private val browserInformationLiveData = MutableLiveData() - - private val codecsInformationLiveData = MutableLiveData() - - private val batteryInformationLiveData = MutableLiveData() - - private val sarInformationLiveData = MutableLiveData() - - @RequiresPermission( - allOf = [Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_SMS, "android.permission.READ_PHONE_NUMBERS"] - ) - fun loadInformation(context: Context) = viewModelScope.launch(Dispatchers.IO) { - generalInformationLiveData.postValue(DeviceInformationFactory.getGeneralInformation()) - ramInformationLiveData.postValue(DeviceInformationFactory.getRAMInformation(context)) - osInformationLiveData.postValue(DeviceInformationFactory.getOSInformation()) - cpuInformationLiveData.postValue(DeviceInformationFactory.getCPUInformation()) - simCardInformationLiveData.postValue(DeviceInformationFactory.getSIMCardInformation(context)) - displayInformationLiveData.postValue(DeviceInformationFactory.getDisplayInformation(context)) - networkTechnologiesInformationLiveData.postValue( - DeviceInformationFactory.getNetworkTechnologiesInformation( - context - ) - ) - designInformationLiveData.postValue(DeviceInformationFactory.getDesignInformation()) - storageInformationLiveData.postValue(DeviceInformationFactory.getStorageInformation()) - gpuInformationLiveData.postValue(DeviceInformationFactory.getGPUInformation()) - sensorsInformationLiveData.postValue(DeviceInformationFactory.getSensorsInformation()) - rearCameraInformationLiveData.postValue(DeviceInformationFactory.getRearCameraInformation()) - frontCameraInformationLiveData.postValue(DeviceInformationFactory.getFrontCameraInformation()) - audioInformationLiveData.postValue(DeviceInformationFactory.getAudioInformation()) - wirelessInformationLiveData.postValue(DeviceInformationFactory.getWirelessInformation()) - usbInformationLiveData.postValue(DeviceInformationFactory.getUSBInformation()) - browserInformationLiveData.postValue(DeviceInformationFactory.getBrowserInformation()) - codecsInformationLiveData.postValue(DeviceInformationFactory.getCodecsInformation()) - batteryInformationLiveData.postValue(DeviceInformationFactory.getBatteryInformation()) - sarInformationLiveData.postValue(DeviceInformationFactory.getSARInformation()) + fun loadMenu() { + menuLiveData.value = MenuItemEnum.values() + .map { + MenuItem(it.ordinal, it.title, it.logoId) + } } - fun getGeneralInformationLiveData() = generalInformationLiveData.toLiveData() - - fun getRAMInformationLiveData() = ramInformationLiveData.toLiveData() - - fun getOSInformationLiveData() = osInformationLiveData.toLiveData() - - fun getCPUInformationLiveData() = cpuInformationLiveData.toLiveData() - - fun getSIMCardInformationLiveData() = simCardInformationLiveData.toLiveData() - - fun getDisplayInformationLiveData() = displayInformationLiveData.toLiveData() - - fun getNetworkTechnologiesInformationLiveData() = - networkTechnologiesInformationLiveData.toLiveData() - - fun getDesignInformationLiveData() = designInformationLiveData.toLiveData() - - fun getStorageInformationLiveData() = storageInformationLiveData.toLiveData() - - fun getGPUInformationLiveData() = gpuInformationLiveData.toLiveData() - - fun getSensorsInformationLiveData() = sensorsInformationLiveData.toLiveData() - - fun getRearCameraInformationLiveData() = rearCameraInformationLiveData.toLiveData() - - fun getFrontCameraInformationLiveData() = frontCameraInformationLiveData.toLiveData() - - fun getAudioInformationLiveData() = audioInformationLiveData.toLiveData() - - fun getWirelessInformationLiveData() = wirelessInformationLiveData.toLiveData() - - fun getUSBInformationLiveData() = usbInformationLiveData.toLiveData() - - fun getBrowserInformationLiveData() = browserInformationLiveData.toLiveData() - - fun getCodecsInformationLiveData() = codecsInformationLiveData.toLiveData() - - fun getBatteryInformationLiveData() = batteryInformationLiveData.toLiveData() - - fun getSARInformationLiveData() = sarInformationLiveData.toLiveData() + fun getMenuLiveData() = menuLiveData.toLiveData() } \ No newline at end of file diff --git a/sample/src/main/java/com/udfsoft/androidinfo/sample/util/LiveDataExtensions.kt b/sample/src/main/java/com/udfsoft/androidinfo/sample/util/LiveDataExtensions.kt index 063430b..fc89883 100644 --- a/sample/src/main/java/com/udfsoft/androidinfo/sample/util/LiveDataExtensions.kt +++ b/sample/src/main/java/com/udfsoft/androidinfo/sample/util/LiveDataExtensions.kt @@ -19,4 +19,6 @@ package com.udfsoft.androidinfo.sample.util import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -fun MutableLiveData.toLiveData(): LiveData = this \ No newline at end of file +fun MutableLiveData.toLiveData(): LiveData = this + +fun listLiveData() = MutableLiveData>() \ No newline at end of file diff --git a/sample/src/main/res/drawable/ic_general.xml b/sample/src/main/res/drawable/ic_general.xml new file mode 100644 index 0000000..56a324a --- /dev/null +++ b/sample/src/main/res/drawable/ic_general.xml @@ -0,0 +1,40 @@ + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 1dfb73b..e5de22d 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -2,6 +2,7 @@ \ No newline at end of file diff --git a/sample/src/main/res/layout/fragment_details.xml b/sample/src/main/res/layout/fragment_details.xml new file mode 100644 index 0000000..d9433ba --- /dev/null +++ b/sample/src/main/res/layout/fragment_details.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/fragment_main.xml b/sample/src/main/res/layout/fragment_main.xml index 1196542..89e6174 100644 --- a/sample/src/main/res/layout/fragment_main.xml +++ b/sample/src/main/res/layout/fragment_main.xml @@ -1,20 +1,36 @@ - - + - + - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/layout_info_item.xml b/sample/src/main/res/layout/layout_info_item.xml new file mode 100644 index 0000000..b433bd3 --- /dev/null +++ b/sample/src/main/res/layout/layout_info_item.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + diff --git a/sample/src/main/res/layout/layout_menu_item.xml b/sample/src/main/res/layout/layout_menu_item.xml new file mode 100644 index 0000000..e9fadd8 --- /dev/null +++ b/sample/src/main/res/layout/layout_menu_item.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + diff --git a/screens/1_2.png b/screens/1_2.png new file mode 100644 index 0000000..c27f50e Binary files /dev/null and b/screens/1_2.png differ diff --git a/screens/1_3.png b/screens/1_3.png new file mode 100644 index 0000000..c3b53d1 Binary files /dev/null and b/screens/1_3.png differ diff --git a/settings.gradle b/settings.gradle index 393ce07..b4a7e46 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,5 +13,6 @@ dependencyResolutionManagement { } } rootProject.name = "AndroidInfoLib" -include ':sample' include ':AndroidInfoLib' +if (!System.env.JITPACK) + include ':sample'