feat:add SwipeLayout

This commit is contained in:
pengfei.zhou
2019-11-25 17:15:43 +08:00
parent 893aa34378
commit d3b2d4c8bd
9 changed files with 1498 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
package="pub.doric.demo">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
@@ -12,6 +13,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".PullableActivity"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -48,6 +48,7 @@ public class MainActivity extends AppCompatActivity {
try {
String[] demos = getAssets().list("demo");
List<String> ret = new ArrayList<>();
ret.add("Test");
for (String str : demos) {
if (str.endsWith("js")) {
ret.add(str);
@@ -91,6 +92,11 @@ public class MainActivity extends AppCompatActivity {
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (data[position].contains("Test")) {
Intent intent = new Intent(tv.getContext(), PullableActivity.class);
tv.getContext().startActivity(intent);
return;
}
if (data[position].contains("NavigatorDemo")) {
Intent intent = new Intent(tv.getContext(), DoricActivity.class);
intent.putExtra("scheme", "assets://demo/" + data[position]);

View File

@@ -0,0 +1,28 @@
package pub.doric.demo;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.FrameLayout;
import pub.doric.pullable.DoricSwipeLayout;
public class PullableActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pullable);
final DoricSwipeLayout swipeRefreshLayout = findViewById(R.id.swipe_layout);
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setBackgroundColor(Color.YELLOW);
swipeRefreshLayout.addView(frameLayout);
swipeRefreshLayout.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeRefreshLayout.setRefreshing(false);
}
});
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PullableActivity">
<pub.doric.pullable.DoricSwipeLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>