add share page
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
@Keep
|
||||
public interface IShareControl {
|
||||
/**
|
||||
* 显示对话框
|
||||
*/
|
||||
@Keep
|
||||
void showDialog(Context context);
|
||||
|
||||
/**
|
||||
* 对话框消失
|
||||
*/
|
||||
@Keep
|
||||
void dismissDialog();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
import com.mogo.module.share.dialog.LaucherShareDialog;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 分享弹框接口
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
public class ShareControl implements IShareControl {
|
||||
@Override
|
||||
public void showDialog(Context context) {
|
||||
LaucherShareDialog shareDialog = new LaucherShareDialog(context);
|
||||
shareDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissDialog() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.module.share.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.share.R;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通用分享dialog
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
private TextView txtOk;
|
||||
private ImageView mBackImage;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, R.style.Theme_AppCompat_Dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
initView();
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setContentView(R.layout.launcher_dialog_share);
|
||||
txtOk = findViewById(R.id.btn_share_title);
|
||||
mBackImage = findViewById(R.id.btn_back);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
mBackImage.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_back) {
|
||||
sendShareReceiver();
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送广播
|
||||
*/
|
||||
private void sendShareReceiver() {
|
||||
Logger.d("liyz", "LaucherShareDialog sendShareReceiver ---->");
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.roadcondition.share");
|
||||
intent.putExtra("type", "1");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user