51、微信-发送朋友圈ShareActivity


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<include layout="@layout/layout_title" />


<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/et_usertel"
android:layout_width="match_parent"
android:layout_height="100dp"
android:hint="这一刻的想法..."
android:background="@color/white"
android:paddingLeft="20dp"
android:textColorHint="#DDDDDD"
android:textSize="16sp" />
<LinearLayout
android:gravity="left"
android:orientation="horizontal"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<HorizontalScrollView
android:id="@+id/hsv_banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:overScrollMode="never">
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_margin="5dp" >
<LinearLayout
android:id="@+id/ll_banner"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btnaddimg"
android:background="@drawable/zx"
android:layout_width="60.0dip"
android:layout_height="60.0dip"
android:layout_margin="5.0dip" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_height="1.0dip" />
<TextView
android:id="@+id/txt_location"
style="@style/TxtTitle"
android:textSize="16sp"
android:gravity="center_vertical"
android:background="@drawable/setting_item_selector"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:paddingLeft="16dp"
android:paddingRight="10dp"
android:drawablePadding="10dp"
android:drawableLeft="@drawable/auj"
android:drawableRight="@drawable/right"
android:text="所在位置" />

<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_marginTop="20dp"
android:layout_height="1.0dip" />

<TextView
android:id="@+id/txt_who"
style="@style/TxtTitle"
android:textSize="16sp"
android:gravity="center_vertical"
android:background="@drawable/setting_item_selector"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:paddingLeft="16dp"
android:paddingRight="10dp"
android:drawablePadding="10dp"
android:drawableLeft="@drawable/aul"
android:drawableRight="@drawable/right"
android:text="谁可以看" />
<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_height="1.0dip" />
<TextView
android:id="@+id/txt_tip"
style="@style/TxtTitle"
android:textSize="16sp"
android:gravity="center_vertical"
android:background="@drawable/setting_item_selector"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:paddingLeft="16dp"
android:paddingRight="10dp"
android:drawablePadding="10dp"
android:drawableLeft="@drawable/aub"
android:drawableRight="@drawable/right"
android:text="提醒谁看" />
<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_height="1.0dip" />


<ImageView
android:id="@+id/img_qzone"
android:background="@drawable/aun"
android:layout_width="25dip"
android:layout_height="25dip"
android:layout_marginTop="10dp"
android:layout_marginLeft="16dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
代码没有什么实际功能:
public class ShareActivity extends BaseActivity implements View.OnClickListener {
private TextView txt_title, txt_right;
private ImageView img_back;

@Override
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_share);
super.onCreate(savedInstanceState);
}

@Override
protected void initControl() {
txt_title = (TextView) findViewById(R.id.txt_title);
txt_title.setText("朋友圈分享");
txt_right = (TextView) this.findViewById(R.id.txt_right);
txt_right.setText("发送");
txt_right.setTextColor(0xFF45C01A);
img_back = (ImageView) findViewById(R.id.img_back);
img_back.setVisibility(View.VISIBLE);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// TODO
Utils.finish(this);
return true;
}
return super.onKeyDown(keyCode, event);
}

@Override
protected void initView() {

}

@Override
protected void initData() {
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();

if (Intent.ACTION_SEND.equals(action) && type != null) {
if ("text/plain".equals(type)) {
handleSendText(intent);
} else if (type.startsWith("image/")) {
handleSendImage(intent);
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
if (type.startsWith("image/")) {
handleSendMultipleImages(intent);
}
} else {
// Handle other intents, such as being started from the home screen
}
}

void handleSendText(Intent intent) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
String sharedTitle = intent.getStringExtra(Intent.EXTRA_TITLE);
if (sharedText != null) {
// Update UI to reflect text being shared
Utils.showLongToast(context, sharedText);
}
}

void handleSendImage(Intent intent) {
Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (imageUri != null) {
// Update UI to reflect image being shared
Utils.showLongToast(context, imageUri.toString());
}
}

void handleSendMultipleImages(Intent intent) {
ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (imageUris != null) {
// Update UI to reflect multiple images being shared
}
}

@Override
protected void setListener() {
img_back.setOnClickListener(this);
txt_right.setOnClickListener(this);
}

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.img_back:
Utils.finish(ShareActivity.this);
break;
case R.id.txt_right:
break;
default:
break;
}
}

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

asmcvc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值