Skip to content

Commit a8dfd52

Browse files
committed
feat(main): first commit
1 parent 4072ac2 commit a8dfd52

36 files changed

+1424
-7
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@ captures/
3838

3939
# Keystore files
4040
*.jks
41+
42+
.idea
43+
test.tmp
44+
reports
45+
.DS_Store
46+
47+
example

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: android
2+
jdk: oraclejdk8
3+
4+
cache:
5+
directories:
6+
- .autoconf
7+
- $HOME/.m2
8+
9+
android:
10+
components:
11+
- tools
12+
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
13+
- platform-tools
14+
- build-tools-24.0.3
15+
- android-24
16+
- extra-android-m2repository
17+
18+
script: ./gradlew clean check test install

LICENSE

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2016 TinkerPatch
3+
Copyright (c) 2016 Shengjie Sim Sun
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# tinker_debug_tool
1+
# TinkerPatch Debug Tool
2+
3+
[![Build Status](https://travis-ci.org/TinkerPatch/tinkerpatch-debug-tool.svg?branch=master)](https://travis-ci.org/TinkerPatch/tinkerpatch-debug-tool)

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion COMPILE_SDK_VERSION as int
5+
buildToolsVersion BUILD_TOOLS_VERSION as String
6+
7+
defaultConfig {
8+
applicationId "com.tinker.debug.DebugToolApplication"
9+
10+
minSdkVersion 14
11+
targetSdkVersion TARGET_SDK_VERSION as int
12+
13+
versionCode 1
14+
versionName VERSION_NAME as String
15+
}
16+
signingConfigs {
17+
debug {
18+
storeFile rootProject.file("keystore/debug.keystore")
19+
}
20+
}
21+
buildTypes {
22+
release {
23+
minifyEnabled true
24+
signingConfig signingConfigs.debug
25+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
26+
}
27+
debug {
28+
minifyEnabled false
29+
signingConfig signingConfigs.debug
30+
}
31+
}
32+
}
33+
34+
dependencies {
35+
compile fileTree(dir: 'libs', include: ['*.jar'])
36+
compile "com.android.support:appcompat-v7:${SUPPORT_LIB_VERSION}"
37+
testCompile 'junit:junit:4.12'
38+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/shwenzhang/Library/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<manifest package="com.tinker.debug"
2+
xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:supportsRtl="true"
9+
android:theme="@style/AppTheme">
10+
<activity
11+
android:name=".SettingsActivity"
12+
android:label="@string/app_name">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN"/>
15+
16+
<category android:name="android.intent.category.LAUNCHER"/>
17+
</intent-filter>
18+
</activity>
19+
20+
<provider
21+
android:name=".DebugProvider"
22+
android:authorities="com.tinker.debug.debugprovider"
23+
android:writePermission="com.tinker.debug.debugprovider.WRITE"
24+
android:exported="true"
25+
/>
26+
</application>
27+
28+
</manifest>
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 Shengjie Sim Sun
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
package com.tinker.debug;
26+
27+
import android.content.res.Configuration;
28+
import android.os.Bundle;
29+
import android.preference.PreferenceActivity;
30+
import android.support.annotation.LayoutRes;
31+
import android.support.annotation.Nullable;
32+
import android.support.v7.app.ActionBar;
33+
import android.support.v7.app.AppCompatDelegate;
34+
import android.support.v7.widget.Toolbar;
35+
import android.view.MenuInflater;
36+
import android.view.View;
37+
import android.view.ViewGroup;
38+
39+
/**
40+
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
41+
* to be used with AppCompat.
42+
*/
43+
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
44+
45+
private AppCompatDelegate mDelegate;
46+
47+
@Override
48+
protected void onCreate(Bundle savedInstanceState) {
49+
getDelegate().installViewFactory();
50+
getDelegate().onCreate(savedInstanceState);
51+
super.onCreate(savedInstanceState);
52+
}
53+
54+
@Override
55+
protected void onPostCreate(Bundle savedInstanceState) {
56+
super.onPostCreate(savedInstanceState);
57+
getDelegate().onPostCreate(savedInstanceState);
58+
}
59+
60+
public ActionBar getSupportActionBar() {
61+
return getDelegate().getSupportActionBar();
62+
}
63+
64+
public void setSupportActionBar(@Nullable Toolbar toolbar) {
65+
getDelegate().setSupportActionBar(toolbar);
66+
}
67+
68+
@Override
69+
public MenuInflater getMenuInflater() {
70+
return getDelegate().getMenuInflater();
71+
}
72+
73+
@Override
74+
public void setContentView(@LayoutRes int layoutResID) {
75+
getDelegate().setContentView(layoutResID);
76+
}
77+
78+
@Override
79+
public void setContentView(View view) {
80+
getDelegate().setContentView(view);
81+
}
82+
83+
@Override
84+
public void setContentView(View view, ViewGroup.LayoutParams params) {
85+
getDelegate().setContentView(view, params);
86+
}
87+
88+
@Override
89+
public void addContentView(View view, ViewGroup.LayoutParams params) {
90+
getDelegate().addContentView(view, params);
91+
}
92+
93+
@Override
94+
protected void onPostResume() {
95+
super.onPostResume();
96+
getDelegate().onPostResume();
97+
}
98+
99+
@Override
100+
protected void onTitleChanged(CharSequence title, int color) {
101+
super.onTitleChanged(title, color);
102+
getDelegate().setTitle(title);
103+
}
104+
105+
@Override
106+
public void onConfigurationChanged(Configuration newConfig) {
107+
super.onConfigurationChanged(newConfig);
108+
getDelegate().onConfigurationChanged(newConfig);
109+
}
110+
111+
@Override
112+
protected void onStop() {
113+
super.onStop();
114+
getDelegate().onStop();
115+
}
116+
117+
@Override
118+
protected void onDestroy() {
119+
super.onDestroy();
120+
getDelegate().onDestroy();
121+
}
122+
123+
public void invalidateOptionsMenu() {
124+
getDelegate().invalidateOptionsMenu();
125+
}
126+
127+
private AppCompatDelegate getDelegate() {
128+
if (mDelegate == null) {
129+
mDelegate = AppCompatDelegate.create(this, null);
130+
}
131+
return mDelegate;
132+
}
133+
}

0 commit comments

Comments
 (0)