分享光环(普通分享和热点网页分享)
This commit is contained in:
80
app/src/main/java/com/gh/gamecenter/ShareGhActivity.java
Normal file
80
app/src/main/java/com/gh/gamecenter/ShareGhActivity.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.QRCodeUtils;
|
||||
import com.gh.common.util.ShareUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/2/6.
|
||||
*/
|
||||
public class ShareGhActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.gh_address_qrcode) ImageView mGhQrcode;
|
||||
@BindView(R.id.gh_address_tv) TextView mGhAddress;
|
||||
@BindView(R.id.wifi_share_btn) Button mWifiShareBtn;
|
||||
@BindView(R.id.content_ll) LinearLayout mContentLl;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
View contentView = View.inflate(this, R.layout.activity_share_gh, null);
|
||||
init(contentView, "分享光环");
|
||||
ButterKnife.bind(this);
|
||||
|
||||
mGhAddress.setText(Html.fromHtml("<u>"+"www.ghzhushou.com"+"</u>"));
|
||||
createQrCode();
|
||||
ShareUtils.getInstance(this).showShareWindows(mContentLl, "http://www.ghzhushou.com?source=appshare300", "光环助手"
|
||||
, "http://image.ghzhushou.com/pic/57d604808ab49e467d8b4568.png", null, false, false);
|
||||
}
|
||||
|
||||
@OnClick(R.id.wifi_share_btn)
|
||||
public void skipWifiShare() {
|
||||
Intent intent = new Intent(this, ShareGhWfifActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@OnClick(R.id.gh_address_tv)
|
||||
public void copyAddress() {
|
||||
ClipboardManager cmb = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cmb.setText("http://www.ghzhushou.com?source=appshare100");
|
||||
|
||||
Utils.toast(this, "网址复制成功");
|
||||
}
|
||||
|
||||
|
||||
private void createQrCode() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String filePath = getExternalCacheDir().getPath() + "/ShareImg/ShareQRCode.jpg";
|
||||
boolean success = QRCodeUtils.createQRImage("www.ghzhushou.com"
|
||||
, 200, 200, filePath, ShareGhActivity.this);
|
||||
if (success) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mGhQrcode.setImageBitmap(BitmapFactory.decodeFile(filePath));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user