Skip to content

Commit

Permalink
repair view
Browse files Browse the repository at this point in the history
  • Loading branch information
redrain39 committed Dec 5, 2018
1 parent 037351a commit e2649a2
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 53 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ dependencies {

implementation "com.jakewharton:butterknife:8.8.1"
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation project(path: ':dialoglib')


}
14 changes: 12 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nasduck.duckandroiddialog">

Expand All @@ -7,5 +8,14 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" />
</manifest>
android:theme="@style/AppTheme">
<activity android:name=".TestActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
41 changes: 0 additions & 41 deletions app/src/main/java/com/nasduck/duckandroiddialog/MainActivity.java

This file was deleted.

43 changes: 43 additions & 0 deletions app/src/main/java/com/nasduck/duckandroiddialog/TestActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.nasduck.duckandroiddialog;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.nasduck.dialoglib.Base.DuckDialog;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class TestActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}

@OnClick(R.id.btn_toast_text)
public void onTextToast() {
DuckDialog.assignTextToast("hello world!!")
.setCancelable(true)
.buildTextToast()
.show(getSupportFragmentManager(), "");
}

@OnClick(R.id.btn_toast_image)
public void onImageToast() {
DuckDialog.assignImageToast()
.setCancelable(true)
.buildImageToast()
.show(getSupportFragmentManager(), "");
}

@OnClick(R.id.btn_toast_text_image)
public void onTextImageToast() {
DuckDialog.assignTextAndImageToast("hello world!!")
.setCancelable(true)
.buildTextImageToast()
.show(getSupportFragmentManager(), "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public static ImageToastConfigBean assignImageToast() {
ImageToastConfigBean configBean = new ImageToastConfigBean();
configBean.setBackground(R.drawable.bg_default)
.setCancelable(false)
.setHasShade(true);
// .setImage(R.mipmap.ic_launcher);
.setHasShade(true)
.setImage(R.drawable.ic_launcher);
return configBean;
}

Expand All @@ -50,7 +50,7 @@ public static TextAndImageToastConfigBean assignTextAndImageToast(String content
configBean.setBackground(R.drawable.bg_default)
.setCancelable(false)
.setHasShade(true)
// .setImage(R.mipmap.ic_launcher)
.setImage(R.drawable.ic_launcher)
.setContentText(contentText)
.setContentTextSize(16)
.setContentTextColor(R.color.colorDefaultContentText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public class ImageToast extends BaseDialogFragment {
private int mImage;

public ImageToast() {
mLayoutBackground = view.findViewById(R.id.background);
mIvImage = view.findViewById(R.id.iv_image);

}

public static ImageToast newImageToast(ImageToastConfigBean configBean){
Expand Down Expand Up @@ -51,6 +50,9 @@ protected int getLayoutId() {

@Override
protected void initEventAndData() {
mLayoutBackground = view.findViewById(R.id.background);
mIvImage = view.findViewById(R.id.iv_image);

mLayoutBackground.setBackgroundResource(mBackground);
setShade(hasShade);
setCancelable(isCancelable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ public class TextImageToast extends BaseDialogFragment {
private int mContentTextSize;

public TextImageToast(){
mLayoutBackground = view.findViewById(R.id.background);
mIvImage = view.findViewById(R.id.iv_image);
mTvContent = view.findViewById(R.id.tv_content);

}

public static TextImageToast newTextToast(TextAndImageToastConfigBean configBean){
Expand Down Expand Up @@ -63,6 +61,10 @@ protected int getLayoutId() {

@Override
protected void initEventAndData() {
mLayoutBackground = view.findViewById(R.id.background);
mIvImage = view.findViewById(R.id.iv_image);
mTvContent = view.findViewById(R.id.tv_content);

mLayoutBackground.setBackgroundResource(mBackground);
setCancelable(isCancelable);
setShade(hasShade);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public class TextToast extends BaseDialogFragment {
private int mContentTextSize;

public TextToast(){
mTvContent = view.findViewById(R.id.tv_content);
mLayoutBackground = view.findViewById(R.id.background);

}

public static TextToast newTextToast(TextToastConfigBean configBean){
Expand Down Expand Up @@ -57,6 +56,9 @@ protected int getLayoutId() {

@Override
protected void initEventAndData() {
mTvContent = view.findViewById(R.id.tv_content);
mLayoutBackground = view.findViewById(R.id.background);

mLayoutBackground.setBackgroundResource(mBackground);
setCancelable(isCancelable);
setShade(hasShade);
Expand Down
Binary file added dialoglib/src/main/res/drawable/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e2649a2

Please sign in to comment.