-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches/build_file_checksums.ser | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.example.negar.testone" | ||
minSdkVersion 15 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation 'androidx.appcompat:appcompat:1.0.0' | ||
implementation 'androidx.recyclerview:recyclerview:1.0.0' | ||
implementation 'androidx.cardview:cardview:1.0.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||
|
||
implementation 'com.github.bumptech.glide:glide:4.8.0' | ||
implementation 'com.jakewharton:butterknife:9.0.0-rc1' | ||
implementation 'com.wang.avi:library:2.1.3' | ||
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test:runner:1.1.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' | ||
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' | ||
|
||
implementation project(':recyclerlibrary') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# 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 *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
-keep public class * implements com.bumptech.glide.module.GlideModule | ||
-keep public class * extends com.bumptech.glide.module.AppGlideModule | ||
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { | ||
**[] $VALUES; | ||
public *; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.Vasl.Library.Android; | ||
|
||
import android.content.Context; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import androidx.test.InstrumentationRegistry; | ||
import androidx.test.runner.AndroidJUnit4; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* 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.example.negar.testone", appContext.getPackageName()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.Vasl.Library.Android"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
|
||
<activity android:name="com.Vasl.Library.Android.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package com.Vasl.Library.Android; | ||
|
||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.view.Menu; | ||
import android.view.MenuInflater; | ||
import android.view.MenuItem; | ||
import android.widget.Toast; | ||
|
||
import com.Vasl.recyclerlibrary.MyCustomView; | ||
import com.Vasl.recyclerlibrary.globalEnums.ListStatuse; | ||
import com.Vasl.recyclerlibrary.globalInterfaces.MyCustomAdapterCallBack; | ||
import com.Vasl.recyclerlibrary.globalInterfaces.MyCustomViewCallBack; | ||
import com.Vasl.recyclerlibrary.globalObjects.RowModel; | ||
|
||
import java.util.ArrayList; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
public class MainActivity extends AppCompatActivity implements MyCustomViewCallBack { | ||
|
||
MyCustomView myCustomView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.activity_main); | ||
|
||
myCustomView = findViewById(R.id.myCustomView); | ||
|
||
myCustomView.setMyCustomViewCallBack(this); | ||
|
||
myCustomView.setStatus(ListStatuse.LOADING, null); | ||
|
||
Handler handler = new Handler(); | ||
handler.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
myList(); | ||
} | ||
}, 2000); | ||
|
||
} | ||
|
||
private void myList() { | ||
|
||
myCustomView.setStatus(ListStatuse.LOADING, null); | ||
|
||
RecyclerView recyclerView = myCustomView.getRecyclerView(); | ||
|
||
|
||
ArrayList<RowModel> rowModels = new ArrayList<>(); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "1")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "2")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "3")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "4")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "5")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "6")); | ||
rowModels.add(new RowModel("https://dkstatics-public.digikala.com/digikala-adservice-banners/2880.jpg", "7")); | ||
|
||
RecyclerVerticalAdapter adapter = new RecyclerVerticalAdapter(MainActivity.this, rowModels); | ||
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true)); | ||
adapter.setMyCustomAdapterCallBack(new MyCustomAdapterCallBack() { | ||
@Override | ||
public void verticalScrollRichToEnd() { | ||
Toast.makeText(MainActivity.this, "verticalScrollRichToEnd", Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
@Override | ||
public void horizontalScrollRichToEnd() { | ||
Toast.makeText(MainActivity.this, "horizontalScrollRichToEnd", Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
recyclerView.setAdapter(adapter); | ||
|
||
myCustomView.setStatus(ListStatuse.FAILURE, null); | ||
} | ||
|
||
@Override | ||
public void onRetryClicked() { | ||
myList(); | ||
} | ||
|
||
@Override | ||
public void onRefresh(int page) { | ||
myList(); | ||
} | ||
|
||
@Override | ||
public void onEndOfList() { | ||
Toast.makeText(this, "onEndList", Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
MenuInflater inflater = getMenuInflater(); | ||
inflater.inflate(R.menu.main_menu, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle item selection | ||
switch (item.getItemId()) { | ||
case R.id.action_load: | ||
myCustomView.setStatus(ListStatuse.LOADING, null); | ||
return true; | ||
case R.id.action_success: | ||
myCustomView.setStatus(ListStatuse.SUCCESS, null); | ||
return true; | ||
case R.id.action_failure: | ||
myCustomView.setStatus(ListStatuse.FAILURE, "hellooo"); | ||
return true; | ||
case R.id.action_empty: | ||
myCustomView.setStatus(ListStatuse.EMPTY, "no item"); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.Vasl.Library.Android; | ||
|
||
import com.bumptech.glide.annotation.GlideModule; | ||
import com.bumptech.glide.module.AppGlideModule; | ||
|
||
@GlideModule | ||
public class MyAppGlideModule extends AppGlideModule { | ||
} |