_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q5700
DefaultConfiguration.getKubernetesConfigurationUrl
train
public static URL getKubernetesConfigurationUrl(Map<String, String> map) throws MalformedURLException { if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, ""))) { return new URL(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, "")); } else if (Strings...
java
{ "resource": "" }
q5701
DefaultConfiguration.findConfigResource
train
public static URL findConfigResource(String resourceName) { if (Strings.isNullOrEmpty(resourceName)) { return null; } final URL url = resourceName.startsWith(ROOT) ? DefaultConfiguration.class.getResource(resourceName) : DefaultConfiguration.class.getResource(ROOT + reso...
java
{ "resource": "" }
q5702
DefaultConfiguration.asUrlOrResource
train
public static URL asUrlOrResource(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { return new URL(s); } catch (MalformedURLException e) { //If its not a valid URL try to treat it as a local resource. return findConfigResour...
java
{ "resource": "" }
q5703
OpenShiftAssistant.deploy
train
@Override public void deploy(InputStream inputStream) throws IOException { final List<? extends HasMetadata> entities = deploy("application", inputStream); if (this.applicationName == null) { Optional<String> deploymentConfig = entities.stream() .filter(hm -> hm instanc...
java
{ "resource": "" }
q5704
OpenShiftAssistant.getRoute
train
public Optional<URL> getRoute(String routeName) { Route route = getClient().routes() .inNamespace(namespace).withName(routeName).get(); return route != null ? Optional.ofNullable(createUrlFromRoute(route)) : Optional.empty(); }
java
{ "resource": "" }
q5705
OpenShiftAssistant.getRoute
train
public Optional<URL> getRoute() { Optional<Route> optionalRoute = getClient().routes().inNamespace(namespace) .list().getItems() .stream() .findFirst(); return optionalRoute .map(OpenShiftRouteLocator::createUrlFromRoute); }
java
{ "resource": "" }
q5706
OpenShiftAssistant.projectExists
train
public boolean projectExists(String name) throws IllegalArgumentException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Project name cannot be empty"); } return listProjects().stream() .map(p -> p.getMetadata().getName()) .anyMatc...
java
{ "resource": "" }
q5707
OpenShiftAssistant.findProject
train
public Optional<Project> findProject(String name) throws IllegalArgumentException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Project name cannot be empty"); } return getProject(name); }
java
{ "resource": "" }
q5708
Constraints.loadConstraint
train
private static Constraint loadConstraint(Annotation context) { Constraint constraint = null; final ServiceLoader<Constraint> constraints = ServiceLoader.load(Constraint.class); for (Constraint aConstraint : constraints) { try { aConstraint.getClass().getDeclaredMetho...
java
{ "resource": "" }
q5709
CEEnvironmentProcessor.createEnvironment
train
public void createEnvironment(@Observes(precedence = 10) BeforeClass event, OpenShiftAdapter client, CubeOpenShiftConfiguration cubeOpenShiftConfiguration) { final TestClass testClass = event.getTestClass(); log.info(String.format("Creating environment for %s", testClass.getName())); Ope...
java
{ "resource": "" }
q5710
DockerContainerObjectBuilder.withContainerObjectClass
train
public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass) { if (containerObjectClass == null) { throw new IllegalArgumentException("container object class cannot be null"); } this.containerObjectClass = containerObjectClass; //First we ch...
java
{ "resource": "" }
q5711
DockerContainerObjectBuilder.withEnrichers
train
public DockerContainerObjectBuilder<T> withEnrichers(Collection<TestEnricher> enrichers) { if (enrichers == null) { throw new IllegalArgumentException("enrichers cannot be null"); } this.enrichers = enrichers; return this; }
java
{ "resource": "" }
q5712
DockerContainerObjectBuilder.build
train
public T build() throws IllegalAccessException, IOException, InvocationTargetException { generatedConfigutation = new CubeContainer(); findContainerName(); // if needed, prepare prepare resources required to build a docker image prepareImageBuild(); // instantiate container obje...
java
{ "resource": "" }
q5713
DockerContainerDefinitionParser.resolveDockerDefinition
train
private static Path resolveDockerDefinition(Path fullpath) { final Path ymlPath = fullpath.resolveSibling(fullpath.getFileName() + ".yml"); if (Files.exists(ymlPath)) { return ymlPath; } else { final Path yamlPath = fullpath.resolveSibling(fullpath.getFileName() + ".yaml"...
java
{ "resource": "" }
q5714
ResourceUtil.awaitRoute
train
public static void awaitRoute(URL routeUrl, int timeout, TimeUnit timeoutUnit, int repetitions, int... statusCodes) { AtomicInteger successfulAwaitsInARow = new AtomicInteger(0); await().atMost(timeout, timeoutUnit).until(() -> { if (tryConnect(routeUrl, statusCodes)) { succe...
java
{ "resource": "" }
q5715
ReflectionUtil.getConstructor
train
public static Constructor<?> getConstructor(final Class<?> clazz, final Class<?>... argumentTypes) throws NoSuchMethodException { try { return AccessController .doPrivileged(new PrivilegedExceptionAction<Constructor<?>>() { public Constructor<?> run() ...
java
{ "resource": "" }
q5716
ConfigUtil.getStringProperty
train
public static String getStringProperty(String name, Map<String, String> map, String defaultValue) { if (map.containsKey(name) && Strings.isNotNullOrEmpty(map.get(name))) { defaultValue = map.get(name); } return getPropertyOrEnvironmentVariable(name, defaultValue); }
java
{ "resource": "" }
q5717
OpenShiftAssistantTemplate.parameter
train
public OpenShiftAssistantTemplate parameter(String name, String value) { parameterValues.put(name, value); return this; }
java
{ "resource": "" }
q5718
Timespan.create
train
public static Timespan create(Timespan... timespans) { if (timespans == null) { return null; } if (timespans.length == 0) { return ZERO_MILLISECONDS; } Timespan res = timespans[0]; for (int i = 1; i < timespans.length; i++) { Timespa...
java
{ "resource": "" }
q5719
InstallSeleniumCube.install
train
public void install(@Observes(precedence = 90) CubeDockerConfiguration configuration, ArquillianDescriptor arquillianDescriptor) { DockerCompositions cubes = configuration.getDockerContainersContent(); final SeleniumContainers seleniumContainers = SeleniumContainers.create(getBrows...
java
{ "resource": "" }
q5720
DockerMachine.startDockerMachine
train
public void startDockerMachine(String cliPathExec, String machineName) { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec), "start", machineName); this.manuallyStarted = true; }
java
{ "resource": "" }
q5721
DockerMachine.isDockerMachineInstalled
train
public boolean isDockerMachineInstalled(String cliPathExec) { try { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec)); return true; } catch (Exception e) { return false; } }
java
{ "resource": "" }
q5722
DockerCompositions.overrideCubeProperties
train
public void overrideCubeProperties(DockerCompositions overrideDockerCompositions) { final Set<String> containerIds = overrideDockerCompositions.getContainerIds(); for (String containerId : containerIds) { // main definition of containers contains a container that must be overrode ...
java
{ "resource": "" }
q5723
DockerComposeEnvironmentVarResolver.replaceParameters
train
public static String replaceParameters(final InputStream stream) { String content = IOUtil.asStringPreservingNewLines(stream); return resolvePlaceholders(content); }
java
{ "resource": "" }
q5724
Strings.join
train
public static String join(final Collection<?> collection, final String separator) { StringBuffer buffer = new StringBuffer(); boolean first = true; Iterator<?> iter = collection.iterator(); while (iter.hasNext()) { Object next = iter.next(); if (first) { ...
java
{ "resource": "" }
q5725
Strings.splitAsList
train
public static List<String> splitAsList(String text, String delimiter) { List<String> answer = new ArrayList<String>(); if (text != null && text.length() > 0) { answer.addAll(Arrays.asList(text.split(delimiter))); } return answer; }
java
{ "resource": "" }
q5726
Strings.splitAndTrimAsList
train
public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { ...
java
{ "resource": "" }
q5727
TemplateContainerStarter.waitForDeployments
train
public void waitForDeployments(@Observes(precedence = -100) AfterStart event, OpenShiftAdapter client, CEEnvironmentProcessor.TemplateDetails details, TestClass testClass, CubeOpenShiftConfiguration configuration, OpenShiftClient openshiftClient) throws Exception { if (testClass == null) { ...
java
{ "resource": "" }
q5728
IpAddressValidator.validate
train
public static boolean validate(final String ip) { Matcher matcher = pattern.matcher(ip); return matcher.matches(); }
java
{ "resource": "" }
q5729
BackHandlingFilePickerActivity.getFragment
train
@Override protected AbstractFilePickerFragment<File> getFragment( final String startPath, final int mode, final boolean allowMultiple, final boolean allowDirCreate, final boolean allowExistingFile, final boolean singleClick) { // startPath is allowed to be null. ...
java
{ "resource": "" }
q5730
FilePickerFragment.getParent
train
@NonNull @Override public File getParent(@NonNull final File from) { if (from.getPath().equals(getRoot().getPath())) { // Already at root, we can't go higher return from; } else if (from.getParentFile() != null) { return from.getParentFile(); } else { ...
java
{ "resource": "" }
q5731
FilePickerFragment.getLoader
train
@NonNull @Override public Loader<SortedList<File>> getLoader() { return new AsyncTaskLoader<SortedList<File>>(getActivity()) { FileObserver fileObserver; @Override public SortedList<File> loadInBackground() { File[] listFiles = mCurrentPath.listFiles...
java
{ "resource": "" }
q5732
AbstractFilePickerFragment.onLoadFinished
train
@Override public void onLoadFinished(final Loader<SortedList<T>> loader, final SortedList<T> data) { isLoading = false; mCheckedItems.clear(); mCheckedVisibleViewHolders.clear(); mFiles = data; mAdapter.setList(data); if (mCurrentDirView...
java
{ "resource": "" }
q5733
AbstractFilePickerFragment.clearSelections
train
public void clearSelections() { for (CheckableViewHolder vh : mCheckedVisibleViewHolders) { vh.checkbox.setChecked(false); } mCheckedVisibleViewHolders.clear(); mCheckedItems.clear(); }
java
{ "resource": "" }
q5734
MultimediaPickerFragment.isMultimedia
train
protected boolean isMultimedia(File file) { //noinspection SimplifiableIfStatement if (isDir(file)) { return false; } String path = file.getPath().toLowerCase(); for (String ext : MULTIMEDIA_EXTENSIONS) { if (path.endsWith(ext)) { return t...
java
{ "resource": "" }
q5735
FtpPickerFragment.getLoader
train
@NonNull @Override public Loader<SortedList<FtpFile>> getLoader() { return new AsyncTaskLoader<SortedList<FtpFile>>(getContext()) { @Override public SortedList<FtpFile> loadInBackground() { SortedList<FtpFile> sortedList = new SortedList<>(FtpFile.class, new Sorte...
java
{ "resource": "" }
q5736
UserAndTimestamp.timestamp
train
@JsonProperty public String timestamp() { if (timestampAsText == null) { timestampAsText = DateTimeFormatter.ISO_INSTANT.format(timestamp); } return timestampAsText; }
java
{ "resource": "" }
q5737
CentralDogma.forConfig
train
public static CentralDogma forConfig(File configFile) throws IOException { requireNonNull(configFile, "configFile"); return new CentralDogma(Jackson.readValue(configFile, CentralDogmaConfig.class)); }
java
{ "resource": "" }
q5738
CentralDogma.activePort
train
public Optional<ServerPort> activePort() { final Server server = this.server; return server != null ? server.activePort() : Optional.empty(); }
java
{ "resource": "" }
q5739
CentralDogma.activePorts
train
public Map<InetSocketAddress, ServerPort> activePorts() { final Server server = this.server; if (server != null) { return server.activePorts(); } else { return Collections.emptyMap(); } }
java
{ "resource": "" }
q5740
CentralDogma.stop
train
public CompletableFuture<Void> stop() { numPendingStopRequests.incrementAndGet(); return startStop.stop().thenRun(numPendingStopRequests::decrementAndGet); }
java
{ "resource": "" }
q5741
ProjectInitializer.initializeInternalProject
train
public static void initializeInternalProject(CommandExecutor executor) { final long creationTimeMillis = System.currentTimeMillis(); try { executor.execute(createProject(creationTimeMillis, Author.SYSTEM, INTERNAL_PROJ)) .get(); } catch (Throwable cause) { ...
java
{ "resource": "" }
q5742
ZooKeeperCommandExecutor.doExecute
train
@Override protected <T> CompletableFuture<T> doExecute(Command<T> command) throws Exception { final CompletableFuture<T> future = new CompletableFuture<>(); executor.execute(() -> { try { future.complete(blockingExecute(command)); } catch (Throwable t) { ...
java
{ "resource": "" }
q5743
WatchTimeout.makeReasonable
train
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) { checkArgument(expectedTimeoutMillis > 0, "expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis); checkArgument(bufferMillis >= 0, "bufferMillis: %s (expected: > 0)"...
java
{ "resource": "" }
q5744
CentralDogmaBuilder.port
train
public CentralDogmaBuilder port(InetSocketAddress localAddress, SessionProtocol protocol) { return port(new ServerPort(localAddress, protocol)); }
java
{ "resource": "" }
q5745
GitRepository.close
train
void close(Supplier<CentralDogmaException> failureCauseSupplier) { requireNonNull(failureCauseSupplier, "failureCauseSupplier"); if (closePending.compareAndSet(null, failureCauseSupplier)) { repositoryWorker.execute(() -> { rwLock.writeLock().lock(); try { ...
java
{ "resource": "" }
q5746
GitRepository.diff
train
@Override public CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern) { final ServiceRequestContext ctx = context(); return CompletableFuture.supplyAsync(() -> { requireNonNull(from, "from"); requireNonNull(to, "to"); requ...
java
{ "resource": "" }
q5747
GitRepository.uncachedHeadRevision
train
private Revision uncachedHeadRevision() { try (RevWalk revWalk = new RevWalk(jGitRepository)) { final ObjectId headRevisionId = jGitRepository.resolve(R_HEADS_MASTER); if (headRevisionId != null) { final RevCommit revCommit = revWalk.parseCommit(headRevisionId); ...
java
{ "resource": "" }
q5748
Util.simpleTypeName
train
public static String simpleTypeName(Object obj) { if (obj == null) { return "null"; } return simpleTypeName(obj.getClass(), false); }
java
{ "resource": "" }
q5749
AbstractCentralDogmaBuilder.accessToken
train
public final B accessToken(String accessToken) { requireNonNull(accessToken, "accessToken"); checkArgument(!accessToken.isEmpty(), "accessToken is empty."); this.accessToken = accessToken; return self(); }
java
{ "resource": "" }
q5750
JsonPatch.fromJson
train
public static JsonPatch fromJson(final JsonNode node) throws IOException { requireNonNull(node, "node"); try { return Jackson.treeToValue(node, JsonPatch.class); } catch (JsonMappingException e) { throw new JsonPatchException("invalid JSON patch", e); } }
java
{ "resource": "" }
q5751
JsonPatch.generate
train
public static JsonPatch generate(final JsonNode source, final JsonNode target, ReplaceMode replaceMode) { requireNonNull(source, "source"); requireNonNull(target, "target"); final DiffProcessor processor = new DiffProcessor(replaceMode, () -> unchangedValues(source, target)); generateDif...
java
{ "resource": "" }
q5752
JsonPatch.apply
train
public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; }
java
{ "resource": "" }
q5753
Converter.convert
train
static Project convert( String name, com.linecorp.centraldogma.server.storage.project.Project project) { return new Project(name); }
java
{ "resource": "" }
q5754
CachingProctorStore.getMatrixHistory
train
@Override public List<Revision> getMatrixHistory(final int start, final int limit) throws StoreException { return delegate.getMatrixHistory(start, limit); }
java
{ "resource": "" }
q5755
SvnWorkspaceProviderImpl.getUserDirectory
train
private static File getUserDirectory(final String prefix, final String suffix, final File parent) { final String dirname = formatDirName(prefix, suffix); return new File(parent, dirname); }
java
{ "resource": "" }
q5756
SvnWorkspaceProviderImpl.formatDirName
train
private static String formatDirName(final String prefix, final String suffix) { // Replace all invalid characters with '-' final CharMatcher invalidCharacters = VALID_SUFFIX_CHARS.negate(); return String.format("%s-%s", prefix, invalidCharacters.trimAndCollapseFrom(suffix.toLowerCase(), '-')); ...
java
{ "resource": "" }
q5757
SvnWorkspaceProviderImpl.deleteUserDirectories
train
private static void deleteUserDirectories(final File root, final FileFilter filter) { final File[] dirs = root.listFiles(filter); LOGGER.info("Identified (" + dirs.length + ") directories to delete"); for (final File dir : dirs) { LOGGER....
java
{ "resource": "" }
q5758
Proctor.construct
train
@Nonnull public static Proctor construct(@Nonnull final TestMatrixArtifact matrix, ProctorLoadResult loadResult, FunctionMapper functionMapper) { final ExpressionFactory expressionFactory = RuleEvaluator.EXPRESSION_FACTORY; final Map<String, TestChooser<?>> testChoosers = Maps.newLinkedHashMap(); ...
java
{ "resource": "" }
q5759
ProctorUtils.verifyWithoutSpecification
train
public static ProctorLoadResult verifyWithoutSpecification(@Nonnull final TestMatrixArtifact testMatrix, final String matrixSource) { final ProctorLoadResult.Builder resultBuilder = ProctorLoadResult.newBuilder(); for (final Entry<String, C...
java
{ "resource": "" }
q5760
ProctorUtils.verify
train
public static ProctorLoadResult verify( @Nonnull final TestMatrixArtifact testMatrix, final String matrixSource, @Nonnull final Map<String, TestSpecification> requiredTests, @Nonnull final FunctionMapper functionMapper, final ProvidedContext providedContext, ...
java
{ "resource": "" }
q5761
ProctorUtils.isEmptyWhitespace
train
static boolean isEmptyWhitespace(@Nullable final String s) { if (s == null) { return true; } return CharMatcher.WHITESPACE.matchesAllOf(s); }
java
{ "resource": "" }
q5762
ProctorUtils.generateSpecification
train
public static TestSpecification generateSpecification(@Nonnull final TestDefinition testDefinition) { final TestSpecification testSpecification = new TestSpecification(); // Sort buckets by value ascending final Map<String,Integer> buckets = Maps.newLinkedHashMap(); final List<TestBucket...
java
{ "resource": "" }
q5763
AbstractGroups.getPayload
train
@Nonnull protected Payload getPayload(final String testName) { // Get the current bucket. final TestBucket testBucket = buckets.get(testName); // Lookup Payloads for this test if (testBucket != null) { final Payload payload = testBucket.getPayload(); if (null...
java
{ "resource": "" }
q5764
ProctorConsumerUtils.parseForcedGroups
train
@Nonnull public static Map<String, Integer> parseForcedGroups(@Nonnull final HttpServletRequest request) { final String forceGroupsList = getForceGroupsStringFromRequest(request); return parseForceGroupsList(forceGroupsList); }
java
{ "resource": "" }
q5765
Payload.precheckStateAllNull
train
private void precheckStateAllNull() throws IllegalStateException { if ((doubleValue != null) || (doubleArray != null) || (longValue != null) || (longArray != null) || (stringValue != null) || (stringArray != null) || (map != null)) { throw new IllegalStateExceptio...
java
{ "resource": "" }
q5766
SampleRandomGroupsHttpHandler.runSampling
train
private Map<String, Integer> runSampling( final ProctorContext proctorContext, final Set<String> targetTestNames, final TestType testType, final int determinationsToRun ) { final Set<String> targetTestGroups = getTargetTestGroups(targetTestNames); fina...
java
{ "resource": "" }
q5767
SampleRandomGroupsHttpHandler.getProctorNotNull
train
private Proctor getProctorNotNull() { final Proctor proctor = proctorLoader.get(); if (proctor == null) { throw new IllegalStateException("Proctor specification and/or text matrix has not been loaded"); } return proctor; }
java
{ "resource": "" }
q5768
DynamicFilters.registerFilterTypes
train
@SafeVarargs public static void registerFilterTypes(final Class<? extends DynamicFilter>... types) { FILTER_TYPES.addAll(Arrays.asList(types)); }
java
{ "resource": "" }
q5769
AbstractSampleRandomGroupsController.getProctorContext
train
private ProctorContext getProctorContext(final HttpServletRequest request) throws IllegalAccessException, InstantiationException { final ProctorContext proctorContext = contextClass.newInstance(); final BeanWrapper beanWrapper = new BeanWrapperImpl(proctorContext); for (final PropertyDescriptor ...
java
{ "resource": "" }
q5770
GitProctorUtils.resolveSvnMigratedRevision
train
public static String resolveSvnMigratedRevision(final Revision revision, final String branch) { if (revision == null) { return null; } final Pattern pattern = Pattern.compile("^git-svn-id: .*" + branch + "@([0-9]+) ", Pattern.MULTILINE); final Matcher matcher = pattern.matche...
java
{ "resource": "" }
q5771
RosettaMapper.mapRow
train
public T mapRow(ResultSet rs) throws SQLException { Map<String, Object> map = new HashMap<String, Object>(); ResultSetMetaData metadata = rs.getMetaData(); for (int i = 1; i <= metadata.getColumnCount(); ++i) { String label = metadata.getColumnLabel(i); final Object value; // calling get...
java
{ "resource": "" }
q5772
OpacityBar.getOpacity
train
public int getOpacity() { int opacity = Math .round((mPosToOpacFactor * (mBarPointerPosition - mBarPointerHaloRadius))); if (opacity < 5) { return 0x00; } else if (opacity > 250) { return 0xFF; } else { return opacity; } }
java
{ "resource": "" }
q5773
ColorPicker.calculateColor
train
private int calculateColor(float angle) { float unit = (float) (angle / (2 * Math.PI)); if (unit < 0) { unit += 1; } if (unit <= 0) { mColor = COLORS[0]; return COLORS[0]; } if (unit >= 1) { mColor = COLORS[COLORS.length - 1]; return COLORS[COLORS.length - 1]; } float p = unit * (COLORS...
java
{ "resource": "" }
q5774
ColorPicker.colorToAngle
train
private float colorToAngle(int color) { float[] colors = new float[3]; Color.colorToHSV(color, colors); return (float) Math.toRadians(-colors[0]); }
java
{ "resource": "" }
q5775
ColorPicker.calculatePointerPosition
train
private float[] calculatePointerPosition(float angle) { float x = (float) (mColorWheelRadius * Math.cos(angle)); float y = (float) (mColorWheelRadius * Math.sin(angle)); return new float[] { x, y }; }
java
{ "resource": "" }
q5776
ColorPicker.addOpacityBar
train
public void addOpacityBar(OpacityBar bar) { mOpacityBar = bar; // Give an instance of the color picker to the Opacity bar. mOpacityBar.setColorPicker(this); mOpacityBar.setColor(mColor); }
java
{ "resource": "" }
q5777
ColorPicker.setNewCenterColor
train
public void setNewCenterColor(int color) { mCenterNewColor = color; mCenterNewPaint.setColor(color); if (mCenterOldColor == 0) { mCenterOldColor = color; mCenterOldPaint.setColor(color); } if (onColorChangedListener != null && color != oldChangedListenerColor ) { onColorChangedListener.onColorChanged...
java
{ "resource": "" }
q5778
SVBar.setValue
train
public void setValue(float value) { mBarPointerPosition = Math.round((mSVToPosFactor * (1 - value)) + mBarPointerHaloRadius + (mBarLength / 2)); calculateColor(mBarPointerPosition); mBarPointerPaint.setColor(mColor); // Check whether the Saturation/Value bar is added to the ColorPicker // wheel if (mPic...
java
{ "resource": "" }
q5779
UIUtils.getNavigationBarHeight
train
public static int getNavigationBarHeight(Context context) { Resources resources = context.getResources(); int id = resources.getIdentifier(context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "...
java
{ "resource": "" }
q5780
UIUtils.getActionBarHeight
train
public static int getActionBarHeight(Context context) { int actionBarHeight = UIUtils.getThemeAttributeDimensionSize(context, R.attr.actionBarSize); if (actionBarHeight == 0) { actionBarHeight = context.getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material); ...
java
{ "resource": "" }
q5781
UIUtils.getStatusBarHeight
train
public static int getStatusBarHeight(Context context, boolean force) { int result = 0; int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = context.getResources().getDimensionPixelSize(resourceId); } ...
java
{ "resource": "" }
q5782
UIUtils.setTranslucentStatusFlag
train
public static void setTranslucentStatusFlag(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, on); } }
java
{ "resource": "" }
q5783
UIUtils.setTranslucentNavigationFlag
train
public static void setTranslucentNavigationFlag(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on); } }
java
{ "resource": "" }
q5784
UIUtils.setFlag
train
public static void setFlag(Activity activity, final int bits, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.s...
java
{ "resource": "" }
q5785
UIUtils.getScreenWidth
train
public static int getScreenWidth(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return metrics.widthPixels; }
java
{ "resource": "" }
q5786
UIUtils.getScreenHeight
train
public static int getScreenHeight(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return metrics.heightPixels; }
java
{ "resource": "" }
q5787
MaterializeBuilder.withActivity
train
public MaterializeBuilder withActivity(Activity activity) { this.mRootView = (ViewGroup) activity.findViewById(android.R.id.content); this.mActivity = activity; return this; }
java
{ "resource": "" }
q5788
MaterializeBuilder.withContainer
train
public MaterializeBuilder withContainer(ViewGroup container, ViewGroup.LayoutParams layoutParams) { this.mContainer = container; this.mContainerLayoutParams = layoutParams; return this; }
java
{ "resource": "" }
q5789
Materialize.setFullscreen
train
public void setFullscreen(boolean fullscreen) { if (mBuilder.mScrimInsetsLayout != null) { mBuilder.mScrimInsetsLayout.setTintStatusBar(!fullscreen); mBuilder.mScrimInsetsLayout.setTintNavigationBar(!fullscreen); } }
java
{ "resource": "" }
q5790
Materialize.setStatusBarColor
train
public void setStatusBarColor(int statusBarColor) { if (mBuilder.mScrimInsetsLayout != null) { mBuilder.mScrimInsetsLayout.setInsetForeground(statusBarColor); mBuilder.mScrimInsetsLayout.getView().invalidate(); } }
java
{ "resource": "" }
q5791
Materialize.keyboardSupportEnabled
train
public void keyboardSupportEnabled(Activity activity, boolean enable) { if (getContent() != null && getContent().getChildCount() > 0) { if (mKeyboardUtil == null) { mKeyboardUtil = new KeyboardUtil(activity, getContent().getChildAt(0)); mKeyboardUtil.disable(); ...
java
{ "resource": "" }
q5792
ColorHolder.applyTo
train
public void applyTo(Context ctx, GradientDrawable drawable) { if (mColorInt != 0) { drawable.setColor(mColorInt); } else if (mColorRes != -1) { drawable.setColor(ContextCompat.getColor(ctx, mColorRes)); } }
java
{ "resource": "" }
q5793
ColorHolder.applyToBackground
train
public void applyToBackground(View view) { if (mColorInt != 0) { view.setBackgroundColor(mColorInt); } else if (mColorRes != -1) { view.setBackgroundResource(mColorRes); } }
java
{ "resource": "" }
q5794
ColorHolder.applyToOr
train
public void applyToOr(TextView textView, ColorStateList colorDefault) { if (mColorInt != 0) { textView.setTextColor(mColorInt); } else if (mColorRes != -1) { textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes)); } else if (colorDefault != null) ...
java
{ "resource": "" }
q5795
ColorHolder.color
train
public int color(Context ctx) { if (mColorInt == 0 && mColorRes != -1) { mColorInt = ContextCompat.getColor(ctx, mColorRes); } return mColorInt; }
java
{ "resource": "" }
q5796
ColorHolder.color
train
public static int color(ColorHolder colorHolder, Context ctx) { if (colorHolder == null) { return 0; } else { return colorHolder.color(ctx); } }
java
{ "resource": "" }
q5797
ColorHolder.applyToOr
train
public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) { if (colorHolder != null && textView != null) { colorHolder.applyToOr(textView, colorDefault); } else if (textView != null) { textView.setTextColor(colorDefault); } ...
java
{ "resource": "" }
q5798
ColorHolder.applyToOrTransparent
train
public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) { if (colorHolder != null && gradientDrawable != null) { colorHolder.applyTo(ctx, gradientDrawable); } else if (gradientDrawable != null) { gradientDrawable.setColor(C...
java
{ "resource": "" }
q5799
ImageHolder.applyTo
train
public static boolean applyTo(ImageHolder imageHolder, ImageView imageView, String tag) { if (imageHolder != null && imageView != null) { return imageHolder.applyTo(imageView, tag); } return false; }
java
{ "resource": "" }