Move Theme enum to extension API
Change-Id: I04b8c1ebbe373906cd7983f92d934eb56c2c47f8
This commit is contained in:

committed by
David Pursehouse

parent
1ca5f7f8af
commit
a5caa9a49f
@@ -8,6 +8,7 @@ gwt_module(
|
||||
SRC + 'common/InheritableBoolean.java',
|
||||
SRC + 'common/ListChangesOption.java',
|
||||
SRC + 'common/SubmitType.java',
|
||||
SRC + 'common/Theme.java',
|
||||
SRC + 'webui/GerritTopMenu.java',
|
||||
]),
|
||||
gwt_xml = SRC + 'Extensions.gwt.xml',
|
||||
|
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2014 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
public enum Theme {
|
||||
// Light themes
|
||||
DEFAULT,
|
||||
ECLIPSE,
|
||||
ELEGANT,
|
||||
NEAT,
|
||||
// Dark themes
|
||||
MIDNIGHT,
|
||||
NIGHT,
|
||||
TWILIGHT;
|
||||
|
||||
public boolean isDark() {
|
||||
switch (this) {
|
||||
case MIDNIGHT:
|
||||
case NIGHT:
|
||||
case TWILIGHT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,8 +14,8 @@
|
||||
|
||||
package com.google.gerrit.client.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
|
@@ -28,8 +28,8 @@ import com.google.gerrit.client.account.DiffPreferences;
|
||||
import com.google.gerrit.client.patches.PatchUtil;
|
||||
import com.google.gerrit.client.rpc.GerritCallback;
|
||||
import com.google.gerrit.client.ui.NpIntTextBox;
|
||||
import com.google.gerrit.extensions.common.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
|
||||
import com.google.gerrit.reviewdb.client.Patch.ChangeType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.reviewdb.client;
|
||||
|
||||
import com.google.gerrit.extensions.common.Theme;
|
||||
import com.google.gwtorm.client.Column;
|
||||
|
||||
/** Diff formatting preferences of an account */
|
||||
@@ -56,29 +57,6 @@ public class AccountDiffPreference {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Theme {
|
||||
// Light themes
|
||||
DEFAULT,
|
||||
ECLIPSE,
|
||||
ELEGANT,
|
||||
NEAT,
|
||||
// Dark themes
|
||||
MIDNIGHT,
|
||||
NIGHT,
|
||||
TWILIGHT;
|
||||
|
||||
public boolean isDark() {
|
||||
switch (this) {
|
||||
case MIDNIGHT:
|
||||
case NIGHT:
|
||||
case TWILIGHT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static AccountDiffPreference createDefault(Account.Id accountId) {
|
||||
AccountDiffPreference p = new AccountDiffPreference(accountId);
|
||||
p.setIgnoreWhitespace(Whitespace.IGNORE_NONE);
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Theme;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Theme;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Theme;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
|
Reference in New Issue
Block a user