diff --git a/app/src/main/java/cf/android666/wanandroid/activity/ContentActivity.kt b/app/src/main/java/cf/android666/wanandroid/activity/ContentActivity.kt index f642d75..cbfceae 100644 --- a/app/src/main/java/cf/android666/wanandroid/activity/ContentActivity.kt +++ b/app/src/main/java/cf/android666/wanandroid/activity/ContentActivity.kt @@ -2,11 +2,15 @@ package cf.android666.wanandroid.activity import android.os.Bundle import android.support.v7.app.AppCompatActivity +import android.view.Menu +import android.view.MenuItem import android.view.View import cf.android666.wanandroid.R import cf.android666.wanandroid.utils.SuperUtil import kotlinx.android.synthetic.main.activity_content.* import cf.android666.wanandroid.base.BaseActivity +import android.content.Intent +import android.net.Uri /** @@ -26,7 +30,27 @@ class ContentActivity : BaseActivity() { SuperUtil.loadUrl(web_view,intent.getStringExtra("url")) + toolbar.title = web_view.title } + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.menu_content, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem?): Boolean { + + when (item!!.itemId) { + + R.id.refresh -> web_view.reload() + + R.id.open_sys -> + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(intent.getStringExtra("url")))) + + } + + return super.onOptionsItemSelected(item) + } + } \ No newline at end of file diff --git a/app/src/main/java/cf/android666/wanandroid/fragment/IndexPostFragment.kt b/app/src/main/java/cf/android666/wanandroid/fragment/IndexPostFragment.kt index b1fc323..72f6eaf 100644 --- a/app/src/main/java/cf/android666/wanandroid/fragment/IndexPostFragment.kt +++ b/app/src/main/java/cf/android666/wanandroid/fragment/IndexPostFragment.kt @@ -174,11 +174,14 @@ class IndexPostFragment : BaseFragment() { currentPage = it.data.curPage - view!!.recycler_view.adapter.notifyDataSetChanged() + if (view != null) { + + view!!.recycler_view.adapter.notifyDataSetChanged() + childCount = recycler_view.childCount + } - childCount = recycler_view.childCount - view!!.swipe_refresh.isRefreshing = false + view?.swipe_refresh?.isRefreshing = false } } diff --git a/app/src/main/java/cf/android666/wanandroid/view/AutoRefreshRecyclerView.kt b/app/src/main/java/cf/android666/wanandroid/view/AutoRefreshRecyclerView.kt index 5bcfed1..dd1475d 100644 --- a/app/src/main/java/cf/android666/wanandroid/view/AutoRefreshRecyclerView.kt +++ b/app/src/main/java/cf/android666/wanandroid/view/AutoRefreshRecyclerView.kt @@ -31,8 +31,6 @@ class AutoRefreshRecyclerView(context: Context, attributeSet: AttributeSet?, def MotionEvent.ACTION_UP -> { - Logger.wtf("onTouchEvent e.y is ${e.y}") - checkFoot(e.y - oldY) } @@ -55,11 +53,9 @@ class AutoRefreshRecyclerView(context: Context, attributeSet: AttributeSet?, def } - Logger.wtf("dy is $dy") if (dy < 0 && lastPosition > childCount - 2 && onFootListener!=null) { onFootListener!!.invoke() - Logger.wtf("onFootListener!!.invoke() ") } diff --git a/app/src/main/res/layout/activity_content.xml b/app/src/main/res/layout/activity_content.xml index 326a455..8770acf 100644 --- a/app/src/main/res/layout/activity_content.xml +++ b/app/src/main/res/layout/activity_content.xml @@ -10,7 +10,8 @@ android:layout_width="match_parent" android:layout_height="@dimen/nav_height" app:titleTextColor="#fff" - android:background="@color/colorBottomNav"> + android:background="@color/colorBottomNav" + > diff --git a/app/src/main/res/menu/menu_content.xml b/app/src/main/res/menu/menu_content.xml new file mode 100644 index 0000000..d919bbc --- /dev/null +++ b/app/src/main/res/menu/menu_content.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file