-
Notifications
You must be signed in to change notification settings - Fork 8
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
43 changed files
with
775 additions
and
787 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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line=lf | ||
charset=utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_size=4 | ||
insert_final_newline=true | ||
trim_trailing_whitespace=true | ||
|
||
[*.{kt, kts}] | ||
ij_kotlin_imports_layout = * | ||
[*.{kt,kts}] | ||
ij_kotlin_allow_trailing_comma=true | ||
ij_kotlin_allow_trailing_comma_on_call_site=true | ||
ij_kotlin_imports_layout=* | ||
|
||
[*.yaml] | ||
indent_style = space | ||
|
||
[*.md] | ||
indent_style = space |
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
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
27 changes: 12 additions & 15 deletions
27
app/src/androidTest/java/com/king/imageviewer/app/ExampleInstrumentedTest.kt
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,27 +1,24 @@ | ||
package com.king.imageviewer.app; | ||
package com.king.imageviewer.app | ||
|
||
import android.content.Context; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
|
||
assertEquals("com.king.imageviewer.app", appContext.getPackageName()); | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.king.imageviewer.app", appContext.packageName) | ||
} | ||
} |
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,20 @@ | ||
package com.king.imageviewer.app | ||
|
||
import android.app.Application | ||
import com.king.image.imageviewer.ImageViewer | ||
import com.king.image.imageviewer.loader.GlideImageLoader | ||
|
||
/** | ||
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||
* <p> | ||
* <a href="https://github.com/jenly1314">Follow me</a> | ||
*/ | ||
class App : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
// 设置全局默认的图片加载器 | ||
ImageViewer.setGlobalDefaultImageLoader(GlideImageLoader()) | ||
} | ||
} |
62 changes: 22 additions & 40 deletions
62
app/src/main/java/com/king/imageviewer/app/MainActivity.kt
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,54 +1,36 @@ | ||
package com.king.imageviewer.app; | ||
package com.king.imageviewer.app | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
import com.king.image.imageviewer.ImageViewer; | ||
import com.king.image.imageviewer.loader.GlideImageLoader; | ||
import com.king.image.imageviewer.loader.ImageLoader; | ||
import com.king.image.imageviewer.loader.PicassoImageLoader; | ||
|
||
import java.io.File; | ||
|
||
import androidx.annotation.DrawableRes; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.king.image.imageviewer.ImageViewer | ||
import com.king.image.imageviewer.ImageViewerSpec | ||
import com.king.image.imageviewer.loader.GlideImageLoader | ||
|
||
/** | ||
* ImageViewer 是一个图片查看器。一般用来查看图片详情或查看大图时使用。 | ||
* | ||
* {@link ImageViewer} 支持加载{@link Uri}, {@code url}, {@code path},{@link File}, {@link DrawableRes resId}…等 | ||
* 如果使用{@link GlideImageLoader}会支持的类型会更多。 | ||
* 使用{@link ImageViewer}时,必须配置一个实现的{@link ImageLoader}。 | ||
* 目前内置默认实现的{@link ImageLoader}有{@link GlideImageLoader} 和{@link PicassoImageLoader} | ||
* 如果不满足您的需求,您也可以自己实现一个{@link ImageLoader} | ||
* ImageViewer 示例 | ||
* | ||
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||
* <p> | ||
* <a href="https://github.com/jenly1314">Follow me</a> | ||
*/ | ||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
} | ||
|
||
private void startActivity(Class<?> cls){ | ||
Intent intent = new Intent(this,cls); | ||
startActivity(intent); | ||
private fun startActivity(cls: Class<*>) { | ||
val intent = Intent(this, cls) | ||
startActivity(intent) | ||
} | ||
|
||
public void onClick(View v){ | ||
switch (v.getId()){ | ||
case R.id.btn1: | ||
startActivity(PhotoActivity.class); | ||
break; | ||
case R.id.btn2: | ||
startActivity(PhotoListActivity.class); | ||
break; | ||
fun onClick(v: View) { | ||
when (v.id) { | ||
R.id.btn1 -> startActivity(PhotoActivity::class.java) | ||
R.id.btn2 -> startActivity(PhotoListActivity::class.java) | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.