-
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
0 parents
commit 130d9de
Showing
64 changed files
with
2,841 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,13 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
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,46 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.example.isca_app" | ||
minSdkVersion 18 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
|
||
def lifecycle_version = "1.1.1" | ||
def paging_version = "1.0.1" | ||
implementation "android.arch.paging:runtime:$paging_version" | ||
implementation "android.arch.lifecycle:extensions:$lifecycle_version" | ||
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version" | ||
implementation "android.arch.persistence.room:runtime:1.1.1" | ||
annotationProcessor "android.arch.persistence.room:compiler:1.1.1" | ||
implementation 'com.squareup.retrofit2:retrofit:2.4.0' | ||
implementation 'com.squareup.retrofit2:converter-gson:2.4.0' | ||
implementation "com.android.support:recyclerview-v7:28.0.0" | ||
implementation "com.android.support:cardview-v7:28.0.0" | ||
implementation 'com.android.support:design:28.0.0' | ||
|
||
implementation 'com.squareup.picasso:picasso:2.5.2' | ||
implementation 'com.miguelcatalan:materialsearchview:1.4.0' | ||
|
||
implementation 'com.victor:lib:1.0.4' | ||
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' | ||
} |
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 |
Binary file not shown.
Binary file not shown.
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 @@ | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/example/isca_app/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 com.example.isca_app; | ||
|
||
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("com.example.isca_app", 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,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.isca_app"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<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"> | ||
<activity android:name=".view.FullScreenPhotoActivity" | ||
android:theme="@style/AppTheme.NoActionBar"></activity> | ||
<activity | ||
android:name=".view.MainActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
159 changes: 159 additions & 0 deletions
159
app/src/main/java/com/example/isca_app/adapter/PhotoAdapter.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,159 @@ | ||
package com.example.isca_app.adapter; | ||
|
||
import android.app.Activity; | ||
import android.app.ActivityOptions; | ||
import android.app.Dialog; | ||
import android.arch.paging.PagedListAdapter; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.os.Build; | ||
import android.support.annotation.NonNull; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.support.v7.widget.Toolbar; | ||
import android.transition.Fade; | ||
import android.util.Pair; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.view.Window; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import com.example.isca_app.R; | ||
import com.example.isca_app.model.Retrofit.PhotoModel; | ||
import com.example.isca_app.model.Room.entity.Photo; | ||
import com.example.isca_app.view.FullScreenPhotoActivity; | ||
import com.squareup.picasso.Picasso; | ||
import com.victor.loading.rotate.RotateLoading; | ||
|
||
public class PhotoAdapter extends PagedListAdapter<PhotoModel,PhotoAdapter.PhotoHolder> { | ||
|
||
Context mContext; | ||
Activity mActivity; | ||
public PhotoAdapter(Context context,Activity activity) { | ||
super(PhotoModel.CALLBACK); | ||
mContext=context; | ||
mActivity=activity; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public PhotoHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | ||
View layoutView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.photo_item, null); //client_recycleview | ||
PhotoHolder photoHolder = new PhotoHolder(layoutView); | ||
return photoHolder; | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull final PhotoHolder photoHolder, int potsition) { | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
Fade fade = new Fade(); | ||
View decor = mActivity.getWindow().getDecorView(); | ||
fade.excludeTarget(decor.findViewById(R.id.action_bar_container), true); | ||
fade.excludeTarget(android.R.id.statusBarBackground, true); | ||
|
||
fade.excludeTarget(android.R.id.navigationBarBackground, true); | ||
|
||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
mActivity.getWindow().setEnterTransition(fade); | ||
mActivity.getWindow().setExitTransition(fade); | ||
} | ||
} | ||
|
||
final PhotoModel model=getItem(potsition); | ||
|
||
|
||
final RotateLoading rotateLoading=photoHolder.rotateLoading; | ||
rotateLoading.start(); | ||
|
||
Picasso.with(mContext).load("https:\\/\\/live.staticflickr.com\\/"+model.getServer()+"\\/"+model.getId()+"_"+model.getSecret()+"_m.jpg").fit().centerInside() | ||
.into(photoHolder.photoItem, new com.squareup.picasso.Callback() { | ||
@Override | ||
public void onSuccess() { | ||
rotateLoading.stop(); | ||
} | ||
@Override | ||
public void onError() { | ||
rotateLoading.stop(); | ||
photoHolder.photoItem.setImageResource(R.drawable.ic_action_navigation_arrow_back); | ||
} | ||
}); | ||
photoHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() { | ||
@Override | ||
public boolean onLongClick(View view) { | ||
MyCustomDualSimDialog(model); | ||
return false; | ||
} | ||
}); | ||
photoHolder.itemView.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Pair pair=new Pair<View,String>(photoHolder.photoItem,"backgroundTransition"); | ||
ActivityOptions options= null; | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { | ||
options = ActivityOptions.makeSceneTransitionAnimation(mActivity,pair); | ||
} | ||
Intent intent=new Intent(mContext, FullScreenPhotoActivity.class); | ||
intent.putExtra("URL","https:\\/\\/live.staticflickr.com\\/"+model.getServer()+"\\/"+model.getId()+"_"+model.getSecret()+"_z.jpg"); | ||
mActivity.startActivity(intent,options.toBundle()); | ||
} | ||
}); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
public class PhotoHolder extends RecyclerView.ViewHolder { | ||
|
||
ImageView photoItem; | ||
RotateLoading rotateLoading; | ||
public PhotoHolder(View itemView) { | ||
super(itemView); | ||
|
||
rotateLoading=itemView.findViewById(R.id.rotateloading); | ||
photoItem=itemView.findViewById(R.id.photo_item); | ||
|
||
} | ||
} | ||
|
||
|
||
Dialog MyDialogPhoto; | ||
|
||
public void MyCustomDualSimDialog(PhotoModel photoModel) { | ||
MyDialogPhoto = new Dialog(mContext); | ||
MyDialogPhoto.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
MyDialogPhoto.setContentView(R.layout.dialog_photo); | ||
Window window = MyDialogPhoto.getWindow(); | ||
window.setLayout(Toolbar.LayoutParams.WRAP_CONTENT, Toolbar.LayoutParams.WRAP_CONTENT); | ||
MyDialogPhoto.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
|
||
TextView id, owner, secret, server, farm, title, ispublic, isfriend, isfamily; | ||
|
||
id=MyDialogPhoto.findViewById(R.id.Id_text); | ||
owner=MyDialogPhoto.findViewById(R.id.owner_text); | ||
secret=MyDialogPhoto.findViewById(R.id.secret_text); | ||
server=MyDialogPhoto.findViewById(R.id.server_text); | ||
farm=MyDialogPhoto.findViewById(R.id.farm_text); | ||
title=MyDialogPhoto.findViewById(R.id.Photo_Title); | ||
ispublic=MyDialogPhoto.findViewById(R.id.ispublic_text); | ||
isfriend=MyDialogPhoto.findViewById(R.id.isfriend_text); | ||
isfamily=MyDialogPhoto.findViewById(R.id.isfamily_text); | ||
|
||
id.setText(photoModel.getId()); | ||
owner.setText(photoModel.getOwner()); | ||
secret.setText(photoModel.getSecret()); | ||
server.setText(photoModel.getServer()); | ||
farm.setText(String.valueOf(photoModel.getFarm())); | ||
title.setText(photoModel.getTitle()); | ||
ispublic.setText(String.valueOf(photoModel.getIspublic())); | ||
isfriend.setText(String.valueOf(photoModel.getIsfriend())); | ||
isfamily.setText(String.valueOf(photoModel.getIsfamily())); | ||
|
||
MyDialogPhoto.show(); | ||
} | ||
} |
Oops, something went wrong.