mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
#1777 Sync Login page with device theme
This commit is contained in:
parent
4a528ad9b7
commit
cb119c595c
3 changed files with 32 additions and 31 deletions
|
@ -1,30 +0,0 @@
|
|||
package com.newsblur.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import android.view.Window;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.fragment.LoginRegisterFragment;
|
||||
|
||||
public class Login extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_login);
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
||||
if (fragmentManager.findFragmentByTag(LoginRegisterFragment.class.getName()) == null) {
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
LoginRegisterFragment login = new LoginRegisterFragment();
|
||||
transaction.add(R.id.login_container, login, LoginRegisterFragment.class.getName());
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.newsblur.activity
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.Window
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.commit
|
||||
import com.newsblur.R
|
||||
import com.newsblur.fragment.LoginRegisterFragment
|
||||
|
||||
class Login : FragmentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
|
||||
Configuration.UI_MODE_NIGHT_YES -> setTheme(R.style.NewsBlurDarkTheme)
|
||||
Configuration.UI_MODE_NIGHT_NO -> setTheme(R.style.NewsBlurTheme)
|
||||
Configuration.UI_MODE_NIGHT_UNDEFINED -> setTheme(R.style.NewsBlurTheme)
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
setContentView(R.layout.activity_login)
|
||||
|
||||
if (supportFragmentManager.findFragmentByTag(LoginRegisterFragment::class.java.name) == null) {
|
||||
supportFragmentManager.commit {
|
||||
val login = LoginRegisterFragment()
|
||||
add(R.id.login_container, login, LoginRegisterFragment::class.java.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="?layoutBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
@ -7,7 +8,6 @@
|
|||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/item_background"
|
||||
android:contentDescription="@string/description_login_logo"
|
||||
android:paddingVertical="16dp"
|
||||
android:src="@drawable/logo_newsblur_blur" />
|
||||
|
|
Loading…
Add table
Reference in a new issue