forked from flipkart-incubator/proteus
-
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
Aditya Sharat
committed
Mar 1, 2017
1 parent
478d055
commit 83a0b96
Showing
10 changed files
with
299 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,78 @@ | ||
/* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
* | ||
* Copyright (c) 2017 Flipkart Internet Pvt. Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.1" | ||
|
||
defaultConfig { | ||
minSdkVersion 14 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
|
||
afterEvaluate { | ||
javadoc.classpath += files(android.libraryVariants.collect { variant -> | ||
variant.javaCompile.classpath.files | ||
}) | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:recyclerview-v7:25.1.0' | ||
compile 'com.android.support:appcompat-v7:25.1.0' | ||
testCompile 'junit:junit:4.12' | ||
compile project(path: ':proteus-core') | ||
} |
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,33 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/aditya.sharat/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
-dontobfuscate | ||
-printmapping out.map | ||
-keepparameternames | ||
-renamesourcefileattribute SourceFile | ||
-keepattributes Exceptions,InnerClasses,Signature,Deprecated | ||
|
||
# Preserve all annotations. | ||
|
||
-keepattributes *Annotation* | ||
|
||
# Preserve all public classes, and their public and protected fields and | ||
# methods. | ||
|
||
-keep public class * { | ||
public protected *; | ||
} |
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,20 @@ | ||
<!-- | ||
~ Apache License | ||
~ Version 2.0, January 2004 | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
~ | ||
~ Copyright (c) 2017 Flipkart Internet Pvt. Ltd. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
~ this file except in compliance with the License. You may obtain a copy of the | ||
~ License at http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software distributed | ||
~ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
~ CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations under the License. | ||
--> | ||
|
||
<manifest package="com.flipkart.android.proteus.recyclerview.v7"/> |
43 changes: 43 additions & 0 deletions
43
...v7/src/main/java/com/flipkart/android/proteus/recyclerview/v7/RecyclerViewCollection.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,43 @@ | ||
/* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
* | ||
* Copyright (c) 2017 Flipkart Internet Pvt. Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.flipkart.android.proteus.recyclerview.v7; | ||
|
||
import com.flipkart.android.proteus.ProteusBuilder; | ||
|
||
/** | ||
* RecyclerViewCollection | ||
* | ||
* @author adityasharat | ||
*/ | ||
public class RecyclerViewCollection implements ProteusBuilder.Collection { | ||
|
||
private RecyclerViewCollection() { | ||
|
||
} | ||
|
||
public static RecyclerViewCollection create() { | ||
return new RecyclerViewCollection(); | ||
} | ||
|
||
@Override | ||
public void registerWith(ProteusBuilder builder) { | ||
builder.register(new RecyclerViewParser()); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...iew-v7/src/main/java/com/flipkart/android/proteus/recyclerview/v7/RecyclerViewParser.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,64 @@ | ||
/* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
* | ||
* Copyright (c) 2017 Flipkart Internet Pvt. Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.flipkart.android.proteus.recyclerview.v7; | ||
|
||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.ViewGroup; | ||
|
||
import com.flipkart.android.proteus.ProteusContext; | ||
import com.flipkart.android.proteus.ProteusView; | ||
import com.flipkart.android.proteus.ViewTypeParser; | ||
import com.flipkart.android.proteus.recyclerview.v7.widget.ProteusRecyclerView; | ||
import com.flipkart.android.proteus.value.Layout; | ||
import com.flipkart.android.proteus.value.ObjectValue; | ||
|
||
/** | ||
* RecyclerViewParser | ||
* | ||
* @author adityasharat | ||
*/ | ||
|
||
public class RecyclerViewParser<T extends RecyclerView> extends ViewTypeParser { | ||
|
||
@NonNull | ||
@Override | ||
public String getType() { | ||
return "RecyclerView"; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String getParentType() { | ||
return "ViewGroup"; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public ProteusView createView(@NonNull ProteusContext context, @NonNull Layout layout, @NonNull ObjectValue data, @Nullable ViewGroup parent, int dataIndex) { | ||
return new ProteusRecyclerView(context); | ||
} | ||
|
||
@Override | ||
protected void addAttributeProcessors() { | ||
|
||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...rc/main/java/com/flipkart/android/proteus/recyclerview/v7/widget/ProteusRecyclerView.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,56 @@ | ||
/* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
* | ||
* Copyright (c) 2017 Flipkart Internet Pvt. Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package com.flipkart.android.proteus.recyclerview.v7.widget; | ||
|
||
import android.support.v7.widget.RecyclerView; | ||
import android.view.View; | ||
|
||
import com.flipkart.android.proteus.ProteusContext; | ||
import com.flipkart.android.proteus.ProteusView; | ||
|
||
/** | ||
* ProteusRecyclerView | ||
* | ||
* @author adityasharat | ||
*/ | ||
|
||
public class ProteusRecyclerView extends RecyclerView implements ProteusView { | ||
|
||
Manager manager; | ||
|
||
public ProteusRecyclerView(ProteusContext context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public Manager getViewManager() { | ||
return manager; | ||
} | ||
|
||
@Override | ||
public void setViewManager(Manager manager) { | ||
this.manager = manager; | ||
} | ||
|
||
@Override | ||
public View getAsView() { | ||
return this; | ||
} | ||
} |
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