Skip to content

Commit

Permalink
1.查看大图添加了分享按钮
Browse files Browse the repository at this point in the history
2.小彩蛋删除了AgentWeb,点击会跳转到系统自带浏览器
  • Loading branch information
zhoujia456888 committed Jan 28, 2021
1 parent 297f578 commit 484b362
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 103 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@
* [BaseRecyclerViewAdapterHelper](https://github.com/CymChad/BaseRecyclerViewAdapterHelper/tree/androidx)
* [Coroutines](https://github.com/Kotlin/kotlinx.coroutines)
* [CustomActivityOnCrash](https://github.com/Ereza/CustomActivityOnCrash)
* [AgentWeb](https://github.com/Justson/AgentWeb)
8 changes: 2 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {
signingConfigs {
release {
//签名文件路径
storeFile file { "../keyStorePath.keystore" }
storeFile file { "../keyStore.keystore" }
//签名密码
storePassword "abcd1234"
//别名
Expand All @@ -61,7 +61,7 @@ android {

debug {
//签名文件路径
storeFile file { "../keyStorePath.keystore" }
storeFile file { "../keyStore.keystore" }
//签名密码
storePassword "abcd1234"
//别名
Expand Down Expand Up @@ -132,10 +132,6 @@ dependencies {
//自定义程序崩溃页面 https://github.com/Ereza/CustomActivityOnCrash
implementation 'cat.ereza:customactivityoncrash:2.3.0'

//AgentWeb框架 https://github.com/Justson/AgentWeb
implementation 'com.just.agentweb:agentweb-androidx:4.1.4' // (必选)
implementation 'com.just.agentweb:filechooser-androidx:4.1.4'// (可选)
implementation 'com.download.library:downloader-androidx:4.1.4'// (可选)
}

def releaseTime() {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
android:screenOrientation="portrait" />

<activity android:name=".ui.activity.PicturesDetailsActivity" />
<activity android:name=".ui.activity.WebActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ package com.jloveh.beautifulgirl2.app.ext

import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.view.View
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.jloveh.beautifulgirl2.R
import com.jloveh.beautifulgirl2.app.weight.viewpage.ScaleTransitionPagerTitleView
import com.jloveh.beautifulgirl2.ui.activity.PicturesDetailsActivity
import com.jloveh.beautifulgirl2.ui.activity.WebActivity
import me.hgj.jetpackmvvm.base.appContext
import me.hgj.jetpackmvvm.ext.util.toHtml
import net.lucode.hackware.magicindicator.MagicIndicator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.jloveh.beautifulgirl2.ui.activity

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment
Expand All @@ -16,6 +18,7 @@ import com.jloveh.beautifulgirl2.viewmodel.MainViewModel
import com.lxj.xpopup.XPopup
import kotlinx.android.synthetic.main.include_viewpager.*


class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {

var exitTime = 0L
Expand Down Expand Up @@ -43,7 +46,15 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {

btn_into_web.setOnClickListener {
LogUtils.e("点击了")
ActivityUtils.startActivity(WebActivity::class.java)

var webUrlSp = webUrlSp.getString("webUrl", "https://www.98awwyou21.xyz")
webUrlSp = if (webUrlSp.contains("http")) webUrlSp else "https://$webUrlSp"

val intent = Intent()
intent.action = "android.intent.action.VIEW"
val content_url: Uri = Uri.parse(webUrlSp)
intent.data = content_url
startActivity(intent)
}

btn_into_web.setOnLongClickListener {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package com.jloveh.beautifulgirl2.ui.popup

import android.R.attr.bitmap
import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.net.Uri
import android.provider.MediaStore
import com.blankj.utilcode.util.LogUtils
import com.jloveh.beautifulgirl2.R
import com.lxj.xpopup.core.ImageViewerPopupView
import kotlinx.android.synthetic.main.popup_big_image_viewer.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.io.FileInputStream

class BigImageViewerPopup(context: Context): ImageViewerPopupView(context){
override fun getImplLayoutId()= R.layout.popup_big_image_viewer

class BigImageViewerPopup(context: Context) : ImageViewerPopupView(context) {
override fun getImplLayoutId() = R.layout.popup_big_image_viewer

override fun onCreate() {
super.onCreate()
Expand All @@ -16,6 +27,23 @@ class BigImageViewerPopup(context: Context): ImageViewerPopupView(context){
save()
}

tv_share.setOnClickListener {
GlobalScope.launch(Dispatchers.IO) {
var url = urls[if (isInfinite) position % urls.size else position]

var source = imageLoader.getImageFile(context, url)

var bitmap = BitmapFactory.decodeStream(FileInputStream(source))

val uri = Uri.parse(MediaStore.Images.Media.insertImage(context.contentResolver, bitmap, null, null))

val intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_STREAM, uri)
intent.type = "image/*"
context.startActivity(Intent.createChooser(intent, "分享到"))
}
}
}

}
24 changes: 0 additions & 24 deletions app/src/main/res/layout/activity_web.xml

This file was deleted.

12 changes: 12 additions & 0 deletions app/src/main/res/layout/popup_big_image_viewer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />

<TextView
android:id="@+id/tv_share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="分享"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:textSize="16sp"/>

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 484b362

Please sign in to comment.