-
Notifications
You must be signed in to change notification settings - Fork 219
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
kidloserme
committed
Jun 18, 2016
1 parent
ff19184
commit a92e884
Showing
101 changed files
with
5,243 additions
and
0 deletions.
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,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
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 @@ | ||
/build |
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 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "org.easydarwin.easyplayer" | ||
minSdkVersion 16 | ||
targetSdkVersion 21 | ||
versionCode 4 | ||
versionName "1.0.16.0618" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dirs 'libs' | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile(name: 'rtspclient-release', ext: 'aar') | ||
compile project(':okhttplibrary') | ||
compile 'com.android.support:recyclerview-v7:23.2.0' | ||
compile 'com.google.code.gson:gson:2.3.1' | ||
compile 'com.android.support:appcompat-v7:23.2.0' | ||
compile 'com.android.support:support-v4:23.2.0' | ||
compile 'com.android.support:design:23.2.0' | ||
compile 'org.greenrobot:eventbus:3.0.0' | ||
compile 'com.umeng.analytics:analytics:latest.integration' | ||
} |
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,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in D:\AndroidStudio\StudioSDK/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 *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
Android/app/src/androidTest/java/org/easydarwin/easypusherlive/ApplicationTest.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,13 @@ | ||
package org.easydarwin.easyplayer; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
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,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.easydarwin.easyplayer"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:name="org.easydarwin.easyplayer.MyApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name="org.easydarwin.easyplayer.activity.MainActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name="org.easydarwin.easyplayer.activity.SplashActivity" | ||
android:screenOrientation="portrait"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="org.easydarwin.easyplayer.activity.SettingActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name="org.easydarwin.easyplayer.activity.EasyPlayerActivity" | ||
android:configChanges="orientation|screenSize|keyboardHidden" | ||
/> | ||
<activity android:name="org.easydarwin.easyplayer.activity.AddLocalSessionActivity" | ||
android:screenOrientation="portrait"/> | ||
</application> | ||
|
||
</manifest> |
69 changes: 69 additions & 0 deletions
69
Android/app/src/main/java/org/easydarwin/easyplayer/MyApplication.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,69 @@ | ||
/* | ||
* Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved. | ||
* Github: https://github.com/EasyDarwin | ||
* WEChat: EasyDarwin | ||
* Website: http://www.easydarwin.org | ||
*/ | ||
package org.easydarwin.easyplayer; | ||
|
||
import android.app.Application; | ||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.content.res.Resources; | ||
import android.text.TextUtils; | ||
|
||
|
||
import org.easydarwin.easyplayer.config.DarwinConfig; | ||
import org.easydarwin.okhttplibrary.OkHttpUtils; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* Created by zhy on 15/8/25. | ||
*/ | ||
public class MyApplication extends Application | ||
{ | ||
|
||
private static MyApplication instance; | ||
@Override | ||
public void onCreate() | ||
{ | ||
super.onCreate(); | ||
OkHttpUtils.getInstance().setConnectTimeout(100000, TimeUnit.MILLISECONDS); | ||
instance=this; | ||
initServerInfo(); | ||
} | ||
|
||
private void initServerInfo(){ | ||
SharedPreferences sharedPreferences = getSharedPreferences(DarwinConfig.SETTING_PREF_NAME, MODE_PRIVATE); | ||
SharedPreferences.Editor editor = sharedPreferences.edit(); | ||
|
||
String serverIp = sharedPreferences.getString(DarwinConfig.SERVER_IP, ""); | ||
if (TextUtils.isEmpty(serverIp)) { | ||
editor.putString(DarwinConfig.SERVER_IP, DarwinConfig.DEFAULT_SERVER_IP); | ||
editor.commit(); | ||
} | ||
|
||
String port = sharedPreferences.getString(DarwinConfig.SERVER_PORT, ""); | ||
if (TextUtils.isEmpty(port)) { | ||
editor.putString(DarwinConfig.SERVER_PORT, DarwinConfig.DEFAULT_SERVER_PORT); | ||
editor.commit(); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
/** | ||
* @return the main context of the Application | ||
*/ | ||
public static Context getAppContext() | ||
{ | ||
return instance; | ||
} | ||
|
||
public static Resources getAppResources() | ||
{ | ||
return instance.getResources(); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
Android/app/src/main/java/org/easydarwin/easyplayer/activity/AddLocalSessionActivity.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,93 @@ | ||
package org.easydarwin.easyplayer.activity; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.ActionBar; | ||
import android.text.TextUtils; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
|
||
import org.easydarwin.easyplayer.R; | ||
import org.easydarwin.easyplayer.config.DarwinConfig; | ||
import org.easydarwin.easyplayer.domain.LocalAddSessionVO; | ||
import org.easydarwin.easyplayer.event.LocalSessionEvent; | ||
import org.greenrobot.eventbus.EventBus; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
public class AddLocalSessionActivity extends BaseActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
ActionBar actionBar=getSupportActionBar(); | ||
if(actionBar!=null){ | ||
actionBar.setDisplayShowTitleEnabled(true); | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
actionBar.setTitle(R.string.title_activity_add_session); | ||
actionBar.show(); | ||
} | ||
|
||
setContentView(R.layout.activity_add_local_session); | ||
final List<LocalAddSessionVO> localAddSessions = getMyLocalSession(); | ||
|
||
final EditText txtName= (EditText) findViewById(R.id.edt_name); | ||
txtName.setText(String.valueOf(System.currentTimeMillis())); | ||
final EditText txtUrl= (EditText) findViewById(R.id.edt_url); | ||
final LocalAddSessionVO intentSession= (LocalAddSessionVO) getIntent().getSerializableExtra(DarwinConfig.SESSION_DATA); | ||
if(intentSession!=null){ | ||
txtName.setText(intentSession.getName()); | ||
txtUrl.setText(intentSession.getAddress()); | ||
} | ||
findViewById(R.id.btn_save).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
String name=txtName.getText().toString(); | ||
String url=txtUrl.getText().toString(); | ||
if(TextUtils.isEmpty(url)){ | ||
Toast.makeText(AddLocalSessionActivity.this,"请输入直播地址",Toast.LENGTH_LONG).show(); | ||
return; | ||
} | ||
if(!url.startsWith("rtsp://") || !url.endsWith(".sdp") || url.equals("rtsp://.sdp")){ | ||
Toast.makeText(AddLocalSessionActivity.this,"请输入正确的直播地址",Toast.LENGTH_LONG).show(); | ||
return; | ||
} | ||
|
||
if(intentSession!=null){ | ||
intentSession.setName(name); | ||
intentSession.setAddress(url); | ||
for (int i=0;i<localAddSessions.size();i++){ | ||
if(intentSession.getId().equals(localAddSessions.get(i).getId())){ | ||
localAddSessions.set(i,intentSession); | ||
break; | ||
} | ||
} | ||
}else { | ||
LocalAddSessionVO localAddSessionVO=new LocalAddSessionVO(); | ||
String id= UUID.randomUUID().toString(); | ||
localAddSessionVO.setAddress(url); | ||
localAddSessionVO.setName(name); | ||
localAddSessionVO.setId(id); | ||
localAddSessions.add(localAddSessionVO); | ||
} | ||
saveMyLocalSessions(LocalAddSessionVO.toJson(localAddSessions)); | ||
LocalSessionEvent localSessionEvent = new LocalSessionEvent(); | ||
localSessionEvent.setLocalAddSessionVOs(localAddSessions); | ||
EventBus.getDefault().post(localSessionEvent); | ||
finish(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()){ | ||
case android.R.id.home: | ||
finish(); | ||
break; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
Android/app/src/main/java/org/easydarwin/easyplayer/activity/BaseActivity.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,70 @@ | ||
/* | ||
Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved. | ||
Github: https://github.com/EasyDarwin | ||
WEChat: EasyDarwin | ||
Website: http://www.easydarwin.org | ||
*/ | ||
|
||
package org.easydarwin.easyplayer.activity; | ||
|
||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.Toast; | ||
|
||
import org.easydarwin.easyplayer.config.DarwinConfig; | ||
import org.easydarwin.easyplayer.domain.LocalAddSessionVO; | ||
import org.easydarwin.easyplayer.indicator.WaitProgressDialog; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 类BaseActivity的实现描述://TODO 类实现描述 | ||
* | ||
* @author HELONG 2016/3/16 18:06 | ||
*/ | ||
public class BaseActivity extends AppCompatActivity { | ||
|
||
static SharedPreferences mSettingSharedPreference; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
if(mSettingSharedPreference==null){ | ||
mSettingSharedPreference=getSharedPreferences(DarwinConfig.SETTING_PREF_NAME,MODE_PRIVATE); | ||
} | ||
} | ||
|
||
protected void showToadMessage(String message){ | ||
Toast.makeText(this,message,Toast.LENGTH_LONG).show(); | ||
} | ||
|
||
private WaitProgressDialog waitProgressDialog; | ||
|
||
// 显示等待框 | ||
public void showWaitProgress(String message) { | ||
if (waitProgressDialog == null) { | ||
waitProgressDialog = new WaitProgressDialog(this); | ||
} | ||
waitProgressDialog.showProgress(message); | ||
} | ||
|
||
// 隐藏等待框 | ||
public void hideWaitProgress() { | ||
if (waitProgressDialog != null) { | ||
waitProgressDialog.hideProgress(); | ||
} | ||
} | ||
|
||
protected List<LocalAddSessionVO> getMyLocalSession(){ | ||
String localString=mSettingSharedPreference.getString(DarwinConfig.LOCAL_SESSION,DarwinConfig.LOCAL_SESSION_DEFAUT); | ||
return LocalAddSessionVO.parse(localString); | ||
} | ||
|
||
protected void saveMyLocalSessions(String json){ | ||
SharedPreferences.Editor editor = mSettingSharedPreference.edit(); | ||
editor.putString(DarwinConfig.LOCAL_SESSION,json); | ||
editor.commit(); | ||
} | ||
|
||
} |
Oops, something went wrong.