forked from ZJYZJY/arch
-
Notifications
You must be signed in to change notification settings - Fork 1
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
zhengjy
committed
Jul 16, 2020
1 parent
2f99719
commit 4ba217d
Showing
50 changed files
with
1,801 additions
and
28 deletions.
There are no files selected for viewing
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
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,19 @@ | ||
package com.zjy.arch | ||
|
||
import com.tencent.mmkv.MMKV | ||
import com.zjy.architecture.util.preference.IStorage | ||
import com.zjy.architecture.util.preference.Preference | ||
import com.zjy.architecture.util.preference.PreferenceDelegate | ||
import com.zjy.architecture.util.preference.PreferenceStorage | ||
|
||
/** | ||
* @author zhengjy | ||
* @since 2020/07/15 | ||
* Description: | ||
*/ | ||
object AppPreference : Preference { | ||
override val sp: IStorage = PreferenceStorage(MMKV.defaultMMKV()) | ||
|
||
val isLogin by PreferenceDelegate("IS_LOGIN", false, sp) | ||
|
||
} |
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,68 @@ | ||
package com.zjy.arch | ||
|
||
import android.os.Bundle | ||
import android.view.ViewGroup | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.coordinatorlayout.widget.CoordinatorLayout | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.qmuiteam.qmui.nestedScroll.QMUIContinuousNestedBottomAreaBehavior | ||
import com.qmuiteam.qmui.nestedScroll.QMUIContinuousNestedBottomRecyclerView | ||
import com.qmuiteam.qmui.nestedScroll.QMUIContinuousNestedTopAreaBehavior | ||
import com.qmuiteam.qmui.nestedScroll.QMUIContinuousNestedTopWebView | ||
import com.zhy.adapter.recyclerview.CommonAdapter | ||
import com.zhy.adapter.recyclerview.base.ViewHolder | ||
import kotlinx.android.synthetic.main.activity_web_view.* | ||
|
||
|
||
class WebViewActivity : AppCompatActivity() { | ||
|
||
private var mNestedWebView: QMUIContinuousNestedTopWebView? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_web_view) | ||
|
||
mNestedWebView = QMUIContinuousNestedTopWebView(this) | ||
val matchParent = ViewGroup.LayoutParams.MATCH_PARENT | ||
val webViewLp = CoordinatorLayout.LayoutParams( | ||
matchParent, matchParent | ||
) | ||
webViewLp.behavior = QMUIContinuousNestedTopAreaBehavior(this) | ||
mCoordinatorLayout.setTopAreaView(mNestedWebView, webViewLp) | ||
|
||
val mRecyclerView = QMUIContinuousNestedBottomRecyclerView(this) | ||
val recyclerViewLp = CoordinatorLayout.LayoutParams( | ||
matchParent, matchParent | ||
) | ||
recyclerViewLp.behavior = QMUIContinuousNestedBottomAreaBehavior() | ||
mCoordinatorLayout.setBottomAreaView(mRecyclerView, recyclerViewLp) | ||
|
||
mRecyclerView.layoutManager = LinearLayoutManager(this) | ||
mRecyclerView.adapter = object : CommonAdapter<String>(this, android.R.layout.activity_list_item, listOf("a", "b", "c", "d", "e")) { | ||
override fun convert(holder: ViewHolder, t: String, position: Int) { | ||
holder.setText(android.R.id.text1, t) | ||
} | ||
} | ||
|
||
mNestedWebView?.settings?.apply { | ||
javaScriptEnabled = true | ||
domStorageEnabled = true | ||
blockNetworkImage = false | ||
} | ||
mNestedWebView?.loadUrl( | ||
// "https://api.xiaoheihe.cn/v3/bbs/app/api/web/share?link_id=42234008" | ||
// "http://fd.33.cn:1230/#/detail?id=40" | ||
// "https://www.baidu.com" | ||
"https://server.chain199.com/#/detail?id=23" | ||
) | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy(); | ||
if (mNestedWebView != null) { | ||
mCoordinatorLayout.removeView(mNestedWebView); | ||
mNestedWebView?.destroy() | ||
mNestedWebView = null | ||
} | ||
} | ||
} |
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,19 @@ | ||
package com.zjy.arch | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import androidx.fragment.app.commit | ||
import com.zjy.arch.fragment.ChartFragment | ||
import com.zjy.arch.fragment.PullLayoutFragment | ||
|
||
class WidgetActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_widget) | ||
|
||
supportFragmentManager.commit { | ||
// add(R.id.fcv_container, PullLayoutFragment(R.layout.fragment_pull_layout)) | ||
add(R.id.fcv_container, ChartFragment(R.layout.fragment_chart)) | ||
} | ||
} | ||
} |
Oops, something went wrong.