add share page
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.example.mogo_module_share
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.mogo_module_share.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
2
modules/mogo-module-share/src/main/AndroidManifest.xml
Normal file
2
modules/mogo-module-share/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.share" />
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/color_545362"
|
||||
android:layout_width="1980dp"
|
||||
android:layout_height="1080dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_share_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_60"
|
||||
android:layout_marginBottom="@dimen/dp_35"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="我要分享"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_30" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_below="@+id/btn_share_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_65"
|
||||
android:src="@drawable/main_video_play_btn_normal" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
18
modules/mogo-module-share/src/main/res/values/colors.xml
Normal file
18
modules/mogo-module-share/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#000000</color>
|
||||
<color name="colorPrimaryDark">#000000</color>
|
||||
<color name="colorAccent">#1F7FFF</color>
|
||||
|
||||
<color name="red_tips">#FF1B1B</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="white_50">#80FFFFFF</color>
|
||||
<color name="color_F8F8F8">#F8F8F8</color>
|
||||
<color name="color_3">#333333</color>
|
||||
<color name="color_DADAE2">#DADAE2</color>
|
||||
<color name="color_545362">#545362</color>
|
||||
<color name="color_191C25">#99191C25</color>
|
||||
<color name="color_666666">#666666</color>
|
||||
<color name="color_999999">#999999</color>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">share</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.mogo_module_share
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user