Skip to content

Commit

Permalink
Themer activity (#30) and some minor changes (0.5.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriDellal committed Dec 30, 2017
1 parent 2c25f3d commit fab907e
Show file tree
Hide file tree
Showing 26 changed files with 278 additions and 93 deletions.
17 changes: 7 additions & 10 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="26"
android:versionName="0.5.2.4" package="ru.henridellal.emerald"
android:versionCode="28"
android:versionName="0.5.3" package="ru.henridellal.emerald"
>

<!--android:configChanges="keyboard|keyboardHidden|orientation|screenSize"-->
Expand All @@ -23,14 +23,11 @@
android:label="@string/app_name"
android:icon="@drawable/icon">

<activity android:name=".AboutActivity" android:label="@string/aboutTitle">
</activity>
<activity android:name=".TutorialActivity" android:label="@string/how_to_use">
</activity>
<activity android:name=".CategoryManagerActivity" android:label="@string/categoryManager">
</activity>
<activity android:name=".Options" android:label="@string/launcherSettings">
</activity>
<activity android:name=".AboutActivity" android:label="@string/aboutTitle"/>
<activity android:name=".TutorialActivity" android:label="@string/how_to_use"/>
<activity android:name=".CategoryManagerActivity" android:label="@string/categoryManager"/>
<activity android:name=".Options" android:label="@string/launcherSettings"/>
<activity android:name=".ThemerActivity" android:label="@string/ui_colors"/>
<!--
-->
<activity android:name=".Apps"
Expand Down
Binary file removed res/drawable/menu.png
Binary file not shown.
Binary file removed res/drawable/menu_dark.png
Binary file not shown.
Binary file removed res/drawable/menu_dark_pressed.png
Binary file not shown.
Binary file removed res/drawable/menu_pressed.png
Binary file not shown.
Binary file removed res/drawable/search.png
Binary file not shown.
Binary file removed res/drawable/search_dark.png
Binary file not shown.
Binary file removed res/drawable/search_dark_pressed.png
Binary file not shown.
Binary file removed res/drawable/search_pressed.png
Binary file not shown.
Binary file removed res/drawable/web_search.png
Binary file not shown.
Binary file removed res/drawable/web_search_dark.png
Binary file not shown.
Binary file removed res/drawable/web_search_dark_pressed.png
Binary file not shown.
Binary file removed res/drawable/web_search_pressed.png
Binary file not shown.
51 changes: 51 additions & 0 deletions res/layout/themer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/ui_preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dp"
/>
<LinearLayout
android:id="@+id/color_mixer_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:visibility="gone">
<Button
android:id="@+id/color_mixer_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cwac_colormixer_cancel"
/>
<Button
android:id="@+id/color_mixer_apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cwac_colormixer_set"
/>
</LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/ui_settings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ScrollView
android:id="@+id/color_mixer_holder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<com.commonsware.cwac.colormixer.ColorMixer
android:id="@+id/color_mixer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</ScrollView>
</FrameLayout>
</LinearLayout>
9 changes: 6 additions & 3 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<string name="dock_height">Высота дока</string>
<string name="dock_icon_size">Размер иконок дока</string>
<string name="show_dock_in_landscape">Показывать в ландшафтном режиме</string>
<string name="dock_background">Цвет фона дока</string>
<string name="dock_background">Док</string>

<string name="createCategory">Создать категорию</string>
<string name="launcherSettings">Настройки лаунчера</string>
Expand All @@ -48,8 +48,11 @@
<string name="setHome">Выбрать домашней категорией</string>
<string name="hide">Скрыть</string>
<string name="unhide">Убрать из скрытых</string>
<string name="appsBackground">Цвет фона приложения</string>
<string name="barBackground">Цвет фона верхнего бара</string>
<string name="ui_colors">Цвета интерфейса</string>
<string name="appsBackground">Меню</string>
<string name="statusBarBackground">Статус-бар</string>
<string name="barBackground">Главная панель</string>
<string name="navBarBackground">Навигационный бар</string>
<string name="searchProvider">Сайт для поиска в интернете</string>
<string name="keepInMemory">Держать в памяти</string>
<string name="save_here">Сохранить в этой папке</string>
Expand Down
9 changes: 6 additions & 3 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
<string name="scrollbar">Show letter hint on scroll</string>
<string name="orientation">Screen orientation</string>
<string name="theme">Theme</string>
<string name="appsBackground">Apps window background color</string>
<string name="barBackground">Top bar background color</string>
<string name="ui_colors">UI colors</string>
<string name="appsBackground">Apps window</string>
<string name="statusBarBackground">Status bar</string>
<string name="barBackground">Top bar</string>
<string name="navBarBackground">Navigation bar</string>
<string name="iconPack">Icon pack</string>
<string name="transformIcons">Transform icons</string>
<string name="transformIconsSummary">Edit icons according to icon pack settings</string>
Expand Down Expand Up @@ -55,7 +58,7 @@
<string name="dock_height">Dock height</string>
<string name="dock_icon_size">Dock icon size</string>
<string name="show_dock_in_landscape">Show dock in landscape mode</string>
<string name="dock_background">Dock background</string>
<string name="dock_background">Dock</string>

<string name="change_wallpaper">Change wallpaper</string>
<string name="accessHidden">Access hidden apps</string>
Expand Down
23 changes: 6 additions & 17 deletions res/xml/options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@
android:title="@string/show_dock_in_landscape"
android:defaultValue="true"
android:key="show_dock_in_landscape"/>
<com.commonsware.cwac.colormixer.ColorPreference
android:key="dock_background"
android:defaultValue="0x22000000"
android:title="@string/dock_background" />
</PreferenceScreen>
<ru.henridellal.emerald.LaunchActivityPreference
android:title="@string/ui_colors"
android:key="themer"/>
<CheckBoxPreference
android:title="@string/tileView"
android:defaultValue="true"
Expand All @@ -88,16 +87,6 @@
android:entryValues="@array/themeValues"
android:title="@string/theme"
android:key="theme"/>
<com.commonsware.cwac.colormixer.ColorPreference
android:key="bar_background"
android:defaultValue="0x22000000"
android:title="@string/barBackground"
/>
<com.commonsware.cwac.colormixer.ColorPreference
android:key="apps_background"
android:defaultValue="0x00000000"
android:title="@string/appsBackground"
/>
<ListPreference
android:defaultValue="default"
android:title="@string/iconPack"
Expand All @@ -108,9 +97,9 @@
android:defaultValue="true"
android:key="transform_drawable"/>
</PreferenceScreen>
<ru.henridellal.emerald.CategoryManagerPreference
<ru.henridellal.emerald.LaunchActivityPreference
android:title="@string/categoryManager"
android:key="categoryManager"/>
android:key="category_manager"/>
<ru.henridellal.emerald.EditIntPreference
android:title="@string/historySize"
android:defaultValue="@integer/history_size_default"
Expand All @@ -121,7 +110,7 @@
android:summary="@string/passwordSummary"
android:defaultValue=""
android:key="password"/>
<ru.henridellal.emerald.AboutPreference
<ru.henridellal.emerald.LaunchActivityPreference
android:title="@string/aboutTitle"
android:key="about"/>
<ListPreference
Expand Down
24 changes: 0 additions & 24 deletions src/ru/henridellal/emerald/AboutPreference.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/ru/henridellal/emerald/Apps.java
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
if (Build.VERSION.SDK_INT >= 19) {
Themer.setWindowDecorations(this, options);
}
Themer.applyTheme(this, options);
spin = (Spinner)findViewById(R.id.category);
spin.setOnTouchListener(new SwipeListener(this));
dock = new Dock(this);
Expand Down Expand Up @@ -718,7 +719,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public void onResume() {
super.onResume();
Themer.applyTheme(this, options);
//Log.v(APP_TAG, "onResume");
appShortcut = Integer.parseInt(options.getString(Keys.APP_SHORTCUT, "3"));
lock = options.getString(Keys.PASSWORD, "").length() > 0;
Expand Down
5 changes: 0 additions & 5 deletions src/ru/henridellal/emerald/CategoryManagerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public void onItemClick(AdapterView<?> parent, View view,
int catNum, long id) {
String chosenCat = categories.get(catNum);
buildMenu(chosenCat);
//renameCategory(chosenCat);
//build and show new context menu
}

});
Expand All @@ -68,9 +66,6 @@ public void onClick(View v) {
}

private void buildMenu(final String category) {
/* if (category.equals(CategoryManager.ALL)) {
return;
}*/
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(category);
final boolean isHidden = cm.getCategory(category).isHidden();
Expand Down
24 changes: 0 additions & 24 deletions src/ru/henridellal/emerald/CategoryManagerPreference.java

This file was deleted.

1 change: 1 addition & 0 deletions src/ru/henridellal/emerald/EditIntPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected View onCreateDialogView() {
protected void onBindDialogView(View v) {
super.onBindDialogView(v);
tv.setText(lastValue.toString());
tv.requestFocusFromTouch();
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/ru/henridellal/emerald/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public final class Keys {

public static final String BAR_BACKGROUND = "bar_background";
public static final String DOCK_BACKGROUND = "dock_background";
public static final String NAV_BAR_BACKGROUND = "nav_bar_background";
public static final String STATUS_BAR_BACKGROUND = "status_bar_background";
public static final String APPS_WINDOW_BACKGROUND = "apps_background";

public static final String ICON_PACK = "icon_pack";
Expand Down Expand Up @@ -38,7 +40,8 @@ public final class Keys {
public static final String HISTORY_SIZE = "history_size";
public static final String PASSWORD = "password";

public static final String[] restart = {MESSAGE_SHOWN, BAR_BACKGROUND, DOCK_BACKGROUND, APPS_WINDOW_BACKGROUND, TILE, THEME, ORIENTATION, APP_SHORTCUT, KEEP_IN_MEMORY};


public static final String[] restart = {MESSAGE_SHOWN, BAR_BACKGROUND,
NAV_BAR_BACKGROUND, STATUS_BAR_BACKGROUND, DOCK_BACKGROUND,
APPS_WINDOW_BACKGROUND, TILE, THEME, ORIENTATION,
APP_SHORTCUT, KEEP_IN_MEMORY};
}
31 changes: 31 additions & 0 deletions src/ru/henridellal/emerald/LaunchActivityPreference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ru.henridellal.emerald;

//import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.preference.Preference;
import android.util.AttributeSet;

import java.util.HashMap;
import java.util.Map;

public class LaunchActivityPreference extends Preference {
public LaunchActivityPreference(Context c) {
this(c, null);
}
public LaunchActivityPreference(Context c, AttributeSet attr) {
super(c, attr);
}
@Override
public void onClick() {
super.onClick();
Map<String, Class> activityMap = new HashMap<String, Class>();
activityMap.put("about", AboutActivity.class);
activityMap.put("category_manager", CategoryManagerActivity.class);
activityMap.put("themer", ThemerActivity.class);
if (activityMap.containsKey(getKey())) {
Intent intent = new Intent(getContext(), activityMap.get(getKey()));
getContext().startActivity(intent);
}
}
}
6 changes: 3 additions & 3 deletions src/ru/henridellal/emerald/Themer.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public static void applyTheme(Activity activity, SharedPreferences options) {
}
public static void setWindowDecorations(Activity activity, SharedPreferences options) {
if (Build.VERSION.SDK_INT >= 21) {
activity.getWindow().setStatusBarColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
activity.getWindow().setNavigationBarColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
activity.getWindow().setStatusBarColor(options.getInt(Keys.STATUS_BAR_BACKGROUND, 0x22000000));
activity.getWindow().setNavigationBarColor(options.getInt(Keys.NAV_BAR_BACKGROUND, 0x22000000));
} else {
activity.findViewById(R.id.dummy_top_view).setBackgroundColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
Display display = ((WindowManager)activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Expand All @@ -93,7 +93,7 @@ public static void setWindowDecorations(Activity activity, SharedPreferences opt
dummyBottomView.setLayoutParams(p);
if (navBarHeight > 0) {
dummyBottomView.setVisibility(View.VISIBLE);
dummyBottomView.setBackgroundColor(options.getInt(Keys.DOCK_BACKGROUND, 0x22000000));
dummyBottomView.setBackgroundColor(options.getInt(Keys.NAV_BAR_BACKGROUND, 0x22000000));
}
}
}
Expand Down
Loading

0 comments on commit fab907e

Please sign in to comment.