repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
|---|---|---|---|---|---|---|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/HelpCommand.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
|
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.impl.CloseUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.regex.Pattern;
|
package org.jsoftware.dbpatch.command;
/**
* Command: Display help
*
* @author szalik
*/
public class HelpCommand extends AbstractCommand {
private static final Pattern TASK_PREFIX_PATTERN = Pattern.compile("\\[prefix:task\\]");
private static final Pattern PROPERTY_PREFIX_PATTERN = Pattern.compile("\\[prefix:property\\]");
private final String taskPrefix, propertyPrefix;
private final String commandTitle;
private HelpCommand(EnvSettings envSettings, String taskPrefix, String propertyPrefix, String commandTitle) {
super(envSettings);
this.taskPrefix = taskPrefix;
this.propertyPrefix = propertyPrefix;
this.commandTitle = commandTitle;
}
public void execute() throws CommandExecutionException {
execute(System.out);
}
void execute(PrintStream printStream) throws CommandExecutionException {
InputStream in = getClass().getResourceAsStream("/dbpatch-help.txt");
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
String s;
while ((s = br.readLine()) != null) {
s = replace(s);
printStream.println(s);
}
} catch (IOException e) {
throw new CommandExecutionException(e.getMessage(), e);
} finally {
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/HelpCommand.java
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.impl.CloseUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.regex.Pattern;
package org.jsoftware.dbpatch.command;
/**
* Command: Display help
*
* @author szalik
*/
public class HelpCommand extends AbstractCommand {
private static final Pattern TASK_PREFIX_PATTERN = Pattern.compile("\\[prefix:task\\]");
private static final Pattern PROPERTY_PREFIX_PATTERN = Pattern.compile("\\[prefix:property\\]");
private final String taskPrefix, propertyPrefix;
private final String commandTitle;
private HelpCommand(EnvSettings envSettings, String taskPrefix, String propertyPrefix, String commandTitle) {
super(envSettings);
this.taskPrefix = taskPrefix;
this.propertyPrefix = propertyPrefix;
this.commandTitle = commandTitle;
}
public void execute() throws CommandExecutionException {
execute(System.out);
}
void execute(PrintStream printStream) throws CommandExecutionException {
InputStream in = getClass().getResourceAsStream("/dbpatch-help.txt");
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
String s;
while ((s = br.readLine()) != null) {
s = replace(s);
printStream.println(s);
}
} catch (IOException e) {
throw new CommandExecutionException(e.getMessage(), e);
} finally {
|
CloseUtil.close(br);
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/InteractiveCommand.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractConfigurationParser.java
// public abstract class AbstractConfigurationParser {
//
// public static Collection<ConfigurationEntry> discoverConfiguration(File confFile) throws ParseException, IOException {
// final Log log = LogFactory.getInstance();
// InputStream input = null;
// File baseDir = null;
// try {
// if (confFile == null) {
// log.debug("Looking for dbpach.properties in classpath.");
// input = Thread.currentThread().getContextClassLoader().getResourceAsStream("/dbpatch.properties");
// log.debug("Resource dbpatch.properties " + (input == null ? "not" : "") + " found in classpath.");
// if (input == null) {
// log.debug("Looking for dbpach.properties in current directory.");
// File f = new File("dbpatch.properties");
// log.debug("Resource dbpatch.properties " + (!f.exists() ? "not" : "") + " found in current directory.");
// input = new FileInputStream(f);
// baseDir = new File(".");
// }
// } else {
// if (!confFile.exists()) {
// throw new FileNotFoundException(confFile.getAbsolutePath());
// }
// log.debug("Configuration found - " + confFile.getPath());
// input = new FileInputStream(confFile);
// baseDir = confFile.getParentFile();
// }
// AbstractConfigurationParser parser = new PropertiesConfigurationParser();
// Collection<ConfigurationEntry> conf = parser.parse(baseDir, input);
// for (ConfigurationEntry ce : conf) {
// ce.validate();
// }
// return conf;
// } finally {
// CloseUtil.close(input);
// }
// }
//
// protected abstract Collection<ConfigurationEntry> parse(File baseDir, InputStream input) throws ParseException, IOException;
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.jsoftware.dbpatch.config.AbstractConfigurationParser;
import org.jsoftware.dbpatch.config.ConfigurationEntry;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.impl.gui.InteractivePanel;
import java.util.Collection;
|
package org.jsoftware.dbpatch.command;
/**
* Command: Runs interactive client from maven
*
* @author szalik
*/
public class InteractiveCommand extends AbstractCommand {
public InteractiveCommand(EnvSettings envSettings) {
super(envSettings);
}
public void execute() throws CommandExecutionException, CommandFailureException {
try {
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractConfigurationParser.java
// public abstract class AbstractConfigurationParser {
//
// public static Collection<ConfigurationEntry> discoverConfiguration(File confFile) throws ParseException, IOException {
// final Log log = LogFactory.getInstance();
// InputStream input = null;
// File baseDir = null;
// try {
// if (confFile == null) {
// log.debug("Looking for dbpach.properties in classpath.");
// input = Thread.currentThread().getContextClassLoader().getResourceAsStream("/dbpatch.properties");
// log.debug("Resource dbpatch.properties " + (input == null ? "not" : "") + " found in classpath.");
// if (input == null) {
// log.debug("Looking for dbpach.properties in current directory.");
// File f = new File("dbpatch.properties");
// log.debug("Resource dbpatch.properties " + (!f.exists() ? "not" : "") + " found in current directory.");
// input = new FileInputStream(f);
// baseDir = new File(".");
// }
// } else {
// if (!confFile.exists()) {
// throw new FileNotFoundException(confFile.getAbsolutePath());
// }
// log.debug("Configuration found - " + confFile.getPath());
// input = new FileInputStream(confFile);
// baseDir = confFile.getParentFile();
// }
// AbstractConfigurationParser parser = new PropertiesConfigurationParser();
// Collection<ConfigurationEntry> conf = parser.parse(baseDir, input);
// for (ConfigurationEntry ce : conf) {
// ce.validate();
// }
// return conf;
// } finally {
// CloseUtil.close(input);
// }
// }
//
// protected abstract Collection<ConfigurationEntry> parse(File baseDir, InputStream input) throws ParseException, IOException;
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/InteractiveCommand.java
import org.jsoftware.dbpatch.config.AbstractConfigurationParser;
import org.jsoftware.dbpatch.config.ConfigurationEntry;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.impl.gui.InteractivePanel;
import java.util.Collection;
package org.jsoftware.dbpatch.command;
/**
* Command: Runs interactive client from maven
*
* @author szalik
*/
public class InteractiveCommand extends AbstractCommand {
public InteractiveCommand(EnvSettings envSettings) {
super(envSettings);
}
public void execute() throws CommandExecutionException, CommandFailureException {
try {
|
Collection<ConfigurationEntry> conf = AbstractConfigurationParser.discoverConfiguration(getConfigFile());
|
m-szalik/dbpatch
|
dbpatch-maven-plugin/src/main/java/org/jsoftware/dbpatch/maven/PatchMojo.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.jsoftware.dbpatch.command.PatchCommand;
import org.jsoftware.dbpatch.config.EnvSettings;
|
package org.jsoftware.dbpatch.maven;
/**
* Runs auto-patch mode
*
* @author szalik
* @goal patch
*/
public class PatchMojo extends CommandSingleConfMojoAdapter<PatchCommand> {
protected PatchMojo() {
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-maven-plugin/src/main/java/org/jsoftware/dbpatch/maven/PatchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.jsoftware.dbpatch.command.PatchCommand;
import org.jsoftware.dbpatch.config.EnvSettings;
package org.jsoftware.dbpatch.maven;
/**
* Runs auto-patch mode
*
* @author szalik
* @goal patch
*/
public class PatchMojo extends CommandSingleConfMojoAdapter<PatchCommand> {
protected PatchMojo() {
|
super(new PatchCommand(EnvSettings.maven()));
|
m-szalik/dbpatch
|
dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/ListCommandTest.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
|
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.Patch;
import org.junit.Assert;
import org.junit.Test;
import java.util.List;
|
package org.jsoftware.dbpatch.command;
public class ListCommandTest extends AbstractDbCommandTest {
@Test
public void testListCommand() throws Exception {
ListCommand command = prepareCommand(ListCommand.class);
List<Patch> list;
list = command.getList();
Assert.assertEquals(0, list.size());
addPatchToATestContext("010.patch1", "010.patch1.sql");
list = command.getList();
Assert.assertEquals(1, list.size());
Patch patch = list.get(0);
Assert.assertEquals("010.patch1", patch.getName());
Assert.assertEquals(2, patch.getStatementCount());
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
// Path: dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/ListCommandTest.java
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.Patch;
import org.junit.Assert;
import org.junit.Test;
import java.util.List;
package org.jsoftware.dbpatch.command;
public class ListCommandTest extends AbstractDbCommandTest {
@Test
public void testListCommand() throws Exception {
ListCommand command = prepareCommand(ListCommand.class);
List<Patch> list;
list = command.getList();
Assert.assertEquals(0, list.size());
addPatchToATestContext("010.patch1", "010.patch1.sql");
list = command.getList();
Assert.assertEquals(1, list.size());
Patch patch = list.get(0);
Assert.assertEquals("010.patch1", patch.getName());
Assert.assertEquals(2, patch.getStatementCount());
|
Assert.assertEquals(AbstractPatch.DbState.NOT_AVAILABLE, patch.getDbState());
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/dialect/SybaseDialect.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
//
// void trace(String msg, Throwable e);
//
// void debug(String msg);
//
// void info(String msg);
//
// void warn(String msg);
//
// void fatal(String msg);
//
// void warn(String msg, Throwable e);
//
// void fatal(String msg, Throwable e);
// }
|
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;
|
package org.jsoftware.dbpatch.config.dialect;
/**
* Sybase dialect
*
* @author Chandar Rayane
*/
public class SybaseDialect extends DefaultDialect {
private static final long serialVersionUID = -109096601395312248L;
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
//
// void trace(String msg, Throwable e);
//
// void debug(String msg);
//
// void info(String msg);
//
// void warn(String msg);
//
// void fatal(String msg);
//
// void warn(String msg, Throwable e);
//
// void fatal(String msg, Throwable e);
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/dialect/SybaseDialect.java
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;
package org.jsoftware.dbpatch.config.dialect;
/**
* Sybase dialect
*
* @author Chandar Rayane
*/
public class SybaseDialect extends DefaultDialect {
private static final long serialVersionUID = -109096601395312248L;
|
private static final Log logger = LogFactory.getInstance();
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/dialect/SybaseDialect.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
//
// void trace(String msg, Throwable e);
//
// void debug(String msg);
//
// void info(String msg);
//
// void warn(String msg);
//
// void fatal(String msg);
//
// void warn(String msg, Throwable e);
//
// void fatal(String msg, Throwable e);
// }
|
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;
|
package org.jsoftware.dbpatch.config.dialect;
/**
* Sybase dialect
*
* @author Chandar Rayane
*/
public class SybaseDialect extends DefaultDialect {
private static final long serialVersionUID = -109096601395312248L;
private static final Log logger = LogFactory.getInstance();
public void checkAndCreateStructure(Connection con) throws SQLException {
boolean autoCommit = con.getAutoCommit();
con.setAutoCommit(true);
ResultSet rs;
try {
rs = con.getMetaData().getTables(null, null, DBPATCH_TABLE_NAME, null);
boolean tableFound = rs.next();
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
//
// private CloseUtil() {
// }
//
// public static void close(Closeable closeable) {
// try {
// if (closeable != null) {
// closeable.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Statement statement) {
// try {
// if (statement != null) {
// statement.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(Connection conn) {
// try {
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// public static void close(ResultSet rs) {
// try {
// if (rs != null) {
// rs.close();
// }
// } catch (Exception e) { /* findBugs ok */ }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
//
// void trace(String msg, Throwable e);
//
// void debug(String msg);
//
// void info(String msg);
//
// void warn(String msg);
//
// void fatal(String msg);
//
// void warn(String msg, Throwable e);
//
// void fatal(String msg, Throwable e);
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/dialect/SybaseDialect.java
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;
package org.jsoftware.dbpatch.config.dialect;
/**
* Sybase dialect
*
* @author Chandar Rayane
*/
public class SybaseDialect extends DefaultDialect {
private static final long serialVersionUID = -109096601395312248L;
private static final Log logger = LogFactory.getInstance();
public void checkAndCreateStructure(Connection con) throws SQLException {
boolean autoCommit = con.getAutoCommit();
con.setAutoCommit(true);
ResultSet rs;
try {
rs = con.getMetaData().getTables(null, null, DBPATCH_TABLE_NAME, null);
boolean tableFound = rs.next();
|
CloseUtil.close(rs);
|
m-szalik/dbpatch
|
dbpatch-maven-plugin/src/main/java/org/jsoftware/dbpatch/maven/InteractiveMojo.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/InteractiveCommand.java
// public class InteractiveCommand extends AbstractCommand {
//
// public InteractiveCommand(EnvSettings envSettings) {
// super(envSettings);
// }
//
// public void execute() throws CommandExecutionException, CommandFailureException {
// try {
// Collection<ConfigurationEntry> conf = AbstractConfigurationParser.discoverConfiguration(getConfigFile());
// InteractivePanel interactive = new InteractivePanel(conf);
// interactive.start();
// interactive.join();
// } catch (Exception e) {
// throw new CommandExecutionException(e.getMessage(), e);
// }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.jsoftware.dbpatch.command.InteractiveCommand;
import org.jsoftware.dbpatch.config.EnvSettings;
|
package org.jsoftware.dbpatch.maven;
/**
* Runs interactive client from maven
*
* @author szalik
* @goal interactive
*/
public class InteractiveMojo extends CommandMojoAdapter<InteractiveCommand> {
protected InteractiveMojo() {
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/InteractiveCommand.java
// public class InteractiveCommand extends AbstractCommand {
//
// public InteractiveCommand(EnvSettings envSettings) {
// super(envSettings);
// }
//
// public void execute() throws CommandExecutionException, CommandFailureException {
// try {
// Collection<ConfigurationEntry> conf = AbstractConfigurationParser.discoverConfiguration(getConfigFile());
// InteractivePanel interactive = new InteractivePanel(conf);
// interactive.start();
// interactive.join();
// } catch (Exception e) {
// throw new CommandExecutionException(e.getMessage(), e);
// }
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-maven-plugin/src/main/java/org/jsoftware/dbpatch/maven/InteractiveMojo.java
import org.jsoftware.dbpatch.command.InteractiveCommand;
import org.jsoftware.dbpatch.config.EnvSettings;
package org.jsoftware.dbpatch.maven;
/**
* Runs interactive client from maven
*
* @author szalik
* @goal interactive
*/
public class InteractiveMojo extends CommandMojoAdapter<InteractiveCommand> {
protected InteractiveMojo() {
|
super(new InteractiveCommand(EnvSettings.maven()));
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/AbstractCommand.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.jsoftware.dbpatch.config.ConfigurationEntry;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.log.LogFactory;
import java.io.File;
|
package org.jsoftware.dbpatch.command;
/**
* Abstract plugin command
*
* @author szalik
*/
public abstract class AbstractCommand {
protected final org.jsoftware.dbpatch.log.Log log = LogFactory.getInstance();
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/AbstractCommand.java
import org.jsoftware.dbpatch.config.ConfigurationEntry;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.log.LogFactory;
import java.io.File;
package org.jsoftware.dbpatch.command;
/**
* Abstract plugin command
*
* @author szalik
*/
public abstract class AbstractCommand {
protected final org.jsoftware.dbpatch.log.Log log = LogFactory.getInstance();
|
protected final EnvSettings envSettings;
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/ListCommand.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
//
// /**
// * @param connection connection
// * @param patches all detected patches
// * @return list of patches to apply
// */
// List<Patch> filter(Connection connection, List<Patch> patches);
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;
|
package org.jsoftware.dbpatch.command;
/**
* Command:Show list of patches
*
* @author szalik
*/
public class ListCommand extends AbstractListCommand<Patch> {
public ListCommand(EnvSettings envSettings) {
super(envSettings);
}
protected List<Patch> generateList(List<Patch> inList) throws IOException {
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
//
// /**
// * @param connection connection
// * @param patches all detected patches
// * @return list of patches to apply
// */
// List<Patch> filter(Connection connection, List<Patch> patches);
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/ListCommand.java
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;
package org.jsoftware.dbpatch.command;
/**
* Command:Show list of patches
*
* @author szalik
*/
public class ListCommand extends AbstractListCommand<Patch> {
public ListCommand(EnvSettings envSettings) {
super(envSettings);
}
protected List<Patch> generateList(List<Patch> inList) throws IOException {
|
ApplyStrategy strategy = configurationEntry.getApplyStarters();
|
m-szalik/dbpatch
|
dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/ListCommand.java
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
//
// /**
// * @param connection connection
// * @param patches all detected patches
// * @return list of patches to apply
// */
// List<Patch> filter(Connection connection, List<Patch> patches);
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
|
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;
|
package org.jsoftware.dbpatch.command;
/**
* Command:Show list of patches
*
* @author szalik
*/
public class ListCommand extends AbstractListCommand<Patch> {
public ListCommand(EnvSettings envSettings) {
super(envSettings);
}
protected List<Patch> generateList(List<Patch> inList) throws IOException {
ApplyStrategy strategy = configurationEntry.getApplyStarters();
log.debug("Apply strategy is " + strategy.getClass().getSimpleName() + ", configurationId:" + configurationEntry.getId());
List<Patch> patchesToApply = strategy.filter(manager.getConnection(), inList);
StringBuilder sb = new StringBuilder("Patch list:\n");
for (Patch p : inList) {
getConfigurationEntry().getPatchParser().parse(p, getConfigurationEntry());
sb.append('\t');
|
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
// private static final long serialVersionUID = 4178101927323891639L;
// private String name;
// private int statementCount = -1;
// private File file;
//
// public enum DbState {
// COMMITTED, IN_PROGRESS, NOT_AVAILABLE
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getStatementCount() {
// return statementCount;
// }
//
// public void setStatementCount(int statementCount) {
// this.statementCount = statementCount;
// }
//
// public File getFile() {
// return file;
// }
//
// public void setFile(File file) {
// this.file = file;
// }
//
// public abstract void setDbDate(Date dbDate);
//
// public abstract void setDbState(DbState dbState);
//
// public abstract Date getDbDate();
//
// public abstract DbState getDbState();
//
// public abstract boolean canApply();
//
// public String toString() {
// return super.toString() + "-" + name;
// }
//
// public static String normalizeName(String name) {
// String nameLC = name.toLowerCase();
// while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
// int dot = nameLC.lastIndexOf('.');
// nameLC = nameLC.substring(0, dot);
// }
// return name.substring(0, nameLC.length());
// }
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
//
// /**
// * @param connection connection
// * @param patches all detected patches
// * @return list of patches to apply
// */
// List<Patch> filter(Connection connection, List<Patch> patches);
//
// }
//
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
// private final String prefix;
//
// private EnvSettings(String prefix) {
// this.prefix = prefix;
// }
//
// public String getDbPatchFile() {
// return prefix + "dbpatch.file";
// }
//
// public String getDbPatchConfiguration() {
// return prefix + "dbpatch.configuration";
// }
//
// public String getDbPatchStop() {
// return prefix + "dbpatch.stop";
// }
//
// public String getDbPatchSingle() {
// return prefix + "dbpatch.single";
// }
//
// public String getLogLevel() {
// return prefix + "dbpatch.logLevel";
// }
//
// public static EnvSettings standalone() {
// return new EnvSettings("");
// }
//
// public static EnvSettings maven() {
// return new EnvSettings("maven.");
// }
//
// public static EnvSettings gradle() {
// return new EnvSettings("gradle.");
// }
//
// }
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/ListCommand.java
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;
package org.jsoftware.dbpatch.command;
/**
* Command:Show list of patches
*
* @author szalik
*/
public class ListCommand extends AbstractListCommand<Patch> {
public ListCommand(EnvSettings envSettings) {
super(envSettings);
}
protected List<Patch> generateList(List<Patch> inList) throws IOException {
ApplyStrategy strategy = configurationEntry.getApplyStarters();
log.debug("Apply strategy is " + strategy.getClass().getSimpleName() + ", configurationId:" + configurationEntry.getId());
List<Patch> patchesToApply = strategy.filter(manager.getConnection(), inList);
StringBuilder sb = new StringBuilder("Patch list:\n");
for (Patch p : inList) {
getConfigurationEntry().getPatchParser().parse(p, getConfigurationEntry());
sb.append('\t');
|
if (p.getDbState() == AbstractPatch.DbState.COMMITTED) {
|
m-szalik/dbpatch
|
dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/HelpCommandTest.java
|
// Path: dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/AbstractDbCommandTest.java
// public static String executeToString(ExecuteToStringCallback callback) throws Exception {
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// callback.call(new PrintStream(out));
// out.close();
// return new String(out.toByteArray());
// }
|
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import java.io.PrintStream;
import static org.jsoftware.dbpatch.command.AbstractDbCommandTest.executeToString;
|
package org.jsoftware.dbpatch.command;
public class HelpCommandTest {
static class ExecuteToStringCallbackHelpCmd implements AbstractDbCommandTest.ExecuteToStringCallback {
private final HelpCommand helpCommand;
ExecuteToStringCallbackHelpCmd(HelpCommand helpCommand) {this.helpCommand = helpCommand;}
@Override
public void call(PrintStream printStream) throws Exception {
helpCommand.execute(printStream);
}
}
@Test
public void testStandalone() throws Exception {
HelpCommand helpCommand = HelpCommand.helpCommandStandalone();
|
// Path: dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/AbstractDbCommandTest.java
// public static String executeToString(ExecuteToStringCallback callback) throws Exception {
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// callback.call(new PrintStream(out));
// out.close();
// return new String(out.toByteArray());
// }
// Path: dbpatch-core/src/test/java/org/jsoftware/dbpatch/command/HelpCommandTest.java
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import java.io.PrintStream;
import static org.jsoftware.dbpatch.command.AbstractDbCommandTest.executeToString;
package org.jsoftware.dbpatch.command;
public class HelpCommandTest {
static class ExecuteToStringCallbackHelpCmd implements AbstractDbCommandTest.ExecuteToStringCallback {
private final HelpCommand helpCommand;
ExecuteToStringCallbackHelpCmd(HelpCommand helpCommand) {this.helpCommand = helpCommand;}
@Override
public void call(PrintStream printStream) throws Exception {
helpCommand.execute(printStream);
}
}
@Test
public void testStandalone() throws Exception {
HelpCommand helpCommand = HelpCommand.helpCommandStandalone();
|
String out = executeToString(new ExecuteToStringCallbackHelpCmd(helpCommand));
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/IJettyHandler.java
// public interface IJettyHandler<T extends Handler> {
//
// T getHandler() throws JettyBootstrapException;
//
// String getItemType();
//
// String getItemName();
//
// String toString();
// }
|
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.component.LifeCycle.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.IJettyHandler;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class JettyLifeCycleLogListener implements Listener{
private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/IJettyHandler.java
// public interface IJettyHandler<T extends Handler> {
//
// T getHandler() throws JettyBootstrapException;
//
// String getItemType();
//
// String getItemName();
//
// String toString();
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.component.LifeCycle.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.IJettyHandler;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class JettyLifeCycleLogListener implements Listener{
private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
|
private IJettyHandler<?> iJettyHandler;
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationUtil.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationClass.java
// public enum Position {
// BEFORE,
// AFTER
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/ClassUtil.java
// public class ClassUtil {
//
// public static boolean classExists(String className) {
// try {
// Class.forName(className);
// } catch (ClassNotFoundException e) {
// return false;
// }
//
// return true;
// }
//
// public static boolean classesExists(List<String> classNames) {
// for (String className : classNames) {
// if (! classExists(className)) {
// return false;
// }
// }
//
// return true;
// }
// }
|
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.util.AdditionalWebAppJettyConfigurationClass.Position;
import org.teknux.jettybootstrap.utils.ClassUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class AdditionalWebAppJettyConfigurationUtil {
private final static Logger LOG = LoggerFactory.getLogger(AdditionalWebAppJettyConfigurationUtil.class);
/**
* Classes that natively supported by JettyBootstrap
*
* @return String[]
*/
private static AdditionalWebAppJettyConfigurationClass[] getOptionnalAdditionalsWebAppJettyConfigurationClasses() {
return new AdditionalWebAppJettyConfigurationClass[] {
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationClass.java
// public enum Position {
// BEFORE,
// AFTER
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/ClassUtil.java
// public class ClassUtil {
//
// public static boolean classExists(String className) {
// try {
// Class.forName(className);
// } catch (ClassNotFoundException e) {
// return false;
// }
//
// return true;
// }
//
// public static boolean classesExists(List<String> classNames) {
// for (String className : classNames) {
// if (! classExists(className)) {
// return false;
// }
// }
//
// return true;
// }
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationUtil.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.util.AdditionalWebAppJettyConfigurationClass.Position;
import org.teknux.jettybootstrap.utils.ClassUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class AdditionalWebAppJettyConfigurationUtil {
private final static Logger LOG = LoggerFactory.getLogger(AdditionalWebAppJettyConfigurationUtil.class);
/**
* Classes that natively supported by JettyBootstrap
*
* @return String[]
*/
private static AdditionalWebAppJettyConfigurationClass[] getOptionnalAdditionalsWebAppJettyConfigurationClasses() {
return new AdditionalWebAppJettyConfigurationClass[] {
|
new AdditionalWebAppJettyConfigurationClass("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", Position.BEFORE, "org.eclipse.jetty.annotations.AnnotationConfiguration")
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationUtil.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationClass.java
// public enum Position {
// BEFORE,
// AFTER
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/ClassUtil.java
// public class ClassUtil {
//
// public static boolean classExists(String className) {
// try {
// Class.forName(className);
// } catch (ClassNotFoundException e) {
// return false;
// }
//
// return true;
// }
//
// public static boolean classesExists(List<String> classNames) {
// for (String className : classNames) {
// if (! classExists(className)) {
// return false;
// }
// }
//
// return true;
// }
// }
|
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.util.AdditionalWebAppJettyConfigurationClass.Position;
import org.teknux.jettybootstrap.utils.ClassUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class AdditionalWebAppJettyConfigurationUtil {
private final static Logger LOG = LoggerFactory.getLogger(AdditionalWebAppJettyConfigurationUtil.class);
/**
* Classes that natively supported by JettyBootstrap
*
* @return String[]
*/
private static AdditionalWebAppJettyConfigurationClass[] getOptionnalAdditionalsWebAppJettyConfigurationClasses() {
return new AdditionalWebAppJettyConfigurationClass[] {
new AdditionalWebAppJettyConfigurationClass("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", Position.BEFORE, "org.eclipse.jetty.annotations.AnnotationConfiguration")
};
}
/**
* Add the classes that natively supported by JettyBootstrap if available (e.g. : Annotations)
*
* @param configurationClasses Class Name array
* @return String[]
*/
public static String[] addOptionalConfigurationClasses(String[] configurationClasses) {
return addConfigurationClasses(configurationClasses, AdditionalWebAppJettyConfigurationUtil.getOptionnalAdditionalsWebAppJettyConfigurationClasses());
}
/**
* Add the optionalAdditionalsWebappConfigurationClasses to the configurationClasses if available
*
* @param configurationClasses Class Name array
* @param optionalAdditionalsWebappConfigurationClasses Class Name array
* @return String[]
*/
public static String[] addConfigurationClasses(String[] configurationClasses, AdditionalWebAppJettyConfigurationClass[] optionalAdditionalsWebappConfigurationClasses) {
List<String> newConfigurationClasses = new ArrayList<>(Arrays.asList(configurationClasses));
for (AdditionalWebAppJettyConfigurationClass additionalWebappConfigurationClass : optionalAdditionalsWebappConfigurationClasses) {
if (additionalWebappConfigurationClass.getClasses() == null || additionalWebappConfigurationClass.getPosition() == null) {
LOG.warn("Bad support class name");
} else {
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationClass.java
// public enum Position {
// BEFORE,
// AFTER
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/ClassUtil.java
// public class ClassUtil {
//
// public static boolean classExists(String className) {
// try {
// Class.forName(className);
// } catch (ClassNotFoundException e) {
// return false;
// }
//
// return true;
// }
//
// public static boolean classesExists(List<String> classNames) {
// for (String className : classNames) {
// if (! classExists(className)) {
// return false;
// }
// }
//
// return true;
// }
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/AdditionalWebAppJettyConfigurationUtil.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.teknux.jettybootstrap.handler.util.AdditionalWebAppJettyConfigurationClass.Position;
import org.teknux.jettybootstrap.utils.ClassUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler.util;
public class AdditionalWebAppJettyConfigurationUtil {
private final static Logger LOG = LoggerFactory.getLogger(AdditionalWebAppJettyConfigurationUtil.class);
/**
* Classes that natively supported by JettyBootstrap
*
* @return String[]
*/
private static AdditionalWebAppJettyConfigurationClass[] getOptionnalAdditionalsWebAppJettyConfigurationClasses() {
return new AdditionalWebAppJettyConfigurationClass[] {
new AdditionalWebAppJettyConfigurationClass("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", Position.BEFORE, "org.eclipse.jetty.annotations.AnnotationConfiguration")
};
}
/**
* Add the classes that natively supported by JettyBootstrap if available (e.g. : Annotations)
*
* @param configurationClasses Class Name array
* @return String[]
*/
public static String[] addOptionalConfigurationClasses(String[] configurationClasses) {
return addConfigurationClasses(configurationClasses, AdditionalWebAppJettyConfigurationUtil.getOptionnalAdditionalsWebAppJettyConfigurationClasses());
}
/**
* Add the optionalAdditionalsWebappConfigurationClasses to the configurationClasses if available
*
* @param configurationClasses Class Name array
* @param optionalAdditionalsWebappConfigurationClasses Class Name array
* @return String[]
*/
public static String[] addConfigurationClasses(String[] configurationClasses, AdditionalWebAppJettyConfigurationClass[] optionalAdditionalsWebappConfigurationClasses) {
List<String> newConfigurationClasses = new ArrayList<>(Arrays.asList(configurationClasses));
for (AdditionalWebAppJettyConfigurationClass additionalWebappConfigurationClass : optionalAdditionalsWebappConfigurationClasses) {
if (additionalWebappConfigurationClass.getClasses() == null || additionalWebappConfigurationClass.getPosition() == null) {
LOG.warn("Bad support class name");
} else {
|
if (ClassUtil.classesExists(additionalWebappConfigurationClass.getClasses())) {
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/test/java/org/teknux/jettybootstrap/test/utils/Md5UtilTest.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/Md5Util.java
// public class Md5Util {
//
// private final static String HASH_ALGORITHM = "MD5";
//
// private Md5Util() {
// }
//
// public static String hash(String string) throws NoSuchAlgorithmException {
// MessageDigest messageDigest = MessageDigest.getInstance(HASH_ALGORITHM);
// StringBuilder stringBuilder = new StringBuilder();
// for (byte byt : messageDigest.digest(string.getBytes())) {
// stringBuilder.append(String.format("%02x", byt & 0xff));
// }
//
// return stringBuilder.toString();
// }
// }
|
import java.security.NoSuchAlgorithmException;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.teknux.jettybootstrap.utils.Md5Util;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.test.utils;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class Md5UtilTest {
@Test
public void test01Md5Sum() throws NoSuchAlgorithmException {
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/Md5Util.java
// public class Md5Util {
//
// private final static String HASH_ALGORITHM = "MD5";
//
// private Md5Util() {
// }
//
// public static String hash(String string) throws NoSuchAlgorithmException {
// MessageDigest messageDigest = MessageDigest.getInstance(HASH_ALGORITHM);
// StringBuilder stringBuilder = new StringBuilder();
// for (byte byt : messageDigest.digest(string.getBytes())) {
// stringBuilder.append(String.format("%02x", byt & 0xff));
// }
//
// return stringBuilder.toString();
// }
// }
// Path: jetty-bootstrap/src/test/java/org/teknux/jettybootstrap/test/utils/Md5UtilTest.java
import java.security.NoSuchAlgorithmException;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.teknux.jettybootstrap.utils.Md5Util;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.test.utils;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class Md5UtilTest {
@Test
public void test01Md5Sum() throws NoSuchAlgorithmException {
|
Assert.assertEquals("5d41402abc4b2a76b9719d911017c592", Md5Util.hash("hello"));
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/configuration/PropertiesJettyConfiguration.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/PropertiesUtil.java
// public class PropertiesUtil {
//
// private PropertiesUtil() {
// }
//
// /**
// * @param p Properties
// * @param key String
// * @return the {@link Long} or <code>null</code>
// */
// public static Long parseLong(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Long.parseLong(value);
// }
//
// /**
// * @param p Properties
// * @param key Key
// * @return {@link Integer} or <code>null</code>
// */
// public static Integer parseInt(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Integer.parseInt(value);
// }
//
// /**
// * @param p Properties
// * @param key String
// * @param separator String
// * @return an array of {@link String} or
// * <code>null</code>
// */
// public static String[] parseArray(Properties p, String key, String separator) {
// if (p == null || key == null || separator == null || separator.isEmpty()) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return value.contains(separator) ? value.split(separator) : new String[] { value };
// }
//
// /**
// * @param p Properties
// * @param key String
// * @return {@link Boolean} or <code>null</code>
// */
// public static Boolean parseBoolean(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Boolean.parseBoolean(value);
// }
// }
|
import org.teknux.jettybootstrap.utils.PropertiesUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
|
*
* @param properties
* Properties
*/
public PropertiesJettyConfiguration(Properties properties) {
this(properties, false);
}
/**
* First load the given {@link Properties} to map jetty configuration, system properties are applied after. This means system properties have higher priorities that the
* provided ones.
*
* @param properties
* Properties
* @param ignoreSystemProperties
* boolean
*/
public PropertiesJettyConfiguration(Properties properties, boolean ignoreSystemProperties) {
if (properties != null) {
//load given properties first
loadProperties(properties);
}
if (!ignoreSystemProperties) {
//load system properties
loadProperties(System.getProperties());
}
}
private void loadProperties(Properties properties) {
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/utils/PropertiesUtil.java
// public class PropertiesUtil {
//
// private PropertiesUtil() {
// }
//
// /**
// * @param p Properties
// * @param key String
// * @return the {@link Long} or <code>null</code>
// */
// public static Long parseLong(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Long.parseLong(value);
// }
//
// /**
// * @param p Properties
// * @param key Key
// * @return {@link Integer} or <code>null</code>
// */
// public static Integer parseInt(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Integer.parseInt(value);
// }
//
// /**
// * @param p Properties
// * @param key String
// * @param separator String
// * @return an array of {@link String} or
// * <code>null</code>
// */
// public static String[] parseArray(Properties p, String key, String separator) {
// if (p == null || key == null || separator == null || separator.isEmpty()) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return value.contains(separator) ? value.split(separator) : new String[] { value };
// }
//
// /**
// * @param p Properties
// * @param key String
// * @return {@link Boolean} or <code>null</code>
// */
// public static Boolean parseBoolean(Properties p, String key) {
// if (p == null || key == null) {
// return null;
// }
//
// String value = p.getProperty(key);
// if (value == null) {
// return null;
// }
//
// return Boolean.parseBoolean(value);
// }
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/configuration/PropertiesJettyConfiguration.java
import org.teknux.jettybootstrap.utils.PropertiesUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
*
* @param properties
* Properties
*/
public PropertiesJettyConfiguration(Properties properties) {
this(properties, false);
}
/**
* First load the given {@link Properties} to map jetty configuration, system properties are applied after. This means system properties have higher priorities that the
* provided ones.
*
* @param properties
* Properties
* @param ignoreSystemProperties
* boolean
*/
public PropertiesJettyConfiguration(Properties properties, boolean ignoreSystemProperties) {
if (properties != null) {
//load given properties first
loadProperties(properties);
}
if (!ignoreSystemProperties) {
//load system properties
loadProperties(System.getProperties());
}
}
private void loadProperties(Properties properties) {
|
Boolean autoJoin = PropertiesUtil.parseBoolean(properties, KEY_AUTO_JOIN_ON_START);
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/AbstractJettyHandler.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrapException.java
// public class JettyBootstrapException extends Exception {
//
// private static final long serialVersionUID = 3855898924513137363L;
//
// public JettyBootstrapException(String s) {
// super(s);
// }
//
// public JettyBootstrapException(Throwable throwable) {
// super(throwable);
// }
//
// public JettyBootstrapException(String s, Throwable throwable) {
// super(s, throwable);
// }
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
// public class JettyLifeCycleLogListener implements Listener{
//
// private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
//
// private IJettyHandler<?> iJettyHandler;
//
// public JettyLifeCycleLogListener(final IJettyHandler<?> iJettyHandler) {
// this.iJettyHandler = iJettyHandler;
// }
//
// @Override
// public void lifeCycleStarting(LifeCycle event) {
// LOG.trace("Starting {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStarted(LifeCycle event) {
// LOG.debug("{} Started", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleFailure(LifeCycle event, Throwable cause) {
// LOG.error("Failure {}", iJettyHandler.toString(), cause);
// }
//
// @Override
// public void lifeCycleStopping(LifeCycle event) {
// LOG.trace("Stopping {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStopped(LifeCycle event) {
// LOG.debug("{} Stopped", iJettyHandler.toString());
// }
// }
|
import org.eclipse.jetty.server.Handler;
import org.teknux.jettybootstrap.JettyBootstrapException;
import org.teknux.jettybootstrap.handler.util.JettyLifeCycleLogListener;
import java.text.MessageFormat;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler;
abstract public class AbstractJettyHandler<T extends Handler> implements IJettyHandler<T> {
@Override
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrapException.java
// public class JettyBootstrapException extends Exception {
//
// private static final long serialVersionUID = 3855898924513137363L;
//
// public JettyBootstrapException(String s) {
// super(s);
// }
//
// public JettyBootstrapException(Throwable throwable) {
// super(throwable);
// }
//
// public JettyBootstrapException(String s, Throwable throwable) {
// super(s, throwable);
// }
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
// public class JettyLifeCycleLogListener implements Listener{
//
// private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
//
// private IJettyHandler<?> iJettyHandler;
//
// public JettyLifeCycleLogListener(final IJettyHandler<?> iJettyHandler) {
// this.iJettyHandler = iJettyHandler;
// }
//
// @Override
// public void lifeCycleStarting(LifeCycle event) {
// LOG.trace("Starting {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStarted(LifeCycle event) {
// LOG.debug("{} Started", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleFailure(LifeCycle event, Throwable cause) {
// LOG.error("Failure {}", iJettyHandler.toString(), cause);
// }
//
// @Override
// public void lifeCycleStopping(LifeCycle event) {
// LOG.trace("Stopping {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStopped(LifeCycle event) {
// LOG.debug("{} Stopped", iJettyHandler.toString());
// }
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/AbstractJettyHandler.java
import org.eclipse.jetty.server.Handler;
import org.teknux.jettybootstrap.JettyBootstrapException;
import org.teknux.jettybootstrap.handler.util.JettyLifeCycleLogListener;
import java.text.MessageFormat;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler;
abstract public class AbstractJettyHandler<T extends Handler> implements IJettyHandler<T> {
@Override
|
final public T getHandler() throws JettyBootstrapException {
|
teknux-org/jetty-bootstrap
|
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/AbstractJettyHandler.java
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrapException.java
// public class JettyBootstrapException extends Exception {
//
// private static final long serialVersionUID = 3855898924513137363L;
//
// public JettyBootstrapException(String s) {
// super(s);
// }
//
// public JettyBootstrapException(Throwable throwable) {
// super(throwable);
// }
//
// public JettyBootstrapException(String s, Throwable throwable) {
// super(s, throwable);
// }
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
// public class JettyLifeCycleLogListener implements Listener{
//
// private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
//
// private IJettyHandler<?> iJettyHandler;
//
// public JettyLifeCycleLogListener(final IJettyHandler<?> iJettyHandler) {
// this.iJettyHandler = iJettyHandler;
// }
//
// @Override
// public void lifeCycleStarting(LifeCycle event) {
// LOG.trace("Starting {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStarted(LifeCycle event) {
// LOG.debug("{} Started", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleFailure(LifeCycle event, Throwable cause) {
// LOG.error("Failure {}", iJettyHandler.toString(), cause);
// }
//
// @Override
// public void lifeCycleStopping(LifeCycle event) {
// LOG.trace("Stopping {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStopped(LifeCycle event) {
// LOG.debug("{} Stopped", iJettyHandler.toString());
// }
// }
|
import org.eclipse.jetty.server.Handler;
import org.teknux.jettybootstrap.JettyBootstrapException;
import org.teknux.jettybootstrap.handler.util.JettyLifeCycleLogListener;
import java.text.MessageFormat;
|
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler;
abstract public class AbstractJettyHandler<T extends Handler> implements IJettyHandler<T> {
@Override
final public T getHandler() throws JettyBootstrapException {
T handler = createHandler();
|
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrapException.java
// public class JettyBootstrapException extends Exception {
//
// private static final long serialVersionUID = 3855898924513137363L;
//
// public JettyBootstrapException(String s) {
// super(s);
// }
//
// public JettyBootstrapException(Throwable throwable) {
// super(throwable);
// }
//
// public JettyBootstrapException(String s, Throwable throwable) {
// super(s, throwable);
// }
// }
//
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/util/JettyLifeCycleLogListener.java
// public class JettyLifeCycleLogListener implements Listener{
//
// private final static Logger LOG = LoggerFactory.getLogger(JettyLifeCycleLogListener.class);
//
// private IJettyHandler<?> iJettyHandler;
//
// public JettyLifeCycleLogListener(final IJettyHandler<?> iJettyHandler) {
// this.iJettyHandler = iJettyHandler;
// }
//
// @Override
// public void lifeCycleStarting(LifeCycle event) {
// LOG.trace("Starting {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStarted(LifeCycle event) {
// LOG.debug("{} Started", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleFailure(LifeCycle event, Throwable cause) {
// LOG.error("Failure {}", iJettyHandler.toString(), cause);
// }
//
// @Override
// public void lifeCycleStopping(LifeCycle event) {
// LOG.trace("Stopping {}...", iJettyHandler.toString());
// }
//
// @Override
// public void lifeCycleStopped(LifeCycle event) {
// LOG.debug("{} Stopped", iJettyHandler.toString());
// }
// }
// Path: jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/handler/AbstractJettyHandler.java
import org.eclipse.jetty.server.Handler;
import org.teknux.jettybootstrap.JettyBootstrapException;
import org.teknux.jettybootstrap.handler.util.JettyLifeCycleLogListener;
import java.text.MessageFormat;
/*******************************************************************************
* (C) Copyright 2014 Teknux.org (http://teknux.org/).
*
* 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.
*
* Contributors:
* "Pierre PINON"
* "Francois EYL"
* "Laurent MARCHAL"
*
*******************************************************************************/
package org.teknux.jettybootstrap.handler;
abstract public class AbstractJettyHandler<T extends Handler> implements IJettyHandler<T> {
@Override
final public T getHandler() throws JettyBootstrapException {
T handler = createHandler();
|
handler.addLifeCycleListener(new JettyLifeCycleLogListener(this));
|
cattaka/AdapterToolbox
|
example/src/main/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivity.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/CodeLabelAdapter.java
// public class CodeLabelAdapter extends ArrayAdapter<ICodeLabel> {
// @LayoutRes
// private int mResource;
// @LayoutRes
// private int mDropDownResource;
//
// public static CodeLabelAdapter newInstance(Context context, ICodeLabel[] objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(Arrays.asList(objects));
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public static CodeLabelAdapter newInstance(Context context, List<ICodeLabel> objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(objects);
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, ICodeLabel[] objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, List<ICodeLabel> objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
//
// @Override
// public View getDropDownView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mDropDownResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/logic/SnackbarLogic.java
// public class SnackbarLogic {
// public SnackbarLogic() {
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, text, duration));
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @StringRes int resId, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, resId, duration));
// }
//
// /**
// * For InstrumentationTest
// */
// public interface ISnackbarWrapper {
// void show();
// }
//
// private static class SnackbarWrapperImpl implements ISnackbarWrapper {
// private Snackbar orig;
//
// public SnackbarWrapperImpl(Snackbar orig) {
// this.orig = orig;
// }
//
// @Override
// public void show() {
// orig.show();
// }
// }
// }
|
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;
import net.cattaka.android.adaptertoolbox.adapter.CodeLabelAdapter;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.logic.SnackbarLogic;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/05/02.
*/
public class CodeLabelExampleActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
SnackbarLogic mSnackbarLogic = new SnackbarLogic();
Spinner mSpinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_code_label_example);
// find views
mSpinner = (Spinner) findViewById(R.id.spinner);
// set adapter
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/CodeLabelAdapter.java
// public class CodeLabelAdapter extends ArrayAdapter<ICodeLabel> {
// @LayoutRes
// private int mResource;
// @LayoutRes
// private int mDropDownResource;
//
// public static CodeLabelAdapter newInstance(Context context, ICodeLabel[] objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(Arrays.asList(objects));
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public static CodeLabelAdapter newInstance(Context context, List<ICodeLabel> objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(objects);
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, ICodeLabel[] objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, List<ICodeLabel> objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
//
// @Override
// public View getDropDownView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mDropDownResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/logic/SnackbarLogic.java
// public class SnackbarLogic {
// public SnackbarLogic() {
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, text, duration));
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @StringRes int resId, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, resId, duration));
// }
//
// /**
// * For InstrumentationTest
// */
// public interface ISnackbarWrapper {
// void show();
// }
//
// private static class SnackbarWrapperImpl implements ISnackbarWrapper {
// private Snackbar orig;
//
// public SnackbarWrapperImpl(Snackbar orig) {
// this.orig = orig;
// }
//
// @Override
// public void show() {
// orig.show();
// }
// }
// }
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivity.java
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;
import net.cattaka.android.adaptertoolbox.adapter.CodeLabelAdapter;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.logic.SnackbarLogic;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/05/02.
*/
public class CodeLabelExampleActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
SnackbarLogic mSnackbarLogic = new SnackbarLogic();
Spinner mSpinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_code_label_example);
// find views
mSpinner = (Spinner) findViewById(R.id.spinner);
// set adapter
|
mSpinner.setAdapter(CodeLabelAdapter.newInstance(this, OrdinalLabel.values(), true));
|
cattaka/AdapterToolbox
|
example/src/main/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivity.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/CodeLabelAdapter.java
// public class CodeLabelAdapter extends ArrayAdapter<ICodeLabel> {
// @LayoutRes
// private int mResource;
// @LayoutRes
// private int mDropDownResource;
//
// public static CodeLabelAdapter newInstance(Context context, ICodeLabel[] objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(Arrays.asList(objects));
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public static CodeLabelAdapter newInstance(Context context, List<ICodeLabel> objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(objects);
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, ICodeLabel[] objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, List<ICodeLabel> objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
//
// @Override
// public View getDropDownView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mDropDownResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/logic/SnackbarLogic.java
// public class SnackbarLogic {
// public SnackbarLogic() {
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, text, duration));
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @StringRes int resId, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, resId, duration));
// }
//
// /**
// * For InstrumentationTest
// */
// public interface ISnackbarWrapper {
// void show();
// }
//
// private static class SnackbarWrapperImpl implements ISnackbarWrapper {
// private Snackbar orig;
//
// public SnackbarWrapperImpl(Snackbar orig) {
// this.orig = orig;
// }
//
// @Override
// public void show() {
// orig.show();
// }
// }
// }
|
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;
import net.cattaka.android.adaptertoolbox.adapter.CodeLabelAdapter;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.logic.SnackbarLogic;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/05/02.
*/
public class CodeLabelExampleActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
SnackbarLogic mSnackbarLogic = new SnackbarLogic();
Spinner mSpinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_code_label_example);
// find views
mSpinner = (Spinner) findViewById(R.id.spinner);
// set adapter
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/CodeLabelAdapter.java
// public class CodeLabelAdapter extends ArrayAdapter<ICodeLabel> {
// @LayoutRes
// private int mResource;
// @LayoutRes
// private int mDropDownResource;
//
// public static CodeLabelAdapter newInstance(Context context, ICodeLabel[] objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(Arrays.asList(objects));
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public static CodeLabelAdapter newInstance(Context context, List<ICodeLabel> objects, boolean withNullValue) {
// if (withNullValue) {
// List<ICodeLabel> values = new ArrayList<>();
// values.add(null);
// values.addAll(objects);
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, values);
// } else {
// return new CodeLabelAdapter(context, android.R.layout.simple_list_item_1, android.R.layout.simple_spinner_dropdown_item, objects);
// }
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, ICodeLabel[] objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// public CodeLabelAdapter(Context context, @LayoutRes int resource, @LayoutRes int dropDownResource, List<ICodeLabel> objects) {
// super(context, resource, objects);
// mResource = resource;
// mDropDownResource = dropDownResource;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
//
// @Override
// public View getDropDownView(int position, View convertView, ViewGroup parent) {
// if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(mDropDownResource, null);
// }
// TextView view = (TextView) convertView.findViewById(android.R.id.text1);
// ICodeLabel item = getItem(position);
// if (item != null) {
// view.setText(item.getLabel(getContext().getResources()));
// } else {
// view.setText("");
// }
// return view;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/logic/SnackbarLogic.java
// public class SnackbarLogic {
// public SnackbarLogic() {
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, text, duration));
// }
//
// @NonNull
// public ISnackbarWrapper make(@NonNull View view, @StringRes int resId, int duration) {
// return new SnackbarWrapperImpl(Snackbar.make(view, resId, duration));
// }
//
// /**
// * For InstrumentationTest
// */
// public interface ISnackbarWrapper {
// void show();
// }
//
// private static class SnackbarWrapperImpl implements ISnackbarWrapper {
// private Snackbar orig;
//
// public SnackbarWrapperImpl(Snackbar orig) {
// this.orig = orig;
// }
//
// @Override
// public void show() {
// orig.show();
// }
// }
// }
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivity.java
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;
import net.cattaka.android.adaptertoolbox.adapter.CodeLabelAdapter;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.logic.SnackbarLogic;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/05/02.
*/
public class CodeLabelExampleActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
SnackbarLogic mSnackbarLogic = new SnackbarLogic();
Spinner mSpinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_code_label_example);
// find views
mSpinner = (Spinner) findViewById(R.id.spinner);
// set adapter
|
mSpinner.setAdapter(CodeLabelAdapter.newInstance(this, OrdinalLabel.values(), true));
|
cattaka/AdapterToolbox
|
adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsScrambleAdapter.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
// A extends RecyclerView.Adapter<? extends VH>,
// VH extends RecyclerView.ViewHolder> {
// void setProvider(@NonNull IProvider<A, VH> provider);
//
// interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
// @NonNull
// A getAdapter();
//
// @Nullable
// RecyclerView getAttachedRecyclerView();
// }
// }
|
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
|
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 16/05/10.
*/
public abstract class AbsScrambleAdapter<
A extends AbsScrambleAdapter<A, SA, VH, FL, T>,
SA extends AbsScrambleAdapter<?, SA, VH, ?, ?>,
VH extends RecyclerView.ViewHolder,
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
// A extends RecyclerView.Adapter<? extends VH>,
// VH extends RecyclerView.ViewHolder> {
// void setProvider(@NonNull IProvider<A, VH> provider);
//
// interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
// @NonNull
// A getAdapter();
//
// @Nullable
// RecyclerView getAttachedRecyclerView();
// }
// }
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsScrambleAdapter.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 16/05/10.
*/
public abstract class AbsScrambleAdapter<
A extends AbsScrambleAdapter<A, SA, VH, FL, T>,
SA extends AbsScrambleAdapter<?, SA, VH, ?, ?>,
VH extends RecyclerView.ViewHolder,
|
FL extends IForwardingListener<SA, VH>,
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class VerticalListDividerExampleActivityTest {
@Rule
public ActivityTestRule<VerticalListDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(VerticalListDividerExampleActivity.class, false, false);
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class VerticalListDividerExampleActivityTest {
@Rule
public ActivityTestRule<VerticalListDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(VerticalListDividerExampleActivity.class, false, false);
|
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class VerticalListDividerExampleActivityTest {
@Rule
public ActivityTestRule<VerticalListDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(VerticalListDividerExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
VerticalListDividerExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class VerticalListDividerExampleActivityTest {
@Rule
public ActivityTestRule<VerticalListDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(VerticalListDividerExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
VerticalListDividerExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
|
cattaka/AdapterToolbox
|
adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsCustomRecyclerAdapter.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
// A extends RecyclerView.Adapter<? extends VH>,
// VH extends RecyclerView.ViewHolder> {
// void setProvider(@NonNull IProvider<A, VH> provider);
//
// interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
// @NonNull
// A getAdapter();
//
// @Nullable
// RecyclerView getAttachedRecyclerView();
// }
// }
|
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
|
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 2015/07/15.
*/
public abstract class AbsCustomRecyclerAdapter<
A extends AbsCustomRecyclerAdapter<A, VH, T, FL>,
VH extends RecyclerView.ViewHolder,
T,
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
// A extends RecyclerView.Adapter<? extends VH>,
// VH extends RecyclerView.ViewHolder> {
// void setProvider(@NonNull IProvider<A, VH> provider);
//
// interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
// @NonNull
// A getAdapter();
//
// @Nullable
// RecyclerView getAttachedRecyclerView();
// }
// }
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsCustomRecyclerAdapter.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 2015/07/15.
*/
public abstract class AbsCustomRecyclerAdapter<
A extends AbsCustomRecyclerAdapter<A, VH, T, FL>,
VH extends RecyclerView.ViewHolder,
T,
|
FL extends IForwardingListener<A, VH>
|
cattaka/AdapterToolbox
|
adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsChoosableTreeItemAdapter.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/data/ITreeItem.java
// public interface ITreeItem<T extends ITreeItem<T>> {
// List<T> getChildren();
// }
|
import android.content.Context;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.data.ITreeItem;
import java.util.ArrayList;
import java.util.List;
|
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 16/05/21.
*/
public abstract class AbsChoosableTreeItemAdapter<
A extends AbsChoosableTreeItemAdapter<A, VH, T, W>,
VH extends RecyclerView.ViewHolder,
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/data/ITreeItem.java
// public interface ITreeItem<T extends ITreeItem<T>> {
// List<T> getChildren();
// }
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsChoosableTreeItemAdapter.java
import android.content.Context;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.data.ITreeItem;
import java.util.ArrayList;
import java.util.List;
package net.cattaka.android.adaptertoolbox.adapter;
/**
* Created by cattaka on 16/05/21.
*/
public abstract class AbsChoosableTreeItemAdapter<
A extends AbsChoosableTreeItemAdapter<A, VH, T, W>,
VH extends RecyclerView.ViewHolder,
|
T extends ITreeItem<T>,
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
|
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
onView(withId(R.id.recycler)).perform(swipeDown());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
}
@Test
public void checkPayloadValue() {
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
onView(withId(R.id.recycler)).perform(swipeDown());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
}
@Test
public void checkPayloadValue() {
|
onView(withIdInRecyclerView(R.id.button_red, R.id.recycler, 0)).perform(click());
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
onView(withId(R.id.recycler)).perform(swipeDown());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
}
@Test
public void checkPayloadValue() {
onView(withIdInRecyclerView(R.id.button_red, R.id.recycler, 0)).perform(click());
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/utils/FlashColorItemAnimator.java
// public enum FlashColor {
// RED(Color.RED),
// BLUE(Color.BLUE),
// WHITE(Color.WHITE),
// //
// ;
// public final int intValue;
//
// FlashColor(int intValue) {
// this.intValue = intValue;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/StringWithPayloadExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import net.cattaka.android.adaptertoolbox.example.utils.FlashColorItemAnimator.FlashColor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class StringWithPayloadExampleActivityTest {
@Rule
public ActivityTestRule<StringWithPayloadExampleActivity> mActivityTestRule = new ActivityTestRule<>(StringWithPayloadExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
StringWithPayloadExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
onView(withId(R.id.recycler)).perform(swipeDown());
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
}
@Test
public void checkPayloadValue() {
onView(withIdInRecyclerView(R.id.button_red, R.id.recycler, 0)).perform(click());
|
onView(withIdInRecyclerView(R.id.text_payload, R.id.recycler, 0)).check(matches(withText(String.valueOf(FlashColor.RED))));
|
cattaka/AdapterToolbox
|
example/src/main/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivity.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/decoration/VerticalListDividerItemDecoration.java
// public class VerticalListDividerItemDecoration extends RecyclerView.ItemDecoration {
// private boolean mIgnoreParentPadding = true;
// private Drawable mDrawable;
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// final TypedArray a = context.obtainStyledAttributes(new int[]{
// android.R.attr.listDivider
// });
// mDrawable = a.getDrawable(0);
// a.recycle();
// }
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding, @DrawableRes int drawableRes) {
// mIgnoreParentPadding = ignoreParentPadding;
// mDrawable = ContextCompat.getDrawable(context, drawableRes);
// }
//
// public VerticalListDividerItemDecoration(boolean ignoreParentPadding, Drawable drawable) {
// mDrawable = drawable;
// mIgnoreParentPadding = ignoreParentPadding;
// }
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// if (mDrawable == null) {
// return;
// }
// int left = (mIgnoreParentPadding) ? 0 : parent.getPaddingLeft();
// int right = (mIgnoreParentPadding) ? parent.getWidth() : (parent.getWidth() - parent.getPaddingRight());
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount; i++) {
// final View child = parent.getChildAt(i);
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, child);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
// final int bottom = child.getTop() - params.topMargin;
// final int top = bottom - mDrawable.getIntrinsicHeight();
// mDrawable.setBounds(left, top, right, bottom);
// mDrawable.draw(c);
// }
// }
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, view);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (mDrawable != null && nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// outRect.set(0, mDrawable.getIntrinsicHeight(), 0, 0);
// } else {
// outRect.set(0, 0, 0, 0);
// }
// }
//
// @Nullable
// private Integer findPrevViewType(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder nextHolder) {
// if (nextHolder == null) {
// return null;
// }
// RecyclerView.Adapter adapter = parent.getAdapter();
// if (adapter != null && nextHolder.getAdapterPosition() > 0) {
// return adapter.getItemViewType(nextHolder.getAdapterPosition() - 1);
// } else {
// return null;
// }
// }
//
// /**
// * Override this if needed.
// */
// public boolean isAssignable(@NonNull RecyclerView parent, RecyclerView.ViewHolder nextViewHolder, int prevViewType) {
// return true;
// }
//
// public Drawable getDrawable() {
// return mDrawable;
// }
//
// public void setDrawable(Drawable drawable) {
// mDrawable = drawable;
// }
//
// public boolean isIgnoreParentPadding() {
// return mIgnoreParentPadding;
// }
//
// public void setIgnoreParentPadding(boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/adapter/SimpleStringAdapter.java
// public class SimpleStringAdapter extends ScrambleAdapter<String> {
// public SimpleStringAdapter(Context context, List<String> items, ListenerRelay<ScrambleAdapter<?>, RecyclerView.ViewHolder> listenerRelay) {
// super(context, items, listenerRelay, new SimpleStringViewHolderFactory());
// }
// }
|
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.decoration.VerticalListDividerItemDecoration;
import net.cattaka.android.adaptertoolbox.example.adapter.SimpleStringAdapter;
import java.util.ArrayList;
import java.util.List;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/12/11.
*/
public class VerticalListDividerExampleActivity extends AppCompatActivity {
RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vertical_divider_example);
// find views
mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
{ // set adapter
List<String> items = new ArrayList<>();
for (int i = 0; i < 100; i++) {
items.add("item " + i);
}
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/decoration/VerticalListDividerItemDecoration.java
// public class VerticalListDividerItemDecoration extends RecyclerView.ItemDecoration {
// private boolean mIgnoreParentPadding = true;
// private Drawable mDrawable;
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// final TypedArray a = context.obtainStyledAttributes(new int[]{
// android.R.attr.listDivider
// });
// mDrawable = a.getDrawable(0);
// a.recycle();
// }
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding, @DrawableRes int drawableRes) {
// mIgnoreParentPadding = ignoreParentPadding;
// mDrawable = ContextCompat.getDrawable(context, drawableRes);
// }
//
// public VerticalListDividerItemDecoration(boolean ignoreParentPadding, Drawable drawable) {
// mDrawable = drawable;
// mIgnoreParentPadding = ignoreParentPadding;
// }
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// if (mDrawable == null) {
// return;
// }
// int left = (mIgnoreParentPadding) ? 0 : parent.getPaddingLeft();
// int right = (mIgnoreParentPadding) ? parent.getWidth() : (parent.getWidth() - parent.getPaddingRight());
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount; i++) {
// final View child = parent.getChildAt(i);
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, child);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
// final int bottom = child.getTop() - params.topMargin;
// final int top = bottom - mDrawable.getIntrinsicHeight();
// mDrawable.setBounds(left, top, right, bottom);
// mDrawable.draw(c);
// }
// }
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, view);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (mDrawable != null && nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// outRect.set(0, mDrawable.getIntrinsicHeight(), 0, 0);
// } else {
// outRect.set(0, 0, 0, 0);
// }
// }
//
// @Nullable
// private Integer findPrevViewType(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder nextHolder) {
// if (nextHolder == null) {
// return null;
// }
// RecyclerView.Adapter adapter = parent.getAdapter();
// if (adapter != null && nextHolder.getAdapterPosition() > 0) {
// return adapter.getItemViewType(nextHolder.getAdapterPosition() - 1);
// } else {
// return null;
// }
// }
//
// /**
// * Override this if needed.
// */
// public boolean isAssignable(@NonNull RecyclerView parent, RecyclerView.ViewHolder nextViewHolder, int prevViewType) {
// return true;
// }
//
// public Drawable getDrawable() {
// return mDrawable;
// }
//
// public void setDrawable(Drawable drawable) {
// mDrawable = drawable;
// }
//
// public boolean isIgnoreParentPadding() {
// return mIgnoreParentPadding;
// }
//
// public void setIgnoreParentPadding(boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/adapter/SimpleStringAdapter.java
// public class SimpleStringAdapter extends ScrambleAdapter<String> {
// public SimpleStringAdapter(Context context, List<String> items, ListenerRelay<ScrambleAdapter<?>, RecyclerView.ViewHolder> listenerRelay) {
// super(context, items, listenerRelay, new SimpleStringViewHolderFactory());
// }
// }
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.decoration.VerticalListDividerItemDecoration;
import net.cattaka.android.adaptertoolbox.example.adapter.SimpleStringAdapter;
import java.util.ArrayList;
import java.util.List;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/12/11.
*/
public class VerticalListDividerExampleActivity extends AppCompatActivity {
RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vertical_divider_example);
// find views
mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
{ // set adapter
List<String> items = new ArrayList<>();
for (int i = 0; i < 100; i++) {
items.add("item " + i);
}
|
SimpleStringAdapter adapter = new SimpleStringAdapter(this, items, null);
|
cattaka/AdapterToolbox
|
example/src/main/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivity.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/decoration/VerticalListDividerItemDecoration.java
// public class VerticalListDividerItemDecoration extends RecyclerView.ItemDecoration {
// private boolean mIgnoreParentPadding = true;
// private Drawable mDrawable;
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// final TypedArray a = context.obtainStyledAttributes(new int[]{
// android.R.attr.listDivider
// });
// mDrawable = a.getDrawable(0);
// a.recycle();
// }
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding, @DrawableRes int drawableRes) {
// mIgnoreParentPadding = ignoreParentPadding;
// mDrawable = ContextCompat.getDrawable(context, drawableRes);
// }
//
// public VerticalListDividerItemDecoration(boolean ignoreParentPadding, Drawable drawable) {
// mDrawable = drawable;
// mIgnoreParentPadding = ignoreParentPadding;
// }
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// if (mDrawable == null) {
// return;
// }
// int left = (mIgnoreParentPadding) ? 0 : parent.getPaddingLeft();
// int right = (mIgnoreParentPadding) ? parent.getWidth() : (parent.getWidth() - parent.getPaddingRight());
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount; i++) {
// final View child = parent.getChildAt(i);
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, child);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
// final int bottom = child.getTop() - params.topMargin;
// final int top = bottom - mDrawable.getIntrinsicHeight();
// mDrawable.setBounds(left, top, right, bottom);
// mDrawable.draw(c);
// }
// }
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, view);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (mDrawable != null && nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// outRect.set(0, mDrawable.getIntrinsicHeight(), 0, 0);
// } else {
// outRect.set(0, 0, 0, 0);
// }
// }
//
// @Nullable
// private Integer findPrevViewType(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder nextHolder) {
// if (nextHolder == null) {
// return null;
// }
// RecyclerView.Adapter adapter = parent.getAdapter();
// if (adapter != null && nextHolder.getAdapterPosition() > 0) {
// return adapter.getItemViewType(nextHolder.getAdapterPosition() - 1);
// } else {
// return null;
// }
// }
//
// /**
// * Override this if needed.
// */
// public boolean isAssignable(@NonNull RecyclerView parent, RecyclerView.ViewHolder nextViewHolder, int prevViewType) {
// return true;
// }
//
// public Drawable getDrawable() {
// return mDrawable;
// }
//
// public void setDrawable(Drawable drawable) {
// mDrawable = drawable;
// }
//
// public boolean isIgnoreParentPadding() {
// return mIgnoreParentPadding;
// }
//
// public void setIgnoreParentPadding(boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/adapter/SimpleStringAdapter.java
// public class SimpleStringAdapter extends ScrambleAdapter<String> {
// public SimpleStringAdapter(Context context, List<String> items, ListenerRelay<ScrambleAdapter<?>, RecyclerView.ViewHolder> listenerRelay) {
// super(context, items, listenerRelay, new SimpleStringViewHolderFactory());
// }
// }
|
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.decoration.VerticalListDividerItemDecoration;
import net.cattaka.android.adaptertoolbox.example.adapter.SimpleStringAdapter;
import java.util.ArrayList;
import java.util.List;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/12/11.
*/
public class VerticalListDividerExampleActivity extends AppCompatActivity {
RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vertical_divider_example);
// find views
mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
{ // set adapter
List<String> items = new ArrayList<>();
for (int i = 0; i < 100; i++) {
items.add("item " + i);
}
SimpleStringAdapter adapter = new SimpleStringAdapter(this, items, null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mRecyclerView.setAdapter(adapter);
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/decoration/VerticalListDividerItemDecoration.java
// public class VerticalListDividerItemDecoration extends RecyclerView.ItemDecoration {
// private boolean mIgnoreParentPadding = true;
// private Drawable mDrawable;
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// final TypedArray a = context.obtainStyledAttributes(new int[]{
// android.R.attr.listDivider
// });
// mDrawable = a.getDrawable(0);
// a.recycle();
// }
//
// public VerticalListDividerItemDecoration(Context context, boolean ignoreParentPadding, @DrawableRes int drawableRes) {
// mIgnoreParentPadding = ignoreParentPadding;
// mDrawable = ContextCompat.getDrawable(context, drawableRes);
// }
//
// public VerticalListDividerItemDecoration(boolean ignoreParentPadding, Drawable drawable) {
// mDrawable = drawable;
// mIgnoreParentPadding = ignoreParentPadding;
// }
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// if (mDrawable == null) {
// return;
// }
// int left = (mIgnoreParentPadding) ? 0 : parent.getPaddingLeft();
// int right = (mIgnoreParentPadding) ? parent.getWidth() : (parent.getWidth() - parent.getPaddingRight());
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount; i++) {
// final View child = parent.getChildAt(i);
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, child);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
// final int bottom = child.getTop() - params.topMargin;
// final int top = bottom - mDrawable.getIntrinsicHeight();
// mDrawable.setBounds(left, top, right, bottom);
// mDrawable.draw(c);
// }
// }
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// RecyclerView.ViewHolder nextHolder = ForwardingListener.findContainingViewHolder(parent, view);
// Integer prevViewType = findPrevViewType(parent, nextHolder);
// if (mDrawable != null && nextHolder != null && prevViewType != null && isAssignable(parent, nextHolder, prevViewType)) {
// outRect.set(0, mDrawable.getIntrinsicHeight(), 0, 0);
// } else {
// outRect.set(0, 0, 0, 0);
// }
// }
//
// @Nullable
// private Integer findPrevViewType(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder nextHolder) {
// if (nextHolder == null) {
// return null;
// }
// RecyclerView.Adapter adapter = parent.getAdapter();
// if (adapter != null && nextHolder.getAdapterPosition() > 0) {
// return adapter.getItemViewType(nextHolder.getAdapterPosition() - 1);
// } else {
// return null;
// }
// }
//
// /**
// * Override this if needed.
// */
// public boolean isAssignable(@NonNull RecyclerView parent, RecyclerView.ViewHolder nextViewHolder, int prevViewType) {
// return true;
// }
//
// public Drawable getDrawable() {
// return mDrawable;
// }
//
// public void setDrawable(Drawable drawable) {
// mDrawable = drawable;
// }
//
// public boolean isIgnoreParentPadding() {
// return mIgnoreParentPadding;
// }
//
// public void setIgnoreParentPadding(boolean ignoreParentPadding) {
// mIgnoreParentPadding = ignoreParentPadding;
// }
// }
//
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/adapter/SimpleStringAdapter.java
// public class SimpleStringAdapter extends ScrambleAdapter<String> {
// public SimpleStringAdapter(Context context, List<String> items, ListenerRelay<ScrambleAdapter<?>, RecyclerView.ViewHolder> listenerRelay) {
// super(context, items, listenerRelay, new SimpleStringViewHolderFactory());
// }
// }
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/VerticalListDividerExampleActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import net.cattaka.android.adaptertoolbox.decoration.VerticalListDividerItemDecoration;
import net.cattaka.android.adaptertoolbox.example.adapter.SimpleStringAdapter;
import java.util.ArrayList;
import java.util.List;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/12/11.
*/
public class VerticalListDividerExampleActivity extends AppCompatActivity {
RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vertical_divider_example);
// find views
mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
{ // set adapter
List<String> items = new ArrayList<>();
for (int i = 0; i < 100; i++) {
items.add("item " + i);
}
SimpleStringAdapter adapter = new SimpleStringAdapter(this, items, null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.addItemDecoration(new VerticalListDividerItemDecoration(this, false, R.drawable.vertical_list_divider_rgb));
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivityTest.java
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
|
import android.content.res.Resources;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class CodeLabelExampleActivityTest {
@Rule
public ActivityTestRule<CodeLabelExampleActivity> mActivityTestRule = new ActivityTestRule<CodeLabelExampleActivity>(CodeLabelExampleActivity.class, false, false);
@Test
public void clickSpinner() {
CodeLabelExampleActivity activity = mActivityTestRule.launchActivity(null);
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivityTest.java
import android.content.res.Resources;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class CodeLabelExampleActivityTest {
@Rule
public ActivityTestRule<CodeLabelExampleActivity> mActivityTestRule = new ActivityTestRule<CodeLabelExampleActivity>(CodeLabelExampleActivity.class, false, false);
@Test
public void clickSpinner() {
CodeLabelExampleActivity activity = mActivityTestRule.launchActivity(null);
|
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivityTest.java
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
|
import android.content.res.Resources;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class CodeLabelExampleActivityTest {
@Rule
public ActivityTestRule<CodeLabelExampleActivity> mActivityTestRule = new ActivityTestRule<CodeLabelExampleActivity>(CodeLabelExampleActivity.class, false, false);
@Test
public void clickSpinner() {
CodeLabelExampleActivity activity = mActivityTestRule.launchActivity(null);
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/OrdinalLabel.java
// public enum OrdinalLabel implements ICodeLabel {
// FIRST("first", R.string.ordinal_label_first),
// SECOND("second", R.string.ordinal_label_second),
// THIRD("third", R.string.ordinal_label_third),
// FOURTH("fourth", R.string.ordinal_label_fourth),
// //
// ;
//
// final String code;
// @StringRes
// final int resId;
//
// OrdinalLabel(String code, @StringRes int resId) {
// this.code = code;
// this.resId = resId;
// }
//
// @Override
// public String getCode() {
// return code;
// }
//
// @Override
// public String getLabel(Resources res) {
// return res.getString(resId);
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/CodeLabelExampleActivityTest.java
import android.content.res.Resources;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.data.OrdinalLabel;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class CodeLabelExampleActivityTest {
@Rule
public ActivityTestRule<CodeLabelExampleActivity> mActivityTestRule = new ActivityTestRule<CodeLabelExampleActivity>(CodeLabelExampleActivity.class, false, false);
@Test
public void clickSpinner() {
CodeLabelExampleActivity activity = mActivityTestRule.launchActivity(null);
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
|
for (OrdinalLabel item : OrdinalLabel.values()) {
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/DifferenceDividerExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class DifferenceDividerExampleActivityTest {
@Rule
public ActivityTestRule<DifferenceDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(DifferenceDividerExampleActivity.class, false, false);
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/DifferenceDividerExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class DifferenceDividerExampleActivityTest {
@Rule
public ActivityTestRule<DifferenceDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(DifferenceDividerExampleActivity.class, false, false);
|
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/DifferenceDividerExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
|
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class DifferenceDividerExampleActivityTest {
@Rule
public ActivityTestRule<DifferenceDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(DifferenceDividerExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
DifferenceDividerExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/RecyclerViewAnimatingIdlingResource.java
// public class RecyclerViewAnimatingIdlingResource implements IdlingResource {
// RecyclerView mRecyclerView;
// ResourceCallback mCallback;
//
// public RecyclerViewAnimatingIdlingResource(RecyclerView recyclerView) {
// mRecyclerView = recyclerView;
// }
//
// @Override
// public void registerIdleTransitionCallback(ResourceCallback callback) {
// mCallback = callback;
// }
//
// @Override
// public boolean isIdleNow() {
// if (!mRecyclerView.isAnimating()) {
// if (mCallback != null) {
// mCallback.onTransitionToIdle();
// }
// return true;
// } else {
// return false;
// }
// }
//
// @Override
// public String getName() {
// return "RecyclerViewAnimatingIdlingResource";
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static void waitForIdlingResource(IdlingResource idlingResource, int timeout) {
// long l = SystemClock.elapsedRealtime();
// do {
// if (idlingResource.isIdleNow()) {
// break;
// }
// SystemClock.sleep(100);
// } while (SystemClock.elapsedRealtime() - l > timeout);
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/DifferenceDividerExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.test.RecyclerViewAnimatingIdlingResource;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.waitForIdlingResource;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 17/01/02.
*/
public class DifferenceDividerExampleActivityTest {
@Rule
public ActivityTestRule<DifferenceDividerExampleActivity> mActivityTestRule = new ActivityTestRule<>(DifferenceDividerExampleActivity.class, false, false);
RecyclerViewAnimatingIdlingResource mRecyclerViewAnimatingIdlingResource;
DifferenceDividerExampleActivity mActivity;
@Before
public void before() {
mActivity = mActivityTestRule.launchActivity(null);
mRecyclerViewAnimatingIdlingResource = new RecyclerViewAnimatingIdlingResource(mActivity.mRecyclerView);
}
@Test
public void testRun() {
onView(withId(R.id.recycler)).perform(swipeUp());
|
waitForIdlingResource(mRecyclerViewAnimatingIdlingResource, 5000);
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/MainActivityTest.java
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/ActivityEntry.java
// public class ActivityEntry implements ITreeItem<ActivityEntry> {
// @StringRes
// private int labelResId;
// private Class<? extends Activity> clazz;
// private List<ActivityEntry> children;
//
// public ActivityEntry(@StringRes int labelResId, Class<? extends Activity> clazz, ActivityEntry... children) {
// this.labelResId = labelResId;
// this.clazz = clazz;
// this.children = Arrays.asList(children);
// }
//
// public String getLabel(Resources res) {
// return res.getString(labelResId);
// }
//
// public Class<? extends Activity> getClazz() {
// return clazz;
// }
//
// @Override
// public List<ActivityEntry> getChildren() {
// return children;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// @SuppressWarnings("unchecked")
// public static <T extends Activity> T monitorActivity(@NonNull Class<T> activityClass, int timeOut, @NonNull Runnable runnable) {
// Instrumentation.ActivityMonitor monitor = new Instrumentation.ActivityMonitor(activityClass.getCanonicalName(), null, false);
// try {
// InstrumentationRegistry.getInstrumentation().addMonitor(monitor);
// runnable.run();
// return (T) monitor.waitForActivityWithTimeout(timeOut);
// } finally {
// InstrumentationRegistry.getInstrumentation().removeMonitor(monitor);
// }
// }
|
import android.app.Activity;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.data.ActivityEntry;
import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.monitorActivity;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void clickAll() {
mActivityTestRule.launchActivity(null);
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/ActivityEntry.java
// public class ActivityEntry implements ITreeItem<ActivityEntry> {
// @StringRes
// private int labelResId;
// private Class<? extends Activity> clazz;
// private List<ActivityEntry> children;
//
// public ActivityEntry(@StringRes int labelResId, Class<? extends Activity> clazz, ActivityEntry... children) {
// this.labelResId = labelResId;
// this.clazz = clazz;
// this.children = Arrays.asList(children);
// }
//
// public String getLabel(Resources res) {
// return res.getString(labelResId);
// }
//
// public Class<? extends Activity> getClazz() {
// return clazz;
// }
//
// @Override
// public List<ActivityEntry> getChildren() {
// return children;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// @SuppressWarnings("unchecked")
// public static <T extends Activity> T monitorActivity(@NonNull Class<T> activityClass, int timeOut, @NonNull Runnable runnable) {
// Instrumentation.ActivityMonitor monitor = new Instrumentation.ActivityMonitor(activityClass.getCanonicalName(), null, false);
// try {
// InstrumentationRegistry.getInstrumentation().addMonitor(monitor);
// runnable.run();
// return (T) monitor.waitForActivityWithTimeout(timeOut);
// } finally {
// InstrumentationRegistry.getInstrumentation().removeMonitor(monitor);
// }
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/MainActivityTest.java
import android.app.Activity;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.data.ActivityEntry;
import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.monitorActivity;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void clickAll() {
mActivityTestRule.launchActivity(null);
|
List<ActivityEntry> dataPoinsts = pullDataPoints(new ArrayList<ActivityEntry>(), MainActivity.ACTIVITY_ENTRIES);
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/MainActivityTest.java
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/ActivityEntry.java
// public class ActivityEntry implements ITreeItem<ActivityEntry> {
// @StringRes
// private int labelResId;
// private Class<? extends Activity> clazz;
// private List<ActivityEntry> children;
//
// public ActivityEntry(@StringRes int labelResId, Class<? extends Activity> clazz, ActivityEntry... children) {
// this.labelResId = labelResId;
// this.clazz = clazz;
// this.children = Arrays.asList(children);
// }
//
// public String getLabel(Resources res) {
// return res.getString(labelResId);
// }
//
// public Class<? extends Activity> getClazz() {
// return clazz;
// }
//
// @Override
// public List<ActivityEntry> getChildren() {
// return children;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// @SuppressWarnings("unchecked")
// public static <T extends Activity> T monitorActivity(@NonNull Class<T> activityClass, int timeOut, @NonNull Runnable runnable) {
// Instrumentation.ActivityMonitor monitor = new Instrumentation.ActivityMonitor(activityClass.getCanonicalName(), null, false);
// try {
// InstrumentationRegistry.getInstrumentation().addMonitor(monitor);
// runnable.run();
// return (T) monitor.waitForActivityWithTimeout(timeOut);
// } finally {
// InstrumentationRegistry.getInstrumentation().removeMonitor(monitor);
// }
// }
|
import android.app.Activity;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.data.ActivityEntry;
import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.monitorActivity;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void clickAll() {
mActivityTestRule.launchActivity(null);
List<ActivityEntry> dataPoinsts = pullDataPoints(new ArrayList<ActivityEntry>(), MainActivity.ACTIVITY_ENTRIES);
for (int i = 0; i < dataPoinsts.size(); i++) {
ActivityEntry item = dataPoinsts.get(i);
if (item.getClazz() == null) {
continue;
}
mActivityTestRule.getActivity();
final int position = i;
|
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/data/ActivityEntry.java
// public class ActivityEntry implements ITreeItem<ActivityEntry> {
// @StringRes
// private int labelResId;
// private Class<? extends Activity> clazz;
// private List<ActivityEntry> children;
//
// public ActivityEntry(@StringRes int labelResId, Class<? extends Activity> clazz, ActivityEntry... children) {
// this.labelResId = labelResId;
// this.clazz = clazz;
// this.children = Arrays.asList(children);
// }
//
// public String getLabel(Resources res) {
// return res.getString(labelResId);
// }
//
// public Class<? extends Activity> getClazz() {
// return clazz;
// }
//
// @Override
// public List<ActivityEntry> getChildren() {
// return children;
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// @SuppressWarnings("unchecked")
// public static <T extends Activity> T monitorActivity(@NonNull Class<T> activityClass, int timeOut, @NonNull Runnable runnable) {
// Instrumentation.ActivityMonitor monitor = new Instrumentation.ActivityMonitor(activityClass.getCanonicalName(), null, false);
// try {
// InstrumentationRegistry.getInstrumentation().addMonitor(monitor);
// runnable.run();
// return (T) monitor.waitForActivityWithTimeout(timeOut);
// } finally {
// InstrumentationRegistry.getInstrumentation().removeMonitor(monitor);
// }
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/MainActivityTest.java
import android.app.Activity;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import net.cattaka.android.adaptertoolbox.example.data.ActivityEntry;
import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.monitorActivity;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/05.
*/
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void clickAll() {
mActivityTestRule.launchActivity(null);
List<ActivityEntry> dataPoinsts = pullDataPoints(new ArrayList<ActivityEntry>(), MainActivity.ACTIVITY_ENTRIES);
for (int i = 0; i < dataPoinsts.size(); i++) {
ActivityEntry item = dataPoinsts.get(i);
if (item.getClazz() == null) {
continue;
}
mActivityTestRule.getActivity();
final int position = i;
|
Activity nextActivity = monitorActivity(item.getClazz(), 5000, new Runnable() {
|
cattaka/AdapterToolbox
|
example/src/main/java/net/cattaka/android/adaptertoolbox/example/view/SpinnerEx.java
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/utils/SpinnerUtils.java
// public class SpinnerUtils {
// public static boolean selectSpinnerValue(@NonNull Spinner spinner, Object value) {
// return selectSpinnerValue(spinner, value, false);
// }
//
// public static boolean selectSpinnerValue(@NonNull Spinner spinner, Object value, boolean cancelListener) {
// if (value == null) {
// for (int i = 0; i < spinner.getCount(); i++) {
// if (spinner.getItemAtPosition(i) == null) {
// setSelection(spinner, i, cancelListener);
// return true;
// }
// }
// return false;
// }
// for (int i = 0; i < spinner.getCount(); i++) {
// if (value.equals(spinner.getItemAtPosition(i))) {
// setSelection(spinner, i, cancelListener);
// return true;
// }
// }
// return false;
// }
//
// public static void setSelection(@NonNull Spinner spinner, int position, boolean cancelListener) {
// if (cancelListener) {
// AdapterView.OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
// if (listener != null) {
// spinner.setOnItemSelectedListener(null);
// }
// spinner.setSelection(position, false);
// if (listener != null) {
// spinner.setOnItemSelectedListener(listener);
// }
// } else {
// spinner.setSelection(position);
// }
// }
//
// public static void dismissPopup(@NonNull Spinner spinner) {
// // Does not come to mind is a good way to other...
// Class<?> clazz = spinner.getClass();
// Object popup = null;
// while (popup == null && clazz != null) {
// try {
// Field field = clazz.getDeclaredField("mPopup");
// field.setAccessible(true);
// popup = field.get(spinner);
// if (popup != null) {
// popup.getClass().getMethod("dismiss").invoke(popup);
// return;
// }
// } catch (Exception e) {
// // ignore
// }
// clazz = clazz.getSuperclass();
// }
// }
// }
|
import android.content.Context;
import android.content.res.Resources;
import android.support.v7.widget.AppCompatSpinner;
import android.util.AttributeSet;
import net.cattaka.android.adaptertoolbox.utils.SpinnerUtils;
|
package net.cattaka.android.adaptertoolbox.example.view;
/**
* Created by takao on 2016/06/11.
*/
public class SpinnerEx extends AppCompatSpinner {
public SpinnerEx(Context context) {
super(context);
}
public SpinnerEx(Context context, int mode) {
super(context, mode);
}
public SpinnerEx(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr, int mode) {
super(context, attrs, defStyleAttr, mode);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr, int mode, Resources.Theme popupTheme) {
super(context, attrs, defStyleAttr, mode, popupTheme);
}
public Object getSelectedItem() {
return getItemAtPosition(getSelectedItemPosition());
}
public void setSelectedItem(Object value) {
|
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/utils/SpinnerUtils.java
// public class SpinnerUtils {
// public static boolean selectSpinnerValue(@NonNull Spinner spinner, Object value) {
// return selectSpinnerValue(spinner, value, false);
// }
//
// public static boolean selectSpinnerValue(@NonNull Spinner spinner, Object value, boolean cancelListener) {
// if (value == null) {
// for (int i = 0; i < spinner.getCount(); i++) {
// if (spinner.getItemAtPosition(i) == null) {
// setSelection(spinner, i, cancelListener);
// return true;
// }
// }
// return false;
// }
// for (int i = 0; i < spinner.getCount(); i++) {
// if (value.equals(spinner.getItemAtPosition(i))) {
// setSelection(spinner, i, cancelListener);
// return true;
// }
// }
// return false;
// }
//
// public static void setSelection(@NonNull Spinner spinner, int position, boolean cancelListener) {
// if (cancelListener) {
// AdapterView.OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
// if (listener != null) {
// spinner.setOnItemSelectedListener(null);
// }
// spinner.setSelection(position, false);
// if (listener != null) {
// spinner.setOnItemSelectedListener(listener);
// }
// } else {
// spinner.setSelection(position);
// }
// }
//
// public static void dismissPopup(@NonNull Spinner spinner) {
// // Does not come to mind is a good way to other...
// Class<?> clazz = spinner.getClass();
// Object popup = null;
// while (popup == null && clazz != null) {
// try {
// Field field = clazz.getDeclaredField("mPopup");
// field.setAccessible(true);
// popup = field.get(spinner);
// if (popup != null) {
// popup.getClass().getMethod("dismiss").invoke(popup);
// return;
// }
// } catch (Exception e) {
// // ignore
// }
// clazz = clazz.getSuperclass();
// }
// }
// }
// Path: example/src/main/java/net/cattaka/android/adaptertoolbox/example/view/SpinnerEx.java
import android.content.Context;
import android.content.res.Resources;
import android.support.v7.widget.AppCompatSpinner;
import android.util.AttributeSet;
import net.cattaka.android.adaptertoolbox.utils.SpinnerUtils;
package net.cattaka.android.adaptertoolbox.example.view;
/**
* Created by takao on 2016/06/11.
*/
public class SpinnerEx extends AppCompatSpinner {
public SpinnerEx(Context context) {
super(context);
}
public SpinnerEx(Context context, int mode) {
super(context, mode);
}
public SpinnerEx(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr, int mode) {
super(context, attrs, defStyleAttr, mode);
}
public SpinnerEx(Context context, AttributeSet attrs, int defStyleAttr, int mode, Resources.Theme popupTheme) {
super(context, attrs, defStyleAttr, mode, popupTheme);
}
public Object getSelectedItem() {
return getItemAtPosition(getSelectedItemPosition());
}
public void setSelectedItem(Object value) {
|
SpinnerUtils.selectSpinnerValue(this, value);
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/FizzBuzzExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/08.
*/
public class FizzBuzzExampleActivityTest {
@Rule
public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);
@Test
public void click_FizzBuzz() {
FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/FizzBuzzExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/08.
*/
public class FizzBuzzExampleActivityTest {
@Rule
public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);
@Test
public void click_FizzBuzz() {
FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);
|
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
|
cattaka/AdapterToolbox
|
example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/FizzBuzzExampleActivityTest.java
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
|
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
|
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/08.
*/
public class FizzBuzzExampleActivityTest {
@Rule
public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);
@Test
public void click_FizzBuzz() {
FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
{ // Click Integer
int target = 2;
int position = target - 1;
onView(withId(R.id.recycler)).perform(scrollToPosition(position));
|
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
// return new MockSnackbarWrapper();
// }
//
// @NonNull
// @Override
// public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
// return new MockSnackbarWrapper();
// }
//
// public static class MockSnackbarWrapper implements ISnackbarWrapper {
// @Override
// public void show() {
// // no-op
// }
// }
// }
//
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
// return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/FizzBuzzExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
package net.cattaka.android.adaptertoolbox.example;
/**
* Created by cattaka on 16/06/08.
*/
public class FizzBuzzExampleActivityTest {
@Rule
public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);
@Test
public void click_FizzBuzz() {
FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);
activity.mSnackbarLogic = spy(new MockSnackbarLogic());
{ // Click Integer
int target = 2;
int position = target - 1;
onView(withId(R.id.recycler)).perform(scrollToPosition(position));
|
onView(withIdInRecyclerView(R.id.text, R.id.recycler, position)).perform(click());
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/CompositionModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
package eu.netide.workbenchconfigurationeditor.model;
public class CompositionModel {
private String id;
private String compositionPath;
private PropertyChangeSupport changes;
public CompositionModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setCompositionPath(String path) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/CompositionModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
package eu.netide.workbenchconfigurationeditor.model;
public class CompositionModel {
private String id;
private String compositionPath;
private PropertyChangeSupport changes;
public CompositionModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setCompositionPath(String path) {
|
changes.firePropertyChange(Constants.COMPOSITION_MODEL_PATH, this.compositionPath, this.compositionPath = path);
|
fp7-netide/IDE
|
plugins/eu.netide.deployment.topologyimport.ui/src/eu/netide/deployment/topologyimport/ui/popup/actions/TopologyImportAction.java
|
// Path: plugins/eu.netide.deployment.topologyimport/src/eu/netide/deployment/topologyimport/TopologyImportFactory.java
// public class TopologyImportFactory {
//
// public static TopologyImportFactory instance = new TopologyImportFactory();
//
// public TopologyImport createTopologyImport() {
// return new TopologyImport();
// }
//
// }
|
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import eu.netide.deployment.topologyimport.TopologyImport;
import eu.netide.deployment.topologyimport.TopologyImportFactory;
|
package eu.netide.deployment.topologyimport.ui.popup.actions;
public class TopologyImportAction implements IObjectActionDelegate {
private Shell shell;
private IFile file;
/**
* Constructor for Action1.
*/
public TopologyImportAction() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
|
// Path: plugins/eu.netide.deployment.topologyimport/src/eu/netide/deployment/topologyimport/TopologyImportFactory.java
// public class TopologyImportFactory {
//
// public static TopologyImportFactory instance = new TopologyImportFactory();
//
// public TopologyImport createTopologyImport() {
// return new TopologyImport();
// }
//
// }
// Path: plugins/eu.netide.deployment.topologyimport.ui/src/eu/netide/deployment/topologyimport/ui/popup/actions/TopologyImportAction.java
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import eu.netide.deployment.topologyimport.TopologyImport;
import eu.netide.deployment.topologyimport.TopologyImportFactory;
package eu.netide.deployment.topologyimport.ui.popup.actions;
public class TopologyImportAction implements IObjectActionDelegate {
private Shell shell;
private IFile file;
/**
* Constructor for Action1.
*/
public TopologyImportAction() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
|
TopologyImport topologyimport = TopologyImportFactory.instance.createTopologyImport();
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/UiStatusModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import org.eclipse.core.databinding.observable.list.WritableList;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
// private ArrayList<CompositionModel> compositionList;
private PropertyChangeSupport changes;
public UiStatusModel() {
this.changes = new PropertyChangeSupport(this);
this.modelList = new ArrayList<LaunchConfigurationModel>();
this.profileList = new ArrayList<SshProfileModel>();
this.topologyModel = new TopologyModel();
this.compositionModel = new CompositionModel();
this.shimModel = new ShimModel();
this.setMininetRunning(new Boolean(false));
this.setServerControllerRunning(new Boolean(false));
this.setSshRunning(new Boolean(false));
this.setVagrantRunning(new Boolean(false));
this.setCoreRunning(false);
this.setDebuggerRunning(false);
}
// public CompositionModel getCompositionAtSelectedIndex() {
// return this.compositionList.get(this.compositionSelectionIndex);
// }
//
// public void addCompositionToList(CompositionModel m) {
// compositionWritableList.add(m);
// }
public void setCompositionSelectionIndex(int index) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/UiStatusModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import org.eclipse.core.databinding.observable.list.WritableList;
import eu.netide.workbenchconfigurationeditor.util.Constants;
// private ArrayList<CompositionModel> compositionList;
private PropertyChangeSupport changes;
public UiStatusModel() {
this.changes = new PropertyChangeSupport(this);
this.modelList = new ArrayList<LaunchConfigurationModel>();
this.profileList = new ArrayList<SshProfileModel>();
this.topologyModel = new TopologyModel();
this.compositionModel = new CompositionModel();
this.shimModel = new ShimModel();
this.setMininetRunning(new Boolean(false));
this.setServerControllerRunning(new Boolean(false));
this.setSshRunning(new Boolean(false));
this.setVagrantRunning(new Boolean(false));
this.setCoreRunning(false);
this.setDebuggerRunning(false);
}
// public CompositionModel getCompositionAtSelectedIndex() {
// return this.compositionList.get(this.compositionSelectionIndex);
// }
//
// public void addCompositionToList(CompositionModel m) {
// compositionWritableList.add(m);
// }
public void setCompositionSelectionIndex(int index) {
|
changes.firePropertyChange(Constants.COMPOSITION_SELECTION_INDEX, this.compositionSelectionIndex,
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/TopologyModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
package eu.netide.workbenchconfigurationeditor.model;
public class TopologyModel {
private String id;
private String topologyPath;
private PropertyChangeSupport changes;
public TopologyModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setTopologyPath(String path) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/TopologyModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
package eu.netide.workbenchconfigurationeditor.model;
public class TopologyModel {
private String id;
private String topologyPath;
private PropertyChangeSupport changes;
public TopologyModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setTopologyPath(String path) {
|
changes.firePropertyChange(Constants.TOPOLOGY_MODEL_PATH, this.topologyPath, this.topologyPath = path);
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/ShimModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
package eu.netide.workbenchconfigurationeditor.model;
public class ShimModel {
private String id;
private String shim;
private String port;
private PropertyChangeSupport changes;
public ShimModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setPort(String port) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/ShimModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
package eu.netide.workbenchconfigurationeditor.model;
public class ShimModel {
private String id;
private String shim;
private String port;
private PropertyChangeSupport changes;
public ShimModel() {
changes = new PropertyChangeSupport(this);
id = "" + UUID.randomUUID();
}
public String getID() {
return this.id;
}
public void setID(String id) {
this.id = id;
}
public void setPort(String port) {
|
changes.firePropertyChange(Constants.SHIM_PORT, this.port, this.port = port);
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/SshProfileModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
private String engine;
private String core;
private String topology;
private String tools;
private String appFolder;
private String composite;
private String appSource;
private String appTarget;
private String minConfigSource;
private String minConfigTarget;
private String id;
private PropertyChangeSupport changes;
public SshProfileModel() {
changes = new PropertyChangeSupport(this);
this.id = "" + UUID.randomUUID();
}
public boolean getIsDoubleTunnel() {
return (!getSecondHost().equals("") && !getSecondPort().equals("") && !getSecondUsername().equals(""));
}
public String getID() {
return this.id;
}
public void setSecondUsername(String username) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/SshProfileModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.UUID;
import eu.netide.workbenchconfigurationeditor.util.Constants;
private String engine;
private String core;
private String topology;
private String tools;
private String appFolder;
private String composite;
private String appSource;
private String appTarget;
private String minConfigSource;
private String minConfigTarget;
private String id;
private PropertyChangeSupport changes;
public SshProfileModel() {
changes = new PropertyChangeSupport(this);
this.id = "" + UUID.randomUUID();
}
public boolean getIsDoubleTunnel() {
return (!getSecondHost().equals("") && !getSecondPort().equals("") && !getSecondUsername().equals(""));
}
public String getID() {
return this.id;
}
public void setSecondUsername(String username) {
|
this.changes.firePropertyChange(Constants.SECOND_USERNAME, this.secondUsername, this.secondUsername = username);
|
fp7-netide/IDE
|
plugins/eu.netide.configuration.launcher/src/eu/netide/configuration/launcher/dummygui/DummyGUI.java
|
// Path: plugins/eu.netide.deployment.topologyimport/src/eu/netide/deployment/topologyimport/TopologyImportFactory.java
// public class TopologyImportFactory {
//
// public static TopologyImportFactory instance = new TopologyImportFactory();
//
// public TopologyImport createTopologyImport() {
// return new TopologyImport();
// }
//
// }
|
import java.util.ArrayList;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.List;
import org.eclipse.ui.part.ViewPart;
import eu.netide.configuration.launcher.starters.IStarter;
import eu.netide.configuration.launcher.starters.IStarterRegistry;
import eu.netide.deployment.topologyimport.TopologyImport;
import eu.netide.deployment.topologyimport.TopologyImportFactory;
import eu.netide.configuration.launcher.managers.IManager;
|
btnHalt.setText("Halt");
Button btnGetSessions = new Button(grpVagrant, SWT.NONE);
btnGetSessions.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
Job job = new Job("Get Sessions") {
@Override
protected IStatus run(IProgressMonitor monitor) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshStarters();
}
});
return Status.OK_STATUS;
}
};
job.schedule();
}
});
btnGetSessions.setText("Get Sessions");
Button btnGetTopology = new Button(grpVagrant, SWT.NONE);
btnGetTopology.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
String topo = manager.execWithReturn(
"curl -s -u admin:admin http://localhost:8181/restconf/operational/network-topology:network-topology/");
|
// Path: plugins/eu.netide.deployment.topologyimport/src/eu/netide/deployment/topologyimport/TopologyImportFactory.java
// public class TopologyImportFactory {
//
// public static TopologyImportFactory instance = new TopologyImportFactory();
//
// public TopologyImport createTopologyImport() {
// return new TopologyImport();
// }
//
// }
// Path: plugins/eu.netide.configuration.launcher/src/eu/netide/configuration/launcher/dummygui/DummyGUI.java
import java.util.ArrayList;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.List;
import org.eclipse.ui.part.ViewPart;
import eu.netide.configuration.launcher.starters.IStarter;
import eu.netide.configuration.launcher.starters.IStarterRegistry;
import eu.netide.deployment.topologyimport.TopologyImport;
import eu.netide.deployment.topologyimport.TopologyImportFactory;
import eu.netide.configuration.launcher.managers.IManager;
btnHalt.setText("Halt");
Button btnGetSessions = new Button(grpVagrant, SWT.NONE);
btnGetSessions.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
Job job = new Job("Get Sessions") {
@Override
protected IStatus run(IProgressMonitor monitor) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshStarters();
}
});
return Status.OK_STATUS;
}
};
job.schedule();
}
});
btnGetSessions.setText("Get Sessions");
Button btnGetTopology = new Button(grpVagrant, SWT.NONE);
btnGetTopology.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
String topo = manager.execWithReturn(
"curl -s -u admin:admin http://localhost:8181/restconf/operational/network-topology:network-topology/");
|
TopologyImport topoImport = TopologyImportFactory.instance.createTopologyImport();
|
fp7-netide/IDE
|
plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/LaunchConfigurationModel.java
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
|
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import eu.netide.workbenchconfigurationeditor.util.Constants;
|
package eu.netide.workbenchconfigurationeditor.model;
public class LaunchConfigurationModel {
private PropertyChangeSupport changes;
private String appPath;
private String platform;
private String id;
private String clientController;
private String appName;
private String appPort;
private boolean running;
private String name;
private String flagBackend;
private String flagApp;
public LaunchConfigurationModel() {
changes = new PropertyChangeSupport(this);
}
public void setRunning(boolean newRunning) {
|
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/util/Constants.java
// public class Constants {
// // Launch Configuration Model Constants
// public static final String APP_PATH_MODEL = "appPath";
// public static final String CLIENT_CONTROLLER_MODEL = "clientController";
// public static final String TOPOLOGY_MODEL = "topology";
// public static final String ID_MODEL = "id";
// public static final String PLATFORM_MODEL = "platform";
// public static final String PORT_MODEL = "appPort";
// public static final String APP_NAME_MODEL = "appName";
// public static final String APP_RUNNING_MODEL = "running";
// public static final String LaunchName = "name";
// public static final String FLAG_BACKEND = "flagBackend";
// public static final String FLAG_APP = "flagApp";
//
// // UI Status Model Constants
// public static final String VAGRANT_RUNNING_MODEL = "vagrantRunning";
// public static final String MININET_RUNNING_MODEL = "mininetRunning";
// public static final String CORE_RUNNING_MODEL = "coreRunning";
// public static final String SSH_RUNNING_MODEL = "sshRunning";
// public static final String SERVER_CONTROLLER_RUNNING_MODEL = "serverControllerRunning";
// public static final String DEBUGGER_RUNNING_MODEL = "debuggerRunning";
// public static final String SSH_COMBO_SELECTION_INDEX = "sshComboSelectionIndex";
// public static final String LAUNCH_TABLE_INDEX = "launchTableIndex";
// public static final String SERVER_CONTROLLER_SELECTION = "serverControllerSelection";
// public static final String COMPOSITION_SELECTION_INDEX = "compositionSelectionIndex";
//
// public static final String TOPOLOGY_MODEL_PATH = "topologyPath";
// public static final String COMPOSITION = "compositionPath";
// public static final String COMPOSITION_PATH = "compositionPath";
// public static final String ELEMENT_TOPOLOGY_PATH = "topologyPath";
//
// public static final String COMPOSITION_MODEL_PATH = "compositionPath";
// public static final String SERVER_COMBO_TEXT = "shim";
//
// public static final String SHIM_PORT = "port";
//
// // SSH Profile Model Constants
// public static final String HOST_MODEL = "host";
// public static final String SSH_PORT_MODEL = "port";
// public static final String SSH_ID_FILE_MODEL = "sshIdFile";
// public static final String USERNAME_MODEL = "username";
// public static final String PROFILE_NAME_MODEL = "profileName";
// public static final String SECOND_PORT = "secondPort";
// public static final String SECOND_USERNAME = "secondUsername";
// public static final String SECOND_HOST = "secondHost";
//
// public static final String APP_FOLDER = "appFolder";
// public static final String COMPOSITE_FILE = "compositeFile";
// public static final String ODL_SHIM = "odlShim";
// public static final String ENGINE = "engine";
// public static final String CORE = "core";
// public static final String VAGRANT_BOX = "vagrantBox";
// public static final String TOOLS = "tools";
// public static final String TOPOLOGY = "topology";
// public static final String APP_SOURCE = "appSource";
// public static final String APP_TARGET = "appTarget";
// public static final String MIN_CONFIG_SOURCE = "minConfigSource";
// public static final String MIN_CONFIG_TARGET = "minConfigTarget";
//
//
// // UI Constants
// public static final String LABEL_RUNNING = "running";
// public static final String LABEL_OFFLINE = "offline";
//
// }
// Path: plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/model/LaunchConfigurationModel.java
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import eu.netide.workbenchconfigurationeditor.util.Constants;
package eu.netide.workbenchconfigurationeditor.model;
public class LaunchConfigurationModel {
private PropertyChangeSupport changes;
private String appPath;
private String platform;
private String id;
private String clientController;
private String appName;
private String appPort;
private boolean running;
private String name;
private String flagBackend;
private String flagApp;
public LaunchConfigurationModel() {
changes = new PropertyChangeSupport(this);
}
public void setRunning(boolean newRunning) {
|
changes.firePropertyChange(Constants.APP_RUNNING_MODEL, running, this.running = newRunning);
|
TomGrill/gdx-dialogs
|
html/src/de/tomgrill/gdxdialogs/html/dialogs/HTMLGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.html.dialogs;
@SuppressWarnings("JniMissingFunction")
public class HTMLGDXButtonDialog implements GDXButtonDialog {
String title, message = "";
boolean isBuild = false;
|
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: html/src/de/tomgrill/gdxdialogs/html/dialogs/HTMLGDXButtonDialog.java
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.html.dialogs;
@SuppressWarnings("JniMissingFunction")
public class HTMLGDXButtonDialog implements GDXButtonDialog {
String title, message = "";
boolean isBuild = false;
|
ButtonClickListener listener;
|
TomGrill/gdx-dialogs
|
ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
|
import org.robovm.apple.uikit.UIActivityIndicatorView;
import org.robovm.apple.uikit.UIAlertView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXProgressDialog implements GDXProgressDialog {
private UIAlertView alertView;
private UIActivityIndicatorView indicator;
private String title = "";
private String message = "";
public IOSGDXProgressDialog() {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXProgressDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
// Path: ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXProgressDialog.java
import org.robovm.apple.uikit.UIActivityIndicatorView;
import org.robovm.apple.uikit.UIAlertView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXProgressDialog implements GDXProgressDialog {
private UIAlertView alertView;
private UIActivityIndicatorView indicator;
private String title = "";
private String message = "";
public IOSGDXProgressDialog() {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXProgressDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSGDXProgressDialog.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
import javax.swing.JOptionPane;
import javax.swing.JDialog;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXProgressDialog implements GDXProgressDialog {
private JOptionPane optionPane;
private JDialog dialog;
private CharSequence title = "";
private CharSequence message = "";
public DesktopGDXProgressDialog() {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = title;
return this;
}
@Override
public GDXProgressDialog show() {
new Thread(new Runnable() {
@Override
public void run() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
// Path: desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXProgressDialog.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
import javax.swing.JOptionPane;
import javax.swing.JDialog;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXProgressDialog implements GDXProgressDialog {
private JOptionPane optionPane;
private JDialog dialog;
private CharSequence title = "";
private CharSequence message = "";
public DesktopGDXProgressDialog() {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = title;
return this;
}
@Override
public GDXProgressDialog show() {
new Thread(new Runnable() {
@Override
public void run() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, DesktopGDXProgressDialog.class.getSimpleName() +
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public interface GDXTextPrompt {
/**
* Type of input used by the textfield
*/
enum InputType {
/**
* prints readable text
*/
PLAIN_TEXT,
/**
* hides typed text behind specified character
*/
PASSWORD
}
/**
* Sets the title
*
* @param title String value to set the title
* @return The same instance that the method was called from.
*/
GDXTextPrompt setTitle(CharSequence title);
/**
* Set the character limit for input. Default is 16.
*
* @param maxLength
* @return
*/
GDXTextPrompt setMaxLength(int maxLength);
/**
* Shows the dialog. show() can only be called after build() has been called
* else there might be strange behavior. Runs asynchronously on a different thread.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt show();
/**
* Dismisses the dialog. You can show the dialog again.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt dismiss();
/**
* This builds the button and prepares for usage.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt build();
/**
* Sets the message.
*
* @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
* @return The same instance that the method was called from.
*/
GDXTextPrompt setMessage(CharSequence message);
/**
* Sets the default value for the input field.
*
* @param inputTip Placeholder for the text input field.
* @return The same instance that the method was called from.
*/
GDXTextPrompt setValue(CharSequence inputTip);
/**
* Sets the label for the cancel button on the dialog.
*
* @param label Text of the cancel button
* @return The same instance that the method was called from.
*/
GDXTextPrompt setCancelButtonLabel(CharSequence label);
/**
* Sets the label for the confirm button on the dialog.
*
* @param label Text of the confirm button
* @return The same instance that the method was called from.
*/
GDXTextPrompt setConfirmButtonLabel(CharSequence label);
/**
* Sets the {@link TextPromptListener}
*
* @param listener listener to be called when the event is triggered
* @return The same instance that the method was called from.
*/
|
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public interface GDXTextPrompt {
/**
* Type of input used by the textfield
*/
enum InputType {
/**
* prints readable text
*/
PLAIN_TEXT,
/**
* hides typed text behind specified character
*/
PASSWORD
}
/**
* Sets the title
*
* @param title String value to set the title
* @return The same instance that the method was called from.
*/
GDXTextPrompt setTitle(CharSequence title);
/**
* Set the character limit for input. Default is 16.
*
* @param maxLength
* @return
*/
GDXTextPrompt setMaxLength(int maxLength);
/**
* Shows the dialog. show() can only be called after build() has been called
* else there might be strange behavior. Runs asynchronously on a different thread.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt show();
/**
* Dismisses the dialog. You can show the dialog again.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt dismiss();
/**
* This builds the button and prepares for usage.
*
* @return The same instance that the method was called from.
*/
GDXTextPrompt build();
/**
* Sets the message.
*
* @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
* @return The same instance that the method was called from.
*/
GDXTextPrompt setMessage(CharSequence message);
/**
* Sets the default value for the input field.
*
* @param inputTip Placeholder for the text input field.
* @return The same instance that the method was called from.
*/
GDXTextPrompt setValue(CharSequence inputTip);
/**
* Sets the label for the cancel button on the dialog.
*
* @param label Text of the cancel button
* @return The same instance that the method was called from.
*/
GDXTextPrompt setCancelButtonLabel(CharSequence label);
/**
* Sets the label for the confirm button on the dialog.
*
* @param label Text of the confirm button
* @return The same instance that the method was called from.
*/
GDXTextPrompt setConfirmButtonLabel(CharSequence label);
/**
* Sets the {@link TextPromptListener}
*
* @param listener listener to be called when the event is triggered
* @return The same instance that the method was called from.
*/
|
GDXTextPrompt setTextPromptListener(TextPromptListener listener);
|
TomGrill/gdx-dialogs
|
android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
|
import android.app.Activity;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXProgressDialog implements GDXProgressDialog {
private Activity activity;
private android.app.ProgressDialog progressDialog;
private CharSequence message = "";
private CharSequence title = "";
private boolean isBuild = false;
public AndroidGDXProgressDialog(Activity activity) {
this.activity = activity;
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = title;
return this;
}
@Override
public GDXProgressDialog show() {
if (progressDialog == null || !isBuild) {
throw new RuntimeException(AndroidGDXProgressDialog.class.getSimpleName() + " has not been build. Use"+
" build() before show().");
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXProgressDialog.java
import android.app.Activity;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXProgressDialog implements GDXProgressDialog {
private Activity activity;
private android.app.ProgressDialog progressDialog;
private CharSequence message = "";
private CharSequence title = "";
private boolean isBuild = false;
public AndroidGDXProgressDialog(Activity activity) {
this.activity = activity;
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = title;
return this;
}
@Override
public GDXProgressDialog show() {
if (progressDialog == null || !isBuild) {
throw new RuntimeException(AndroidGDXProgressDialog.class.getSimpleName() + " has not been build. Use"+
" build() before show().");
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, GDXProgressDialog.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXTextPrompt implements GDXTextPrompt {
private Activity activity;
private int maxLength = 16;
private TextView titleView;
private TextView messageView;
private CharSequence message = "";
private CharSequence title = "";
private CharSequence cancelLabel = "";
private CharSequence confirmLabel = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXTextPrompt.java
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXTextPrompt implements GDXTextPrompt {
private Activity activity;
private int maxLength = 16;
private TextView titleView;
private TextView messageView;
private CharSequence message = "";
private CharSequence title = "";
private CharSequence cancelLabel = "";
private CharSequence confirmLabel = "";
|
private TextPromptListener listener;
|
TomGrill/gdx-dialogs
|
android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
|
private CharSequence inputValue = "";
private EditText userInput;
private AlertDialog alertDialog;
private boolean isBuild = false;
private int inputType = android.text.InputType.TYPE_CLASS_TEXT;
public AndroidGDXTextPrompt(Activity activity) {
this.activity = activity;
}
@Override
public GDXTextPrompt show() {
if (alertDialog == null || !isBuild) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before" +
" show().");
}
// When alert dialog is null, an except. is thrown and the code never gets here. No point in checking
if (userInput != null) {
userInput.setText(inputValue);
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXTextPrompt.java
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
private CharSequence inputValue = "";
private EditText userInput;
private AlertDialog alertDialog;
private boolean isBuild = false;
private int inputType = android.text.InputType.TYPE_CLASS_TEXT;
public AndroidGDXTextPrompt(Activity activity) {
this.activity = activity;
}
@Override
public GDXTextPrompt show() {
if (alertDialog == null || !isBuild) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before" +
" show().");
}
// When alert dialog is null, an except. is thrown and the code never gets here. No point in checking
if (userInput != null) {
userInput.setText(inputValue);
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, AndroidGDXTextPrompt.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import javax.swing.JOptionPane;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXButtonDialog implements GDXButtonDialog {
private CharSequence title = "";
private CharSequence message = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import javax.swing.JOptionPane;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXButtonDialog implements GDXButtonDialog {
private CharSequence title = "";
private CharSequence message = "";
|
private ButtonClickListener listener;
|
TomGrill/gdx-dialogs
|
desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import javax.swing.JOptionPane;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXButtonDialog implements GDXButtonDialog {
private CharSequence title = "";
private CharSequence message = "";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
private boolean isBuild = false;
public DesktopGDXButtonDialog() {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import javax.swing.JOptionPane;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXButtonDialog implements GDXButtonDialog {
private CharSequence title = "";
private CharSequence message = "";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
private boolean isBuild = false;
public DesktopGDXButtonDialog() {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, "INFO: Desktop Dialogs cannot be set cancelled");
|
TomGrill/gdx-dialogs
|
ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import apple.uikit.UIAlertView;
import apple.uikit.protocol.UIAlertViewDelegate;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXButtonDialog implements GDXButtonDialog {
private final static String TAG = IOSMOEGDXButtonDialog.class.getSimpleName();
private UIAlertView alertView;
private String title = "title";
private String message = "mesage";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import apple.uikit.UIAlertView;
import apple.uikit.protocol.UIAlertViewDelegate;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXButtonDialog implements GDXButtonDialog {
private final static String TAG = IOSMOEGDXButtonDialog.class.getSimpleName();
private UIAlertView alertView;
private String title = "title";
private String message = "mesage";
|
private ButtonClickListener listener;
|
TomGrill/gdx-dialogs
|
ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import apple.uikit.UIAlertView;
import apple.uikit.protocol.UIAlertViewDelegate;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXButtonDialog implements GDXButtonDialog {
private final static String TAG = IOSMOEGDXButtonDialog.class.getSimpleName();
private UIAlertView alertView;
private String title = "title";
private String message = "mesage";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
public IOSMOEGDXButtonDialog () {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been built. Use build() " +
"before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
import apple.uikit.UIAlertView;
import apple.uikit.protocol.UIAlertViewDelegate;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXButtonDialog implements GDXButtonDialog {
private final static String TAG = IOSMOEGDXButtonDialog.class.getSimpleName();
private UIAlertView alertView;
private String title = "title";
private String message = "mesage";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
public IOSMOEGDXButtonDialog () {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been built. Use build() " +
"before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSMOEGDXButtonDialog.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import org.robovm.apple.uikit.UIAlertView;
import org.robovm.apple.uikit.UIAlertViewDelegateAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXButtonDialog implements GDXButtonDialog {
private UIAlertView alertView;
private String title = "";
private String message = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXButtonDialog.java
import org.robovm.apple.uikit.UIAlertView;
import org.robovm.apple.uikit.UIAlertViewDelegateAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXButtonDialog implements GDXButtonDialog {
private UIAlertView alertView;
private String title = "";
private String message = "";
|
private ButtonClickListener listener;
|
TomGrill/gdx-dialogs
|
ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import org.robovm.apple.uikit.UIAlertView;
import org.robovm.apple.uikit.UIAlertViewDelegateAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXButtonDialog implements GDXButtonDialog {
private UIAlertView alertView;
private String title = "";
private String message = "";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
public IOSGDXButtonDialog() {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXButtonDialog.java
import org.robovm.apple.uikit.UIAlertView;
import org.robovm.apple.uikit.UIAlertViewDelegateAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXButtonDialog implements GDXButtonDialog {
private UIAlertView alertView;
private String title = "";
private String message = "";
private ButtonClickListener listener;
private Array<CharSequence> labels = new Array<CharSequence>();
public IOSGDXButtonDialog() {
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSGDXButtonDialog.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
html/src/de/tomgrill/gdxdialogs/html/dialogs/HTMLGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
|
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.html.dialogs;
@SuppressWarnings("JniMissingFunction")
public class HTMLGDXProgressDialog implements GDXProgressDialog {
String title, message = "";
boolean isBuild = false;
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (isBuild == false) {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
// Path: html/src/de/tomgrill/gdxdialogs/html/dialogs/HTMLGDXProgressDialog.java
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.html.dialogs;
@SuppressWarnings("JniMissingFunction")
public class HTMLGDXProgressDialog implements GDXProgressDialog {
String title, message = "";
boolean isBuild = false;
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (isBuild == false) {
|
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been build. Use build() before show().");
|
TomGrill/gdx-dialogs
|
ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import org.robovm.apple.foundation.NSRange;
import org.robovm.apple.uikit.*;
import org.robovm.rt.bro.annotation.ByVal;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import org.robovm.apple.foundation.NSRange;
import org.robovm.apple.uikit.*;
import org.robovm.rt.bro.annotation.ByVal;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
|
private TextPromptListener listener;
|
TomGrill/gdx-dialogs
|
ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import org.robovm.apple.foundation.NSRange;
import org.robovm.apple.uikit.*;
import org.robovm.rt.bro.annotation.ByVal;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
private TextPromptListener listener;
private UIAlertView alertView;
private int maxLength = 16;
private UIAlertViewStyle inputType = UIAlertViewStyle.PlainTextInput;
public IOSGDXTextPrompt() {
}
@Override
public GDXTextPrompt show() {
if (alertView == null) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import org.robovm.apple.foundation.NSRange;
import org.robovm.apple.uikit.*;
import org.robovm.rt.bro.annotation.ByVal;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.ios.dialogs;
public class IOSGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
private TextPromptListener listener;
private UIAlertView alertView;
private int maxLength = 16;
private UIAlertViewStyle inputType = UIAlertViewStyle.PlainTextInput;
public IOSGDXTextPrompt() {
}
@Override
public GDXTextPrompt show() {
if (alertView == null) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSGDXTextPrompt.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public interface GDXButtonDialog {
/**
* Only on Android: When set true, user can click outside of the dialog and
* the dialog will be closed. Has no effect on other operating systems.
*
* @param cancelable this value will be set to the corresponding android property if applicable.
* @return The same instance that the method was called from.
*/
GDXButtonDialog setCancelable(boolean cancelable);
/**
* Shows the dialog. show() can only be called after build() has been called
* else there might be strange behavior. You need to add at least one button
* with addButton() before calling build(). Runs asynchronously on a different thread.
*
* @return The same instance that the method was called from.
*/
GDXButtonDialog show();
/**
* Dismisses the dialog. You can show the dialog again.
*
* @return The same instance that the method was called from.
*/
GDXButtonDialog dismiss();
/**
* Sets the {@link ButtonClickListener}
*
* @param listener listener to be called when the event is triggered
* @return The same instance that the method was called from.
*/
|
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public interface GDXButtonDialog {
/**
* Only on Android: When set true, user can click outside of the dialog and
* the dialog will be closed. Has no effect on other operating systems.
*
* @param cancelable this value will be set to the corresponding android property if applicable.
* @return The same instance that the method was called from.
*/
GDXButtonDialog setCancelable(boolean cancelable);
/**
* Shows the dialog. show() can only be called after build() has been called
* else there might be strange behavior. You need to add at least one button
* with addButton() before calling build(). Runs asynchronously on a different thread.
*
* @return The same instance that the method was called from.
*/
GDXButtonDialog show();
/**
* Dismisses the dialog. You can show the dialog again.
*
* @return The same instance that the method was called from.
*/
GDXButtonDialog dismiss();
/**
* Sets the {@link ButtonClickListener}
*
* @param listener listener to be called when the event is triggered
* @return The same instance that the method was called from.
*/
|
GDXButtonDialog setClickListener(ButtonClickListener listener);
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXButtonDialog implements GDXButtonDialog {
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXButtonDialog implements GDXButtonDialog {
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXButtonDialog.class.getSimpleName() + " now shown ignored. (Fallback with empty methods)");
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXButtonDialog implements GDXButtonDialog {
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXButtonDialog.class.getSimpleName() + " now shown ignored. (Fallback with empty methods)");
return this;
}
@Override
public GDXButtonDialog dismiss() {
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXButtonDialog.class.getSimpleName() + " dismiss ignored. (Fallback with empty methods)");
return this;
}
@Override
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXButtonDialog.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXButtonDialog implements GDXButtonDialog {
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
return this;
}
@Override
public GDXButtonDialog show() {
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXButtonDialog.class.getSimpleName() + " now shown ignored. (Fallback with empty methods)");
return this;
}
@Override
public GDXButtonDialog dismiss() {
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXButtonDialog.class.getSimpleName() + " dismiss ignored. (Fallback with empty methods)");
return this;
}
@Override
|
public GDXButtonDialog setClickListener(ButtonClickListener listener) {
|
TomGrill/gdx-dialogs
|
desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import javax.swing.*;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXTextPrompt implements GDXTextPrompt {
private CharSequence title = "";
private CharSequence message = "";
private CharSequence value = "";
private CharSequence cancelButtonLabel = "Cancel", confirmButtonLabel = "OK";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import javax.swing.*;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXTextPrompt implements GDXTextPrompt {
private CharSequence title = "";
private CharSequence message = "";
private CharSequence value = "";
private CharSequence cancelButtonLabel = "Cancel", confirmButtonLabel = "OK";
|
private TextPromptListener listener;
|
TomGrill/gdx-dialogs
|
desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import javax.swing.*;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXTextPrompt implements GDXTextPrompt {
private CharSequence title = "";
private CharSequence message = "";
private CharSequence value = "";
private CharSequence cancelButtonLabel = "Cancel", confirmButtonLabel = "OK";
private TextPromptListener listener;
private InputType inputType = InputType.PLAIN_TEXT;
public DesktopGDXTextPrompt() {
}
@Override
public GDXTextPrompt show() {
new Thread(new Runnable() {
@Override
public void run() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import javax.swing.*;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.desktop.dialogs;
public class DesktopGDXTextPrompt implements GDXTextPrompt {
private CharSequence title = "";
private CharSequence message = "";
private CharSequence value = "";
private CharSequence cancelButtonLabel = "Cancel", confirmButtonLabel = "OK";
private TextPromptListener listener;
private InputType inputType = InputType.PLAIN_TEXT;
public DesktopGDXTextPrompt() {
}
@Override
public GDXTextPrompt show() {
new Thread(new Runnable() {
@Override
public void run() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG,
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXProgressDialog implements GDXProgressDialog {
@Override
public GDXProgressDialog setMessage(CharSequence message) {
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
return this;
}
@Override
public GDXProgressDialog show() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXProgressDialog.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXProgressDialog implements GDXProgressDialog {
@Override
public GDXProgressDialog setMessage(CharSequence message) {
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
return this;
}
@Override
public GDXProgressDialog show() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXProgressDialog.class.getSimpleName() + " now shown ignored. (Fallback with empty methods)");
|
TomGrill/gdx-dialogs
|
ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import apple.foundation.struct.NSRange;
import apple.uikit.protocol.UITextFieldDelegate;
import com.badlogic.gdx.Gdx;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import apple.uikit.UIAlertView;
import apple.uikit.UITextField;
import apple.uikit.enums.UIAlertViewStyle;
import apple.uikit.protocol.UIAlertViewDelegate;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXTextPrompt.java
import apple.foundation.struct.NSRange;
import apple.uikit.protocol.UITextFieldDelegate;
import com.badlogic.gdx.Gdx;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import apple.uikit.UIAlertView;
import apple.uikit.UITextField;
import apple.uikit.enums.UIAlertViewStyle;
import apple.uikit.protocol.UIAlertViewDelegate;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
|
private TextPromptListener listener;
|
TomGrill/gdx-dialogs
|
ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import apple.foundation.struct.NSRange;
import apple.uikit.protocol.UITextFieldDelegate;
import com.badlogic.gdx.Gdx;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import apple.uikit.UIAlertView;
import apple.uikit.UITextField;
import apple.uikit.enums.UIAlertViewStyle;
import apple.uikit.protocol.UIAlertViewDelegate;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
private TextPromptListener listener;
private UIAlertView alertView;
private int maxLength = 16;
private long inputType = UIAlertViewStyle.PlainTextInput;
public IOSMOEGDXTextPrompt () {
}
@Override
public GDXTextPrompt show() {
if (alertView == null) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
//
// /**
// * Type of input used by the textfield
// */
// enum InputType {
// /**
// * prints readable text
// */
// PLAIN_TEXT,
//
// /**
// * hides typed text behind specified character
// */
// PASSWORD
// }
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTitle(CharSequence title);
//
//
// /**
// * Set the character limit for input. Default is 16.
// *
// * @param maxLength
// * @return
// */
// GDXTextPrompt setMaxLength(int maxLength);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setMessage(CharSequence message);
//
// /**
// * Sets the default value for the input field.
// *
// * @param inputTip Placeholder for the text input field.
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setValue(CharSequence inputTip);
//
// /**
// * Sets the label for the cancel button on the dialog.
// *
// * @param label Text of the cancel button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setCancelButtonLabel(CharSequence label);
//
// /**
// * Sets the label for the confirm button on the dialog.
// *
// * @param label Text of the confirm button
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setConfirmButtonLabel(CharSequence label);
//
// /**
// * Sets the {@link TextPromptListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setTextPromptListener(TextPromptListener listener);
//
// /**
// * Sets the type of input for the text input field.
// *
// * @param inputType type of input
// * @return The same instance that the method was called from.
// */
// GDXTextPrompt setInputType(InputType inputType);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXTextPrompt.java
import apple.foundation.struct.NSRange;
import apple.uikit.protocol.UITextFieldDelegate;
import com.badlogic.gdx.Gdx;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.NInt;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import apple.uikit.UIAlertView;
import apple.uikit.UITextField;
import apple.uikit.enums.UIAlertViewStyle;
import apple.uikit.protocol.UIAlertViewDelegate;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXTextPrompt implements GDXTextPrompt {
private String message = "";
private String title = "";
private String cancelLabel = "";
private String confirmLabel = "";
private TextPromptListener listener;
private UIAlertView alertView;
private int maxLength = 16;
private long inputType = UIAlertViewStyle.PlainTextInput;
public IOSMOEGDXTextPrompt () {
}
@Override
public GDXTextPrompt show() {
if (alertView == null) {
throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSMOEGDXTextPrompt.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXTextPrompt implements GDXTextPrompt {
@Override
public GDXTextPrompt show() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.core.dialogs;
public class FallbackGDXTextPrompt implements GDXTextPrompt {
@Override
public GDXTextPrompt show() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, FallbackGDXTextPrompt.class.getSimpleName() + " now shown " +
|
TomGrill/gdx-dialogs
|
core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXTextPrompt.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
|
public GDXTextPrompt build() {
return this;
}
@Override
public GDXTextPrompt setTitle(CharSequence title) {
return this;
}
@Override
public GDXTextPrompt setMaxLength(int maxLength) {
return this;
}
@Override
public GDXTextPrompt setMessage(CharSequence message) {
return this;
}
@Override
public GDXTextPrompt setCancelButtonLabel(CharSequence label) {
return this;
}
@Override
public GDXTextPrompt setConfirmButtonLabel(CharSequence label) {
return this;
}
@Override
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
//
// public void cancel();
//
// public void confirm(String text);
//
// }
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXTextPrompt.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
public GDXTextPrompt build() {
return this;
}
@Override
public GDXTextPrompt setTitle(CharSequence title) {
return this;
}
@Override
public GDXTextPrompt setMaxLength(int maxLength) {
return this;
}
@Override
public GDXTextPrompt setMessage(CharSequence message) {
return this;
}
@Override
public GDXTextPrompt setCancelButtonLabel(CharSequence label) {
return this;
}
@Override
public GDXTextPrompt setConfirmButtonLabel(CharSequence label) {
return this;
}
@Override
|
public GDXTextPrompt setTextPromptListener(TextPromptListener listener) {
|
TomGrill/gdx-dialogs
|
ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXProgressDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
|
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
import apple.uikit.UIActivityIndicatorView;
import apple.uikit.UIAlertView;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXProgressDialog implements GDXProgressDialog {
private UIAlertView alertView;
private UIActivityIndicatorView indicator;
private String title = "";
private String message = "";
public IOSMOEGDXProgressDialog () {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXProgressDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXProgressDialog.java
// public interface GDXProgressDialog {
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog setTitle(CharSequence title);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog dismiss();
//
// /**
// * This builds the button and prepares for usage.
// *
// * @return The same instance that the method was called from.
// */
// GDXProgressDialog build();
//
// }
// Path: ios-moe/src/de/tomgrill/gdxdialogs/iosmoe/dialogs/IOSMOEGDXProgressDialog.java
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXProgressDialog;
import apple.uikit.UIActivityIndicatorView;
import apple.uikit.UIAlertView;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.iosmoe.dialogs;
public class IOSMOEGDXProgressDialog implements GDXProgressDialog {
private UIAlertView alertView;
private UIActivityIndicatorView indicator;
private String title = "";
private String message = "";
public IOSMOEGDXProgressDialog () {
}
@Override
public GDXProgressDialog setMessage(CharSequence message) {
this.message = (String) message;
return this;
}
@Override
public GDXProgressDialog setTitle(CharSequence title) {
this.title = (String) title;
return this;
}
@Override
public GDXProgressDialog show() {
if (alertView == null) {
throw new RuntimeException(GDXProgressDialog.class.getSimpleName() + " has not been build. Use build() before show().");
}
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, IOSMOEGDXProgressDialog.class.getSimpleName() + " now shown.");
|
TomGrill/gdx-dialogs
|
android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXButtonDialog implements GDXButtonDialog {
private Activity activity;
private AlertDialog.Builder builder;
private AlertDialog dialog;
private boolean cancelable;
private CharSequence message = "";
private CharSequence title = "";
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXButtonDialog.java
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXButtonDialog implements GDXButtonDialog {
private Activity activity;
private AlertDialog.Builder builder;
private AlertDialog dialog;
private boolean cancelable;
private CharSequence message = "";
private CharSequence title = "";
|
private ButtonClickListener listener;
|
TomGrill/gdx-dialogs
|
android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXButtonDialog.java
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
|
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
|
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXButtonDialog implements GDXButtonDialog {
private Activity activity;
private AlertDialog.Builder builder;
private AlertDialog dialog;
private boolean cancelable;
private CharSequence message = "";
private CharSequence title = "";
private ButtonClickListener listener;
private boolean isBuild = false;
private Array<CharSequence> labels = new Array<CharSequence>();
public AndroidGDXButtonDialog(Activity activity) {
this.activity = activity;
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
this.cancelable = cancelable;
return this;
}
@Override
public GDXButtonDialog show() {
if (dialog == null || !isBuild) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been built. Use build() " +
"before show().");
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// public static final String VERSION = "1.3.0";
// public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java
// public interface GDXButtonDialog {
//
// /**
// * Only on Android: When set true, user can click outside of the dialog and
// * the dialog will be closed. Has no effect on other operating systems.
// *
// * @param cancelable this value will be set to the corresponding android property if applicable.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setCancelable(boolean cancelable);
//
// /**
// * Shows the dialog. show() can only be called after build() has been called
// * else there might be strange behavior. You need to add at least one button
// * with addButton() before calling build(). Runs asynchronously on a different thread.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog show();
//
// /**
// * Dismisses the dialog. You can show the dialog again.
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog dismiss();
//
// /**
// * Sets the {@link ButtonClickListener}
// *
// * @param listener listener to be called when the event is triggered
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setClickListener(ButtonClickListener listener);
//
// /**
// * Add new button to the dialog. You need to add at least one button.
// *
// * @param label Text of the added new button.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog addButton(CharSequence label);
//
// /**
// * This builds the button and prepares for usage. You need to add at least
// * one button with addButton() before calling build().
// *
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog build();
//
// /**
// * Sets the message.
// *
// * @param message The text to be displayed at the body of the dialog.
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setMessage(CharSequence message);
//
// /**
// * Sets the title
// *
// * @param title String value to set the title
// * @return The same instance that the method was called from.
// */
// GDXButtonDialog setTitle(CharSequence title);
// }
//
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/ButtonClickListener.java
// public interface ButtonClickListener {
//
// /**
// *
// * @param button
// * Number of button in the order it got added. 1st added = 0, 2nd
// * added = 1, 3rd added = 2. -1 if the dialog got cancelled.
// * Note: Not every OS allows canceling the button.
// */
// public void click(int button);
// }
// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXButtonDialog.java
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXButtonDialog;
import de.tomgrill.gdxdialogs.core.listener.ButtonClickListener;
/*******************************************************************************
* Copyright 2015 See AUTHORS file.
*
* 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 de.tomgrill.gdxdialogs.android.dialogs;
public class AndroidGDXButtonDialog implements GDXButtonDialog {
private Activity activity;
private AlertDialog.Builder builder;
private AlertDialog dialog;
private boolean cancelable;
private CharSequence message = "";
private CharSequence title = "";
private ButtonClickListener listener;
private boolean isBuild = false;
private Array<CharSequence> labels = new Array<CharSequence>();
public AndroidGDXButtonDialog(Activity activity) {
this.activity = activity;
}
@Override
public GDXButtonDialog setCancelable(boolean cancelable) {
this.cancelable = cancelable;
return this;
}
@Override
public GDXButtonDialog show() {
if (dialog == null || !isBuild) {
throw new RuntimeException(GDXButtonDialog.class.getSimpleName() + " has not been built. Use build() " +
"before show().");
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
|
Gdx.app.debug(GDXDialogsVars.LOG_TAG, AndroidGDXButtonDialog.class.getSimpleName() +
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/core/sql/tool/JSqlUtils.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/common/JSqlMapData.java
// public class JSqlMapData {
//
// public static final Map<String, Database> MAP = new HashMap<String, Database>();
// public static Map<String, SqlTypeName> SQLTYPE_MAPPING = new HashMap<String, SqlTypeName>();
// @SuppressWarnings("rawtypes")
// public static Map<String, Class> JAVATYPE_MAPPING = new HashMap<String, Class>();
//
// static {
// loadDatabaseType();
// }
//
// private static void loadDatabaseType() {
// SQLTYPE_MAPPING.put("char", SqlTypeName.CHAR);
// JAVATYPE_MAPPING.put("char", Character.class);
// SQLTYPE_MAPPING.put("varchar", SqlTypeName.VARCHAR);
// JAVATYPE_MAPPING.put("varchar", String.class);
// SQLTYPE_MAPPING.put("boolean", SqlTypeName.BOOLEAN);
// SQLTYPE_MAPPING.put("integer", SqlTypeName.INTEGER);
// JAVATYPE_MAPPING.put("integer", Integer.class);
// SQLTYPE_MAPPING.put("tinyint", SqlTypeName.TINYINT);
// SQLTYPE_MAPPING.put("smallint", SqlTypeName.SMALLINT);
// SQLTYPE_MAPPING.put("bigint", SqlTypeName.BIGINT);
// JAVATYPE_MAPPING.put("bigint", Long.class);
// SQLTYPE_MAPPING.put("decimal", SqlTypeName.DECIMAL);
// SQLTYPE_MAPPING.put("numeric", SqlTypeName.DECIMAL);
// SQLTYPE_MAPPING.put("float", SqlTypeName.FLOAT);
// SQLTYPE_MAPPING.put("real", SqlTypeName.REAL);
// SQLTYPE_MAPPING.put("double", SqlTypeName.DOUBLE);
// SQLTYPE_MAPPING.put("date", SqlTypeName.DATE);
// JAVATYPE_MAPPING.put("date", Date.class);
// SQLTYPE_MAPPING.put("time", SqlTypeName.TIME);
// SQLTYPE_MAPPING.put("timestamp", SqlTypeName.TIMESTAMP);
// SQLTYPE_MAPPING.put("any", SqlTypeName.ANY);
// }
//
// public static void loadSchema(JSONObject cols, String tableName, List<List<String>> datas) {
// Database db = new Database();
// Table table = new Table();
// table.tableName = tableName;
// for (String key : cols.keySet()) {
// Column _col = new Column();
// _col.name = key;
// _col.type = cols.getString(key);
// table.columns.add(_col);
// }
// table.data = datas;
// db.tables.add(table);
// MAP.put("db", db);
// }
//
// public static class Database {
// public List<Table> tables = new LinkedList<Table>();
// }
//
// public static class Table {
// public String tableName;
// public List<Column> columns = new LinkedList<Column>();
// public List<List<String>> data = new LinkedList<List<String>>();
// }
//
// public static class Column {
// public String name;
// public String type;
// }
// }
|
import java.util.Properties;
import org.smartloli.kafka.eagle.core.sql.common.JSqlMapData;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.tool;
/**
* Define the data structure, query by condition.
*
* @author smartloli.
*
* Created by Mar 29, 2016
*/
public class JSqlUtils {
/**
*
* @param tabSchema
* : Table column,such as {"id":"integer","name":"varchar"}
* @param tableName
* : Defining table names for query datasets, such as "user"
* @param dataSets
* : DataSets ,such as
* [{"id":1,"name":"aaa"},{"id":2,"name":"bbb"},{}...]
* @param sql
* : such as "SELECT * FROM TBL"
*
* @return String
* @throws Exception
* : Throws an exception
*/
public static String query(JSONObject tabSchema, String tableName, List<JSONArray> dataSets, String sql) throws Exception {
File file = createTempJson();
List<List<String>> list = new LinkedList<List<String>>();
for (JSONArray dataSet : dataSets) {
for (Object obj : dataSet) {
JSONObject object = (JSONObject) obj;
List<String> tmp = new LinkedList<>();
for (String key : object.keySet()) {
tmp.add(object.getString(key));
}
list.add(tmp);
}
}
|
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/common/JSqlMapData.java
// public class JSqlMapData {
//
// public static final Map<String, Database> MAP = new HashMap<String, Database>();
// public static Map<String, SqlTypeName> SQLTYPE_MAPPING = new HashMap<String, SqlTypeName>();
// @SuppressWarnings("rawtypes")
// public static Map<String, Class> JAVATYPE_MAPPING = new HashMap<String, Class>();
//
// static {
// loadDatabaseType();
// }
//
// private static void loadDatabaseType() {
// SQLTYPE_MAPPING.put("char", SqlTypeName.CHAR);
// JAVATYPE_MAPPING.put("char", Character.class);
// SQLTYPE_MAPPING.put("varchar", SqlTypeName.VARCHAR);
// JAVATYPE_MAPPING.put("varchar", String.class);
// SQLTYPE_MAPPING.put("boolean", SqlTypeName.BOOLEAN);
// SQLTYPE_MAPPING.put("integer", SqlTypeName.INTEGER);
// JAVATYPE_MAPPING.put("integer", Integer.class);
// SQLTYPE_MAPPING.put("tinyint", SqlTypeName.TINYINT);
// SQLTYPE_MAPPING.put("smallint", SqlTypeName.SMALLINT);
// SQLTYPE_MAPPING.put("bigint", SqlTypeName.BIGINT);
// JAVATYPE_MAPPING.put("bigint", Long.class);
// SQLTYPE_MAPPING.put("decimal", SqlTypeName.DECIMAL);
// SQLTYPE_MAPPING.put("numeric", SqlTypeName.DECIMAL);
// SQLTYPE_MAPPING.put("float", SqlTypeName.FLOAT);
// SQLTYPE_MAPPING.put("real", SqlTypeName.REAL);
// SQLTYPE_MAPPING.put("double", SqlTypeName.DOUBLE);
// SQLTYPE_MAPPING.put("date", SqlTypeName.DATE);
// JAVATYPE_MAPPING.put("date", Date.class);
// SQLTYPE_MAPPING.put("time", SqlTypeName.TIME);
// SQLTYPE_MAPPING.put("timestamp", SqlTypeName.TIMESTAMP);
// SQLTYPE_MAPPING.put("any", SqlTypeName.ANY);
// }
//
// public static void loadSchema(JSONObject cols, String tableName, List<List<String>> datas) {
// Database db = new Database();
// Table table = new Table();
// table.tableName = tableName;
// for (String key : cols.keySet()) {
// Column _col = new Column();
// _col.name = key;
// _col.type = cols.getString(key);
// table.columns.add(_col);
// }
// table.data = datas;
// db.tables.add(table);
// MAP.put("db", db);
// }
//
// public static class Database {
// public List<Table> tables = new LinkedList<Table>();
// }
//
// public static class Table {
// public String tableName;
// public List<Column> columns = new LinkedList<Column>();
// public List<List<String>> data = new LinkedList<List<String>>();
// }
//
// public static class Column {
// public String name;
// public String type;
// }
// }
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/tool/JSqlUtils.java
import java.util.Properties;
import org.smartloli.kafka.eagle.core.sql.common.JSqlMapData;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.tool;
/**
* Define the data structure, query by condition.
*
* @author smartloli.
*
* Created by Mar 29, 2016
*/
public class JSqlUtils {
/**
*
* @param tabSchema
* : Table column,such as {"id":"integer","name":"varchar"}
* @param tableName
* : Defining table names for query datasets, such as "user"
* @param dataSets
* : DataSets ,such as
* [{"id":1,"name":"aaa"},{"id":2,"name":"bbb"},{}...]
* @param sql
* : such as "SELECT * FROM TBL"
*
* @return String
* @throws Exception
* : Throws an exception
*/
public static String query(JSONObject tabSchema, String tableName, List<JSONArray> dataSets, String sql) throws Exception {
File file = createTempJson();
List<List<String>> list = new LinkedList<List<String>>();
for (JSONArray dataSet : dataSets) {
for (Object obj : dataSet) {
JSONObject object = (JSONObject) obj;
List<String> tmp = new LinkedList<>();
for (String key : object.keySet()) {
tmp.add(object.getString(key));
}
list.add(tmp);
}
}
|
JSqlMapData.loadSchema(tabSchema, tableName, list);
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/conf/WebMvcConfig.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/aop/AccountInterceptor.java
// public class AccountInterceptor extends HandlerInterceptorAdapter {
//
// /** Kafka service interface. */
// private KafkaService kafkaService = new KafkaFactory().create();
// private int count = 0;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// try {
// Object object = request.getSession().getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS);
// if (object == null) {
// String[] clusterAliass = SystemConfigUtils.getPropertyArray("kafka.eagle.zk.cluster.alias", ",");
// String defaultClusterAlias = clusterAliass[0];
// request.getSession().setAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS, defaultClusterAlias);
// }
// String formatter = SystemConfigUtils.getProperty("kafka.eagle.offset.storage");
// if ("kafka".equals(formatter) && count == 0) {
// HttpSession session = request.getSession();
// String clusterAlias = session.getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS).toString();
// String brokers = kafkaService.getAllBrokersInfo(clusterAlias);
// JSONArray kafkaBrokers = JSON.parseArray(brokers);
// String bootstrapServers = "";
// for (Object subObject : kafkaBrokers) {
// JSONObject kafkaBroker = (JSONObject) subObject;
// String host = kafkaBroker.getString("host");
// int port = kafkaBroker.getInteger("port");
// bootstrapServers += host + ":" + port + ",";
// }
// bootstrapServers = bootstrapServers.substring(0, bootstrapServers.length() - 1);
// //RpcClient.system(bootstrapServers);
// count++;
// }
// } catch (Exception e) {
// String[] clusterAliass = SystemConfigUtils.getPropertyArray("kafka.eagle.zk.cluster.alias", ",");
// String defaultClusterAlias = clusterAliass[0];
// request.getSession().setAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS, defaultClusterAlias);
// e.printStackTrace();
// }
// return true;
// }
//
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// super.postHandle(request, response, handler, modelAndView);
// }
//
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// super.afterCompletion(request, response, handler, ex);
// }
// }
|
import org.smartloli.kafka.eagle.web.controller.aop.AccountInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
package org.smartloli.kafka.eagle.conf;
/**
* @author yunnet
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
super.addResourceHandlers(registry);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
|
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/aop/AccountInterceptor.java
// public class AccountInterceptor extends HandlerInterceptorAdapter {
//
// /** Kafka service interface. */
// private KafkaService kafkaService = new KafkaFactory().create();
// private int count = 0;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// try {
// Object object = request.getSession().getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS);
// if (object == null) {
// String[] clusterAliass = SystemConfigUtils.getPropertyArray("kafka.eagle.zk.cluster.alias", ",");
// String defaultClusterAlias = clusterAliass[0];
// request.getSession().setAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS, defaultClusterAlias);
// }
// String formatter = SystemConfigUtils.getProperty("kafka.eagle.offset.storage");
// if ("kafka".equals(formatter) && count == 0) {
// HttpSession session = request.getSession();
// String clusterAlias = session.getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS).toString();
// String brokers = kafkaService.getAllBrokersInfo(clusterAlias);
// JSONArray kafkaBrokers = JSON.parseArray(brokers);
// String bootstrapServers = "";
// for (Object subObject : kafkaBrokers) {
// JSONObject kafkaBroker = (JSONObject) subObject;
// String host = kafkaBroker.getString("host");
// int port = kafkaBroker.getInteger("port");
// bootstrapServers += host + ":" + port + ",";
// }
// bootstrapServers = bootstrapServers.substring(0, bootstrapServers.length() - 1);
// //RpcClient.system(bootstrapServers);
// count++;
// }
// } catch (Exception e) {
// String[] clusterAliass = SystemConfigUtils.getPropertyArray("kafka.eagle.zk.cluster.alias", ",");
// String defaultClusterAlias = clusterAliass[0];
// request.getSession().setAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS, defaultClusterAlias);
// e.printStackTrace();
// }
// return true;
// }
//
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// super.postHandle(request, response, handler, modelAndView);
// }
//
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// super.afterCompletion(request, response, handler, ex);
// }
// }
// Path: src/main/java/org/smartloli/kafka/eagle/conf/WebMvcConfig.java
import org.smartloli.kafka.eagle.web.controller.aop.AccountInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
package org.smartloli.kafka.eagle.conf;
/**
* @author yunnet
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
super.addResourceHandlers(registry);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
|
registry.addInterceptor(new AccountInterceptor());
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
|
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
|
private DashboardService dashboradService;
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
|
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
private DashboardService dashboradService;
/** Index viewer. */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView indexView(HttpSession session) {
ModelAndView mav = new ModelAndView();
mav.setViewName("/main/index");
return mav;
}
/** Get data from Kafka in dashboard by ajax. */
@RequestMapping(value = "/dash/kafka/ajax", method = RequestMethod.GET)
public void dashboardAjax(HttpServletResponse response, HttpServletRequest request) {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
response.setHeader("Charset", "utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Encoding", "gzip");
String clusterAlias = "";
try {
HttpSession session = request.getSession();
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
private DashboardService dashboradService;
/** Index viewer. */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView indexView(HttpSession session) {
ModelAndView mav = new ModelAndView();
mav.setViewName("/main/index");
return mav;
}
/** Get data from Kafka in dashboard by ajax. */
@RequestMapping(value = "/dash/kafka/ajax", method = RequestMethod.GET)
public void dashboardAjax(HttpServletResponse response, HttpServletRequest request) {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
response.setHeader("Charset", "utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Encoding", "gzip");
String clusterAlias = "";
try {
HttpSession session = request.getSession();
|
clusterAlias = session.getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS).toString();
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
|
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
private DashboardService dashboradService;
/** Index viewer. */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView indexView(HttpSession session) {
ModelAndView mav = new ModelAndView();
mav.setViewName("/main/index");
return mav;
}
/** Get data from Kafka in dashboard by ajax. */
@RequestMapping(value = "/dash/kafka/ajax", method = RequestMethod.GET)
public void dashboardAjax(HttpServletResponse response, HttpServletRequest request) {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
response.setHeader("Charset", "utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Encoding", "gzip");
String clusterAlias = "";
try {
HttpSession session = request.getSession();
clusterAlias = session.getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS).toString();
} catch (Exception e) {
e.printStackTrace();
}
try {
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/DashboardService.java
// public interface DashboardService {
//
// /** Get kafka & dashboard dataset interface. */
// public String getDashboard(String clusterAlias);
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/DashboardController.java
import org.smartloli.kafka.eagle.web.service.DashboardService;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Dashboard controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class DashboardController {
/** Kafka Eagle dashboard data generator interface. */
@Autowired
private DashboardService dashboradService;
/** Index viewer. */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView indexView(HttpSession session) {
ModelAndView mav = new ModelAndView();
mav.setViewName("/main/index");
return mav;
}
/** Get data from Kafka in dashboard by ajax. */
@RequestMapping(value = "/dash/kafka/ajax", method = RequestMethod.GET)
public void dashboardAjax(HttpServletResponse response, HttpServletRequest request) {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
response.setHeader("Charset", "utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Encoding", "gzip");
String clusterAlias = "";
try {
HttpSession session = request.getSession();
clusterAlias = session.getAttribute(ConstantUtils.SessionAlias.CLUSTER_ALIAS).toString();
} catch (Exception e) {
e.printStackTrace();
}
try {
|
byte[] output = GzipUtils.compressToByte(dashboradService.getDashboard(clusterAlias));
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/core/sql/common/JSqlEnumerator.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/tool/JSqlDateUtils.java
// public class JSqlDateUtils {
//
// public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd";
// public static final String DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS = "yyyy-MM-dd HH:mm:ss";
// public static final String DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS = "yyyy-MM-dd HH:mm:ss.SSS";
//
// static final private Map<String, ThreadLocal<SimpleDateFormat>> threadLocalMap = new ConcurrentHashMap<String, ThreadLocal<SimpleDateFormat>>();
//
// public static SimpleDateFormat getDateFormat(String datePattern) {
// ThreadLocal<SimpleDateFormat> formatThreadLocal = threadLocalMap.get(datePattern);
// if (formatThreadLocal == null) {
// threadLocalMap.put(datePattern, formatThreadLocal = new ThreadLocal<SimpleDateFormat>());
// }
// SimpleDateFormat format = formatThreadLocal.get();
// if (format == null) {
// format = new SimpleDateFormat(datePattern);
// format.setTimeZone(TimeZone.getTimeZone("GMT"));
// formatThreadLocal.set(format);
// }
// return format;
// }
//
// public static String formatToDateStr(long millis) {
// return getDateFormat(DEFAULT_DATE_PATTERN).format(new Date(millis));
// }
//
// public static String formatToTimeStr(long millis) {
// return getDateFormat(DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).format(new Date(millis));
// }
//
// public static String dateToString(Date date) {
// return dateToString(date, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS);
// }
//
// public static String dateToString(Date date, String pattern) {
// return getDateFormat(pattern).format(date);
// }
//
// public static Date stringToDate(String str) {
// return stringToDate(str, DEFAULT_DATE_PATTERN);
// }
//
// public static Date stringToDate(String str, String pattern) {
// Date date = null;
// try {
// date = Date.valueOf(str);
// } catch (Exception e) {
// throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e);
// }
// return date;
// }
//
// public static long stringToMillis(String str) {
// if (isAllDigits(str)) {
// return Long.parseLong(str);
// } else if (str.length() == 10) {
// return stringToDate(str, DEFAULT_DATE_PATTERN).getTime();
// } else if (str.length() == 19) {
// return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS).getTime();
// } else if (str.length() == 23) {
// return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).getTime();
// } else {
// throw new IllegalArgumentException("There is no valid date pattern for : " + str);
// }
// }
//
// private static boolean isAllDigits(String str) {
// for (int i = 0, n = str.length(); i < n; i++) {
// if (Character.isDigit(str.charAt(i)) == false)
// return false;
// }
// return true;
// }
//
// }
|
import java.math.BigDecimal;
import java.util.List;
import org.apache.calcite.linq4j.Enumerator;
import org.smartloli.kafka.eagle.core.sql.tool.JSqlDateUtils;
|
private int[] fields;
public ArrayRowConverter(int[] fields) {
this.fields = fields;
}
@Override
Object[] convertRow(List<String> rows, List<String> columnTypes) {
Object[] objects = new Object[fields.length];
int i = 0;
for (int field : this.fields) {
objects[i++] = convertOptiqCellValue(rows.get(field), columnTypes.get(field));
}
return objects;
}
}
public void close() {
}
public static Object convertOptiqCellValue(String strValue, String dataType) {
if (strValue == null)
return null;
if ((strValue.equals("") || strValue.equals("\\N")) && !dataType.equals("string"))
return null;
// use data type enum instead of string comparison
if ("date".equals(dataType)) {
|
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/tool/JSqlDateUtils.java
// public class JSqlDateUtils {
//
// public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd";
// public static final String DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS = "yyyy-MM-dd HH:mm:ss";
// public static final String DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS = "yyyy-MM-dd HH:mm:ss.SSS";
//
// static final private Map<String, ThreadLocal<SimpleDateFormat>> threadLocalMap = new ConcurrentHashMap<String, ThreadLocal<SimpleDateFormat>>();
//
// public static SimpleDateFormat getDateFormat(String datePattern) {
// ThreadLocal<SimpleDateFormat> formatThreadLocal = threadLocalMap.get(datePattern);
// if (formatThreadLocal == null) {
// threadLocalMap.put(datePattern, formatThreadLocal = new ThreadLocal<SimpleDateFormat>());
// }
// SimpleDateFormat format = formatThreadLocal.get();
// if (format == null) {
// format = new SimpleDateFormat(datePattern);
// format.setTimeZone(TimeZone.getTimeZone("GMT"));
// formatThreadLocal.set(format);
// }
// return format;
// }
//
// public static String formatToDateStr(long millis) {
// return getDateFormat(DEFAULT_DATE_PATTERN).format(new Date(millis));
// }
//
// public static String formatToTimeStr(long millis) {
// return getDateFormat(DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).format(new Date(millis));
// }
//
// public static String dateToString(Date date) {
// return dateToString(date, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS);
// }
//
// public static String dateToString(Date date, String pattern) {
// return getDateFormat(pattern).format(date);
// }
//
// public static Date stringToDate(String str) {
// return stringToDate(str, DEFAULT_DATE_PATTERN);
// }
//
// public static Date stringToDate(String str, String pattern) {
// Date date = null;
// try {
// date = Date.valueOf(str);
// } catch (Exception e) {
// throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e);
// }
// return date;
// }
//
// public static long stringToMillis(String str) {
// if (isAllDigits(str)) {
// return Long.parseLong(str);
// } else if (str.length() == 10) {
// return stringToDate(str, DEFAULT_DATE_PATTERN).getTime();
// } else if (str.length() == 19) {
// return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS).getTime();
// } else if (str.length() == 23) {
// return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).getTime();
// } else {
// throw new IllegalArgumentException("There is no valid date pattern for : " + str);
// }
// }
//
// private static boolean isAllDigits(String str) {
// for (int i = 0, n = str.length(); i < n; i++) {
// if (Character.isDigit(str.charAt(i)) == false)
// return false;
// }
// return true;
// }
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/common/JSqlEnumerator.java
import java.math.BigDecimal;
import java.util.List;
import org.apache.calcite.linq4j.Enumerator;
import org.smartloli.kafka.eagle.core.sql.tool.JSqlDateUtils;
private int[] fields;
public ArrayRowConverter(int[] fields) {
this.fields = fields;
}
@Override
Object[] convertRow(List<String> rows, List<String> columnTypes) {
Object[] objects = new Object[fields.length];
int i = 0;
for (int field : this.fields) {
objects[i++] = convertOptiqCellValue(rows.get(field), columnTypes.get(field));
}
return objects;
}
}
public void close() {
}
public static Object convertOptiqCellValue(String strValue, String dataType) {
if (strValue == null)
return null;
if ((strValue.equals("") || strValue.equals("\\N")) && !dataType.equals("string"))
return null;
// use data type enum instead of string comparison
if ("date".equals(dataType)) {
|
return JSqlDateUtils.stringToDate(strValue);
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/web/service/ConsumerService.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/PageParamDomain.java
// public class PageParamDomain {
//
// private String search;
// private int iDisplayStart;
// private int iDisplayLength;
//
// public String getSearch() {
// return search;
// }
//
// public void setSearch(String search) {
// this.search = search;
// }
//
// public int getiDisplayStart() {
// return iDisplayStart;
// }
//
// public void setiDisplayStart(int iDisplayStart) {
// this.iDisplayStart = iDisplayStart;
// }
//
// public int getiDisplayLength() {
// return iDisplayLength;
// }
//
// public void setiDisplayLength(int iDisplayLength) {
// this.iDisplayLength = iDisplayLength;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
|
import org.smartloli.kafka.eagle.common.domain.PageParamDomain;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.service;
/**
* Kafka consumer data interface.
*
* @author smartloli.
*
* Created by Jan 17, 2017.
*
* Update by hexiang 20170216
*/
public interface ConsumerService {
/** Get active topic graph data interface. */
public String getActiveGraph(String clusterAlias);
/** Storage offset in kafka or zookeeper interface. */
public String getActiveTopic(String clusterAlias,String formatter);
/**
* Judge consumer detail information storage offset in kafka or zookeeper
* interface.
*/
public String getConsumerDetail(String clusterAlias,String formatter, String group);
/** Judge consumers storage offset in kafka or zookeeper interface. */
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/PageParamDomain.java
// public class PageParamDomain {
//
// private String search;
// private int iDisplayStart;
// private int iDisplayLength;
//
// public String getSearch() {
// return search;
// }
//
// public void setSearch(String search) {
// this.search = search;
// }
//
// public int getiDisplayStart() {
// return iDisplayStart;
// }
//
// public void setiDisplayStart(int iDisplayStart) {
// this.iDisplayStart = iDisplayStart;
// }
//
// public int getiDisplayLength() {
// return iDisplayLength;
// }
//
// public void setiDisplayLength(int iDisplayLength) {
// this.iDisplayLength = iDisplayLength;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/ConsumerService.java
import org.smartloli.kafka.eagle.common.domain.PageParamDomain;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.service;
/**
* Kafka consumer data interface.
*
* @author smartloli.
*
* Created by Jan 17, 2017.
*
* Update by hexiang 20170216
*/
public interface ConsumerService {
/** Get active topic graph data interface. */
public String getActiveGraph(String clusterAlias);
/** Storage offset in kafka or zookeeper interface. */
public String getActiveTopic(String clusterAlias,String formatter);
/**
* Judge consumer detail information storage offset in kafka or zookeeper
* interface.
*/
public String getConsumerDetail(String clusterAlias,String formatter, String group);
/** Judge consumers storage offset in kafka or zookeeper interface. */
|
public String getConsumer(String clusterAlias,String formatter, PageParamDomain page);
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/web/controller/ClusterController.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/ClusterService.java
// public interface ClusterService {
//
// /** Execute zookeeper comand interface */
// public String execute(String clusterAlias, String cmd, String type);
//
// /** Get Kafka & Zookeeper interface. */
// public String get(String clusterAlias, String type);
//
// /** Get Zookkeeper status interface. */
// public JSONObject status(String clusterAlias);
//
// /** Get multi cluster aliass interface. */
// public JSONArray clusterAliass();
//
// /** Checked cluster alias is exist interface. */
// public boolean hasClusterAlias(String clusterAlias);
//
// }
|
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
import org.smartloli.kafka.eagle.web.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Kafka & Zookeeper controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class ClusterController {
@Autowired
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
//
// /** D3 data plugin size. */
// public interface D3 {
// public final static int SIZE = 40;
// }
//
// /** Kafka parameter setting. */
// public interface Kafka {
// public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// public final static int SINGLE_THREAD = 1;
// public final static int ACTIVER_INTERVAL = 10000;
// }
//
// public interface Mail {
// public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// }
//
// /** Custom variable separator. */
// public interface Separator {
// public final static String EIGHT = "________";
// }
//
// public interface SessionAlias {
// public final static String CLUSTER_ALIAS = "clusterAlias";
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
//
// private static final String UTF_16 = "UTF-16";
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @return byte[]
// */
// public static byte[] compressToByte(String str) {
// return compressToByte(str, UTF_16);
// }
//
// /**
// * Strings compress to bytes.
// *
// * @param str
// * @param encoding
// * @return byte[]
// */
// public static byte[] compressToByte(String str, String encoding) {
// if (str == null || str.length() == 0) {
// return null;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// GZIPOutputStream gzip;
// try {
// gzip = new GZIPOutputStream(out);
// gzip.write(str.getBytes(encoding));
// gzip.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return out.toByteArray();
// }
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/ClusterService.java
// public interface ClusterService {
//
// /** Execute zookeeper comand interface */
// public String execute(String clusterAlias, String cmd, String type);
//
// /** Get Kafka & Zookeeper interface. */
// public String get(String clusterAlias, String type);
//
// /** Get Zookkeeper status interface. */
// public JSONObject status(String clusterAlias);
//
// /** Get multi cluster aliass interface. */
// public JSONArray clusterAliass();
//
// /** Checked cluster alias is exist interface. */
// public boolean hasClusterAlias(String clusterAlias);
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/ClusterController.java
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
import org.smartloli.kafka.eagle.web.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.web.controller;
/**
* Kafka & Zookeeper controller to viewer data.
*
* @author smartloli.
*
* Created by Sep 6, 2016.
*
* Update by hexiang 20170216
*/
@Controller
public class ClusterController {
@Autowired
|
private ClusterService clusterService;
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/core/sql/execute/SimpleKafkaConsumer.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/HostsDomain.java
// public class HostsDomain {
//
// private String host;
// private int port;
//
// public String getHost() {
// return host;
// }
//
// public void setHost(String host) {
// this.host = host;
// }
//
// public int getPort() {
// return port;
// }
//
// public void setPort(int port) {
// this.port = port;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/KafkaSqlDomain.java
// public class KafkaSqlDomain {
//
// private List<Integer> partition = new ArrayList<>();
// private String sql;
// private String metaSql;
// private JSONObject schema = new JSONObject();
// private String tableName;
// private String topic;
// private boolean status;
// private List<HostsDomain> seeds = new ArrayList<>();
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public String getMetaSql() {
// return metaSql;
// }
//
// public void setMetaSql(String metaSql) {
// this.metaSql = metaSql;
// }
//
// public List<HostsDomain> getSeeds() {
// return seeds;
// }
//
// public void setSeeds(List<HostsDomain> seeds) {
// this.seeds = seeds;
// }
//
// public JSONObject getSchema() {
// return schema;
// }
//
// public void setSchema(JSONObject schema) {
// this.schema = schema;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public List<Integer> getPartition() {
// return partition;
// }
//
// public void setPartition(List<Integer> partition) {
// this.partition = partition;
// }
//
// public String getSql() {
// return sql;
// }
//
// public void setSql(String sql) {
// this.sql = sql;
// }
//
// public boolean isStatus() {
// return status;
// }
//
// public void setStatus(boolean status) {
// this.status = status;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
|
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartloli.kafka.eagle.common.domain.HostsDomain;
import org.smartloli.kafka.eagle.common.domain.KafkaSqlDomain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kafka.api.FetchRequest;
import kafka.api.FetchRequestBuilder;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.common.ErrorMapping;
import kafka.common.TopicAndPartition;
import kafka.javaapi.FetchResponse;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.message.MessageAndOffset;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.execute;
/**
* Kafka underlying consumer API interface.
*
* @author smartloli.
*
* Created by Mar 14, 2016
*/
public class SimpleKafkaConsumer {
private static Logger LOG = LoggerFactory.getLogger(SimpleKafkaConsumer.class);
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/HostsDomain.java
// public class HostsDomain {
//
// private String host;
// private int port;
//
// public String getHost() {
// return host;
// }
//
// public void setHost(String host) {
// this.host = host;
// }
//
// public int getPort() {
// return port;
// }
//
// public void setPort(int port) {
// this.port = port;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/KafkaSqlDomain.java
// public class KafkaSqlDomain {
//
// private List<Integer> partition = new ArrayList<>();
// private String sql;
// private String metaSql;
// private JSONObject schema = new JSONObject();
// private String tableName;
// private String topic;
// private boolean status;
// private List<HostsDomain> seeds = new ArrayList<>();
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public String getMetaSql() {
// return metaSql;
// }
//
// public void setMetaSql(String metaSql) {
// this.metaSql = metaSql;
// }
//
// public List<HostsDomain> getSeeds() {
// return seeds;
// }
//
// public void setSeeds(List<HostsDomain> seeds) {
// this.seeds = seeds;
// }
//
// public JSONObject getSchema() {
// return schema;
// }
//
// public void setSchema(JSONObject schema) {
// this.schema = schema;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public List<Integer> getPartition() {
// return partition;
// }
//
// public void setPartition(List<Integer> partition) {
// this.partition = partition;
// }
//
// public String getSql() {
// return sql;
// }
//
// public void setSql(String sql) {
// this.sql = sql;
// }
//
// public boolean isStatus() {
// return status;
// }
//
// public void setStatus(boolean status) {
// this.status = status;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/execute/SimpleKafkaConsumer.java
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartloli.kafka.eagle.common.domain.HostsDomain;
import org.smartloli.kafka.eagle.common.domain.KafkaSqlDomain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kafka.api.FetchRequest;
import kafka.api.FetchRequestBuilder;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.common.ErrorMapping;
import kafka.common.TopicAndPartition;
import kafka.javaapi.FetchResponse;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.message.MessageAndOffset;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.execute;
/**
* Kafka underlying consumer API interface.
*
* @author smartloli.
*
* Created by Mar 14, 2016
*/
public class SimpleKafkaConsumer {
private static Logger LOG = LoggerFactory.getLogger(SimpleKafkaConsumer.class);
|
private List<HostsDomain> m_replicaBrokers = new ArrayList<HostsDomain>();
|
yunnet/kafkaEagle
|
src/main/java/org/smartloli/kafka/eagle/core/sql/execute/SimpleKafkaConsumer.java
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/HostsDomain.java
// public class HostsDomain {
//
// private String host;
// private int port;
//
// public String getHost() {
// return host;
// }
//
// public void setHost(String host) {
// this.host = host;
// }
//
// public int getPort() {
// return port;
// }
//
// public void setPort(int port) {
// this.port = port;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/KafkaSqlDomain.java
// public class KafkaSqlDomain {
//
// private List<Integer> partition = new ArrayList<>();
// private String sql;
// private String metaSql;
// private JSONObject schema = new JSONObject();
// private String tableName;
// private String topic;
// private boolean status;
// private List<HostsDomain> seeds = new ArrayList<>();
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public String getMetaSql() {
// return metaSql;
// }
//
// public void setMetaSql(String metaSql) {
// this.metaSql = metaSql;
// }
//
// public List<HostsDomain> getSeeds() {
// return seeds;
// }
//
// public void setSeeds(List<HostsDomain> seeds) {
// this.seeds = seeds;
// }
//
// public JSONObject getSchema() {
// return schema;
// }
//
// public void setSchema(JSONObject schema) {
// this.schema = schema;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public List<Integer> getPartition() {
// return partition;
// }
//
// public void setPartition(List<Integer> partition) {
// this.partition = partition;
// }
//
// public String getSql() {
// return sql;
// }
//
// public void setSql(String sql) {
// this.sql = sql;
// }
//
// public boolean isStatus() {
// return status;
// }
//
// public void setStatus(boolean status) {
// this.status = status;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
|
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartloli.kafka.eagle.common.domain.HostsDomain;
import org.smartloli.kafka.eagle.common.domain.KafkaSqlDomain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kafka.api.FetchRequest;
import kafka.api.FetchRequestBuilder;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.common.ErrorMapping;
import kafka.common.TopicAndPartition;
import kafka.javaapi.FetchResponse;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.message.MessageAndOffset;
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.execute;
/**
* Kafka underlying consumer API interface.
*
* @author smartloli.
*
* Created by Mar 14, 2016
*/
public class SimpleKafkaConsumer {
private static Logger LOG = LoggerFactory.getLogger(SimpleKafkaConsumer.class);
private List<HostsDomain> m_replicaBrokers = new ArrayList<HostsDomain>();
private static int buff_size = 64 * 1024;
private static int fetch_size = 1000 * 1000 * 1000;
private static int timeout = 100000;
private static int maxSize = 5000;
public SimpleKafkaConsumer() {
m_replicaBrokers = new ArrayList<HostsDomain>();
}
|
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/HostsDomain.java
// public class HostsDomain {
//
// private String host;
// private int port;
//
// public String getHost() {
// return host;
// }
//
// public void setHost(String host) {
// this.host = host;
// }
//
// public int getPort() {
// return port;
// }
//
// public void setPort(int port) {
// this.port = port;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
//
// Path: src/main/java/org/smartloli/kafka/eagle/common/domain/KafkaSqlDomain.java
// public class KafkaSqlDomain {
//
// private List<Integer> partition = new ArrayList<>();
// private String sql;
// private String metaSql;
// private JSONObject schema = new JSONObject();
// private String tableName;
// private String topic;
// private boolean status;
// private List<HostsDomain> seeds = new ArrayList<>();
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public String getMetaSql() {
// return metaSql;
// }
//
// public void setMetaSql(String metaSql) {
// this.metaSql = metaSql;
// }
//
// public List<HostsDomain> getSeeds() {
// return seeds;
// }
//
// public void setSeeds(List<HostsDomain> seeds) {
// this.seeds = seeds;
// }
//
// public JSONObject getSchema() {
// return schema;
// }
//
// public void setSchema(JSONObject schema) {
// this.schema = schema;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public List<Integer> getPartition() {
// return partition;
// }
//
// public void setPartition(List<Integer> partition) {
// this.partition = partition;
// }
//
// public String getSql() {
// return sql;
// }
//
// public void setSql(String sql) {
// this.sql = sql;
// }
//
// public boolean isStatus() {
// return status;
// }
//
// public void setStatus(boolean status) {
// this.status = status;
// }
//
// @Override
// public String toString() {
// return new Gson().toJson(this);
// }
//
// }
// Path: src/main/java/org/smartloli/kafka/eagle/core/sql/execute/SimpleKafkaConsumer.java
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartloli.kafka.eagle.common.domain.HostsDomain;
import org.smartloli.kafka.eagle.common.domain.KafkaSqlDomain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kafka.api.FetchRequest;
import kafka.api.FetchRequestBuilder;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.common.ErrorMapping;
import kafka.common.TopicAndPartition;
import kafka.javaapi.FetchResponse;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.message.MessageAndOffset;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.smartloli.kafka.eagle.core.sql.execute;
/**
* Kafka underlying consumer API interface.
*
* @author smartloli.
*
* Created by Mar 14, 2016
*/
public class SimpleKafkaConsumer {
private static Logger LOG = LoggerFactory.getLogger(SimpleKafkaConsumer.class);
private List<HostsDomain> m_replicaBrokers = new ArrayList<HostsDomain>();
private static int buff_size = 64 * 1024;
private static int fetch_size = 1000 * 1000 * 1000;
private static int timeout = 100000;
private static int maxSize = 5000;
public SimpleKafkaConsumer() {
m_replicaBrokers = new ArrayList<HostsDomain>();
}
|
public static List<JSONArray> start(KafkaSqlDomain kafkaSql) {
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackLocalDataSource.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import com.github.gfx.android.orma.annotation.OnConflict;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.model.OrmaDatabase;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.schedulers.Schedulers;
|
package io.github.droidkaigi.confsched2017.repository.feedbacks;
public class SessionFeedbackLocalDataSource {
private final OrmaDatabase orma;
@Inject
public SessionFeedbackLocalDataSource(OrmaDatabase orma) {
this.orma = orma;
}
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackLocalDataSource.java
import com.github.gfx.android.orma.annotation.OnConflict;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.model.OrmaDatabase;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.schedulers.Schedulers;
package io.github.droidkaigi.confsched2017.repository.feedbacks;
public class SessionFeedbackLocalDataSource {
private final OrmaDatabase orma;
@Inject
public SessionFeedbackLocalDataSource(OrmaDatabase orma) {
this.orma = orma;
}
|
public void save(@NonNull SessionFeedback sessionFeedback) {
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/fragment/ContributorsFragment.java
// public class ContributorsFragment extends BaseFragment implements ContributorsViewModel.Callback {
//
// public static final String TAG = ContributorsFragment.class.getSimpleName();
//
// @Inject
// ContributorsViewModel viewModel;
//
// private FragmentContributorsBinding binding;
//
// private Adapter adapter;
//
// public static ContributorsFragment newInstance() {
// return new ContributorsFragment();
// }
//
// public ContributorsFragment() {
// }
//
// @Override
// public void onAttach(Context context) {
// super.onAttach(context);
// getComponent().inject(this);
// }
//
// @Override
// public void onDetach() {
// viewModel.destroy();
// super.onDetach();
// }
//
// @Override
// public void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// viewModel.setCallback(this);
// viewModel.start();
// }
//
// @Nullable
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// setHasOptionsMenu(true);
// binding = FragmentContributorsBinding.inflate(inflater, container, false);
// binding.setViewModel(viewModel);
//
// initView();
// return binding.getRoot();
// }
//
// @Override
// public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
// menuInflater.inflate(R.menu.menu_contributors, menu);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case R.id.item_repository:
// viewModel.onClickRepositoryMenu();
// return true;
// default:
// return super.onOptionsItemSelected(item);
// }
// }
//
//
// private void initView() {
// adapter = new Adapter(getContext(), viewModel.getContributorViewModels());
// binding.recyclerView.setAdapter(adapter);
// binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), getColumnCount()));
// }
//
// @Override
// public void onConfigurationChanged(Configuration newConfig) {
// super.onConfigurationChanged(newConfig);
// ((GridLayoutManager) binding.recyclerView.getLayoutManager()).setSpanCount(getColumnCount());
// }
//
// @Override
// public void showError(@StringRes int resId) {
// Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_INDEFINITE)
// .setAction(R.string.retry, v -> viewModel.retry())
// .setActionTextColor(ContextCompat.getColor(getActivity(), R.color.white))
// .show();
// }
//
// private int getColumnCount() {
// return getResources().getInteger(R.integer.contributors_columns);
// }
//
// private static class Adapter
// extends ArrayRecyclerAdapter<ContributorViewModel, BindingHolder<ViewContributorCellBinding>> {
//
// public Adapter(@NonNull Context context, @NonNull ObservableList<ContributorViewModel> list) {
// super(context, list);
//
// list.addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<ContributorViewModel>>() {
// @Override
// public void onChanged(ObservableList<ContributorViewModel> contributorViewModels) {
// notifyDataSetChanged();
// }
//
// @Override
// public void onItemRangeChanged(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeChanged(i, i1);
// }
//
// @Override
// public void onItemRangeInserted(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeInserted(i, i1);
// }
//
// @Override
// public void onItemRangeMoved(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1,
// int i2) {
// notifyItemMoved(i, i1);
// }
//
// @Override
// public void onItemRangeRemoved(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeRemoved(i, i1);
// }
// });
// }
//
// @Override
// public BindingHolder<ViewContributorCellBinding> onCreateViewHolder(ViewGroup parent, int viewType) {
// return new BindingHolder<>(getContext(), parent, R.layout.view_contributor_cell);
// }
//
// @Override
// public void onBindViewHolder(BindingHolder<ViewContributorCellBinding> holder, int position) {
// ContributorViewModel viewModel = getItem(position);
// ViewContributorCellBinding itemBinding = holder.binding;
// itemBinding.setViewModel(viewModel);
// itemBinding.executePendingBindings();
// }
// }
// }
|
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.ActivityContributorsBinding;
import io.github.droidkaigi.confsched2017.view.fragment.ContributorsFragment;
import io.github.droidkaigi.confsched2017.viewmodel.ToolbarViewModel;
|
package io.github.droidkaigi.confsched2017.view.activity;
public class ContributorsActivity extends BaseActivity {
private ActivityContributorsBinding binding;
@Inject
ToolbarViewModel viewModel;
public static Intent createIntent(Context context) {
return new Intent(context, ContributorsActivity.class);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getComponent().inject(this);
binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
binding.setViewModel(viewModel);
initBackToolbar(binding.toolbar);
viewModel.setToolbarTitle(getString(R.string.contributors));
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/fragment/ContributorsFragment.java
// public class ContributorsFragment extends BaseFragment implements ContributorsViewModel.Callback {
//
// public static final String TAG = ContributorsFragment.class.getSimpleName();
//
// @Inject
// ContributorsViewModel viewModel;
//
// private FragmentContributorsBinding binding;
//
// private Adapter adapter;
//
// public static ContributorsFragment newInstance() {
// return new ContributorsFragment();
// }
//
// public ContributorsFragment() {
// }
//
// @Override
// public void onAttach(Context context) {
// super.onAttach(context);
// getComponent().inject(this);
// }
//
// @Override
// public void onDetach() {
// viewModel.destroy();
// super.onDetach();
// }
//
// @Override
// public void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// viewModel.setCallback(this);
// viewModel.start();
// }
//
// @Nullable
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// setHasOptionsMenu(true);
// binding = FragmentContributorsBinding.inflate(inflater, container, false);
// binding.setViewModel(viewModel);
//
// initView();
// return binding.getRoot();
// }
//
// @Override
// public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
// menuInflater.inflate(R.menu.menu_contributors, menu);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case R.id.item_repository:
// viewModel.onClickRepositoryMenu();
// return true;
// default:
// return super.onOptionsItemSelected(item);
// }
// }
//
//
// private void initView() {
// adapter = new Adapter(getContext(), viewModel.getContributorViewModels());
// binding.recyclerView.setAdapter(adapter);
// binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), getColumnCount()));
// }
//
// @Override
// public void onConfigurationChanged(Configuration newConfig) {
// super.onConfigurationChanged(newConfig);
// ((GridLayoutManager) binding.recyclerView.getLayoutManager()).setSpanCount(getColumnCount());
// }
//
// @Override
// public void showError(@StringRes int resId) {
// Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_INDEFINITE)
// .setAction(R.string.retry, v -> viewModel.retry())
// .setActionTextColor(ContextCompat.getColor(getActivity(), R.color.white))
// .show();
// }
//
// private int getColumnCount() {
// return getResources().getInteger(R.integer.contributors_columns);
// }
//
// private static class Adapter
// extends ArrayRecyclerAdapter<ContributorViewModel, BindingHolder<ViewContributorCellBinding>> {
//
// public Adapter(@NonNull Context context, @NonNull ObservableList<ContributorViewModel> list) {
// super(context, list);
//
// list.addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<ContributorViewModel>>() {
// @Override
// public void onChanged(ObservableList<ContributorViewModel> contributorViewModels) {
// notifyDataSetChanged();
// }
//
// @Override
// public void onItemRangeChanged(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeChanged(i, i1);
// }
//
// @Override
// public void onItemRangeInserted(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeInserted(i, i1);
// }
//
// @Override
// public void onItemRangeMoved(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1,
// int i2) {
// notifyItemMoved(i, i1);
// }
//
// @Override
// public void onItemRangeRemoved(ObservableList<ContributorViewModel> contributorViewModels, int i, int i1) {
// notifyItemRangeRemoved(i, i1);
// }
// });
// }
//
// @Override
// public BindingHolder<ViewContributorCellBinding> onCreateViewHolder(ViewGroup parent, int viewType) {
// return new BindingHolder<>(getContext(), parent, R.layout.view_contributor_cell);
// }
//
// @Override
// public void onBindViewHolder(BindingHolder<ViewContributorCellBinding> holder, int position) {
// ContributorViewModel viewModel = getItem(position);
// ViewContributorCellBinding itemBinding = holder.binding;
// itemBinding.setViewModel(viewModel);
// itemBinding.executePendingBindings();
// }
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.ActivityContributorsBinding;
import io.github.droidkaigi.confsched2017.view.fragment.ContributorsFragment;
import io.github.droidkaigi.confsched2017.viewmodel.ToolbarViewModel;
package io.github.droidkaigi.confsched2017.view.activity;
public class ContributorsActivity extends BaseActivity {
private ActivityContributorsBinding binding;
@Inject
ToolbarViewModel viewModel;
public static Intent createIntent(Context context) {
return new Intent(context, ContributorsActivity.class);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getComponent().inject(this);
binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
binding.setViewModel(viewModel);
initBackToolbar(binding.toolbar);
viewModel.setToolbarTitle(getString(R.string.contributors));
|
replaceFragment(ContributorsFragment.newInstance(), R.id.content_view);
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SplashActivity.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
//
// private final MySessionsDataSource localDataSource;
//
// private Map<Integer, MySession> cachedMySessions;
//
// @Inject
// public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
// this.localDataSource = localDataSource;
// this.cachedMySessions = new LinkedHashMap<>();
// }
//
// @Override
// public Single<List<MySession>> findAll() {
// if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
// return Single.create(emitter -> {
// emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
// });
// }
//
// return localDataSource.findAll().doOnSuccess(this::refreshCache);
// }
//
// @Override
// public Completable save(@NonNull Session session) {
// cachedMySessions.put(session.id, new MySession(session));
// return localDataSource.save(session);
// }
//
// @Override
// public Single<Integer> delete(@NonNull Session session) {
// cachedMySessions.remove(session.id);
// return localDataSource.delete(session);
// }
//
// @Override
// public boolean isExist(int sessionId) {
// return localDataSource.isExist(sessionId);
// }
//
// private void refreshCache(List<MySession> mySessions) {
// if (cachedMySessions == null) {
// cachedMySessions = new LinkedHashMap<>();
// }
// cachedMySessions.clear();
// for (MySession mySession : mySessions) {
// cachedMySessions.put(mySession.session.id, mySession);
// }
// }
// }
//
// Path: app/src/release/java/io/github/droidkaigi/confsched2017/util/FpsMeasureUtil.java
// public class FpsMeasureUtil {
//
// private FpsMeasureUtil() {
// }
//
// public static void play(Application application) {
// // no-op.
// }
//
// public static void finish() {
// // no-op.
// }
//
// }
|
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.util.FpsMeasureUtil;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
|
package io.github.droidkaigi.confsched2017.view.activity;
public class SplashActivity extends BaseActivity {
private static final String TAG = SplashActivity.class.getSimpleName();
private static final int MINIMUM_LOADING_TIME = 1500;
@Inject
CompositeDisposable compositeDisposable;
@Inject
SessionsRepository sessionsRepository;
@Inject
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
//
// private final MySessionsDataSource localDataSource;
//
// private Map<Integer, MySession> cachedMySessions;
//
// @Inject
// public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
// this.localDataSource = localDataSource;
// this.cachedMySessions = new LinkedHashMap<>();
// }
//
// @Override
// public Single<List<MySession>> findAll() {
// if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
// return Single.create(emitter -> {
// emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
// });
// }
//
// return localDataSource.findAll().doOnSuccess(this::refreshCache);
// }
//
// @Override
// public Completable save(@NonNull Session session) {
// cachedMySessions.put(session.id, new MySession(session));
// return localDataSource.save(session);
// }
//
// @Override
// public Single<Integer> delete(@NonNull Session session) {
// cachedMySessions.remove(session.id);
// return localDataSource.delete(session);
// }
//
// @Override
// public boolean isExist(int sessionId) {
// return localDataSource.isExist(sessionId);
// }
//
// private void refreshCache(List<MySession> mySessions) {
// if (cachedMySessions == null) {
// cachedMySessions = new LinkedHashMap<>();
// }
// cachedMySessions.clear();
// for (MySession mySession : mySessions) {
// cachedMySessions.put(mySession.session.id, mySession);
// }
// }
// }
//
// Path: app/src/release/java/io/github/droidkaigi/confsched2017/util/FpsMeasureUtil.java
// public class FpsMeasureUtil {
//
// private FpsMeasureUtil() {
// }
//
// public static void play(Application application) {
// // no-op.
// }
//
// public static void finish() {
// // no-op.
// }
//
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SplashActivity.java
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.util.FpsMeasureUtil;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
package io.github.droidkaigi.confsched2017.view.activity;
public class SplashActivity extends BaseActivity {
private static final String TAG = SplashActivity.class.getSimpleName();
private static final int MINIMUM_LOADING_TIME = 1500;
@Inject
CompositeDisposable compositeDisposable;
@Inject
SessionsRepository sessionsRepository;
@Inject
|
MySessionsRepository mySessionsRepository;
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SplashActivity.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
//
// private final MySessionsDataSource localDataSource;
//
// private Map<Integer, MySession> cachedMySessions;
//
// @Inject
// public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
// this.localDataSource = localDataSource;
// this.cachedMySessions = new LinkedHashMap<>();
// }
//
// @Override
// public Single<List<MySession>> findAll() {
// if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
// return Single.create(emitter -> {
// emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
// });
// }
//
// return localDataSource.findAll().doOnSuccess(this::refreshCache);
// }
//
// @Override
// public Completable save(@NonNull Session session) {
// cachedMySessions.put(session.id, new MySession(session));
// return localDataSource.save(session);
// }
//
// @Override
// public Single<Integer> delete(@NonNull Session session) {
// cachedMySessions.remove(session.id);
// return localDataSource.delete(session);
// }
//
// @Override
// public boolean isExist(int sessionId) {
// return localDataSource.isExist(sessionId);
// }
//
// private void refreshCache(List<MySession> mySessions) {
// if (cachedMySessions == null) {
// cachedMySessions = new LinkedHashMap<>();
// }
// cachedMySessions.clear();
// for (MySession mySession : mySessions) {
// cachedMySessions.put(mySession.session.id, mySession);
// }
// }
// }
//
// Path: app/src/release/java/io/github/droidkaigi/confsched2017/util/FpsMeasureUtil.java
// public class FpsMeasureUtil {
//
// private FpsMeasureUtil() {
// }
//
// public static void play(Application application) {
// // no-op.
// }
//
// public static void finish() {
// // no-op.
// }
//
// }
|
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.util.FpsMeasureUtil;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
|
package io.github.droidkaigi.confsched2017.view.activity;
public class SplashActivity extends BaseActivity {
private static final String TAG = SplashActivity.class.getSimpleName();
private static final int MINIMUM_LOADING_TIME = 1500;
@Inject
CompositeDisposable compositeDisposable;
@Inject
SessionsRepository sessionsRepository;
@Inject
MySessionsRepository mySessionsRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getComponent().inject(this);
DataBindingUtil.setContentView(this, R.layout.activity_splash);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
findViewById(android.R.id.content).setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
}
@Override
protected void onStart() {
super.onStart();
loadSessionsForCache();
// Starting new Activity normally will not destroy this Activity, so set this up in start/stop cycle
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
//
// private final MySessionsDataSource localDataSource;
//
// private Map<Integer, MySession> cachedMySessions;
//
// @Inject
// public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
// this.localDataSource = localDataSource;
// this.cachedMySessions = new LinkedHashMap<>();
// }
//
// @Override
// public Single<List<MySession>> findAll() {
// if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
// return Single.create(emitter -> {
// emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
// });
// }
//
// return localDataSource.findAll().doOnSuccess(this::refreshCache);
// }
//
// @Override
// public Completable save(@NonNull Session session) {
// cachedMySessions.put(session.id, new MySession(session));
// return localDataSource.save(session);
// }
//
// @Override
// public Single<Integer> delete(@NonNull Session session) {
// cachedMySessions.remove(session.id);
// return localDataSource.delete(session);
// }
//
// @Override
// public boolean isExist(int sessionId) {
// return localDataSource.isExist(sessionId);
// }
//
// private void refreshCache(List<MySession> mySessions) {
// if (cachedMySessions == null) {
// cachedMySessions = new LinkedHashMap<>();
// }
// cachedMySessions.clear();
// for (MySession mySession : mySessions) {
// cachedMySessions.put(mySession.session.id, mySession);
// }
// }
// }
//
// Path: app/src/release/java/io/github/droidkaigi/confsched2017/util/FpsMeasureUtil.java
// public class FpsMeasureUtil {
//
// private FpsMeasureUtil() {
// }
//
// public static void play(Application application) {
// // no-op.
// }
//
// public static void finish() {
// // no-op.
// }
//
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SplashActivity.java
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.util.FpsMeasureUtil;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
package io.github.droidkaigi.confsched2017.view.activity;
public class SplashActivity extends BaseActivity {
private static final String TAG = SplashActivity.class.getSimpleName();
private static final int MINIMUM_LOADING_TIME = 1500;
@Inject
CompositeDisposable compositeDisposable;
@Inject
SessionsRepository sessionsRepository;
@Inject
MySessionsRepository mySessionsRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getComponent().inject(this);
DataBindingUtil.setContentView(this, R.layout.activity_splash);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
findViewById(android.R.id.content).setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
}
@Override
protected void onStart() {
super.onStart();
loadSessionsForCache();
// Starting new Activity normally will not destroy this Activity, so set this up in start/stop cycle
|
FpsMeasureUtil.play(getApplication());
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
// public class ContributorsActivity extends BaseActivity {
//
// private ActivityContributorsBinding binding;
//
// @Inject
// ToolbarViewModel viewModel;
//
// public static Intent createIntent(Context context) {
// return new Intent(context, ContributorsActivity.class);
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// getComponent().inject(this);
//
// binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
// binding.setViewModel(viewModel);
//
// initBackToolbar(binding.toolbar);
// viewModel.setToolbarTitle(getString(R.string.contributors));
// replaceFragment(ContributorsFragment.newInstance(), R.id.content_view);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
|
import android.app.Activity;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.webkit.URLUtil;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.di.scope.ActivityScope;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.view.activity.ContributorsActivity;
import io.github.droidkaigi.confsched2017.view.activity.LicensesActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionFeedbackActivity;
import io.github.droidkaigi.confsched2017.view.activity.SponsorsActivity;
|
package io.github.droidkaigi.confsched2017.view.helper;
/**
* Created by shihochan on 2017/02/15.
*/
@ActivityScope
public class Navigator {
private final Activity activity;
@Inject
public Navigator(AppCompatActivity activity) {
this.activity = activity;
}
public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
// public class ContributorsActivity extends BaseActivity {
//
// private ActivityContributorsBinding binding;
//
// @Inject
// ToolbarViewModel viewModel;
//
// public static Intent createIntent(Context context) {
// return new Intent(context, ContributorsActivity.class);
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// getComponent().inject(this);
//
// binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
// binding.setViewModel(viewModel);
//
// initBackToolbar(binding.toolbar);
// viewModel.setToolbarTitle(getString(R.string.contributors));
// replaceFragment(ContributorsFragment.newInstance(), R.id.content_view);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
import android.app.Activity;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.webkit.URLUtil;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.di.scope.ActivityScope;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.view.activity.ContributorsActivity;
import io.github.droidkaigi.confsched2017.view.activity.LicensesActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionFeedbackActivity;
import io.github.droidkaigi.confsched2017.view.activity.SponsorsActivity;
package io.github.droidkaigi.confsched2017.view.helper;
/**
* Created by shihochan on 2017/02/15.
*/
@ActivityScope
public class Navigator {
private final Activity activity;
@Inject
public Navigator(AppCompatActivity activity) {
this.activity = activity;
}
public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
|
activity.startActivity(SessionDetailActivity.createIntent(activity, session.id, parentClass));
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
// public class ContributorsActivity extends BaseActivity {
//
// private ActivityContributorsBinding binding;
//
// @Inject
// ToolbarViewModel viewModel;
//
// public static Intent createIntent(Context context) {
// return new Intent(context, ContributorsActivity.class);
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// getComponent().inject(this);
//
// binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
// binding.setViewModel(viewModel);
//
// initBackToolbar(binding.toolbar);
// viewModel.setToolbarTitle(getString(R.string.contributors));
// replaceFragment(ContributorsFragment.newInstance(), R.id.content_view);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
|
import android.app.Activity;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.webkit.URLUtil;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.di.scope.ActivityScope;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.view.activity.ContributorsActivity;
import io.github.droidkaigi.confsched2017.view.activity.LicensesActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionFeedbackActivity;
import io.github.droidkaigi.confsched2017.view.activity.SponsorsActivity;
|
package io.github.droidkaigi.confsched2017.view.helper;
/**
* Created by shihochan on 2017/02/15.
*/
@ActivityScope
public class Navigator {
private final Activity activity;
@Inject
public Navigator(AppCompatActivity activity) {
this.activity = activity;
}
public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
activity.startActivity(SessionDetailActivity.createIntent(activity, session.id, parentClass));
}
public void navigateToFeedbackPage(@NonNull Session session) {
activity.startActivity(SessionFeedbackActivity.createIntent(activity, session.id));
}
public void navigateToSponsorsPage() {
activity.startActivity(SponsorsActivity.createIntent(activity));
}
public void navigateToContributorsPage() {
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/ContributorsActivity.java
// public class ContributorsActivity extends BaseActivity {
//
// private ActivityContributorsBinding binding;
//
// @Inject
// ToolbarViewModel viewModel;
//
// public static Intent createIntent(Context context) {
// return new Intent(context, ContributorsActivity.class);
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// getComponent().inject(this);
//
// binding = DataBindingUtil.setContentView(this, R.layout.activity_contributors);
// binding.setViewModel(viewModel);
//
// initBackToolbar(binding.toolbar);
// viewModel.setToolbarTitle(getString(R.string.contributors));
// replaceFragment(ContributorsFragment.newInstance(), R.id.content_view);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
import android.app.Activity;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.webkit.URLUtil;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.di.scope.ActivityScope;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.view.activity.ContributorsActivity;
import io.github.droidkaigi.confsched2017.view.activity.LicensesActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionFeedbackActivity;
import io.github.droidkaigi.confsched2017.view.activity.SponsorsActivity;
package io.github.droidkaigi.confsched2017.view.helper;
/**
* Created by shihochan on 2017/02/15.
*/
@ActivityScope
public class Navigator {
private final Activity activity;
@Inject
public Navigator(AppCompatActivity activity) {
this.activity = activity;
}
public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
activity.startActivity(SessionDetailActivity.createIntent(activity, session.id, parentClass));
}
public void navigateToFeedbackPage(@NonNull Session session) {
activity.startActivity(SessionFeedbackActivity.createIntent(activity, session.id));
}
public void navigateToSponsorsPage() {
activity.startActivity(SponsorsActivity.createIntent(activity));
}
public void navigateToContributorsPage() {
|
activity.startActivity(ContributorsActivity.createIntent(activity));
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackRemoteDataSource.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
// @Singleton
// public class DroidKaigiClient {
//
// private final DroidKaigiService droidKaigiService;
//
// private final GithubService githubService;
//
// private final GoogleFormService googleFormService;
//
// private static final int INCLUDE_ANONYMOUS = 1;
//
// private static final int MAX_PER_PAGE = 100;
//
// @Inject
// public DroidKaigiClient(DroidKaigiService droidKaigiService, GithubService githubService,
// GoogleFormService googleFormService) {
// this.droidKaigiService = droidKaigiService;
// this.githubService = githubService;
// this.googleFormService = googleFormService;
// }
//
// public Single<List<Session>> getSessions(@NonNull Locale locale) {
// if (locale == Locale.JAPANESE) {
// return droidKaigiService.getSessionsJa();
// } else {
// return droidKaigiService.getSessionsEn();
// }
// }
//
// public Single<List<Contributor>> getContributors() {
// return githubService.getContributors("DroidKaigi", "conference-app-2017", INCLUDE_ANONYMOUS, MAX_PER_PAGE);
// }
//
// public Single<Response<Void>> submitSessionFeedback(@NonNull SessionFeedback sessionFeedback) {
// return googleFormService.submitSessionFeedback(sessionFeedback.sessionId,
// sessionFeedback.sessionTitle,
// sessionFeedback.relevancy,
// sessionFeedback.asExpected,
// sessionFeedback.difficulty,
// sessionFeedback.knowledgeable,
// sessionFeedback.comment);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.api.DroidKaigiClient;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
|
package io.github.droidkaigi.confsched2017.repository.feedbacks;
public class SessionFeedbackRemoteDataSource {
private final DroidKaigiClient client;
@Inject
public SessionFeedbackRemoteDataSource(DroidKaigiClient client) {
this.client = client;
}
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
// @Singleton
// public class DroidKaigiClient {
//
// private final DroidKaigiService droidKaigiService;
//
// private final GithubService githubService;
//
// private final GoogleFormService googleFormService;
//
// private static final int INCLUDE_ANONYMOUS = 1;
//
// private static final int MAX_PER_PAGE = 100;
//
// @Inject
// public DroidKaigiClient(DroidKaigiService droidKaigiService, GithubService githubService,
// GoogleFormService googleFormService) {
// this.droidKaigiService = droidKaigiService;
// this.githubService = githubService;
// this.googleFormService = googleFormService;
// }
//
// public Single<List<Session>> getSessions(@NonNull Locale locale) {
// if (locale == Locale.JAPANESE) {
// return droidKaigiService.getSessionsJa();
// } else {
// return droidKaigiService.getSessionsEn();
// }
// }
//
// public Single<List<Contributor>> getContributors() {
// return githubService.getContributors("DroidKaigi", "conference-app-2017", INCLUDE_ANONYMOUS, MAX_PER_PAGE);
// }
//
// public Single<Response<Void>> submitSessionFeedback(@NonNull SessionFeedback sessionFeedback) {
// return googleFormService.submitSessionFeedback(sessionFeedback.sessionId,
// sessionFeedback.sessionTitle,
// sessionFeedback.relevancy,
// sessionFeedback.asExpected,
// sessionFeedback.difficulty,
// sessionFeedback.knowledgeable,
// sessionFeedback.comment);
// }
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackRemoteDataSource.java
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.api.DroidKaigiClient;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
package io.github.droidkaigi.confsched2017.repository.feedbacks;
public class SessionFeedbackRemoteDataSource {
private final DroidKaigiClient client;
@Inject
public SessionFeedbackRemoteDataSource(DroidKaigiClient client) {
this.client = client;
}
|
public Single<Response<Void>> submit(SessionFeedback sessionFeedback) {
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/receiver/NotificationReceiver.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
|
import android.app.Notification;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.view.activity.MainActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import timber.log.Timber;
|
/**
* Show group notification
* @param context Context
*/
private void showGroupNotification(Context context) {
// Group notification is supported on Android N and Android Wear.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Notification groupNotification = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
.setColor(ContextCompat.getColor(context, R.color.theme))
.setAutoCancel(true)
.setGroup(GROUP_NAME)
.setGroupSummary(true)
.build();
NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
}
}
/**
* Show child notification
* @param context Context
* @param intent Intent
*/
private void showChildNotification(Context context, Intent intent, boolean headsUp) {
int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
String title = intent.getStringExtra(KEY_TITLE);
String text = intent.getStringExtra(KEY_TEXT);
int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
//
// private static final String EXTRA_SESSION_ID = "session_id";
// private static final String EXTRA_PARENT = "parent";
//
// private Class parentClass;
//
// public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
// Intent intent = new Intent(context, SessionDetailActivity.class);
// intent.putExtra(EXTRA_SESSION_ID, sessionId);
// if (parentClass != null) {
// intent.putExtra(EXTRA_PARENT, parentClass.getName());
// }
// return intent;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
// getComponent().inject(this);
//
// final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
// String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
// if (TextUtils.isEmpty(parentClassName)) {
// parentClass = MainActivity.class;
// } else {
// try {
// parentClass = Class.forName(parentClassName);
// } catch (ClassNotFoundException e) {
// Timber.e(e);
// }
// }
// replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case android.R.id.home:
// upToParentActivity();
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private void upToParentActivity() {
// Intent upIntent = new Intent(getApplicationContext(), parentClass);
// upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// startActivity(upIntent);
// finish();
// }
//
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/receiver/NotificationReceiver.java
import android.app.Notification;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.view.activity.MainActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import timber.log.Timber;
/**
* Show group notification
* @param context Context
*/
private void showGroupNotification(Context context) {
// Group notification is supported on Android N and Android Wear.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Notification groupNotification = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
.setColor(ContextCompat.getColor(context, R.color.theme))
.setAutoCancel(true)
.setGroup(GROUP_NAME)
.setGroupSummary(true)
.build();
NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
}
}
/**
* Show child notification
* @param context Context
* @param intent Intent
*/
private void showChildNotification(Context context, Intent intent, boolean headsUp) {
int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
String title = intent.getStringExtra(KEY_TITLE);
String text = intent.getStringExtra(KEY_TEXT);
int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
|
Intent openIntent = SessionDetailActivity.createIntent(context, sessionId, MainActivity.class);
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/view/fragment/SessionFeedbackFragment.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import com.sys1yagi.fragmentcreator.annotation.Args;
import com.sys1yagi.fragmentcreator.annotation.FragmentCreator;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.FragmentSessionFeedbackBinding;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.github.droidkaigi.confsched2017.viewmodel.SessionFeedbackViewModel;
|
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = FragmentSessionFeedbackBinding.inflate(inflater, container, false);
binding.setViewModel(viewModel);
return binding.getRoot();
}
@Override
public void onDetach() {
viewModel.destroy();
super.onDetach();
}
@Override
public void onSuccessSubmit() {
showToast(R.string.session_feedback_submit_success);
}
@Override
public void onErrorSubmit() {
showToast(R.string.session_feedback_submit_failure);
}
@Override
public void onErrorUnFilled() {
showToast(R.string.session_feedback_error_not_filled);
}
@Override
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/fragment/SessionFeedbackFragment.java
import com.sys1yagi.fragmentcreator.annotation.Args;
import com.sys1yagi.fragmentcreator.annotation.FragmentCreator;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.FragmentSessionFeedbackBinding;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.github.droidkaigi.confsched2017.viewmodel.SessionFeedbackViewModel;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = FragmentSessionFeedbackBinding.inflate(inflater, container, false);
binding.setViewModel(viewModel);
return binding.getRoot();
}
@Override
public void onDetach() {
viewModel.destroy();
super.onDetach();
}
@Override
public void onSuccessSubmit() {
showToast(R.string.session_feedback_submit_success);
}
@Override
public void onErrorSubmit() {
showToast(R.string.session_feedback_submit_failure);
}
@Override
public void onErrorUnFilled() {
showToast(R.string.session_feedback_error_not_filled);
}
@Override
|
public void onSessionFeedbackInitialized(@NonNull SessionFeedback sessionFeedback) {
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackRepository.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
|
package io.github.droidkaigi.confsched2017.repository.feedbacks;
@Singleton
public class SessionFeedbackRepository {
private final SessionFeedbackRemoteDataSource remoteDataSource;
private final SessionFeedbackLocalDataSource localDataSource;
@Inject
public SessionFeedbackRepository(SessionFeedbackRemoteDataSource remoteDataSource,
SessionFeedbackLocalDataSource localDataSource) {
this.remoteDataSource = remoteDataSource;
this.localDataSource = localDataSource;
}
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/feedbacks/SessionFeedbackRepository.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
package io.github.droidkaigi.confsched2017.repository.feedbacks;
@Singleton
public class SessionFeedbackRepository {
private final SessionFeedbackRemoteDataSource remoteDataSource;
private final SessionFeedbackLocalDataSource localDataSource;
@Inject
public SessionFeedbackRepository(SessionFeedbackRemoteDataSource remoteDataSource,
SessionFeedbackLocalDataSource localDataSource) {
this.remoteDataSource = remoteDataSource;
this.localDataSource = localDataSource;
}
|
public Single<Response<Void>> submit(SessionFeedback sessionFeedback) {
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/util/AlarmUtil.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/receiver/NotificationReceiver.java
// public class NotificationReceiver extends BroadcastReceiver {
//
// private static final String TAG = NotificationReceiver.class.getSimpleName();
//
// private static final String KEY_SESSION_ID = "session_id";
//
// private static final String KEY_TITLE = "title";
//
// private static final String KEY_TEXT = "text";
//
// private static final String GROUP_NAME = "droidkaigi";
// private static final int GROUP_NOTIFICATION_ID = 0;
//
// public static Intent createIntent(Context context, int sessionId, String title, String text) {
// Intent intent = new Intent(context, NotificationReceiver.class);
// intent.putExtra(NotificationReceiver.KEY_SESSION_ID, sessionId);
// intent.putExtra(NotificationReceiver.KEY_TITLE, title);
// intent.putExtra(NotificationReceiver.KEY_TEXT, text);
// return intent;
// }
//
// @Override
// public void onReceive(Context context, Intent intent) {
// DefaultPrefs prefs = DefaultPrefs.get(context);
// if (!prefs.getNotificationFlag()) {
// Timber.tag(TAG).v("Notification is disabled.");
// return;
// }
//
// showGroupNotification(context);
//
// showChildNotification(context, intent, prefs.getHeadsUpFlag());
// }
//
// /**
// * Show group notification
// * @param context Context
// */
// private void showGroupNotification(Context context) {
// // Group notification is supported on Android N and Android Wear.
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// Notification groupNotification = new NotificationCompat.Builder(context)
// .setSmallIcon(R.drawable.ic_notification)
// .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
// .setColor(ContextCompat.getColor(context, R.color.theme))
// .setAutoCancel(true)
// .setGroup(GROUP_NAME)
// .setGroupSummary(true)
// .build();
// NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
// }
// }
//
// /**
// * Show child notification
// * @param context Context
// * @param intent Intent
// */
// private void showChildNotification(Context context, Intent intent, boolean headsUp) {
// int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
// String title = intent.getStringExtra(KEY_TITLE);
// String text = intent.getStringExtra(KEY_TEXT);
// int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
// Intent openIntent = SessionDetailActivity.createIntent(context, sessionId, MainActivity.class);
// openIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, openIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
// .setTicker(title)
// .setContentTitle(title)
// .setContentText(text)
// .setSmallIcon(R.drawable.ic_notification)
// .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
// .setColor(ContextCompat.getColor(context, R.color.theme))
// .setAutoCancel(true)
// .setContentIntent(pendingIntent)
// .setDefaults(NotificationCompat.DEFAULT_ALL)
// .setPriority(priority);
// // Group notification is supported on Android N and Android Wear.
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// builder.setGroup(GROUP_NAME).setGroupSummary(false);
// }
// NotificationManagerCompat.from(context).notify(sessionId, builder.build());
// }
// }
|
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.receiver.NotificationReceiver;
|
time = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(5);
}
if (System.currentTimeMillis() < time) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, time, createAlarmIntent(context, session));
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, time, createAlarmIntent(context, session));
}
}
}
public static void unregisterAlarm(@NonNull Context context, @NonNull Session session) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(createAlarmIntent(context, session));
}
private static PendingIntent createAlarmIntent(@NonNull Context context, @NonNull Session session) {
String title = context.getString(R.string.notification_title, session.title);
Date displaySTime = LocaleUtil.getDisplayDate(session.stime, context);
Date displayETime = LocaleUtil.getDisplayDate(session.etime, context);
String room = "";
if (session.room != null) {
room = session.room.name;
}
String text = context.getString(R.string.notification_message,
DateUtil.getHourMinute(displaySTime),
DateUtil.getHourMinute(displayETime),
room);
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/receiver/NotificationReceiver.java
// public class NotificationReceiver extends BroadcastReceiver {
//
// private static final String TAG = NotificationReceiver.class.getSimpleName();
//
// private static final String KEY_SESSION_ID = "session_id";
//
// private static final String KEY_TITLE = "title";
//
// private static final String KEY_TEXT = "text";
//
// private static final String GROUP_NAME = "droidkaigi";
// private static final int GROUP_NOTIFICATION_ID = 0;
//
// public static Intent createIntent(Context context, int sessionId, String title, String text) {
// Intent intent = new Intent(context, NotificationReceiver.class);
// intent.putExtra(NotificationReceiver.KEY_SESSION_ID, sessionId);
// intent.putExtra(NotificationReceiver.KEY_TITLE, title);
// intent.putExtra(NotificationReceiver.KEY_TEXT, text);
// return intent;
// }
//
// @Override
// public void onReceive(Context context, Intent intent) {
// DefaultPrefs prefs = DefaultPrefs.get(context);
// if (!prefs.getNotificationFlag()) {
// Timber.tag(TAG).v("Notification is disabled.");
// return;
// }
//
// showGroupNotification(context);
//
// showChildNotification(context, intent, prefs.getHeadsUpFlag());
// }
//
// /**
// * Show group notification
// * @param context Context
// */
// private void showGroupNotification(Context context) {
// // Group notification is supported on Android N and Android Wear.
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// Notification groupNotification = new NotificationCompat.Builder(context)
// .setSmallIcon(R.drawable.ic_notification)
// .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
// .setColor(ContextCompat.getColor(context, R.color.theme))
// .setAutoCancel(true)
// .setGroup(GROUP_NAME)
// .setGroupSummary(true)
// .build();
// NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
// }
// }
//
// /**
// * Show child notification
// * @param context Context
// * @param intent Intent
// */
// private void showChildNotification(Context context, Intent intent, boolean headsUp) {
// int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
// String title = intent.getStringExtra(KEY_TITLE);
// String text = intent.getStringExtra(KEY_TEXT);
// int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
// Intent openIntent = SessionDetailActivity.createIntent(context, sessionId, MainActivity.class);
// openIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, openIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
// .setTicker(title)
// .setContentTitle(title)
// .setContentText(text)
// .setSmallIcon(R.drawable.ic_notification)
// .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
// .setColor(ContextCompat.getColor(context, R.color.theme))
// .setAutoCancel(true)
// .setContentIntent(pendingIntent)
// .setDefaults(NotificationCompat.DEFAULT_ALL)
// .setPriority(priority);
// // Group notification is supported on Android N and Android Wear.
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// builder.setGroup(GROUP_NAME).setGroupSummary(false);
// }
// NotificationManagerCompat.from(context).notify(sessionId, builder.build());
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/util/AlarmUtil.java
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.receiver.NotificationReceiver;
time = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(5);
}
if (System.currentTimeMillis() < time) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, time, createAlarmIntent(context, session));
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, time, createAlarmIntent(context, session));
}
}
}
public static void unregisterAlarm(@NonNull Context context, @NonNull Session session) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(createAlarmIntent(context, session));
}
private static PendingIntent createAlarmIntent(@NonNull Context context, @NonNull Session session) {
String title = context.getString(R.string.notification_title, session.title);
Date displaySTime = LocaleUtil.getDisplayDate(session.stime, context);
Date displayETime = LocaleUtil.getDisplayDate(session.etime, context);
String room = "";
if (session.room != null) {
room = session.room.name;
}
String text = context.getString(R.string.notification_message,
DateUtil.getHourMinute(displaySTime),
DateUtil.getHourMinute(displayETime),
room);
|
Intent intent = NotificationReceiver.createIntent(context, session.id, title, text);
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/DroidKaigiService.java
// public interface DroidKaigiService {
//
// @GET("sessions.json")
// Single<List<Session>> getSessionsJa();
//
// @GET("en/sessions.json")
// Single<List<Session>> getSessionsEn();
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/GoogleFormService.java
// public interface GoogleFormService {
//
// @POST("e/1FAIpQLSf5NydpYm48GXqlKqbG3e0dna3bw5HJ4GUg8W1Yfe4znTWH_g/formResponse")
// @FormUrlEncoded
// Single<Response<Void>> submitSessionFeedback(
// @Field("entry.1298546024") int sessionId,
// @Field("entry.413792998") String sessionTitle,
// @Field("entry.335146475") int relevancy,
// @Field("entry.1916895481") int asExpected,
// @Field("entry.1501292277") int difficulty,
// @Field("entry.2121897737") int knowledgeable,
// @Field("entry.645604473") String comment);
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import android.support.annotation.NonNull;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.api.service.DroidKaigiService;
import io.github.droidkaigi.confsched2017.api.service.GithubService;
import io.github.droidkaigi.confsched2017.api.service.GoogleFormService;
import io.github.droidkaigi.confsched2017.model.Contributor;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
|
package io.github.droidkaigi.confsched2017.api;
@Singleton
public class DroidKaigiClient {
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/DroidKaigiService.java
// public interface DroidKaigiService {
//
// @GET("sessions.json")
// Single<List<Session>> getSessionsJa();
//
// @GET("en/sessions.json")
// Single<List<Session>> getSessionsEn();
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/GoogleFormService.java
// public interface GoogleFormService {
//
// @POST("e/1FAIpQLSf5NydpYm48GXqlKqbG3e0dna3bw5HJ4GUg8W1Yfe4znTWH_g/formResponse")
// @FormUrlEncoded
// Single<Response<Void>> submitSessionFeedback(
// @Field("entry.1298546024") int sessionId,
// @Field("entry.413792998") String sessionTitle,
// @Field("entry.335146475") int relevancy,
// @Field("entry.1916895481") int asExpected,
// @Field("entry.1501292277") int difficulty,
// @Field("entry.2121897737") int knowledgeable,
// @Field("entry.645604473") String comment);
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
import android.support.annotation.NonNull;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.api.service.DroidKaigiService;
import io.github.droidkaigi.confsched2017.api.service.GithubService;
import io.github.droidkaigi.confsched2017.api.service.GoogleFormService;
import io.github.droidkaigi.confsched2017.model.Contributor;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
package io.github.droidkaigi.confsched2017.api;
@Singleton
public class DroidKaigiClient {
|
private final DroidKaigiService droidKaigiService;
|
DroidKaigi/conference-app-2017
|
app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/DroidKaigiService.java
// public interface DroidKaigiService {
//
// @GET("sessions.json")
// Single<List<Session>> getSessionsJa();
//
// @GET("en/sessions.json")
// Single<List<Session>> getSessionsEn();
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/GoogleFormService.java
// public interface GoogleFormService {
//
// @POST("e/1FAIpQLSf5NydpYm48GXqlKqbG3e0dna3bw5HJ4GUg8W1Yfe4znTWH_g/formResponse")
// @FormUrlEncoded
// Single<Response<Void>> submitSessionFeedback(
// @Field("entry.1298546024") int sessionId,
// @Field("entry.413792998") String sessionTitle,
// @Field("entry.335146475") int relevancy,
// @Field("entry.1916895481") int asExpected,
// @Field("entry.1501292277") int difficulty,
// @Field("entry.2121897737") int knowledgeable,
// @Field("entry.645604473") String comment);
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
|
import android.support.annotation.NonNull;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.api.service.DroidKaigiService;
import io.github.droidkaigi.confsched2017.api.service.GithubService;
import io.github.droidkaigi.confsched2017.api.service.GoogleFormService;
import io.github.droidkaigi.confsched2017.model.Contributor;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
|
package io.github.droidkaigi.confsched2017.api;
@Singleton
public class DroidKaigiClient {
private final DroidKaigiService droidKaigiService;
private final GithubService githubService;
|
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/DroidKaigiService.java
// public interface DroidKaigiService {
//
// @GET("sessions.json")
// Single<List<Session>> getSessionsJa();
//
// @GET("en/sessions.json")
// Single<List<Session>> getSessionsEn();
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/service/GoogleFormService.java
// public interface GoogleFormService {
//
// @POST("e/1FAIpQLSf5NydpYm48GXqlKqbG3e0dna3bw5HJ4GUg8W1Yfe4znTWH_g/formResponse")
// @FormUrlEncoded
// Single<Response<Void>> submitSessionFeedback(
// @Field("entry.1298546024") int sessionId,
// @Field("entry.413792998") String sessionTitle,
// @Field("entry.335146475") int relevancy,
// @Field("entry.1916895481") int asExpected,
// @Field("entry.1501292277") int difficulty,
// @Field("entry.2121897737") int knowledgeable,
// @Field("entry.645604473") String comment);
//
// }
//
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/model/SessionFeedback.java
// @Table
// public class SessionFeedback {
//
// @PrimaryKey(auto = false)
// @Column(indexed = true)
// @SerializedName("session_id")
// public int sessionId;
//
// @Column
// @SerializedName("session_title")
// public String sessionTitle;
//
// @Column
// @SerializedName("relevancy")
// public int relevancy;
//
// @Column
// @SerializedName("as_expected")
// public int asExpected;
//
// @Column
// @SerializedName("difficulty")
// public int difficulty;
//
// @Column
// @SerializedName("knowledgeable")
// public int knowledgeable;
//
// @Column
// @Nullable
// @SerializedName("comment")
// public String comment;
//
// @Column
// @SerializedName("is_submitted")
// public boolean isSubmitted;
//
// public SessionFeedback() {
//
// }
//
// public SessionFeedback(@NonNull Session session, int relevancy, int asExpected,
// int difficulty, int knowledgeable, @Nullable String comment) {
// this.sessionId = session.id;
// this.sessionTitle = session.title;
// this.relevancy = relevancy;
// this.asExpected = asExpected;
// this.difficulty = difficulty;
// this.knowledgeable = knowledgeable;
// this.comment = comment;
// }
//
// public boolean isAllFilled() {
// return sessionId > 0
// && sessionTitle != null
// && relevancy > 0
// && asExpected > 0
// && difficulty > 0
// && knowledgeable > 0;
// }
// }
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/api/DroidKaigiClient.java
import android.support.annotation.NonNull;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.github.droidkaigi.confsched2017.api.service.DroidKaigiService;
import io.github.droidkaigi.confsched2017.api.service.GithubService;
import io.github.droidkaigi.confsched2017.api.service.GoogleFormService;
import io.github.droidkaigi.confsched2017.model.Contributor;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.model.SessionFeedback;
import io.reactivex.Single;
import retrofit2.Response;
package io.github.droidkaigi.confsched2017.api;
@Singleton
public class DroidKaigiClient {
private final DroidKaigiService droidKaigiService;
private final GithubService githubService;
|
private final GoogleFormService googleFormService;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.