mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-21 03:02:59 -04:00
Added more comprehensive night mode #353
This commit is contained in:
parent
afde421c36
commit
47fbc4db7c
@ -40,7 +40,6 @@
|
||||
<activity
|
||||
android:name=".KiwixMobileActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|locale"
|
||||
android:theme="@style/AppTheme.Main"
|
||||
android:label="@string/app_name">
|
||||
|
||||
<intent-filter>
|
||||
|
@ -1,65 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bookmarks_activity_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white">
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/bookmarks_activity_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".BookmarksActivity">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="?colorPrimaryDark"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:theme="@style/AppTheme.AppBarOverlay" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/bookmarks_list"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/bookmarks_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/listBackground"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bookmarks_none_linlayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/ic_star_yellow"/>
|
||||
|
||||
<TextView
|
||||
style="@android:style/TextAppearance.Large"
|
||||
<LinearLayout
|
||||
android:id="@+id/bookmarks_none_linlayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="15dp"
|
||||
android:text="@string/no_bookmarks"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/ic_star_yellow"/>
|
||||
|
||||
<TextView
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="15dp"
|
||||
android:text="@string/no_bookmarks"
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
@ -8,14 +8,16 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/listBackground">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/library_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="60dp"
|
||||
android:divider="@null"/>
|
||||
android:divider="@null"
|
||||
android:background="?attr/listBackground"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/network_permission_text"
|
||||
|
@ -2,7 +2,8 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/listBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_management_no_downloads"
|
||||
@ -20,6 +21,7 @@
|
||||
<ListView
|
||||
android:id="@+id/zim_downloader_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listBackground"/>
|
||||
|
||||
</RelativeLayout>
|
@ -7,6 +7,7 @@
|
||||
<ListView
|
||||
android:id="@+id/language_check_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listBackground"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,21 +1,30 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layoutDirection="ltr">
|
||||
|
||||
<include layout="@layout/toolbar"/>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layoutDirection="ltr"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="?colorPrimaryDark"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:theme="@style/AppTheme.AppBarOverlay" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/listBackground"
|
||||
android:id="@+id/search_list"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
@ -1,19 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
layout="@layout/toolbar"
|
||||
android:id="@+id/toolbar_container"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_frame"
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/toolbar_container"
|
||||
android:background="@color/white"/>
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="?colorPrimaryDark"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:theme="@style/AppTheme.AppBarOverlay" />
|
||||
|
||||
</RelativeLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/toolbar"
|
||||
android:background="?attr/listBackground"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -18,7 +18,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:backgroundColor="@color/primary_dark"
|
||||
app:backgroundColor="?attr/progressBackgroundColor"
|
||||
app:bidirectionalAnimate="false"
|
||||
app:progressColor="@color/accent"/>
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/listBackground">
|
||||
|
||||
|
||||
<TextView
|
||||
@ -29,6 +30,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/toolbar"
|
||||
android:paddingBottom="60dp"
|
||||
android:background="?attr/listBackground"
|
||||
android:divider="@null">
|
||||
</ListView>
|
||||
|
||||
|
@ -2,7 +2,9 @@
|
||||
<resources>
|
||||
|
||||
<color name="primary">#000000</color>
|
||||
<color name="primary_night">#283c64</color>
|
||||
<color name="primary_dark">#000000</color>
|
||||
<color name="primary_dark_night">#283c64</color>
|
||||
<color name="primary_light">#ffffff</color>
|
||||
<color name="accent">#304e9a</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
@ -11,12 +13,13 @@
|
||||
<color name="divider">#304e9a</color>
|
||||
<color name="white">#FAFAFA</color>
|
||||
<color name="gray_list_bg">#0d000000</color>
|
||||
<color name="drawer_background">#ffffff</color>
|
||||
<color name="drawer_background_day">#ffffff</color>
|
||||
<color name="drawer_background_night">#5a5a5a</color>
|
||||
<color name="selected_light">#0F000000</color>
|
||||
<color name="divider_light">#2b3f6a</color>
|
||||
<color name="greyed_out_selected">#BDBDBD</color>
|
||||
<color name="black_regular_mat_design">#212121</color>
|
||||
<color name="grey">#808080</color>
|
||||
<color name="grey">#5a5a5a</color>
|
||||
<color name="blue_grey">#ECEFF1</color>
|
||||
<color name="foreground_material_dark">@android:color/white</color>
|
||||
</resources>
|
@ -18,16 +18,23 @@
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="arrowBackDrawable">@drawable/ic_action_back</item>
|
||||
<item name="arrowForwardDrawable">@drawable/ic_action_forward</item>
|
||||
<item name="drawerBackground">@color/drawer_background</item>
|
||||
<item name="drawerBackground">@color/drawer_background_day</item>
|
||||
<item name="plusDrawable">@drawable/ic_action_plus</item>
|
||||
<item name="deleteDrawable">@drawable/ic_action_delete</item>
|
||||
<item name="dividerColor">@color/divider_light</item>
|
||||
<item name="selectedBackground">@drawable/list_bg_light</item>
|
||||
<item name="android:itemBackground">@color/primary_light</item>
|
||||
<item name="android:windowTranslucentStatus" tools:targetApi="19">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Main">
|
||||
<item name="android:windowTranslucentStatus" tools:targetApi="19">true</item>
|
||||
<style name="AppTheme.Night" parent="AppTheme.Base">
|
||||
<item name="colorPrimary">@color/primary_night</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark_night</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="progressBackgroundColor">@color/primary_dark_night</item>
|
||||
<item name="drawerBackground">@color/drawer_background_night</item>
|
||||
<item name="listBackground">@color/grey</item>
|
||||
<item name="android:itemBackground">@color/grey</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Launcher">
|
||||
|
@ -21,8 +21,11 @@
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@ -54,16 +57,20 @@ public class BookmarksActivity extends AppCompatActivity
|
||||
private ArrayAdapter adapter;
|
||||
private ArrayList<String> selected;
|
||||
private int numOfSelected;
|
||||
private LinearLayout snackbarLayout;
|
||||
private CoordinatorLayout snackbarLayout;
|
||||
private LinearLayout noBookmarksLayout;
|
||||
private BookmarksDao bookmarksDao;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_NIGHT_MODE, false)) {
|
||||
setTheme(R.style.AppTheme_Night);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_bookmarks);
|
||||
setUpToolbar();
|
||||
snackbarLayout = (LinearLayout) findViewById(R.id.bookmarks_activity_layout);
|
||||
snackbarLayout = (CoordinatorLayout) findViewById(R.id.bookmarks_activity_layout);
|
||||
selected = new ArrayList<>();
|
||||
bookmarksList = (ListView) findViewById(R.id.bookmarks_list);
|
||||
noBookmarksLayout = (LinearLayout) findViewById(R.id.bookmarks_none_linlayout);
|
||||
|
@ -125,7 +125,7 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
|
||||
|
||||
private static final String TAG_CURRENT_TAB = "currenttab";
|
||||
|
||||
private static final String PREF_NIGHT_MODE = "pref_nightmode";
|
||||
public static final String PREF_NIGHT_MODE = "pref_nightmode";
|
||||
|
||||
private static final String PREF_KIWIX_MOBILE = "kiwix-mobile";
|
||||
|
||||
@ -285,6 +285,11 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
nightMode = sharedPreferences.getBoolean(PREF_NIGHT_MODE, false);
|
||||
if (nightMode) {
|
||||
setTheme(R.style.AppTheme_Night);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
handleLocaleCheck();
|
||||
setContentView(R.layout.main);
|
||||
@ -296,7 +301,6 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
|
||||
|
||||
initPlayStoreUri();
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
isHideToolbar = sharedPreferences.getBoolean(PREF_HIDE_TOOLBAR, false);
|
||||
|
||||
FileReader fileReader = new FileReader();
|
||||
@ -1054,10 +1058,8 @@ public class KiwixMobileActivity extends AppCompatActivity implements WebViewCal
|
||||
selectTab(currentWebViewIndex);
|
||||
}
|
||||
if (refresh) {
|
||||
for (KiwixWebView kiwixWebView : mWebViews) {
|
||||
kiwixWebView.reload();
|
||||
}
|
||||
refresh = false;
|
||||
recreate();
|
||||
}
|
||||
if (menu != null) {
|
||||
refreshBookmarkSymbol(menu);
|
||||
|
@ -3,7 +3,9 @@ package org.kiwix.kiwixmobile;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
@ -43,6 +45,10 @@ public class SearchActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_NIGHT_MODE, false)) {
|
||||
setTheme(R.style.AppTheme_Night);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
View contentView = LayoutInflater.from(this).inflate(R.layout.search, null);
|
||||
setContentView(contentView);
|
||||
|
@ -2,7 +2,9 @@ package org.kiwix.kiwixmobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.app.Fragment;
|
||||
@ -60,6 +62,10 @@ public class ZimManageActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_NIGHT_MODE, false)) {
|
||||
setTheme(R.style.AppTheme_Night);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.zim_manager);
|
||||
|
||||
|
@ -81,6 +81,10 @@ public class KiwixSettingsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_NIGHT_MODE, false)) {
|
||||
setTheme(R.style.AppTheme_Night);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
|
||||
@ -252,6 +256,7 @@ public class KiwixSettingsActivity extends AppCompatActivity {
|
||||
}
|
||||
if (key.equals(PREF_NIGHTMODE)) {
|
||||
KiwixMobileActivity.refresh = true;
|
||||
getActivity().recreate();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user