-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
615 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import luyao.box.adapter.MainAdapter | |
import luyao.box.bean.MainBean | ||
import luyao.box.ui.activity.CurrentActivity | ||
import luyao.box.ui.appManager.AppListActivity | ||
import luyao.box.ui.device.DeviceInfoActivity | ||
import java.io.File | ||
|
||
/** | ||
|
@@ -20,6 +21,7 @@ const val ISSUE_URL="https://github.com/lulululbj/Box/issues" | |
const val DEVELOPER_EMAIL="[email protected]" | ||
|
||
val MAIN_LIST = mutableListOf( | ||
MainBean(R.drawable.ic_menu_slideshow,"本机信息", DeviceInfoActivity::class.java), | ||
MainBean(R.drawable.ic_menu_camera, "应用管理", AppListActivity::class.java), | ||
MainBean(R.drawable.ic_menu_gallery, "Activity历史", CurrentActivity::class.java), | ||
MainBean(R.drawable.ic_add_circle,"Coming Soon",MainAdapter::class.java) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
app/src/main/java/luyao/box/ui/device/DeviceInfoActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package luyao.box.ui.device | ||
|
||
import android.Manifest | ||
import android.annotation.SuppressLint | ||
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import androidx.core.app.ActivityCompat | ||
import androidx.core.content.ContextCompat | ||
import kotlinx.android.synthetic.main.activity_device_info.* | ||
import kotlinx.android.synthetic.main.title_layout.* | ||
import luyao.box.R | ||
import luyao.box.common.base.BaseActivity | ||
import luyao.box.common.util.DeviceUtils | ||
|
||
/** | ||
* Created by luyao | ||
* on 2019/1/25 16:17 | ||
*/ | ||
class DeviceInfoActivity : BaseActivity() { | ||
|
||
private val permission = Manifest.permission.READ_PHONE_STATE | ||
|
||
|
||
override fun getLayoutResId() = R.layout.activity_device_info | ||
|
||
override fun initView() { | ||
mToolbar.title = getString(R.string.device_ifo) | ||
} | ||
|
||
override fun initData() { | ||
checkPermissions() | ||
setDeviceInfo() | ||
} | ||
|
||
private fun setDeviceInfo() { | ||
brand.text = DeviceUtils.getBrand() | ||
display.text = DeviceUtils.getDisplay() | ||
product.text = DeviceUtils.getProduct() | ||
device.text = DeviceUtils.getDevice() | ||
board.text = DeviceUtils.getBoard() | ||
model.text = DeviceUtils.getModel() | ||
manufacturer.text = DeviceUtils.getManufacturer() | ||
bootloader.text = DeviceUtils.getBootloader() | ||
hardware.text = DeviceUtils.getHardware() | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
abis.text = DeviceUtils.getSupportedAbis()!!.contentToString() | ||
} | ||
radioVersion.text = Build.getRadioVersion() | ||
api.text = DeviceUtils.getSDK().toString() | ||
version.text = DeviceUtils.getVersion() | ||
os.text = DeviceUtils.getKernelVersion() | ||
macAddress.text = DeviceUtils.getMacAddress() | ||
} | ||
|
||
private fun checkPermissions() { | ||
if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) { | ||
ActivityCompat.requestPermissions(this, arrayOf(permission), 1001) | ||
} else { | ||
imei.text = DeviceUtils.getIMEI(this) | ||
meid.text = DeviceUtils.getMEID(this) | ||
sn.text = DeviceUtils.getSN() | ||
} | ||
} | ||
|
||
@SuppressLint("MissingPermission") | ||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) { | ||
super.onRequestPermissionsResult(requestCode, permissions, grantResults) | ||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED){ | ||
imei.text = DeviceUtils.getIMEI(this) | ||
meid.text = DeviceUtils.getMEID(this) | ||
sn.text = DeviceUtils.getSN() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<include layout="@layout/title_layout"/> | ||
|
||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
android:padding="10dp"> | ||
|
||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/brand"/> | ||
|
||
<TextView | ||
android:id="@+id/brand" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/display"/> | ||
|
||
<TextView | ||
android:id="@+id/display" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/product"/> | ||
|
||
<TextView | ||
android:id="@+id/product" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/device"/> | ||
|
||
<TextView | ||
android:id="@+id/device" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/board"/> | ||
|
||
<TextView | ||
android:id="@+id/board" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/model"/> | ||
|
||
<TextView | ||
android:id="@+id/model" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/manufacturer"/> | ||
|
||
<TextView | ||
android:id="@+id/manufacturer" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/bootloader"/> | ||
|
||
<TextView | ||
android:id="@+id/bootloader" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/hardware"/> | ||
|
||
<TextView | ||
android:id="@+id/hardware" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/sdk"/> | ||
|
||
<TextView | ||
android:id="@+id/api" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/android_version"/> | ||
|
||
<TextView | ||
android:id="@+id/version" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/kernel_version"/> | ||
|
||
<TextView | ||
android:id="@+id/os" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/imei"/> | ||
|
||
<TextView | ||
android:id="@+id/imei" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/meid"/> | ||
|
||
<TextView | ||
android:id="@+id/meid" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/sn"/> | ||
|
||
<TextView | ||
android:id="@+id/sn" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/mac_address"/> | ||
|
||
<TextView | ||
android:id="@+id/macAddress" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/abis"/> | ||
|
||
<TextView | ||
android:id="@+id/abis" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout style="@style/Device_Lin"> | ||
|
||
<TextView | ||
style="@style/Device_Text" | ||
android:layout_width="100dp" | ||
android:text="@string/radio_version"/> | ||
|
||
<TextView | ||
android:id="@+id/radioVersion" | ||
style="@style/Device_Text"/> | ||
|
||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
</ScrollView> | ||
</LinearLayout> |
Oops, something went wrong.