Created
November 22, 2017 09:38
-
-
Save xxnjdlys/40527dc1e446c4d3cc0dd133478f373c to your computer and use it in GitHub Desktop.
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
package com.example.sadieyu.myapplication; | |
import android.app.Activity; | |
import android.content.ComponentName; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
/** | |
* Created by ArthurYu. | |
* Date : 17/07/2017. | |
* Time : 23:20. | |
*/ | |
public class MainActivity extends Activity implements View.OnClickListener { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Button btnOpenVideoDetail = (Button) findViewById(R.id.btn_open_video_detail); | |
btnOpenVideoDetail.setOnClickListener(this); | |
Button btnOpenSubjectDetail = (Button) findViewById(R.id.btn_open_subject_detail); | |
btnOpenSubjectDetail.setOnClickListener(this); | |
} | |
/** | |
* 打开视频详情页. | |
* com.tvjianshen.tvfit/com.dailyupfitness.up.page.detail.DetailsActivity | |
* | |
* lesson_id : 课程 id , String 类型 | |
* open_from : 来源, 标识由谁发起了本次调用. | |
*/ | |
private void openVideoDetailPage() { | |
String pkg = "com.tvjianshen.tvfit"; | |
String path = "com.dailyupfitness.up.page.detail.DetailsActivity"; | |
Intent intent = new Intent(); | |
intent.putExtra("lesson_id", "27"); | |
intent.putExtra("open_from", "skyworth"); | |
intent.setComponent(new ComponentName(pkg, path)); | |
try { | |
startActivity(intent); | |
} catch (Exception ignore) { | |
Log.d("SADIEYU", "ActivityNotFoundException"); | |
} | |
} | |
/** | |
* 打开住专题详情页 | |
* com.tvjianshen.tvfit/com.dailyupfitness.up.page.subject.SubjectDetailActivity | |
* | |
* lesson_id : 课程 id , int 类型 | |
* open_from : 来源, 标识由谁发起了本次调用. | |
*/ | |
private void openSubjectDetialPage() { | |
String pkg = "com.tvjianshen.tvfit"; | |
String path = "com.dailyupfitness.up.page.subject.SubjectDetailActivity"; | |
Intent intent = new Intent(); | |
intent.putExtra("lesson_id", 19); | |
intent.putExtra("open_from", "skyworth"); | |
intent.setComponent(new ComponentName(pkg, path)); | |
try { | |
startActivity(intent); | |
} catch (Exception ignore) { | |
Log.d("SADIEYU", "ActivityNotFoundException"); | |
} | |
} | |
@Override | |
public void onClick(View v) { | |
switch (v.getId()) { | |
case R.id.btn_open_subject_detail: | |
openSubjectDetialPage(); | |
break; | |
case R.id.btn_open_video_detail: | |
openVideoDetailPage(); | |
break; | |
// case R.id.btn_click: | |
// openLT(); | |
// break; | |
default: | |
break; | |
} | |
} | |
// private void openLT() { | |
// String pkg = "com.dailyupfitness.up"; | |
// String path = "com.dailyupfitness.up.page.unicom.SubjectDetailActivity"; | |
// String type = "1"; | |
// | |
// String data = "{\n" + | |
// " \"linkType\": \"10\",\n" + | |
// " \"type\": \"60\",\n" + | |
// " \"linkUrl\": \"跳转H5页面地址url\",\n" + | |
// " \"linkName\": \"跳转H5页面名字\"\n" + | |
// "}"; | |
// Intent intent = new Intent(Intent.ACTION_MAIN); | |
// ComponentName cn = new ComponentName(pkg, path); | |
// intent.putExtra("data", data); | |
// // 备用字段:暂时为空 | |
// intent.putExtra("action", ""); | |
// intent.setComponent(cn); | |
// try { | |
// startActivity(intent); | |
// } catch (Exception ignore) { | |
// Log.v("SADIEYU", "ActivityNotFoundException"); | |
// } | |
// | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment