feat:add SwipeLayout
This commit is contained in:
@@ -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" />
|
||||
|
@@ -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]);
|
||||
|
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
13
Android/app/src/main/res/layout/activity_pullable.xml
Normal file
13
Android/app/src/main/res/layout/activity_pullable.xml
Normal 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>
|
Reference in New Issue
Block a user