-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
160 changed files
with
2,402 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include ':app', ':scorpio' | ||
include ':support', ':supportSample', ':x', ':xSample' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 29 | ||
|
||
|
||
defaultConfig { | ||
minSdkVersion 15 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
resourcePrefix "scorpio_" | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
|
||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test:runner:1.2.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
|
||
implementation rootProject.ext.dependencies.appCompat | ||
} | ||
|
||
apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle' |
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
support/src/androidTest/java/com/lnysky/scorpio/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.lnysky.scorpio; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.InstrumentationRegistry; | ||
import androidx.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.lnysky.scorpio.test", appContext.getPackageName()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
scorpio/src/main/AndroidManifest.xml → support/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.lnysky.tech.scorpio" /> | ||
package="com.lnysky.scorpio" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.lnysky.scorpio; | ||
|
||
import android.app.Activity; | ||
import android.support.annotation.NonNull; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
|
||
public final class ActivityBar extends Wrapper { | ||
|
||
@NonNull | ||
private final Activity activity; | ||
|
||
ActivityBar(@NonNull Activity activity) { | ||
this.activity = activity; | ||
} | ||
|
||
@NonNull | ||
protected Bar getRealBar() { | ||
View view = ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); | ||
return Utils.viewWrapper(view); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ain/java/com/lnysky/tech/scorpio/Bar.java → ...src/main/java/com/lnysky/scorpio/Bar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.lnysky.tech.scorpio; | ||
package com.lnysky.scorpio; | ||
|
||
public interface Bar { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.lnysky.scorpio; | ||
|
||
import android.support.annotation.NonNull; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
|
||
import java.lang.reflect.InvocationTargetException; | ||
|
||
/** | ||
* Created by lny on 2018/11/28. | ||
*/ | ||
public final class Content extends StateLayout.State<StateLayout.ViewHolder> { | ||
|
||
private View view; | ||
|
||
public Content(View view) { | ||
this.view = view; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public StateLayout.ViewHolder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent) { | ||
return new StateLayout.ViewHolder(view); | ||
} | ||
|
||
static class Factory implements StateLayout.Factory { | ||
|
||
private View view; | ||
|
||
Factory(View view) { | ||
this.view = view; | ||
} | ||
|
||
@SuppressWarnings("ClassNewInstance") | ||
@NonNull | ||
@Override | ||
public <T extends StateLayout.State> T create(@NonNull Class<T> modelClass) { | ||
//noinspection TryWithIdenticalCatches | ||
try { | ||
return modelClass.getConstructor(View.class).newInstance(view); | ||
} catch (InstantiationException e) { | ||
throw new RuntimeException("Cannot create an instance of " + modelClass, e); | ||
} catch (IllegalAccessException e) { | ||
throw new RuntimeException("Cannot create an instance of " + modelClass, e); | ||
} catch (NoSuchMethodException e) { | ||
throw new RuntimeException("Cannot create an instance of " + modelClass, e); | ||
} catch (InvocationTargetException e) { | ||
throw new RuntimeException("Cannot create an instance of " + modelClass, e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.lnysky.scorpio; | ||
|
||
import android.support.annotation.DrawableRes; | ||
import android.support.annotation.NonNull; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
|
||
/** | ||
* Created by lny on 2018/11/28. | ||
*/ | ||
public class Empty extends StateLayout.State<Empty.ViewHolder> { | ||
|
||
@DrawableRes | ||
private int img; | ||
private String tips; | ||
|
||
@NonNull | ||
@Override | ||
public ViewHolder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent) { | ||
View view = inflater.inflate(R.layout.scorpio_state_empty, parent, false); | ||
return new ViewHolder(view); | ||
} | ||
|
||
@Override | ||
protected void onSwitchState(ViewHolder holder, boolean showing) { | ||
super.onSwitchState(holder, showing); | ||
if (img != 0) { | ||
holder.emptyImage.setImageResource(img); | ||
} | ||
holder.emptyText.setText(tips); | ||
} | ||
|
||
public Empty setImg(@DrawableRes int img) { | ||
this.img = img; | ||
return this; | ||
} | ||
|
||
public Empty setTips(String tips) { | ||
this.tips = tips; | ||
return this; | ||
} | ||
|
||
static class ViewHolder extends StateLayout.ViewHolder { | ||
|
||
ImageView emptyImage; | ||
TextView emptyText; | ||
|
||
ViewHolder(View view) { | ||
super(view); | ||
emptyImage = view.findViewById(R.id.empty_image); | ||
emptyText = view.findViewById(R.id.empty_text); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.