forked from seek4/SilentInstall_AndroidTV
-
Notifications
You must be signed in to change notification settings - Fork 0
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
27 changed files
with
429 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/AppControl/gen/* | ||
/AppControl/bin/* | ||
/AppControl/.settings/* | ||
.classpath | ||
.project |
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,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.changhong.appcontrol" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<uses-sdk | ||
android:minSdkVersion="8" | ||
android:targetSdkVersion="21" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<receiver | ||
android:name=".TransferReceiver"> | ||
<intent-filter > | ||
<action android:name="android.intent.action.BOOT_COMPLETED"/> | ||
<action android:name="com.changhong.appcontrol.transfer"/> | ||
</intent-filter> | ||
</receiver> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,20 @@ | ||
# To enable ProGuard in your project, edit project.properties | ||
# to define the proguard.config property as described in that file. | ||
# | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# 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 *; | ||
#} |
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,15 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-19 | ||
android.library.reference.1=../appcompat_v7 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
tools:context="com.changhong.appcontrol.MainActivity" > | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/hello_world" /> | ||
|
||
<Button | ||
android:id="@+id/button_send" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="发送广播" | ||
android:layout_centerInParent="true" | ||
/> | ||
|
||
</RelativeLayout> |
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,12 @@ | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:context="com.changhong.appcontrol.MainActivity" > | ||
|
||
<item | ||
android:id="@+id/action_settings" | ||
android:orderInCategory="100" | ||
android:title="@string/action_settings" | ||
app:showAsAction="never"/> | ||
|
||
</menu> |
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,11 @@ | ||
<resources> | ||
|
||
<!-- | ||
Base application theme for API 11+. This theme completely replaces | ||
AppBaseTheme from res/values/styles.xml on API 11+ devices. | ||
--> | ||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> | ||
<!-- API 11 theme customizations can go here. --> | ||
</style> | ||
|
||
</resources> |
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,12 @@ | ||
<resources> | ||
|
||
<!-- | ||
Base application theme for API 14+. This theme completely replaces | ||
AppBaseTheme from BOTH res/values/styles.xml and | ||
res/values-v11/styles.xml on API 14+ devices. | ||
--> | ||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | ||
<!-- API 14 theme customizations can go here. --> | ||
</style> | ||
|
||
</resources> |
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,10 @@ | ||
<resources> | ||
|
||
<!-- | ||
Example customization of dimensions originally defined in res/values/dimens.xml | ||
(such as screen margins) for screens with more than 820dp of available width. This | ||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). | ||
--> | ||
<dimen name="activity_horizontal_margin">64dp</dimen> | ||
|
||
</resources> |
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,7 @@ | ||
<resources> | ||
|
||
<!-- Default screen margins, per the Android Design guidelines. --> | ||
<dimen name="activity_horizontal_margin">16dp</dimen> | ||
<dimen name="activity_vertical_margin">16dp</dimen> | ||
|
||
</resources> |
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">AppControl</string> | ||
<string name="hello_world">Hello world!</string> | ||
<string name="action_settings">Settings</string> | ||
|
||
</resources> |
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,20 @@ | ||
<resources> | ||
|
||
<!-- | ||
Base application theme, dependent on API level. This theme is replaced | ||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices. | ||
--> | ||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> | ||
<!-- | ||
Theme customizations available in newer API levels can go in | ||
res/values-vXX/styles.xml, while customizations related to | ||
backward-compatibility can go here. | ||
--> | ||
</style> | ||
|
||
<!-- Application theme. --> | ||
<style name="AppTheme" parent="AppBaseTheme"> | ||
<!-- All customizations that are NOT specific to a particular API-level can go here. --> | ||
</style> | ||
|
||
</resources> |
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,41 @@ | ||
package com.changhong.appcontrol; | ||
|
||
import android.support.v7.app.ActionBarActivity; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.media.AudioManager; | ||
import android.media.MediaPlayer; | ||
import android.media.MediaRouter; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.View.OnClickListener; | ||
import android.widget.Button; | ||
|
||
public class MainActivity extends ActionBarActivity { | ||
|
||
protected Button sendButton; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
sendButton = (Button)this.findViewById(R.id.button_send); | ||
|
||
sendButton.setOnClickListener(new OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
Log.i("yangtong","ButtonClick"); | ||
Intent intent = new Intent(); | ||
intent.setAction("com.changhong.appcontrol.transfer"); | ||
sendBroadcast(intent); | ||
} | ||
}); | ||
} | ||
|
||
|
||
} |
46 changes: 46 additions & 0 deletions
46
AppControl/src/com/changhong/appcontrol/TransferReceiver.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.changhong.appcontrol; | ||
|
||
import com.changhong.appcontrol.transfer.Transfer; | ||
import com.changhong.appcontrol.transfer.TransferCallBack; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.util.Log; | ||
|
||
/** | ||
* AppControl入口,负责从服务器端下载信令信息 | ||
* @author YangTong | ||
* | ||
*/ | ||
public class TransferReceiver extends BroadcastReceiver implements TransferCallBack{ | ||
|
||
|
||
int failureCount=0; | ||
Transfer transfer; | ||
|
||
public static final String JSON_URL = "http://192.168.1.105"; | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
// TODO 主要逻辑都在这里实现 | ||
Log.i("yangtong","TransferReceiver onReceive"); | ||
|
||
failureCount = intent.getIntExtra("failureCount", 0); | ||
|
||
transfer = new Transfer(context, JSON_URL); | ||
transfer.downloadControlInfo(this); | ||
} | ||
|
||
|
||
/** | ||
* 数据下载完成 | ||
*/ | ||
@Override | ||
public void downloadFinish(String appControlInfo) { | ||
// TODO 失败的话继续下一次请求,成功的话则开始进行后续的分离等操作 | ||
Log.i("yangtong","Info >>"+appControlInfo); | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
AppControl/src/com/changhong/appcontrol/analysis/JsonAnalysis.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.changhong.appcontrol.analysis; | ||
|
||
import com.changhong.appcontrol.model.AppControl; | ||
|
||
public class JsonAnalysis { | ||
|
||
public static AppControl analysisJson(String jsonString){ | ||
AppControl appControl= new AppControl(); | ||
|
||
return appControl; | ||
} | ||
|
||
public static boolean isStringCompleted(String jsonString){ | ||
|
||
return true; | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
AppControl/src/com/changhong/appcontrol/model/AppControl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.changhong.appcontrol.model; | ||
|
||
import java.util.List; | ||
|
||
public class AppControl { | ||
|
||
public int networkId; | ||
public int versionMajor; | ||
public int versionMinor; | ||
public int dataLength; | ||
public List<Certification> certifications; | ||
public List<Application> applications; | ||
public AppControl(){ | ||
|
||
} | ||
public AppControl(int networkId,int versionMajor,int versionMinor,int dataLength){ | ||
this.networkId = networkId; | ||
this.versionMajor = versionMajor; | ||
this.versionMinor = versionMinor; | ||
this.dataLength = dataLength; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
AppControl/src/com/changhong/appcontrol/model/Application.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.changhong.appcontrol.model; | ||
|
||
public class Application { | ||
public final String appName; | ||
public final int appID; | ||
public final int orgID; | ||
public final int appType; | ||
public final int appVersion; | ||
public final int appPriority; | ||
public final int installType; | ||
public final String cerID; | ||
public final String appUrl; | ||
|
||
public Application(String appName,int appID,int orgID, | ||
int appType,int appVersion,int appPriority,int installType,String cerID,String appUrl){ | ||
this.appName = appName; | ||
this.appID = appID; | ||
this.orgID = orgID; | ||
this.appType = appType; | ||
this.appVersion = appVersion; | ||
this.appPriority = appPriority; | ||
this.installType = installType; | ||
this.cerID = cerID; | ||
this.appUrl = appUrl; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
AppControl/src/com/changhong/appcontrol/model/Certification.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.changhong.appcontrol.model; | ||
|
||
public class Certification { | ||
public final String cerID; | ||
public final String cerUrl; | ||
public Certification(String cerID,String cerUrl){ | ||
this.cerID = cerID; | ||
this.cerUrl = cerUrl; | ||
} | ||
} |
Oops, something went wrong.