-
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
69 changed files
with
1,905 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,50 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
|
||
|
||
|
||
defaultConfig { | ||
minSdkVersion 22 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/layout'] } } | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
implementation 'com.jakewharton:butterknife:10.0.0' | ||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' | ||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' | ||
implementation 'com.google.code.gson:gson:2.8.5' | ||
implementation 'android.arch.persistence.room:runtime:1.1.1' | ||
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1' | ||
implementation 'com.android.support:recyclerview-v7:28.0.0' | ||
implementation "com.github.skydoves:preferenceroom:1.1.3" | ||
annotationProcessor "com.github.skydoves:preferenceroom-processor:1.1.3" | ||
implementation 'frankiesardo:icepick:3.2.0' | ||
compileOnly 'frankiesardo:icepick-processor:3.2.0' | ||
implementation 'com.squareup.retrofit2:retrofit:2.5.0' | ||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' | ||
implementation 'it.sephiroth.android.library.imagezoom:imagezoom:+' | ||
implementation 'org.parceler:parceler-api:1.1.12' | ||
annotationProcessor 'org.parceler:parceler:1.1.12' | ||
} |
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,21 @@ | ||
# 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 |
26 changes: 26 additions & 0 deletions
26
AndroidBase/androidBase/src/androidTest/java/ams/android_base/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,26 @@ | ||
package ams.android_base; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.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("ams.android_base.test", appContext.getPackageName()); | ||
} | ||
} |
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,24 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="ams.android_base"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name"> | ||
<meta-data | ||
android:name="android.support.VERSION" | ||
android:value="28.0.0" | ||
tools:replace="android:value" /> | ||
|
||
<activity android:name=".ZoomImageActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
44 changes: 44 additions & 0 deletions
44
AndroidBase/androidBase/src/main/java/ams/android_base/BaseAPIsConnector.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,44 @@ | ||
package ams.android_base; | ||
|
||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import okhttp3.OkHttpClient; | ||
import retrofit2.Converter; | ||
import retrofit2.Retrofit; | ||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; | ||
|
||
@SuppressWarnings({"WeakerAccess", "unused"}) | ||
public abstract class BaseAPIsConnector { | ||
|
||
private static Retrofit retrofit; | ||
|
||
protected OkHttpClient.Builder getOkHttpBuilder() { | ||
int timeOut = 200; | ||
return new OkHttpClient.Builder() | ||
.connectTimeout(timeOut, TimeUnit.SECONDS) | ||
.writeTimeout(timeOut, TimeUnit.SECONDS) | ||
.readTimeout(timeOut, TimeUnit.SECONDS); | ||
} | ||
|
||
protected Retrofit.Builder getRetrofitBuilder() { | ||
return new Retrofit.Builder() | ||
.baseUrl(getBaseURL()) | ||
.addConverterFactory(getConverterFactory()) | ||
.client(getOkHttpBuilder().build()) | ||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()); | ||
} | ||
|
||
protected final void buildRetrofit () { if (retrofit == null) retrofit = getRetrofitBuilder().build(); } | ||
|
||
protected Retrofit getRetrofit () { return retrofit; } | ||
|
||
protected <APIsInterface> APIsInterface getRetrofitClient(Class<APIsInterface> restAPIsInterface) { | ||
buildRetrofit(); | ||
return retrofit.create(restAPIsInterface); | ||
} | ||
|
||
protected abstract String getBaseURL (); | ||
protected abstract Converter.Factory getConverterFactory (); | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
AndroidBase/androidBase/src/main/java/ams/android_base/ZoomImageActivity.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,49 @@ | ||
package ams.android_base; | ||
|
||
import android.content.Intent; | ||
import android.graphics.Bitmap; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.WindowManager; | ||
|
||
import it.sephiroth.android.library.imagezoom.ImageViewTouch; | ||
|
||
public abstract class ZoomImageActivity extends AppCompatActivity { | ||
|
||
protected ImageViewTouch imageView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
initView(); | ||
renderImageView(); | ||
} | ||
|
||
private void initView() { | ||
setContentView(R.layout.activity_zoom_image); | ||
if(getSupportActionBar() != null) getSupportActionBar().hide(); | ||
// Remove activity title | ||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | ||
WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
//noinspection deprecation,RedundantCast | ||
imageView = (ImageViewTouch) findViewById(R.id.imageView); | ||
} | ||
|
||
protected abstract void renderImageView (); | ||
|
||
@Override | ||
public void onBackPressed() { | ||
super.onBackPressed(); | ||
this.finish(); | ||
} | ||
|
||
|
||
// This is how to send image to view/zoom image page | ||
// Bitmap will be cached for 10 seconds only | ||
// public void sendImageToViewPage (Bitmap bitmap) { | ||
// new CacheManger(this).cacheBitmapTemporary(GlobalKeys.TEMP_BITMAP, bitmap, 10); | ||
// Intent intent = new Intent(this, ZoomImageActivity.class); | ||
// startActivity(intent); | ||
// } | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
AndroidBase/androidBase/src/main/java/ams/android_base/baseClasses/BasePage.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,32 @@ | ||
package ams.android_base.baseClasses; | ||
|
||
@SuppressWarnings("WeakerAccess") | ||
public class BasePage<T> { | ||
|
||
private int itemsCount; | ||
private int itemsPerPage = 20; | ||
private int pageNumber = 1; | ||
|
||
public void setItemsCount(int itemsCount) { this.itemsCount = itemsCount; } | ||
|
||
public int getItemsPerPage() { return itemsPerPage; } | ||
|
||
public int getPageNumber() { return pageNumber; } | ||
|
||
|
||
// Helper methods | ||
public void resetPageCount () { this.pageNumber = 1; } | ||
|
||
public void incrementPageNumber () { this.pageNumber ++; } | ||
|
||
public int getTotalNumberOfPages() { | ||
float tempItemsCount = itemsCount; | ||
float tempItemsPerPage = itemsPerPage; | ||
return (int) (Math.ceil(tempItemsCount/tempItemsPerPage)); | ||
} | ||
|
||
public boolean hasNext() { return pageNumber <= getTotalNumberOfPages(); } | ||
|
||
public void resetPage () { resetPageCount(); } | ||
|
||
} |
Oops, something went wrong.