-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Bai-Jie/mergeMasterToRelease
合并master分支到release分支
- Loading branch information
Showing
8 changed files
with
109 additions
and
240 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
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 was deleted.
Oops, something went wrong.
198 changes: 0 additions & 198 deletions
198
app/src/main/java/com/optimalorange/cooltechnologies/ui/PlayYoukuVideoActivity.java
This file was deleted.
Oops, something went wrong.
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
98 changes: 98 additions & 0 deletions
98
app/src/main/java/com/optimalorange/cooltechnologies/ui/SimpleWebViewActivity.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,98 @@ | ||
package com.optimalorange.cooltechnologies.ui; | ||
|
||
import com.optimalorange.cooltechnologies.R; | ||
import com.umeng.analytics.MobclickAgent; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.ViewGroup; | ||
import android.view.ViewParent; | ||
import android.webkit.WebView; | ||
import android.webkit.WebViewClient; | ||
|
||
public class SimpleWebViewActivity extends Activity { | ||
|
||
/** | ||
* 应当显示的页面的url<br/> | ||
* Type: {@link String} | ||
*/ | ||
public static final String EXTRA_KEY_LINK = | ||
SimpleWebViewActivity.class.getName() + ".extra.KEY_VIDEO_LINK"; | ||
|
||
/** 用于重置{@link WebView}的空网页 */ | ||
private static final String URL_BLANK = "about:blank"; | ||
|
||
private String mLink; | ||
|
||
private WebView mWebView; | ||
|
||
public static Intent buildIntent(Context context, String link) { | ||
final Intent result = new Intent(context, SimpleWebViewActivity.class); | ||
result.putExtra(EXTRA_KEY_LINK, link); | ||
return result; | ||
} | ||
|
||
public static void start(Context context, String link) { | ||
context.startActivity(buildIntent(context, link)); | ||
} | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_simple_web_view); | ||
|
||
mLink = getIntent().getStringExtra(EXTRA_KEY_LINK); | ||
if (mLink == null) { | ||
throw new IllegalStateException("Please set url link with EXTRA_KEY_LINK"); | ||
} | ||
|
||
mWebView = (WebView) findViewById(R.id.web_view); | ||
mWebView.getSettings().setJavaScriptEnabled(true); | ||
mWebView.setWebViewClient(new WebViewClient()); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
mWebView.loadUrl(mLink); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
// call it because this didn't extend BaseActivity | ||
MobclickAgent.onResume(this); | ||
MobclickAgent.onPageStart(getClass().getSimpleName()); | ||
|
||
mWebView.onResume(); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
mWebView.onPause(); | ||
|
||
MobclickAgent.onPageEnd(getClass().getSimpleName()); | ||
MobclickAgent.onPause(this); | ||
super.onPause(); | ||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
mWebView.loadUrl(URL_BLANK); | ||
super.onStop(); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
final ViewParent parent = mWebView.getParent(); | ||
if (parent != null) { | ||
((ViewGroup) parent).removeView(mWebView); | ||
mWebView.destroy(); | ||
} | ||
mWebView = null; | ||
super.onDestroy(); | ||
} | ||
|
||
} |
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