Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@
android:name=".activity.FollowerListActivity"
/>

<activity
android:name=".activity.PhotoDisplayActivity"
android:theme="@style/AppTheme.Transparent"
/>
<activity android:name=".activity.PhotoDisplayActivity" />

<activity android:name=".activity.DebugActivity"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package io.github.anthonyeef.cattle.activity

import android.content.Context
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import android.view.View
import io.github.anthonyeef.cattle.R
import io.github.anthonyeef.cattle.utils.LocaleUtils

Expand All @@ -24,7 +22,6 @@ open class BaseActivity : AppCompatActivity() {
super.onPostCreate(savedInstanceState)

setupToolbar()
setNavigationBarColor()
}


Expand All @@ -47,11 +44,4 @@ open class BaseActivity : AppCompatActivity() {
toolbarTitle = title
toolbar?.title = toolbarTitle
}


private fun setNavigationBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.github.anthonyeef.cattle.activity

import android.os.Build
import android.os.Bundle
import androidx.core.content.ContextCompat
import io.github.anthonyeef.cattle.R
import io.github.anthonyeef.cattle.extension.bindFragment
import io.github.anthonyeef.cattle.fragment.FragmentInstanceCache
Expand All @@ -15,9 +13,6 @@ class GeneralActivity : BaseActivity() {
}


private val shouldTintStatusBar: Boolean by lazy { intent.extras.getBoolean(KEY_TINT_STATUS_BAR) }


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_general)
Expand All @@ -28,14 +23,4 @@ class GeneralActivity : BaseActivity() {
bindFragment(fragmentToShow = it)
}
}

override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)

if (shouldTintStatusBar) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package io.github.anthonyeef.cattle.fragment

import android.graphics.Color
import android.os.Bundle
import android.view.View
import androidx.annotation.StringRes
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
import io.github.anthonyeef.cattle.R
import io.github.anthonyeef.cattle.activity.BaseActivity

/**
*
*/
abstract class BaseFragment : androidx.fragment.app.Fragment() {
abstract class BaseFragment : Fragment() {

private val toolbar: Toolbar? by lazy { view!!.findViewById<Toolbar>(R.id.toolbar) }

Expand All @@ -20,6 +24,15 @@ abstract class BaseFragment : androidx.fragment.app.Fragment() {
}


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

activity?.let {
it.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
it.window.statusBarColor = Color.TRANSPARENT
}
}

fun setToolbarTitle(title: CharSequence) {
(activity as? BaseActivity)?.setToolbarTitle(title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import io.reactivex.disposables.CompositeDisposable
class LoginFragment : BaseFragment(), LoginContract.View {
private lateinit var mLoginPresenter: LoginContract.Presenter

private val loginBtn: FloatingActionButton? = view?.findViewById(R.id.login_btn)
private val name: TextView? = view?.findViewById(R.id.name_text)
private val cat: ImageView? = view?.findViewById(R.id.cat)
private var loginBtn: FloatingActionButton? = null
private var name: TextView? = null
private var cat: ImageView? = null
private lateinit var _disposables: CompositeDisposable

override fun isActive(): Boolean {
Expand All @@ -50,6 +50,10 @@ class LoginFragment : BaseFragment(), LoginContract.View {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

loginBtn = view.findViewById(R.id.login_btn)
name = view.findViewById(R.id.name_text)
cat = view.findViewById(R.id.cat)

name?.setOnClickListener {
mLoginPresenter.checkCredential()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package io.github.anthonyeef.cattle.fragment

import android.content.Intent
import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import io.github.anthonyeef.cattle.R
import io.github.anthonyeef.cattle.activity.HomeActivity
import io.github.anthonyeef.cattle.data.SettingCenter
import io.github.anthonyeef.cattle.entity.SettingItemEntity
import io.github.anthonyeef.cattle.utils.LocaleUtils
import io.github.anthonyeef.cattle.viewbinder.SettingItemViewBinder
import me.drakeet.multitype.register
import java.util.*

class SettingFragment : BaseListFragment(), SettingItemViewBinder.SettingItemClickCallback {

Expand Down Expand Up @@ -51,30 +58,37 @@ class SettingFragment : BaseListFragment(), SettingItemViewBinder.SettingItemCli


private fun openLanguageSelector() {
val languages = listOf(getString(R.string.text_language_default), getString(R.string.text_language_english), getString(R.string.text_language_chinese_simple))
// fixme
/*selector(getString(R.string.text_which_language), languages, { _, i ->
var locale = Locale.getDefault().language
when (i) {
0 -> {
locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Resources.getSystem().configuration.locales[0].language
} else {
Resources.getSystem().configuration.locale.language
}
}
1 -> {
locale = Locale.ENGLISH.language
}
2 -> {
locale = Locale.SIMPLIFIED_CHINESE.language
}
}

context?.let {
val newContext = LocaleUtils.setLocale(it, locale)
newContext.startActivity(newContext.intentFor<HomeActivity>().clearTop())
}
})*/
val languages = arrayOf(getString(R.string.text_language_default), getString(R.string.text_language_english), getString(R.string.text_language_chinese_simple))
val alertDialog = AlertDialog.Builder(context!!)
.setItems(languages) { dialog, which ->
var locale = Locale.getDefault().language
when (which) {
0 -> {
locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Resources.getSystem().configuration.locales[0].language
} else {
Resources.getSystem().configuration.locale.language
}
}

1 -> {
locale = Locale.ENGLISH.language
}

2 -> {
locale = Locale.SIMPLIFIED_CHINESE.language
}
}
context?.let {
val newContext = LocaleUtils.setLocale(it, locale)
val intent = Intent(context, HomeActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}
newContext.startActivity(intent)
}
}
.create()
alertDialog.show()
}
}
108 changes: 0 additions & 108 deletions app/src/main/res/layout-v19/view_profile_header.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
android:id="@id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_toolbar_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
>

<include layout="@layout/toolbar_general"/>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/frag_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/name_text"
app:layout_constraintTop_toBottomOf="@id/name_text"
app:layout_constraintBottom_toTopOf="@id/login_btn"
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/layout/frag_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical"
>

<com.google.android.material.appbar.CollapsingToolbarLayout
Expand All @@ -32,7 +31,6 @@
android:id="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:fitsSystemWindows="false"
app:contentInsetStartWithNavigation="0dp"
app:layout_collapseMode="pin"
/>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/toolbar_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
app:contentInsetStartWithNavigation="0dp"
>

Expand Down
Loading