Skip to content

Commit 5cf3920

Browse files
Optimize code
1 parent 76f8063 commit 5cf3920

28 files changed

+63
-83
lines changed

app/src/main/java/com/dylanc/loadingstateview/sample/App.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
import com.dylanc.loadingstateview.LoadingStateView;
2222
import com.dylanc.loadingstateview.ViewType;
23-
import com.dylanc.loadingstateview.sample.viewdelegate.EmptyViewDelegate;
24-
import com.dylanc.loadingstateview.sample.viewdelegate.ErrorViewDelegate;
25-
import com.dylanc.loadingstateview.sample.viewdelegate.LoadingViewDelegate;
23+
import com.dylanc.loadingstateview.sample.delegate.EmptyViewDelegate;
24+
import com.dylanc.loadingstateview.sample.delegate.ErrorViewDelegate;
25+
import com.dylanc.loadingstateview.sample.delegate.LoadingViewDelegate;
2626

2727
import kotlin.Unit;
2828

@@ -33,10 +33,10 @@ public class App extends Application {
3333
@Override
3434
public void onCreate() {
3535
super.onCreate();
36-
LoadingStateView.setViewDelegatePool(adapterPool -> {
37-
adapterPool.register(ViewType.LOADING, new LoadingViewDelegate());
38-
adapterPool.register(ViewType.ERROR, new ErrorViewDelegate());
39-
adapterPool.register(ViewType.EMPTY, new EmptyViewDelegate());
36+
LoadingStateView.setViewDelegatePool(pool -> {
37+
pool.register(ViewType.LOADING, new LoadingViewDelegate());
38+
pool.register(ViewType.ERROR, new ErrorViewDelegate());
39+
pool.register(ViewType.EMPTY, new EmptyViewDelegate());
4040
return Unit.INSTANCE;
4141
});
4242
}

app/src/main/java/com/dylanc/loadingstateview/sample/base/BaseActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import androidx.appcompat.app.AppCompatActivity;
2121

2222
import com.dylanc.loadingstateview.LoadingStateView;
23-
import com.dylanc.loadingstateview.sample.viewdelegate.NavIconType;
24-
import com.dylanc.loadingstateview.sample.viewdelegate.ToolbarViewDelegate;
23+
import com.dylanc.loadingstateview.sample.delegate.NavIconType;
24+
import com.dylanc.loadingstateview.sample.delegate.ToolbarViewDelegate;
2525

2626
/**
2727
* 这是耦合度较低的封装方式,没有任何抽象方法,可以很方便地将基类里的代码拷贝到其它项目的基类里使用。

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/BottomEditorDecorViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import android.annotation.SuppressLint;
2020
import android.view.LayoutInflater;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/CoolLoadingViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import androidx.annotation.NonNull;
2020
import android.view.LayoutInflater;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/CustomHeaderViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import android.app.Activity;
2020
import android.os.Build;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/EmptyViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import androidx.annotation.NonNull;
2020
import android.view.LayoutInflater;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/ErrorViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import androidx.annotation.NonNull;
2020
import android.view.LayoutInflater;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/LoadingViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import androidx.annotation.NonNull;
2020
import android.view.LayoutInflater;

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/NavIconType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
/**
2020
* @author Dylan Cai

app/src/main/java/com/dylanc/loadingstateview/sample/delegate/NothingViewDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.dylanc.loadingstateview.sample.viewdelegate;
17+
package com.dylanc.loadingstateview.sample.delegate;
1818

1919
import androidx.annotation.NonNull;
2020
import android.view.LayoutInflater;

0 commit comments

Comments
 (0)