-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# roottools-android-studio | ||
判断Android设备是否已越狱 | ||
判断Android设备是否已Root | ||
|
||
----- | ||
Code base on [softctrl/roottools][1] | ||
|
||
[1]: https://github.com/softctrl/roottools |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 18 | ||
buildToolsVersion "27.0.3" | ||
defaultConfig { | ||
applicationId "com.a52developer.androidinfo" | ||
minSdkVersion 14 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile project(path: ':library') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in E:\Androidsdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.lovecode666.androidinfo"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<activity | ||
android:name="com.lovecode666.androidinfo.SplashActivity" | ||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name="com.lovecode666.androidinfo.MainActivity" | ||
android:theme="@android:style/Theme.NoTitleBar"> | ||
</activity> | ||
|
||
|
||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.lovecode666.androidinfo; | ||
|
||
/** | ||
* Created by coleflowers on 2018/8/8. | ||
* @copyright 爱写代码的小马 | ||
* @link https://coleflowers.github.io | ||
*/ | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.TextView; | ||
|
||
|
||
import com.lovecode666.androidinfo.tools.Root; | ||
import com.stericson.RootTools.RootTools; | ||
|
||
import java.io.File; | ||
|
||
public class MainActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
TextView root_v1 = (TextView)findViewById(R.id.root_v1); | ||
if(isRoot()){ | ||
root_v1.setText("已经ROOT"); | ||
} else { | ||
root_v1.setText("还没有ROOT"); | ||
} | ||
|
||
TextView root_v2 = (TextView)findViewById(R.id.root_v2); | ||
if (new Root().isDeviceRooted()){ | ||
root_v2.setText("已经ROOT"); | ||
} else { | ||
root_v2.setText("还没有ROOT"); | ||
} | ||
|
||
|
||
// https://github.com/softctrl/roottools | ||
TextView root_v3 = (TextView)findViewById(R.id.root_v3); | ||
if (RootTools.isRootAvailable()){ | ||
root_v3.setText("已经ROOT"); | ||
} else { | ||
root_v3.setText("还没有ROOT"); | ||
} | ||
|
||
Button btn = (Button)findViewById(R.id.btn); | ||
btn.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
String urlStr = "https://coleflowers.github.io"; | ||
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(urlStr)); | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
startActivity(intent); | ||
} | ||
}); | ||
} | ||
|
||
|
||
/** | ||
* 判断当前手机是否有ROOT权限 | ||
* @link http://www.cnblogs.com/rayray/p/3229265.html | ||
* @return | ||
*/ | ||
public boolean isRoot(){ | ||
boolean bool = false; | ||
|
||
try{ | ||
if ((!new File("/system/bin/su").exists()) && (!new File("/system/xbin/su").exists())){ | ||
bool = false; | ||
} else { | ||
bool = true; | ||
} | ||
} catch (Exception e) { | ||
|
||
} | ||
return bool; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.lovecode666.androidinfo; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
|
||
import java.util.Timer; | ||
import java.util.TimerTask; | ||
|
||
/** | ||
* Created by coleflowers on 2018/8/11. | ||
*/ | ||
|
||
public class SplashActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_splash); | ||
|
||
TimerTask task = new TimerTask() { | ||
@Override | ||
public void run() { | ||
startMain(); | ||
} | ||
}; | ||
Timer timer = new Timer(); | ||
timer.schedule(task, 1200); | ||
|
||
} | ||
|
||
private void startMain(){ | ||
Intent intent = new Intent(SplashActivity.this, MainActivity.class); | ||
startActivity(intent); | ||
finish(); | ||
//overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | ||
//finish(); | ||
} | ||
|
||
} |