file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
SetScaleByZScoreCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetScaleByZScoreCommand.java | /*
* SetScaleByZScoreCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import megan.util.ScalingType;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class SetScaleByZScoreCommand extends CommandBase implements ICheckBoxCommand {
public boolean isSelected() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() != null && chartViewer.getScalingType() == ScalingType.ZSCORE;
}
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
execute("set chartScale=zscore;");
}
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartData() != null && chartViewer.getChartDrawer() != null && chartViewer.getChartDrawer().isSupportedScalingType(ScalingType.ZSCORE);
}
public String getName() {
return "Z-Score Scale";
}
public String getDescription() {
return "Show values on z-score scale";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("ZScoreScale16.gif");
}
public boolean isCritical() {
return true;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,431 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SortAlphabeticallyCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SortAlphabeticallyCommand.java | /*
* SortAlphabeticallyCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.util.ResourceManager;
import jloda.util.Pair;
import jloda.util.parse.NexusStreamParser;
import megan.chart.data.IChartData;
import megan.chart.data.IData;
import megan.chart.data.IPlot2DData;
import megan.chart.drawers.BarChartDrawer;
import megan.chart.drawers.MultiChartDrawer;
import megan.chart.gui.ChartViewer;
import megan.chart.gui.LabelsJList;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.*;
public class SortAlphabeticallyCommand extends CommandBase implements ICommand {
public String getSyntax() {
return "set sort={up|down|alphabetically|alphaBackward|enabled};";
}
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("set sort=");
final String which = np.getWordMatchesIgnoringCase("up down alphabetically alphaBackward enabled");
np.matchIgnoreCase(";");
final ChartViewer chartViewer = (ChartViewer) getViewer();
final LabelsJList list = chartViewer.getActiveLabelsJList();
final LinkedList<String> disabled = new LinkedList<>(list.getDisabledLabels());
switch (which.toLowerCase()) {
case "up", "down" -> {
final int direction = (which.equalsIgnoreCase("up") ? -1 : 1);
final SortedSet<Pair<Number, String>> sorted = new TreeSet<>((pair1, pair2) -> {
if (pair1.getFirst().doubleValue() > pair2.getFirst().doubleValue())
return -direction;
if (pair1.getFirst().doubleValue() < pair2.getFirst().doubleValue())
return direction;
return pair1.getSecond().compareTo(pair2.getSecond());
});
if (list == chartViewer.getSeriesList()) {
final IData chartData = chartViewer.getChartData();
for (String label : list.getAllLabels()) {
Number value;
if (chartViewer.getChartData() instanceof IChartData)
value = ((IChartData) chartData).getTotalForSeries(label);
else
value = ((IPlot2DData) chartData).getRangeX().getSecond();
if (value == null)
value = 0;
sorted.add(new Pair<>(value, label));
}
final LinkedList<String> labels = new LinkedList<>();
for (Pair<Number, String> pair : sorted) {
labels.add(pair.getSecond());
}
list.sync(labels, list.getLabel2ToolTips(), true);
} else if (chartViewer.getChartData() instanceof IChartData) {
final IChartData chartData = (IChartData) chartViewer.getChartData();
for (String label : list.getAllLabels()) {
Number value = chartData.getTotalForClass(label);
sorted.add(new Pair<>(value, label));
}
final LinkedList<String> labels = new LinkedList<>();
for (Pair<Number, String> pair : sorted) {
labels.add(pair.getSecond());
}
list.sync(labels, list.getLabel2ToolTips(), true);
}
}
case "alphabetically", "alphabackward" -> {
final int direction = (which.equalsIgnoreCase("alphabetically") ? 1 : -1);
final SortedSet<String> sorted = new TreeSet<>((s, s1) -> direction * s.compareToIgnoreCase(s1));
sorted.addAll(list.getAllLabels());
list.sync(sorted, list.getLabel2ToolTips(), true);
}
case "enabled" -> {
final String[] array = list.getAllLabels().toArray(new String[0]);
final Set<String> disabledSet = new HashSet<>(disabled);
Arrays.sort(array, (a, b) -> {
if (!disabledSet.contains(a) && disabledSet.contains(b))
return -1;
else if (disabledSet.contains(a) && !disabledSet.contains(b))
return 1;
else
return 0;
});
list.sync(Arrays.asList(array), list.getLabel2ToolTips(), true);
}
}
list.disableLabels(disabled);
list.fireSyncToViewer();
if (chartViewer.getChartDrawer() instanceof MultiChartDrawer) {
MultiChartDrawer multiChartDrawer = (MultiChartDrawer) chartViewer.getChartDrawer();
if (multiChartDrawer.getBaseDrawer() instanceof BarChartDrawer)
multiChartDrawer.updateView();
}
}
public void actionPerformed(ActionEvent event) {
execute("set sort=alphabetically;");
}
public boolean isApplicable() {
final LabelsJList list = ((ChartViewer) getViewer()).getActiveLabelsJList();
return list != null && list.isEnabled() && !list.isDoClustering();
}
public String getName() {
return "Sort Alphabetically";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Sort the list of entries alphabetically";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("SortAlpha16.gif");
}
public boolean isCritical() {
return true;
}
}
| 6,440 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SelectAllSeriesCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SelectAllSeriesCommand.java | /*
* SelectAllSeriesCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.List;
/**
* select all series
* Daniel Huson, 7.2012
*/
public class SelectAllSeriesCommand extends CommandBase implements ICommand {
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("select series=");
List<String> list = np.getTokensRespectCase(null, ";");
ChartViewer viewer = (ChartViewer) getViewer();
for (String name : list) {
if (name.equalsIgnoreCase("all"))
viewer.getChartSelection().setSelectedSeries(viewer.getChartData().getSeriesNames(), true);
else if (name.equalsIgnoreCase("none"))
viewer.getChartSelection().setSelectedSeries(viewer.getChartData().getSeriesNames(), false);
else
viewer.getChartSelection().setSelectedSeries(name, true);
}
viewer.repaint();
}
/**
* get command-line usage description
*
* @return usage
*/
@Override
public String getSyntax() {
return "select series={all|none|<name...>};";
}
/**
* action to be performed
*
*/
@Override
public void actionPerformed(ActionEvent ev) {
execute("select series=all;");
}
/**
* get the name to be used as a menu label
*
* @return name
*/
public String getName() {
return "Select All Series";
}
/**
* get description to be used as a tooltip
*
* @return description
*/
public String getDescription() {
return "Select series";
}
/**
* get icon to be used in menu or button
*
* @return icon
*/
public ImageIcon getIcon() {
return null;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return null;
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return false;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
ChartViewer viewer = (ChartViewer) getViewer();
return viewer.getChartData().getNumberOfSeries() > 0 && viewer.getChartSelection().getSelectedSeries().size() < viewer.getChartData().getNumberOfSeries();
}
}
| 3,653 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
ShowGapBetweenBarsCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/ShowGapBetweenBarsCommand.java | /*
* ShowGapBetweenBarsCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.util.parse.NexusStreamParser;
import megan.chart.drawers.BarChartDrawer;
import megan.chart.drawers.StackedLineChartDrawer;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* show gap between bars in bar chart
* Daniel Huson, 1.2016
*/
public class ShowGapBetweenBarsCommand extends CommandBase implements ICheckBoxCommand {
@Override
public boolean isSelected() {
return getViewer() instanceof ChartViewer && ((ChartViewer) getViewer()).isShowGapsBetweenBars();
}
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("show gapBetweenBars=");
boolean show = np.getBoolean();
np.matchIgnoreCase(";");
if (getViewer() instanceof ChartViewer) {
((ChartViewer) getViewer()).setShowGapsBetweenBars(show);
}
}
/**
* get command-line usage description
*
* @return usage
*/
@Override
public String getSyntax() {
return "show gapBetweenBars={true|false}";
}
/**
* action to be performed
*
*/
@Override
public void actionPerformed(ActionEvent ev) {
execute("show gapBetweenBars=" + (!isSelected()) + ";");
}
/**
* get the name to be used as a menu label
*
* @return name
*/
public String getName() {
return "Gaps Between Bars";
}
/**
* get description to be used as a tooltip
*
* @return description
*/
public String getDescription() {
return "Show gaps between bars";
}
/**
* get icon to be used in menu or button
*
* @return icon
*/
public ImageIcon getIcon() {
return null;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return null;
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return true;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
return getViewer() instanceof ChartViewer && ((ChartViewer) getViewer()).getChartDrawer() instanceof BarChartDrawer && !(((ChartViewer) getViewer()).getChartDrawer() instanceof StackedLineChartDrawer);
}
}
| 3,557 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
CopyLegendCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/CopyLegendCommand.java | /*
* CopyLegendCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.director.IViewerWithLegend;
import jloda.swing.export.TransferableGraphic;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class CopyLegendCommand extends CommandBase implements ICommand {
public String getSyntax() {
return "copyLegend;";
}
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase(getSyntax());
IViewerWithLegend viewer = (IViewerWithLegend) getViewer();
TransferableGraphic tg = new TransferableGraphic(viewer.getLegendPanel(), viewer.getLegendScrollPane());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(tg, tg);
}
public void actionPerformed(ActionEvent event) {
execute(getSyntax());
}
public boolean isApplicable() {
return getViewer() != null && getViewer() instanceof IViewerWithLegend && !((IViewerWithLegend) getViewer()).getShowLegend().equals("none");
}
public String getName() {
return "Copy Legend";
}
public String getDescription() {
return "Copy legend image to clipboard";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("sun/Copy16.gif");
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,366 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
ShowSelectedCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/ShowSelectedCommand.java | /*
* ShowSelectedCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import megan.chart.gui.LabelsJList;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* show all
* Daniel Huson, 7.2012
*/
public class ShowSelectedCommand extends CommandBase implements ICommand {
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) {
}
/**
* get command-line usage description
*
* @return usage
*/
@Override
public String getSyntax() {
return null;
}
/**
* action to be performed
*
*/
@Override
public void actionPerformed(ActionEvent ev) {
execute("show what=selected;");
}
/**
* get the name to be used as a menu label
*
* @return name
*/
public String getName() {
return "Show Selected";
}
/**
* get description to be used as a tooltip
*
* @return description
*/
public String getDescription() {
return "Show selected data items";
}
/**
* get icon to be used in menu or button
*
* @return icon
*/
public ImageIcon getIcon() {
return null;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return null;
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return true;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
final LabelsJList list = ((ChartViewer) getViewer()).getActiveLabelsJList();
return list != null && list.getSelectedIndex() != -1;
}
}
| 2,892 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
DeselectAllSeriesCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/DeselectAllSeriesCommand.java | /*
* DeselectAllSeriesCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.List;
/**
* select all series
* Daniel Huson, 7.2012
*/
public class DeselectAllSeriesCommand extends CommandBase implements ICommand {
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("deselect series=");
List<String> list = np.getTokensRespectCase(null, ";");
ChartViewer viewer = (ChartViewer) getViewer();
for (String name : list) {
if (name.equalsIgnoreCase("all"))
viewer.getChartSelection().setSelectedSeries(viewer.getChartData().getSeriesNames(), false);
else
viewer.getChartSelection().setSelectedSeries(name, false);
}
viewer.repaint();
}
/**
* get command-line usage description
*
* @return usage
*/
@Override
public String getSyntax() {
return "deselect series={all|<name...>};";
}
/**
* action to be performed
*
*/
@Override
public void actionPerformed(ActionEvent ev) {
execute("deselect series=all;");
}
/**
* get the name to be used as a menu label
*
* @return name
*/
public String getName() {
return "Deselect Series";
}
/**
* get description to be used as a tooltip
*
* @return description
*/
public String getDescription() {
return "Deselect series";
}
/**
* get icon to be used in menu or button
*
* @return icon
*/
public ImageIcon getIcon() {
return null;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return null;
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return false;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
ChartViewer viewer = (ChartViewer) getViewer();
return viewer.getChartData().getNumberOfSeries() > 0 && viewer.getChartSelection().getSelectedSeries().size() < viewer.getChartData().getNumberOfSeries();
}
}
| 3,499 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetChartXAxisFontCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetChartXAxisFontCommand.java | /*
* SetChartXAxisFontCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.util.BasicSwing;
import jloda.swing.util.ChooseFontDialog;
import jloda.swing.util.ColorUtilsSwing;
import jloda.swing.util.ProgramProperties;
import jloda.util.Pair;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
* set font
* Daniel Huson, 9.2012
*/
public class SetChartXAxisFontCommand extends CommandBase implements ICommand {
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
ChartViewer chartViewer = (ChartViewer) getViewer();
String target = ChartViewer.FontKeys.XAxisFont.toString();
Font font = ProgramProperties.get(target, ChartViewer.defaultFont);
Color color = ProgramProperties.get(target + "Color", (Color) null);
Pair<Font, Color> result = ChooseFontDialog.showChooseFontDialog(chartViewer.getFrame(), "Choose x-axis font", font, color);
if (result != null)
execute("set chartFont='" + BasicSwing.encode(result.getFirst())
+ "' color=" + (result.getSecond() != null ? ColorUtilsSwing.toString3Int(result.getSecond()) : "default") + " target='" + target + "';");
}
public boolean isApplicable() {
ChartViewer viewer = (ChartViewer) getViewer();
return viewer != null;
}
public String getName() {
return "X-Axis Font...";
}
public ImageIcon getIcon() {
return null;
}
public String getDescription() {
return "Set the font used for the x-axis";
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,715 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetLabelDown45Command.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetLabelDown45Command.java | /*
* SetLabelDown45Command.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class SetLabelDown45Command extends CommandBase implements ICheckBoxCommand {
@Override
public boolean isSelected() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getClassLabelAngle() == Math.PI / 4;
}
public String getSyntax() {
return null;
}
public void actionPerformed(ActionEvent event) {
execute("set labelOrientation=down45;");
}
public String getName() {
return "Labels Down 45o";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Category labels drawn downward in 45o angle";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("LabelsDown4516.gif");
}
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) {
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return true;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() != null && chartViewer.getChartDrawer().canShowXAxis();
}
}
| 2,597 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
RotateLeftCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/RotateLeftCommand.java | /*
* RotateLeftCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.util.parse.NexusStreamParser;
import megan.chart.drawers.RadialSpaceFillingTreeDrawer;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
public class RotateLeftCommand extends CommandBase implements ICommand {
public String getSyntax() {
return "rotate direction={left|right};";
}
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("rotate direction=");
String direction = np.getWordMatchesIgnoringCase("left right");
np.matchIgnoreCase(";");
ChartViewer chartViewer = (ChartViewer) getViewer();
if (chartViewer.getChartDrawer() instanceof RadialSpaceFillingTreeDrawer) {
RadialSpaceFillingTreeDrawer drawer = (RadialSpaceFillingTreeDrawer) chartViewer.getChartDrawer();
if (direction.equalsIgnoreCase("left")) {
drawer.setAngleOffset(drawer.getAngleOffset() + 5);
drawer.repaint();
} else {
drawer.setAngleOffset(drawer.getAngleOffset() - 5);
drawer.repaint();
}
}
}
public void actionPerformed(ActionEvent event) {
executeImmediately("rotate direction=left;");
}
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() instanceof RadialSpaceFillingTreeDrawer;
}
public String getName() {
return "Rotate Left";
}
public ImageIcon getIcon() {
return null;
}
public String getDescription() {
return "Rotate Radial Chart left";
}
public boolean isCritical() {
return true;
}
/**
* gets the accelerator key to be used in menu
*
* @return accelerator key
*/
public KeyStroke getAcceleratorKey() {
return KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() | java.awt.event.InputEvent.SHIFT_DOWN_MASK);
}
}
| 3,008 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetLabelUp45Command.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetLabelUp45Command.java | /*
* SetLabelUp45Command.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class SetLabelUp45Command extends CommandBase implements ICheckBoxCommand {
@Override
public boolean isSelected() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getClassLabelAngle() == -Math.PI / 4;
}
public String getSyntax() {
return null;
}
public void actionPerformed(ActionEvent event) {
execute("set labelorientation=up45;");
}
public String getName() {
return "Labels Up 45o";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Category labels drawn upward in 45o angle";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("LabelsUp4516.gif");
}
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) {
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return true;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() != null && chartViewer.getChartDrawer().canShowXAxis();
}
}
| 2,586 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetChartLegendFontCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetChartLegendFontCommand.java | /*
* SetChartLegendFontCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.util.BasicSwing;
import jloda.swing.util.ChooseFontDialog;
import jloda.swing.util.ColorUtilsSwing;
import jloda.swing.util.ProgramProperties;
import jloda.util.Pair;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
* set font
* Daniel Huson, 9.2012
*/
public class SetChartLegendFontCommand extends CommandBase implements ICommand {
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
ChartViewer chartViewer = (ChartViewer) getViewer();
String target = ChartViewer.FontKeys.LegendFont.toString();
Font font = ProgramProperties.get(target, ChartViewer.defaultFont);
Color color = ProgramProperties.get(target + "Color", (Color) null);
Pair<Font, Color> result = ChooseFontDialog.showChooseFontDialog(chartViewer.getFrame(), "Choose legend font", font, color);
if (result != null)
execute("set chartFont='" + BasicSwing.encode(result.getFirst())
+ "' color=" + (result.getSecond() != null ? ColorUtilsSwing.toString3Int(result.getSecond()) : "default") + " target='" + target + "';");
}
public boolean isApplicable() {
ChartViewer viewer = (ChartViewer) getViewer();
return viewer != null;
}
public String getName() {
return "Legend Font...";
}
public ImageIcon getIcon() {
return null;
}
public String getDescription() {
return "Set the font used for values";
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,714 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetLabelDown90Command.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetLabelDown90Command.java | /*
* SetLabelDown90Command.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class SetLabelDown90Command extends CommandBase implements ICheckBoxCommand {
@Override
public boolean isSelected() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getClassLabelAngle() == -Math.PI / 2;
}
public String getSyntax() {
return null;
}
public void actionPerformed(ActionEvent event) {
execute("set labelOrientation=down90;");
}
public String getName() {
return "Labels Down 90o";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Category labels drawn downward in 90o angle";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("LabelsDown9016.gif");
}
/**
* parses the given command and executes it
*/
@Override
public void apply(NexusStreamParser np) {
}
/**
* is this a critical command that can only be executed when no other command is running?
*
* @return true, if critical
*/
public boolean isCritical() {
return true;
}
/**
* is the command currently applicable? Used to set enable state of command
*
* @return true, if command can be applied
*/
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() != null && chartViewer.getChartDrawer().canShowXAxis();
}
}
| 2,598 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetTitleCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/SetTitleCommand.java | /*
* SetTitleCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class SetTitleCommand extends CommandBase implements ICommand {
public String getSyntax() {
return "set title=<string>;";
}
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("set title=");
String title = np.getWordRespectCase();
np.matchIgnoreCase(";");
ChartViewer chartViewer = (ChartViewer) getViewer();
chartViewer.setChartTitle(title);
chartViewer.repaint();
}
public void actionPerformed(ActionEvent event) {
ChartViewer chartViewer = (ChartViewer) getViewer();
String result = JOptionPane.showInputDialog(chartViewer, "Set Title", chartViewer.getChartTitle());
if (result != null)
executeImmediately("set title='" + result.replaceAll("'", "\"") + "';");
}
public boolean isApplicable() {
return true;
}
public String getName() {
return "Set Title...";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Set the chart title";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("sun/Preferences16.gif");
}
public boolean isCritical() {
return true;
}
}
| 2,372 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
ClusterClassesCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commands/ClusterClassesCommand.java | /*
* ClusterClassesCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commands;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.parse.NexusStreamParser;
import megan.chart.cluster.ClusteringTree;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
public class ClusterClassesCommand extends CommandBase implements ICheckBoxCommand {
public boolean isSelected() {
final ChartViewer chartViewer = (ChartViewer) getViewer();
return isApplicable() && chartViewer.getClassesList().isDoClustering();
}
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
execute("cluster what=classes state=" + !isSelected() + ";");
}
public boolean isApplicable() {
final ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer.getChartDrawer() != null && chartViewer.getChartDrawer().canCluster(ClusteringTree.TYPE.CLASSES);
}
public String getName() {
return "Cluster Classes";
}
public KeyStroke getAcceleratorKey() {
return null;
}
public String getDescription() {
return "Cluster classes";
}
public ImageIcon getIcon() {
return ResourceManager.getIcon("Cluster16.gif");
}
public boolean isCritical() {
return true;
}
}
| 2,289 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetChartDrawerSpecificCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commandtemplates/SetChartDrawerSpecificCommand.java | /*
* SetChartDrawerSpecificCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commandtemplates;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICheckBoxCommand;
import jloda.swing.util.ResourceManager;
import jloda.util.StringUtils;
import jloda.util.parse.NexusStreamParser;
import megan.chart.data.IChartData;
import megan.chart.data.IPlot2DData;
import megan.chart.drawers.CoOccurrenceDrawer;
import megan.chart.drawers.Plot2DDrawer;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* sets the chart drawer
* Daniel Huson, 4.2015
*/
public class SetChartDrawerSpecificCommand extends CommandBase implements ICheckBoxCommand {
private final String chartDrawerName;
private final String displayName;
public SetChartDrawerSpecificCommand(String chartDrawerName) {
this.chartDrawerName = chartDrawerName;
displayName = StringUtils.fromCamelCase(chartDrawerName);
}
public boolean isSelected() {
return getViewer() != null && ((ChartViewer) getViewer()).getChartDrawerName().equals(chartDrawerName);
}
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
execute("set chartDrawer=" + chartDrawerName + ";");
}
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
if (chartViewer != null) {
return switch (chartDrawerName) {
case Plot2DDrawer.NAME -> (chartViewer.getChartData() instanceof IPlot2DData);
case CoOccurrenceDrawer.NAME -> (chartViewer.getChartData() instanceof IChartData && chartViewer.getChartData().getNumberOfSeries() > 1);
default -> (chartViewer.getChartData() instanceof IChartData);
};
}
return false;
}
private static String getName(String displayName) {
return "Use " + displayName;
}
public String getName() {
return getName(displayName);
}
public String getDescription() {
return "Set chart to " + displayName;
}
public ImageIcon getIcon() {
return ResourceManager.getIcon(chartDrawerName + "16.gif");
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 3,184 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
ShowChartSpecificCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commandtemplates/ShowChartSpecificCommand.java | /*
* ShowChartSpecificCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commandtemplates;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.swing.util.ResourceManager;
import jloda.util.StringUtils;
import jloda.util.parse.NexusStreamParser;
import megan.core.Director;
import megan.viewer.ClassificationViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* shows a chart
* Daniel Huson, 4.2015
*/
public class ShowChartSpecificCommand extends CommandBase implements ICommand {
private final String chartDrawerName;
private final String displayName;
public ShowChartSpecificCommand(String chartDrawerName) {
this.chartDrawerName = chartDrawerName;
displayName = StringUtils.fromCamelCase(chartDrawerName);
}
public String getSyntax() {
return null;
}
public void apply(NexusStreamParser np) {
}
public void actionPerformed(ActionEvent event) {
execute("show chart drawer=" + chartDrawerName + " data='" + getViewer().getClassName() + "';");
}
public boolean isApplicable() {
return ((Director) getDir()).getDocument().getNumberOfReads() > 0 && getViewer() instanceof ClassificationViewer;
}
private static String getName(String displayName) {
return "Show " + displayName + "";
}
public String getName() {
return getName(displayName);
}
public String getDescription() {
return "Show " + displayName;
}
public ImageIcon getIcon() {
return ResourceManager.getIcon(chartDrawerName + "16.gif");
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,513 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
SetChartDrawerCommand.java | /FileExtraction/Java_unseen/husonlab_megan-ce/src/megan/chart/commandtemplates/SetChartDrawerCommand.java | /*
* SetChartDrawerCommand.java Copyright (C) 2024 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package megan.chart.commandtemplates;
import jloda.swing.commands.CommandBase;
import jloda.swing.commands.ICommand;
import jloda.util.StringUtils;
import jloda.util.parse.NexusStreamParser;
import megan.chart.data.IPlot2DData;
import megan.chart.drawers.Plot2DDrawer;
import megan.chart.gui.ChartViewer;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.Collection;
/**
* set the chart drawer to use
* Daniel Huson, 4.2015
*/
public class SetChartDrawerCommand extends CommandBase implements ICommand {
public String getSyntax() {
Collection<String> names;
if (getViewer() != null)
names = ((ChartViewer) getViewer()).getChartDrawerNames();
else names = null;
if (names == null || names.size() == 0)
return "set chartDrawer=<name>;";
else
return "set chartDrawer={" + StringUtils.toString(names, "|") + "};";
}
public void apply(NexusStreamParser np) throws Exception {
final ChartViewer chartViewer = (ChartViewer) getViewer();
np.matchIgnoreCase("set chartDrawer=");
String chartDrawerName = np.getWordMatchesRespectingCase(StringUtils.toString(chartViewer.getChartDrawerNames(), " "));
np.matchIgnoreCase(";");
chartViewer.chooseDrawer(chartDrawerName);
}
public void actionPerformed(ActionEvent event) {
}
public boolean isApplicable() {
ChartViewer chartViewer = (ChartViewer) getViewer();
return chartViewer != null && chartViewer.getChartData() != null && ((chartViewer.getChartDrawer() instanceof Plot2DDrawer) == (chartViewer.getChartData() instanceof IPlot2DData));
}
public String getName() {
return null;
}
public String getDescription() {
return "Set the chart drawer to use";
}
public ImageIcon getIcon() {
return null;
}
public boolean isCritical() {
return true;
}
public KeyStroke getAcceleratorKey() {
return null;
}
}
| 2,830 | Java | .java | husonlab/megan-ce | 62 | 21 | 18 | 2016-05-09T10:55:38Z | 2024-02-22T23:23:42Z |
ExampleUnitTest.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/test/java/com/aghajari/emojiview/ExampleUnitTest.java | package com.aghajari.emojiview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | 383 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiUtils.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/AXEmojiUtils.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview;
import android.content.Context;
import android.graphics.Paint;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.utils.EmojiRange;
import org.mark.axemojiview.utils.Utils;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class AXEmojiUtils {
private static final Pattern SPACE_REMOVAL = Pattern.compile("[\\s]");
/**
* returns true when the string contains only emojis. Note that whitespace will be filtered out.
*/
public static boolean isOnlyEmojis(@Nullable final CharSequence text) {
if (!TextUtils.isEmpty(text)) {
final String inputWithoutSpaces = SPACE_REMOVAL.matcher(text).replaceAll(Matcher.quoteReplacement(""));
return AXEmojiManager.getInstance()
.getEmojiRepetitivePattern()
.matcher(inputWithoutSpaces)
.matches();
}
return false;
}
/**
* returns the emojis that were found in the given text
*/
@NonNull
public static List<EmojiRange> getEmojis(@Nullable final CharSequence text) {
return AXEmojiManager.getInstance().findAllEmojis(text);
}
/**
* returns the number of all emojis that were found in the given text
*/
public static int getEmojisCount(@Nullable final CharSequence text) {
return getEmojis(text).size();
}
public static SpannableStringBuilder replaceWithEmojis(Context context, Paint.FontMetrics fontMetrics, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(context, spannableStringBuilder, emojiSize, fontMetrics);
}
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceWithEmojis(Context context, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(context, spannableStringBuilder, emojiSize, null);
}
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceWithEmojisPxSize(Context context, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(context, spannableStringBuilder, Utils.dpToPx(context, emojiSize),null);
}
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceWithEmojis(View view, Paint.FontMetrics fontMetrics, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(view.getContext(),view, spannableStringBuilder, emojiSize, fontMetrics);
}
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceWithEmojis(View view, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(view.getContext(),view, spannableStringBuilder, emojiSize, null);
}
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceWithEmojisPxSize(View view, final CharSequence rawText, float emojiSize) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
if (AXEmojiManager.isInstalled()) {
AXEmojiManager.getInstance().replaceWithImages(view.getContext(),view, spannableStringBuilder, Utils.dpToPx(view.getContext(), emojiSize),null);
}
return spannableStringBuilder;
}
public static String getEmojiUnicode(@NonNull final int[] codePoints) {
return new Emoji(codePoints, -1).getUnicode();
}
public static String getEmojiUnicode(@NonNull final int codePoint) {
return new Emoji(codePoint, -1).getUnicode();
}
public static void backspace(@NonNull final EditText editText) {
final KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
public static void input(@NonNull final EditText editText, @Nullable final Emoji emoji) {
if (emoji != null) {
AXEmojiManager.getInstance().getEditTextInputListener().input(editText, emoji);
}
}
public static Emoji getEmojiFromUnicode(String unicode) {
return AXEmojiManager.getInstance().emojiMap.get(unicode);
}
}
| 6,310 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiTheme.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/AXEmojiTheme.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview;
import android.graphics.Color;
import android.graphics.Typeface;
public class AXEmojiTheme {
int defaultColor = 0xff9aa7af;
int backgroundColor = 0xffebeff2;
int selectedColor = 0xff4a5358;
int selectionColor = 0xff0d917c;
int dividerColor = Color.LTGRAY;
boolean variantDividerEnabled = true;
int variantDividerColor = Color.LTGRAY;
int variantPopupBackgroundColor = Color.WHITE;
int footerBackgroundColor = 0xffe3e7e8;
int footerItemColor = 0xff636768;
int footerSelectedItemColor = 0xff0d917c;
boolean footerEnabled = true;
int categoryColor = 0xffebeff2;
int titleColor = Color.DKGRAY;
Typeface titleTypeface = Typeface.DEFAULT_BOLD;
boolean alwaysShowDivider = false;
boolean categoryEnabled = true;
public int getBackgroundColor() {
return backgroundColor;
}
public int getDefaultColor() {
return defaultColor;
}
public int getSelectedColor() {
return selectedColor;
}
public int getSelectionColor() {
return selectionColor;
}
public void setBackgroundColor(int backgroundColor) {
this.backgroundColor = backgroundColor;
}
public void setDefaultColor(int defaultColor) {
this.defaultColor = defaultColor;
}
public void setSelectedColor(int selectedColor) {
this.selectedColor = selectedColor;
}
public void setSelectionColor(int selectionColor) {
this.selectionColor = selectionColor;
}
public int getDividerColor() {
return this.dividerColor;
}
public void setDividerColor(int color) {
this.dividerColor = color;
}
public boolean isVariantDividerEnabled() {
return variantDividerEnabled;
}
public void setVariantDividerEnabled(boolean variantDividerEnabled) {
this.variantDividerEnabled = variantDividerEnabled;
}
public int getVariantDividerColor() {
return variantDividerColor;
}
public void setVariantDividerColor(int variantDividerColor) {
this.variantDividerColor = variantDividerColor;
}
public int getVariantPopupBackgroundColor() {
return variantPopupBackgroundColor;
}
public void setVariantPopupBackgroundColor(int variantPopupBackgroundColor) {
this.variantPopupBackgroundColor = variantPopupBackgroundColor;
}
public int getFooterBackgroundColor() {
return footerBackgroundColor;
}
public int getFooterItemColor() {
return footerItemColor;
}
public int getFooterSelectedItemColor() {
return footerSelectedItemColor;
}
public void setFooterBackgroundColor(int footerBackgroundColor) {
this.footerBackgroundColor = footerBackgroundColor;
}
public void setFooterItemColor(int footerItemColor) {
this.footerItemColor = footerItemColor;
}
public void setFooterSelectedItemColor(int footerSelectedItemColor) {
this.footerSelectedItemColor = footerSelectedItemColor;
}
public boolean isFooterEnabled() {
return footerEnabled;
}
public void setFooterEnabled(boolean footerEnabled) {
this.footerEnabled = footerEnabled;
}
public int getTitleColor() {
return titleColor;
}
public Typeface getTitleTypeface() {
return titleTypeface;
}
public void setTitleColor(int titleColor) {
this.titleColor = titleColor;
}
public void setTitleTypeface(Typeface titleTypeface) {
this.titleTypeface = titleTypeface;
}
public void setCategoryColor(int categoryColor) {
this.categoryColor = categoryColor;
}
public int getCategoryColor() {
return this.categoryColor;
}
public void setAlwaysShowDivider(boolean value) {
alwaysShowDivider = value;
}
public boolean isAlwaysShowDividerEnabled() {
return alwaysShowDivider;
}
public boolean isCategoryEnabled() {
return categoryEnabled;
}
public void setCategoryEnabled(boolean categoryEnabled) {
this.categoryEnabled = categoryEnabled;
}
}
| 4,772 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiManager.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/AXEmojiManager.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Paint;
import android.text.Spannable;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import org.mark.axemojiview.emoji.AXEmojiLoader;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiCategory;
import org.mark.axemojiview.emoji.EmojiProvider;
import org.mark.axemojiview.listener.EditTextInputListener;
import org.mark.axemojiview.listener.EmojiVariantCreatorListener;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.listener.StickerViewCreatorListener;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.RecentEmojiManager;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.shared.VariantEmojiManager;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.RecentStickerManager;
import org.mark.axemojiview.sticker.Sticker;
import org.mark.axemojiview.sticker.StickerCategory;
import org.mark.axemojiview.utils.EmojiRange;
import org.mark.axemojiview.utils.EmojiReplacer;
import org.mark.axemojiview.utils.EmojiSpan;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.variant.AXEmojiVariantPopup;
import org.mark.axemojiview.variant.AXSimpleEmojiVariantPopup;
import org.mark.axemojiview.variant.AXTouchEmojiVariantPopup;
import org.mark.axemojiview.view.AXEmojiBase;
import org.mark.axemojiview.view.AXEmojiView;
import org.mark.axemojiview.view.AXSingleEmojiView;
import org.mark.axemojiview.view.AXStickerView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class AXEmojiManager {
private static boolean ripple = true;
private static EditTextInputListener defaultInputListener = (editText, emoji) -> {
if (emoji != null) {
final int start = editText.getSelectionStart();
final int end = editText.getSelectionEnd();
if (start < 0) {
editText.append(emoji.getUnicode());
} else {
editText.getText().replace(Math.min(start, end), Math.max(start, end), emoji.getUnicode(), 0, emoji.getUnicode().length());
}
}
};
private static StickerViewCreatorListener defaultStickerCreator = new StickerViewCreatorListener() {
@Override
public View onCreateStickerView(@NonNull Context context, @Nullable StickerCategory category, boolean isRecent) {
return new AppCompatImageView(context);
}
@Override
public View onCreateCategoryView(@NonNull Context context) {
return new AppCompatImageView(context);
}
};
private static EditTextInputListener inputListener;
private static StickerViewCreatorListener stickerViewCreatorListener;
private static EmojiVariantCreatorListener emojiVariantCreatorListener;
private AXEmojiManager() {}
private static final Comparator<String> STRING_LENGTH_COMPARATOR = (first, second) -> {
final int firstLength = first.length();
final int secondLength = second.length();
return firstLength < secondLength ? 1 : firstLength == secondLength ? 0 : -1;
};
private static final int GUESSED_UNICODE_AMOUNT = 3000;
private static final int GUESSED_TOTAL_PATTERN_LENGTH = GUESSED_UNICODE_AMOUNT * 4;
private static final EmojiReplacer DEFAULT_EMOJI_REPLACER = (context, view, text, emojiSize, fontMetrics) -> {
if (text.length() == 0) return;
final AXEmojiManager emojiManager = AXEmojiManager.getInstance();
final EmojiSpan[] existingSpans = text.getSpans(0, text.length(), EmojiSpan.class);
final List<Integer> existingSpanPositions = new ArrayList<>(existingSpans.length);
final int size = existingSpans.length;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < size; i++) {
existingSpanPositions.add(text.getSpanStart(existingSpans[i]));
}
final List<EmojiRange> findAllEmojis = emojiManager.findAllEmojis(text);
for (int i = 0; i < findAllEmojis.size(); i++) {
final EmojiRange location = findAllEmojis.get(i);
if (!existingSpanPositions.contains(location.start)) {
text.setSpan(new EmojiSpan(context, location.emoji, emojiSize),
location.start, location.end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
};
final Map<String, Emoji> emojiMap = new LinkedHashMap<>(GUESSED_UNICODE_AMOUNT);
private EmojiCategory[] categories;
private Pattern emojiPattern;
private Pattern emojiRepetitivePattern;
private EmojiReplacer emojiReplacer;
@SuppressLint("StaticFieldLeak")
static AXEmojiManager INSTANCE = null;
@SuppressLint("StaticFieldLeak")
private static Context context;
public static AXEmojiManager getInstance() {
return INSTANCE;
}
public static boolean isInstalled() {
return INSTANCE != null;
}
private EmojiProvider provider;
/**
* Installs the given EmojiProvider.
*
* @param provider the provider that should be installed.
*/
public static void install(Context context, final EmojiProvider provider) {
AXEmojiManager.context = context.getApplicationContext();
if (INSTANCE!=null) destroy();
INSTANCE = new AXEmojiManager();
if (mEmojiTheme==null) mEmojiTheme = new AXEmojiTheme();
if (mStickerTheme==null) mStickerTheme = new AXEmojiTheme();
/**recentEmoji = null;
recentSticker = null;
variantEmoji = null;
emojiLoader = null;*/
INSTANCE.provider = provider;
setMaxRecentSize(48);
setMaxStickerRecentSize(Utils.getStickerGridCount(context) * 3);
INSTANCE.categories = provider.getCategories();
INSTANCE.emojiMap.clear();
INSTANCE.emojiReplacer = provider instanceof EmojiReplacer ? (EmojiReplacer) provider : DEFAULT_EMOJI_REPLACER;
if (inputListener==null) inputListener = defaultInputListener;
if (stickerViewCreatorListener==null) stickerViewCreatorListener = defaultStickerCreator;
if (emojiVariantCreatorListener==null) enableTouchEmojiVariantPopup();
final List<String> unicodesForPattern = new ArrayList<>(GUESSED_UNICODE_AMOUNT);
final int categoriesSize = INSTANCE.categories.length;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < categoriesSize; i++) {
final Emoji[] emojis = INSTANCE.categories[i].getEmojis();
final int emojisSize = emojis.length;
//noinspection ForLoopReplaceableByForEach
for (int j = 0; j < emojisSize; j++) {
final Emoji emoji = emojis[j];
final String unicode = emoji.getUnicode();
final List<Emoji> variants = emoji.getVariants();
INSTANCE.emojiMap.put(unicode, emoji);
unicodesForPattern.add(unicode);
//noinspection ForLoopReplaceableByForEach
for (int k = 0; k < variants.size(); k++) {
final Emoji variant = variants.get(k);
final String variantUnicode = variant.getUnicode();
INSTANCE.emojiMap.put(variantUnicode, variant);
unicodesForPattern.add(variantUnicode);
}
}
}
if (unicodesForPattern.isEmpty()) {
throw new IllegalArgumentException("Your EmojiProvider must at least have one category with at least one emoji.");
}
// We need to sort the unicodes by length so the longest one gets matched first.
Collections.sort(unicodesForPattern, STRING_LENGTH_COMPARATOR);
final StringBuilder patternBuilder = new StringBuilder(GUESSED_TOTAL_PATTERN_LENGTH);
final int unicodesForPatternSize = unicodesForPattern.size();
for (int i = 0; i < unicodesForPatternSize; i++) {
patternBuilder.append(Pattern.quote(unicodesForPattern.get(i))).append('|');
}
final String regex = patternBuilder.deleteCharAt(patternBuilder.length() - 1).toString();
INSTANCE.emojiPattern = Pattern.compile(regex);
INSTANCE.emojiRepetitivePattern = Pattern.compile('(' + regex + ")+");
}
/**
* Destroys the EmojiManager. This means that all internal data structures are released as well as
* all data associated with installed Emojis.
*
* You have to install EmojiManager again (if you wanted to use it)
*/
public static void destroy() {
synchronized (AXEmojiManager.class) {
INSTANCE.provider.destroy();
INSTANCE.emojiMap.clear();
INSTANCE.categories = null;
INSTANCE.emojiPattern = null;
INSTANCE.emojiRepetitivePattern = null;
INSTANCE.emojiReplacer = null;
}
}
public void replaceWithImages(final Context context, View view, final Spannable text, final float emojiSize, final Paint.FontMetrics fontMetrics) {
if (INSTANCE == null) return;
emojiReplacer.replaceWithImages(context, view, text, emojiSize, fontMetrics);
}
public void replaceWithImages(final Context context, final Spannable text, final float emojiSize, final Paint.FontMetrics fontMetrics) {
if (INSTANCE == null) return;
emojiReplacer.replaceWithImages(context, null, text, emojiSize, fontMetrics);
}
public EmojiCategory[] getCategories() {
return categories;
}
Pattern getEmojiRepetitivePattern() {
return emojiRepetitivePattern;
}
public List<EmojiRange> findAllEmojis(final CharSequence text) {
final List<EmojiRange> result = new ArrayList<>();
if (!TextUtils.isEmpty(text)) {
final Matcher matcher = emojiPattern.matcher(text);
while (matcher.find()) {
final Emoji found = findEmoji(text.subSequence(matcher.start(), matcher.end()));
if (found != null) {
result.add(new EmojiRange(matcher.start(), matcher.end(), found));
}
}
}
return result;
}
public Emoji findEmoji(final CharSequence candidate) {
// We need to call toString on the candidate, since the emojiMap may not find the requested entry otherwise, because
// the type is different.
return emojiMap.get(candidate.toString());
}
static AXEmojiTheme mEmojiTheme;
/**
* set AXEmojiView theme settings
*/
public static void setEmojiViewTheme(AXEmojiTheme theme) {
mEmojiTheme = theme;
}
/**
* @return AXEmojiView theme settings
*/
public static AXEmojiTheme getEmojiViewTheme() {
return mEmojiTheme;
}
/**
* use AXEmojiManager.getEmojiViewTheme() instead.
*
* @deprecated
*/
public static AXEmojiTheme getTheme() {
return getEmojiViewTheme();
}
static AXEmojiTheme mStickerTheme;
/**
* set AXStickerView theme settings
*/
public static void setStickerViewTheme(AXEmojiTheme theme) {
mStickerTheme = theme;
}
/**
* @return AXStickerView theme settings
*/
public static AXEmojiTheme getStickerViewTheme() {
return mStickerTheme;
}
static boolean footer = true;
/**
* AXEmojiPager footer view. backspace will add on footer right icon.
*
* @param footer
*/
public static void setFooterEnabled(boolean footer) {
AXEmojiManager.footer = footer;
}
public static boolean isFooterEnabled() {
return footer;
}
/**
* set max emoji recent sizes in default RecentEmojiManager
*
* @see RecentEmojiManager
*/
public static void setMaxRecentSize(int size) {
RecentEmojiManager.MAX_RECENT = size;
}
public static int getMaxRecentSize() {
return RecentEmojiManager.MAX_RECENT;
}
/**
* fill recent history with default values (if recent was empty)
* default is true
*
* @see RecentEmojiManager
*/
public static void setFillRecentHistoryEnabled(boolean enabled) {
RecentEmojiManager.FILL_DEFAULT_HISTORY = enabled;
}
/**
* fill recent history with this values if recent was empty.
*
* @see RecentEmojiManager
*/
public static void setFillRecentHistoryData(String[] newRecent) {
RecentEmojiManager.FILL_DEFAULT_RECENT_DATA = newRecent;
}
public static String[] getFillRecentHistoryData() {
return RecentEmojiManager.FILL_DEFAULT_RECENT_DATA;
}
/**
* set max sticker recent sizes in default RecentStickerManager
*
* @see RecentStickerManager
*/
public static void setMaxStickerRecentSize(int size) {
RecentStickerManager.MAX_RECENTS = size;
}
public static int getMaxStickerRecentSize() {
return RecentStickerManager.MAX_RECENTS;
}
static boolean recentVariant = true;
/**
* show emoji variants in recent tab
*/
public static void setRecentVariantEnabled(boolean enabled) {
recentVariant = enabled;
}
public static boolean isRecentVariantEnabled() {
return recentVariant;
}
static boolean showEmptyRecent = false;
/**
* Show Recent Tab while there is no data to show
* you can manage this with isEmptyA() method in RecentManagers
*/
public static void setShowEmptyRecentEnabled(boolean value) {
showEmptyRecent = value;
}
public static boolean isShowingEmptyRecentEnabled() {
return showEmptyRecent;
}
private static boolean asyncLoad = false;
public static boolean isAsyncLoadEnabled() {
return asyncLoad;
}
/**
* load emojis with an async task
* default is true;
*/
public static void setAsyncLoadEnabled(boolean asyncLoad) {
AXEmojiManager.asyncLoad = asyncLoad;
}
static RecentEmoji recentEmoji;
static RecentSticker recentSticker;
static VariantEmoji variantEmoji;
/**
* set AXEmojiView EmojiRecentManager
*/
public static void setRecentEmoji(RecentEmoji recentEmoji) {
AXEmojiManager.recentEmoji = recentEmoji;
}
/**
* set AXEmojiView StickerRecentManager
*/
public static void setRecentSticker(RecentSticker recentSticker) {
AXEmojiManager.recentSticker = recentSticker;
}
/**
* set AXEmojiView VariantManager
*/
public static void setVariantEmoji(VariantEmoji variantEmoji) {
AXEmojiManager.variantEmoji = variantEmoji;
}
public static RecentEmoji getRecentEmoji() {
if (recentEmoji==null) return new RecentEmojiManager(context);
return recentEmoji;
}
public static RecentSticker getRecentSticker(final String defType) {
if (recentSticker==null) return new RecentStickerManager(context,defType);
return recentSticker;
}
public static RecentSticker getRecentSticker() {
return recentSticker;
}
public static VariantEmoji getVariantEmoji() {
if (variantEmoji==null) return new VariantEmojiManager(context);
return variantEmoji;
}
/**
* check AXEmojiBase is instance of AXEmojiView or AXSingleEmojiView
*/
public static boolean isAXEmojiView(AXEmojiBase base) {
return base instanceof AXEmojiView || base instanceof AXSingleEmojiView;
}
/**
* check AXEmojiBase is instance of AXStickerView
*/
public static boolean isAXStickerView(AXEmojiBase base) {
return base instanceof AXStickerView;
}
static AXEmojiLoader emojiLoader;
/**
* set AXEmojiView EmojiLoader
*/
public static void setEmojiLoader(AXEmojiLoader emojiLoader) {
AXEmojiManager.emojiLoader = emojiLoader;
}
/**
* set Emoji replacer
*/
public void setEmojiReplacer(EmojiReplacer emojiReplacer) {
this.emojiReplacer = emojiReplacer;
if (emojiReplacer == null) {
this.emojiReplacer = AXEmojiManager.DEFAULT_EMOJI_REPLACER;
}
}
/**
* @return the installed emoji provider
*/
public EmojiProvider getEmojiProvider() {
return provider;
}
public static void setEditTextInputListener(EditTextInputListener listener) {
AXEmojiManager.inputListener = listener;
if (listener == null) {
AXEmojiManager.inputListener = AXEmojiManager.defaultInputListener;
}
}
public static void setStickerViewCreatorListener(StickerViewCreatorListener listener) {
AXEmojiManager.stickerViewCreatorListener = listener;
if (listener == null) {
AXEmojiManager.stickerViewCreatorListener = AXEmojiManager.defaultStickerCreator;
}
}
public EditTextInputListener getEditTextInputListener() {
if (inputListener==null) return defaultInputListener;
return inputListener;
}
public StickerViewCreatorListener getStickerViewCreatorListener() {
if (stickerViewCreatorListener==null) return defaultStickerCreator;
return stickerViewCreatorListener;
}
public static void setEmojiVariantCreatorListener(EmojiVariantCreatorListener listener) {
if (listener == null) {
enableTouchEmojiVariantPopup();
return;
}
AXEmojiManager.emojiVariantCreatorListener = listener;
}
public static void enableTouchEmojiVariantPopup(){
AXEmojiManager.emojiVariantCreatorListener = new EmojiVariantCreatorListener() {
@Override
public AXEmojiVariantPopup create(@NonNull View rootView, @Nullable OnEmojiActions listener) {
return new AXTouchEmojiVariantPopup(rootView, listener);
}
};
}
public static void enableSimpleEmojiVariantPopup(){
AXEmojiManager.emojiVariantCreatorListener = new EmojiVariantCreatorListener() {
@Override
public AXEmojiVariantPopup create(@NonNull View rootView, @Nullable OnEmojiActions listener) {
return new AXSimpleEmojiVariantPopup(rootView, listener);
}
};
}
public static EmojiVariantCreatorListener getEmojiVariantCreatorListener() {
if (emojiVariantCreatorListener==null) enableTouchEmojiVariantPopup();
return emojiVariantCreatorListener;
}
public static AXEmojiLoader getEmojiLoader() {
return emojiLoader;
}
/**
* disable recent managers
*/
public static void disableRecentManagers() {
disableEmojiRecentManager();
disableStickerRecentManager();
}
/**
* disable sticker recent manager
*/
public static void disableStickerRecentManager(){
recentEmoji = new RecentEmoji() {
@NonNull
@Override
public Collection<Emoji> getRecentEmojis() {
return Arrays.asList(new Emoji[0]);
}
@Override
public void addEmoji(@NonNull Emoji emoji) {
}
@Override
public void persist() {
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public void reload() {
}
};
}
/**
* disable emoji recent manager
*/
public static void disableEmojiRecentManager(){
recentSticker = new RecentSticker() {
@SuppressWarnings("rawtypes")
@NonNull
@Override
public Collection<Sticker> getRecentStickers() {
return Arrays.asList(new Sticker[0]);
}
@Override
public void addSticker(@SuppressWarnings("rawtypes") @NonNull Sticker sticker) {
}
@Override
public void persist() {
}
@Override
public boolean isEmpty() {
return true;
}
};
}
public static void enableDefaultRecentManagers() {
enableDefaultEmojiRecentManager();
enableDefaultStickerRecentManager();
}
public static void enableDefaultStickerRecentManager(){
recentSticker = null;
}
public static void enableDefaultEmojiRecentManager(){
recentEmoji = null;
}
public static boolean isRippleEnabled() {
return ripple;
}
public static void setRippleEnabled(boolean enabled) {
ripple = enabled;
}
static boolean isUsingPopupWindow = false;
public static void setUsingPopupWindow(boolean isUsingPopupWindow) {
AXEmojiManager.isUsingPopupWindow = isUsingPopupWindow;
}
public static boolean isUsingPopupWindow() {
return isUsingPopupWindow;
}
private static boolean backspaceCategoryEnabled = true;
public static boolean isBackspaceCategoryEnabled() {
return backspaceCategoryEnabled;
}
public static void setBackspaceCategoryEnabled(boolean enabled) {
backspaceCategoryEnabled = enabled;
}
public static void resetTheme() {
setEmojiViewTheme(new AXEmojiTheme());
setStickerViewTheme(new AXEmojiTheme());
}
}
| 22,451 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiData.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/EmojiData.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji;
import androidx.annotation.IntRange;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
public class EmojiData {
public static final String[][] releaseData = {
new String[]{
"😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "☺", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍", "🥰", "😘", "😗", "😙", "😚", "😋", "😛", "😝", "😜", "🤪", "🤨", "🧐", "🤓", "😎", "🤩", "🥳", "😏", "😒", "😞", "😔", "😟", "😕", "🙁", "☹", "😣", "😖", "😫", "😩", "🥺", "😢", "😭", "😤", "😠", "😡", "🤬", "🤯", "😳", "🥵", "🥶", "😱", "😨", "😰", "😥", "😓", "🤗", "🤔", "🤭", "🤫", "🤥", "😶", "😐", "😑", "😬", "🙄", "😯", "😦", "😧", "😮", "😲", "🥱", "😴", "🤤", "😪", "😵", "🤐", "🥴", "🤢", "🤮", "🤧", "😷", "🤒", "🤕", "🤑", "🤠", "😈", "👿", "👹", "👺", "🤡", "💩", "👻", "💀", "☠", "👽", "👾", "🤖", "🎃", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "😿", "😾",
"🤲",
"👐",
"🙌",
"👏",
"🤝",
"👍",
"👎",
"👊",
"✊",
"🤛",
"🤜",
"🤞",
"✌",
"🤟",
"🤘",
"👌",
"🤏",
"👈",
"👉",
"👆",
"👇",
"☝",
"✋",
"🤚",
"🖐",
"🖖",
"👋",
"🤙",
"💪",
"🦾",
"🖕",
"✍",
"🙏",
"🦶",
"🦵",
"🦿", "💄", "💋", "👄", "🦷", "👅",
"👂",
"🦻",
"👃",
"👣", "👁", "👀", "🧠", "🗣", "👤", "👥",
"👶",
"👧",
"🧒",
"👦",
"👩",
"🧑",
"👨",
"👩🦱",
"🧑🦱",
"👨🦱",
"👩🦰",
"🧑🦰",
"👨🦰",
"👱♀",
"👱",
"👱♂",
"👩🦳",
"🧑🦳",
"👨🦳",
"👩🦲",
"🧑🦲",
"👨🦲",
"🧔",
"👵",
"🧓",
"👴",
"👲",
"👳♀",
"👳",
"👳♂",
"🧕",
"👮♀",
"👮",
"👮♂",
"👷♀",
"👷",
"👷♂",
"💂♀",
"💂",
"💂♂",
"🕵♀",
"🕵",
"🕵♂",
"👩⚕",
"🧑⚕",
"👨⚕",
"👩🌾",
"🧑🌾",
"👨🌾",
"👩🍳",
"🧑🍳",
"👨🍳",
"👩🎓",
"🧑🎓",
"👨🎓",
"👩🎤",
"🧑🎤",
"👨🎤",
"👩🏫",
"🧑🏫",
"👨🏫",
"👩🏭",
"🧑🏭",
"👨🏭",
"👩💻",
"🧑💻",
"👨💻",
"👩💼",
"🧑💼",
"👨💼",
"👩🔧",
"🧑🔧",
"👨🔧",
"👩🔬",
"🧑🔬",
"👨🔬",
"👩🎨",
"🧑🎨",
"👨🎨",
"👩🚒",
"🧑🚒",
"👨🚒",
"👩✈",
"🧑✈",
"👨✈",
"👩🚀",
"🧑🚀",
"👨🚀",
"👩⚖",
"🧑⚖",
"👨⚖",
"👰",
"🤵",
"👸",
"🤴",
"🦸♀",
"🦸",
"🦸♂",
"🦹♀",
"🦹",
"🦹♂",
"🤶",
"🎅",
"🧙♀",
"🧙",
"🧙♂",
"🧝♀",
"🧝",
"🧝♂",
"🧛♀",
"🧛",
"🧛♂",
"🧟♀", "🧟", "🧟♂", "🧞♀", "🧞", "🧞♂",
"🧜♀",
"🧜",
"🧜♂",
"🧚♀",
"🧚",
"🧚♂",
"👼",
"🤰",
"🤱",
"🙇♀",
"🙇",
"🙇♂",
"💁♀",
"💁",
"💁♂",
"🙅♀",
"🙅",
"🙅♂",
"🙆♀",
"🙆",
"🙆♂",
"🙋♀",
"🙋",
"🙋♂",
"🧏♀",
"🧏",
"🧏♂",
"🤦♀",
"🤦",
"🤦♂",
"🤷♀",
"🤷",
"🤷♂",
"🙎♀",
"🙎",
"🙎♂",
"🙍♀",
"🙍",
"🙍♂",
"💇♀",
"💇",
"💇♂",
"💆♀",
"💆",
"💆♂",
"🧖♀",
"🧖",
"🧖♂",
"💅",
"🤳",
"💃",
"🕺",
"👯♀", "👯", "👯♂",
"🕴",
"👩🦽",
"🧑🦽",
"👨🦽",
"👩🦼",
"🧑🦼",
"👨🦼",
"🚶♀",
"🚶",
"🚶♂",
"👩🦯",
"🧑🦯",
"👨🦯",
"🧎♀",
"🧎",
"🧎♂",
"🏃♀",
"🏃",
"🏃♂",
"🧍♀",
"🧍",
"🧍♂",
"👫",
"👭",
"👬",
"👩❤👨", "👩❤👩", "👨❤👨", "👩❤💋👨", "👩❤💋👩", "👨❤💋👨", "👨👩👦", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧", "👩👩👦", "👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦", "👨👨👧👧", "👩👦", "👩👧", "👩👧👦", "👩👦👦", "👩👧👧", "👨👦", "👨👧", "👨👧👦", "👨👦👦", "👨👧👧", "🧶", "🧵", "🧥", "🥼", "🦺", "👚", "👕", "👖", "🩲", "🩳", "👔", "👗", "👙", "👘", "🥻", "🩱", "🥿", "👠", "👡", "👢", "👞", "👟", "🥾", "🧦", "🧤", "🧣", "🎩", "🧢", "👒", "🎓", "⛑", "👑", "💍", "👝", "👛", "👜", "💼", "🎒", "🧳", "👓", "🕶", "🥽", "🌂"
},
new String[]{
"🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐽", "🐸", "🐵", "🙈", "🙉", "🙊", "🐒", "🐔", "🐧", "🐦", "🐤", "🐣", "🐥", "🦆", "🦅", "🦉", "🦇", "🐺", "🐗", "🐴", "🦄", "🐝", "🐛", "🦋", "🐌", "🐞", "🐜", "🦟", "🦗", "🕷", "🕸", "🦂", "🐢", "🐍", "🦎", "🦖", "🦕", "🐙", "🦑", "🦐", "🦞", "🦀", "🐡", "🐠", "🐟", "🐬", "🐳", "🐋", "🦈", "🐊", "🐅", "🐆", "🦓", "🦍", "🦧", "🐘", "🦛", "🦏", "🐪", "🐫", "🦒", "🦘", "🐃", "🐂", "🐄", "🐎", "🐖", "🐏", "🐑", "🦙", "🐐", "🦌", "🐕", "🐩", "🦮", "🐕🦺", "🐈", "🐓", "🦃", "🦚", "🦜", "🦢", "🦩", "🕊", "🐇", "🦝", "🦨", "🦡", "🦦", "🦥", "🐁", "🐀", "🐿", "🦔", "🐾", "🐉", "🐲", "🌵", "🎄", "🌲", "🌳", "🌴", "🌱", "🌿", "☘", "🍀", "🎍", "🎋", "🍃", "🍂", "🍁", "🍄", "🐚", "🌾", "💐", "🌷", "🌹", "🥀", "🌺", "🌸", "🌼", "🌻", "🌞", "🌝", "🌛", "🌜", "🌚", "🌕", "🌖", "🌗", "🌘", "🌑", "🌒", "🌓", "🌔", "🌙", "🌎", "🌍", "🌏", "🪐", "💫", "⭐", "🌟", "✨", "⚡", "☄", "💥", "🔥", "🌪", "🌈", "☀", "🌤", "⛅", "🌥", "☁", "🌦", "🌧", "⛈", "🌩", "🌨", "❄", "☃", "⛄", "🌬", "💨", "💧", "💦", "☔", "☂", "🌊", "🌫"
},
new String[]{
"🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍈", "🍒", "🍑", "🥭", "🍍", "🥥", "🥝", "🍅", "🍆", "🥑", "🥦", "🥬", "🥒", "🌶", "🌽", "🥕", "🧄", "🧅", "🥔", "🍠", "🥐", "🥯", "🍞", "🥖", "🥨", "🧀", "🥚", "🍳", "🧈", "🥞", "🧇", "🥓", "🥩", "🍗", "🍖", "🦴", "🌭", "🍔", "🍟", "🍕", "🥪", "🥙", "🧆", "🌮", "🌯", "🥗", "🥘", "🥫", "🍝", "🍜", "🍲", "🍛", "🍣", "🍱", "🥟", "🦪", "🍤", "🍙", "🍚", "🍘", "🍥", "🥠", "🥮", "🍢", "🍡", "🍧", "🍨", "🍦", "🥧", "🧁", "🍰", "🎂", "🍮", "🍭", "🍬", "🍫", "🍿", "🍩", "🍪", "🌰", "🥜", "🍯", "🥛", "🍼", "☕", "🍵", "🧃", "🥤", "🍶", "🍺", "🍻", "🥂", "🍷", "🥃", "🍸", "🍹", "🧉", "🍾", "🧊", "🥄", "🍴", "🍽", "🥣", "🥡", "🥢", "🧂"
},
new String[]{
"⚽", "🏀", "🏈", "⚾", "🥎", "🎾", "🏐", "🏉", "🥏", "🎱", "🪀", "🏓", "🏸", "🏒", "🏑", "🥍", "🏏", "🥅", "⛳", "🪁", "🏹", "🎣", "🤿", "🥊", "🥋", "🎽", "🛹", "🛷", "⛸", "🥌", "🎿", "⛷", "🏂", "🪂",
"🏋♀",
"🏋",
"🏋♂",
"🤼♀", "🤼", "🤼♂",
"🤸♀",
"🤸",
"🤸♂",
"⛹♀",
"⛹",
"⛹♂",
"🤺",
"🤾♀",
"🤾",
"🤾♂",
"🏌♀",
"🏌",
"🏌♂",
"🏇",
"🧘♀",
"🧘",
"🧘♂",
"🏄♀",
"🏄",
"🏄♂",
"🏊♀",
"🏊",
"🏊♂",
"🤽♀",
"🤽",
"🤽♂",
"🚣♀",
"🚣",
"🚣♂",
"🧗♀",
"🧗",
"🧗♂",
"🚵♀",
"🚵",
"🚵♂",
"🚴♀",
"🚴",
"🚴♂",
"🏆", "🥇", "🥈", "🥉", "🏅", "🎖", "🏵", "🎗", "🎫", "🎟", "🎪",
"🤹♀",
"🤹",
"🤹♂",
"🎭", "🩰", "🎨", "🎬", "🎤", "🎧", "🎼", "🎹", "🥁", "🎷", "🎺", "🎸", "🪕", "🎻", "🎲", "♟", "🎯", "🎳", "🎮", "🎰", "🧩"
},
new String[]{
"🚗", "🚕", "🚙", "🚌", "🚎", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚛", "🚜", "🦯", "🦽", "🦼", "🛴", "🚲", "🛵", "🏍", "🛺", "🚨", "🚔", "🚍", "🚘", "🚖", "🚡", "🚠", "🚟", "🚃", "🚋", "🚞", "🚝", "🚄", "🚅", "🚈", "🚂", "🚆", "🚇", "🚊", "🚉", "✈", "🛫", "🛬", "🛩", "💺", "🛰", "🚀", "🛸", "🚁", "🛶", "⛵", "🚤", "🛥", "🛳", "⛴", "🚢", "⚓", "⛽", "🚧", "🚦", "🚥", "🚏", "🗺", "🗿", "🗽", "🗼", "🏰", "🏯", "🏟", "🎡", "🎢", "🎠", "⛲", "⛱", "🏖", "🏝", "🏜", "🌋", "⛰", "🏔", "🗻", "🏕", "⛺", "🏠", "🏡", "🏘", "🏚", "🏗", "🏭", "🏢", "🏬", "🏣", "🏤", "🏥", "🏦", "🏨", "🏪", "🏫", "🏩", "💒", "🏛", "⛪", "🕌", "🕍", "🛕", "🕋", "⛩", "🛤", "🛣", "🗾", "🎑", "🏞", "🌅", "🌄", "🌠", "🎇", "🎆", "🌇", "🌆", "🏙", "🌃", "🌌", "🌉", "🌁"
},
new String[]{
"⌚", "📱", "📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽", "💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞", "📞", "☎", "📟", "📠", "📺", "📻", "🎙", "🎚", "🎛", "🧭", "⏱", "⏲", "⏰", "🕰", "⌛", "⏳", "📡", "🔋", "🔌", "💡", "🔦", "🕯", "🪔", "🧯", "🛢", "💸", "💵", "💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🧰", "🔧", "🔨", "⚒", "🛠", "⛏", "🔩", "⚙", "🧱", "⛓", "🧲", "🔫", "💣", "🧨", "🪓", "🔪", "🗡", "⚔", "🛡", "🚬", "⚰", "⚱", "🏺", "🔮", "📿", "🧿", "💈", "⚗", "🔭", "🔬", "🕳", "🩹", "🩺", "💊", "💉", "🩸", "🧬", "🦠", "🧫", "🧪", "🌡", "🧹", "🧺", "🧻", "🚽", "🚰", "🚿", "🛁",
"🛀", "🛀🏻", "🛀🏼", "🛀🏽", "🛀🏾", "🛀🏿",
"🧼", "🪒", "🧽", "🧴", "🛎", "🔑", "🗝", "🚪", "🪑", "🛋", "🛏", "🛌", "🧸", "🖼", "🛍", "🛒", "🎁", "🎈", "🎏", "🎀", "🎊", "🎉", "🎎", "🏮", "🎐", "🧧", "✉", "📩", "📨", "📧", "💌", "📥", "📤", "📦", "🏷", "📪", "📫", "📬", "📭", "📮", "📯", "📜", "📃", "📄", "📑", "🧾", "📊", "📈", "📉", "🗒", "🗓", "📆", "📅", "🗑", "📇", "🗃", "🗳", "🗄", "📋", "📁", "📂", "🗂", "🗞", "📰", "📓", "📔", "📒", "📕", "📗", "📘", "📙", "📚", "📖", "🔖", "🧷", "🔗", "📎", "🖇", "📐", "📏", "🧮", "📌", "📍", "✂", "🖊", "🖋", "✒", "🖌", "🖍", "📝", "✏", "🔍", "🔎", "🔏", "🔐", "🔒", "🔓"
},
new String[]{
"❤", "🧡", "💛", "💚", "💙", "💜", "🖤", "🤍", "🤎", "💔", "❣", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "💟", "☮", "✝", "☪", "🕉", "☸", "✡", "🔯", "🕎", "☯", "☦", "🛐", "⛎", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "🆔", "⚛", "🉑", "☢", "☣", "📴", "📳", "🈶", "🈚", "🈸", "🈺", "🈷", "✴", "🆚", "💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈹", "🈲", "🅰", "🅱", "🆎", "🆑", "🅾", "🆘", "❌", "⭕", "🛑", "⛔", "📛", "🚫", "💯", "💢", "♨", "🚷", "🚯", "🚳", "🚱", "🔞", "📵", "🚭", "❗", "❕", "❓", "❔", "‼", "⁉", "🔅", "🔆", "〽", "⚠", "🚸", "🔱", "⚜", "🔰", "♻", "✅", "🈯", "💹", "❇", "✳", "❎", "🌐", "💠", "Ⓜ", "🌀", "💤", "🏧", "🚾", "♿", "🅿", "🈳", "🈂", "🛂", "🛃", "🛄", "🛅", "🚹", "🚺", "🚼", "🚻", "🚮", "🎦", "📶", "🈁", "🔣", "ℹ", "🔤", "🔡", "🔠", "🆖", "🆗", "🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢", "#⃣", "*⃣", "⏏", "▶", "⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "⏫", "⏬", "◀", "🔼", "🔽", "➡", "⬅", "⬆", "⬇", "↗", "↘", "↙", "↖", "↕", "↔", "↪", "↩", "⤴", "⤵", "🔀", "🔁", "🔂", "🔄", "🔃", "🎵", "🎶", "➕", "➖", "➗", "✖", "♾", "💲", "💱", "™", "©", "®", "👁🗨", "🔚", "🔙", "🔛", "🔝", "🔜", "〰", "➰", "➿", "✔", "☑", "🔘", "🔴", "🟠", "🟡", "🟢", "🔵", "🟣", "⚫", "⚪", "🟤", "🔺", "🔻", "🔸", "🔹", "🔶", "🔷", "🔳", "🔲", "▪", "▫", "◾", "◽", "◼", "◻", "🟥", "🟧", "🟨", "🟩", "🟦", "🟪", "⬛", "⬜", "🟫", "🔈", "🔇", "🔉", "🔊", "🔔", "🔕", "📣", "📢", "💬", "💭", "🗯", "♠", "♣", "♥", "♦", "🃏", "🎴", "🀄", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚", "🕛", "🕜", "🕝", "🕞", "🕟", "🕠", "🕡", "🕢", "🕣", "🕤", "🕥", "🕦", "🕧"
},
new String[]{
"🏳", "🏴", "🏴☠", "🏁", "🚩", "🏳🌈", "🇺🇳", "🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦🇴", "🇦🇮", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇺", "🇦🇹", "🇦🇿", "🇧🇸", "🇧🇭", "🇧🇩", "🇧🇧", "🇧🇾", "🇧🇪", "🇧🇿", "🇧🇯", "🇧🇲", "🇧🇹", "🇧🇴", "🇧🇦", "🇧🇼", "🇧🇷", "🇮🇴", "🇻🇬", "🇧🇳", "🇧🇬", "🇧🇫", "🇧🇮", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨", "🇨🇻", "🇧🇶", "🇰🇾", "🇨🇫", "🇹🇩", "🇨🇱", "🇨🇳", "🇨🇽", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩", "🇨🇰", "🇨🇷", "🇨🇮", "🇭🇷", "🇨🇺", "🇨🇼", "🇨🇾", "🇨🇿", "🇩🇰", "🇩🇯", "🇩🇲", "🇩🇴", "🇪🇨", "🇪🇬", "🇸🇻", "🇬🇶", "🇪🇷", "🇪🇪", "🇸🇿", "🇪🇹", "🇪🇺", "🇫🇰", "🇫🇴", "🇫🇯", "🇫🇮", "🇫🇷", "🇬🇫", "🇵🇫", "🇹🇫", "🇬🇦", "🇬🇲", "🇬🇪", "🇩🇪", "🇬🇭", "🇬🇮", "🇬🇷", "🇬🇱", "🇬🇩", "🇬🇵", "🇬🇺", "🇬🇹", "🇬🇬", "🇬🇳", "🇬🇼", "🇬🇾", "🇭🇹", "🇭🇳", "🇭🇰", "🇭🇺", "🇮🇸", "🇮🇳", "🇮🇩", "🇮🇷", "🇮🇶", "🇮🇪", "🇮🇲", "🇮🇱", "🇮🇹", "🇯🇲", "🇯🇵", "🎌", "🇯🇪", "🇯🇴", "🇰🇿", "🇰🇪", "🇰🇮", "🇽🇰", "🇰🇼", "🇰🇬", "🇱🇦", "🇱🇻", "🇱🇧", "🇱🇸", "🇱🇷", "🇱🇾", "🇱🇮", "🇱🇹", "🇱🇺", "🇲🇴", "🇲🇬", "🇲🇼", "🇲🇾", "🇲🇻", "🇲🇱", "🇲🇹", "🇲🇭", "🇲🇶", "🇲🇷", "🇲🇺", "🇾🇹", "🇲🇽", "🇫🇲", "🇲🇩", "🇲🇨", "🇲🇳", "🇲🇪", "🇲🇸", "🇲🇦", "🇲🇿", "🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇱", "🇳🇨", "🇳🇿", "🇳🇮", "🇳🇪", "🇳🇬", "🇳🇺", "🇳🇫", "🇰🇵", "🇲🇰", "🇲🇵", "🇳🇴", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦", "🇵🇬", "🇵🇾", "🇵🇪", "🇵🇭", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇶🇦", "🇷🇪", "🇷🇴", "🇷🇺", "🇷🇼", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇳", "🇷🇸", "🇸🇨", "🇸🇱", "🇸🇬", "🇸🇽", "🇸🇰", "🇸🇮", "🇬🇸", "🇸🇧", "🇸🇴", "🇿🇦", "🇰🇷", "🇸🇸", "🇪🇸", "🇱🇰", "🇧🇱", "🇸🇭", "🇰🇳", "🇱🇨", "🇵🇲", "🇻🇨", "🇸🇩", "🇸🇷", "🇸🇪", "🇨🇭", "🇸🇾", "🇹🇼", "🇹🇯", "🇹🇿", "🇹🇭", "🇹🇱", "🇹🇬", "🇹🇰", "🇹🇴", "🇹🇹", "🇹🇳", "🇹🇷", "🇹🇲", "🇹🇨", "🇹🇻", "🇻🇮", "🇺🇬", "🇺🇦", "🇦🇪", "🇬🇧", "🏴", "🏴", "🏴", "🇺🇸", "🇺🇾", "🇺🇿", "🇻🇺", "🇻🇦", "🇻🇪", "🇻🇳", "🇼🇫", "🇪🇭", "🇾🇪", "🇿🇲", "🇿🇼"
}
};
public static final char[] emojiToFE0F = {
0x2B50, 0x2600, 0x26C5, 0x2601, 0x26A1, 0x2744, 0x26C4, 0x2614, 0x2708, 0x26F5,
0x2693, 0x26FD, 0x26F2, 0x26FA, 0x26EA, 0x2615, 0x26BD, 0x26BE, 0x26F3, 0x231A,
0x260E, 0x231B, 0x2709, 0x2702, 0x2712, 0x270F, 0x2648, 0x2649, 0x264A, 0x264B,
0x264C, 0x264D, 0x264E, 0x264F, 0x2650, 0x2651, 0x2652, 0x2653, 0x2734, 0x3299,
0x3297, 0x26D4, 0x2B55, 0x2668, 0x2757, 0x203C, 0x2049, 0x303D, 0x26A0, 0x267B,
0x2747, 0x2733, 0x24C2, 0x267F, 0x25B6, 0x25C0, 0x27A1, 0x2B05, 0x2B06, 0x2B07,
0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA, 0x21A9, 0x2934, 0x2935,
0x2139, 0x2714, 0x2716, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B, 0x2B1C,
0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A, 0x2639,
0x270C, 0x261D, 0x2764, 0x2603
};
public static final char[] dataChars = {
0x262E, 0x271D, 0x262A, 0x2638, 0x2721, 0x262F, 0x2626, 0x26CE, 0x2648, 0x2649,
0x264A, 0x264B, 0x264C, 0x264D, 0x264E, 0x264F, 0x2650, 0x2651, 0x2652, 0x2653,
0x269B, 0x2622, 0x2623, 0x2734, 0x3299, 0x3297, 0x26D4, 0x274C, 0x2B55, 0x2668,
0x2757, 0x2755, 0x2753, 0x2754, 0x203C, 0x2049, 0x269C, 0x303D, 0x26A0, 0x267B,
0x2747, 0x2733, 0x274E, 0x2705, 0x27BF, 0x24C2, 0x267F, 0x25B6, 0x23F8, 0x23EF,
0x23F9, 0x23FA, 0x23ED, 0x23EE, 0x23E9, 0x23EA, 0x25C0, 0x23EB, 0x23EC, 0x27A1,
0x2B05, 0x2B06, 0x2B07, 0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA,
0x21A9, 0x2934, 0x2935, 0x2139, 0x3030, 0x27B0, 0x2714, 0x2795, 0x2796, 0x2797,
0x2716, 0x00A9, 0x00AE, 0x2122, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B,
0x2B1C, 0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A,
0x2639, 0x270A, 0x270C, 0x270B, 0x261D, 0x270D, 0x26D1, 0x2764, 0x2763, 0x2615,
0x26BD, 0x26BE, 0x26F3, 0x26F7, 0x26F8, 0x26F9, 0x231A, 0x2328, 0x260E, 0x23F1,
0x23F2, 0x23F0, 0x23F3, 0x231B, 0x2696, 0x2692, 0x26CF, 0x2699, 0x26D3, 0x2694,
0x2620, 0x26B0, 0x26B1, 0x2697, 0x26F1, 0x2709, 0x2702, 0x2712, 0x270F, 0x2708,
0x26F5, 0x26F4, 0x2693, 0x26FD, 0x26F2, 0x26F0, 0x26FA, 0x26EA, 0x26E9, 0x2618,
0x2B50, 0x2728, 0x2604, 0x2600, 0x26C5, 0x2601, 0x26C8, 0x26A1, 0x2744, 0x2603,
0x26C4, 0x2602, 0x2614
};
public static final String[] emojiSecret = {
"😉", "😍", "😛", "😭", "😱", "😡", "😎", "😴", "😵", "😈", "😬", "😇", "😏", "👮", "👷", "💂", "👶", "👨", "👩", "👴", "👵", "😻", "😽", "🙀", "👺", "🙈", "🙉", "🙊", "💀", "👽", "💩", "🔥", "💥",
"💤", "👂", "👀", "👃", "👅", "👄", "👍", "👎", "👌", "👊", "✌", "✋", "👐", "👆", "👇", "👉", "👈", "🙏", "👏", "💪", "🚶", "🏃", "💃", "👫", "👪", "👬", "👭", "💅", "🎩", "👑", "👒", "👟", "👞",
"👠", "👕", "👗", "👖", "👙", "👜", "👓", "🎀", "💄", "💛", "💙", "💜", "💚", "💍", "💎", "🐶", "🐺", "🐱", "🐭", "🐹", "🐰", "🐸", "🐯", "🐨", "🐻", "🐷", "🐮", "🐗", "🐴", "🐑", "🐘", "🐼", "🐧",
"🐥", "🐔", "🐍", "🐢", "🐛", "🐝", "🐜", "🐞", "🐌", "🐙", "🐚", "🐟", "🐬", "🐋", "🐐", "🐊", "🐫", "🍀", "🌹", "🌻", "🍁", "🌾", "🍄", "🌵", "🌴", "🌳", "🌞", "🌚", "🌙", "🌎", "🌋", "⚡", "☔", "❄",
"⛄", "🌀", "🌈", "🌊", "🎓", "🎆", "🎃", "👻", "🎅", "🎄", "🎁", "🎈", "🔮", "🎥", "📷", "💿", "💻", "☎", "📡", "📺", "📻", "🔉", "🔔", "⏳", "⏰", "⌚", "🔒", "🔑", "🔎", "💡", "🔦", "🔌", "🔋", "🚿",
"🚽", "🔧", "🔨", "🚪", "🚬", "💣", "🔫", "🔪", "💊", "💉", "💰", "💵", "💳", "✉", "📫", "📦", "📅", "📁", "✂", "📌", "📎", "✒", "✏", "📐", "📚", "🔬", "🔭", "🎨", "🎬", "🎤", "🎧", "🎵", "🎹", "🎻", "🎺",
"🎸", "👾", "🎮", "🃏", "🎲", "🎯", "🏈", "🏀", "⚽", "⚾", "🎾", "🎱", "🏉", "🎳", "🏁", "🏇", "🏆", "🏊", "🏄", "☕", "🍼", "🍺", "🍷", "🍴", "🍕", "🍔", "🍟", "🍗", "🍱", "🍚", "🍜", "🍡", "🍳", "🍞", "🍩",
"🍦", "🎂", "🍰", "🍪", "🍫", "🍭", "🍯", "🍎", "🍏", "🍊", "🍋", "🍒", "🍇", "🍉", "🍓", "🍑", "🍌", "🍐", "🍍", "🍆", "🍅", "🌽", "🏡", "🏥", "🏦", "⛪", "🏰", "⛺", "🏭", "🗻", "🗽", "🎠", "🎡", "⛲", "🎢",
"🚢", "🚤", "⚓", "🚀", "✈", "🚁", "🚂", "🚋", "🚎", "🚌", "🚙", "🚗", "🚕", "🚛", "🚨", "🚔", "🚒", "🚑", "🚲", "🚠", "🚜", "🚦", "⚠", "🚧", "⛽", "🎰", "🗿", "🎪", "🎭", "🇯🇵", "🇰🇷", "🇩🇪", "🇨🇳", "🇺🇸", "🇫🇷", "🇪🇸",
"🇮🇹", "🇷🇺", "🇬🇧", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "0⃣", "🔟", "❗", "❓", "♥", "♦", "💯", "🔗", "🔱", "🔴", "🔵", "🔶", "🔷"
};
public static final String[] emojiColored = {
"🤲", "👐", "🙌", "👏", "👍", "👎", "👊", "✊", "🤛", "🤜", "🤞", "✌", "🤟", "🤘",
"👌", "🤏", "👈", "👉", "👆", "👇", "☝", "✋", "🤚", "🖐", "🖖", "👋", "🤙", "💪",
"🖕", "✍", "🙏", "🦶", "🦵", "👂", "🦻", "👃", "👶", "👧", "🧒", "👦", "👩",
"🧑", "👨", "👩🦱", "🧑🦱", "👨🦱", "👩🦰", "🧑🦰", "👨🦰", "👱♀", "👱", "👱♂", "👩🦳", "🧑🦳", "👨🦳",
"👩🦲", "🧑🦲", "👨🦲", "🧔", "👵", "🧓", "👴", "👲", "👳♀", "👳", "👳♂", "🧕", "👮♀", "👮", "👮♂", "👷♀",
"👷", "👷♂", "💂♀", "💂", "💂♂", "🕵♀", "🕵", "🕵♂", "👩⚕", "🧑⚕", "👨⚕", "👩🌾", "🧑🌾", "👨🌾", "👩🍳", "🧑🍳",
"👨🍳", "👩🎓", "🧑🎓", "👨🎓", "👩🎤", "🧑🎤", "👨🎤", "👩🏫", "🧑🏫", "👨🏫", "👩🏭", "🧑🏭", "👨🏭", "👩💻", "🧑💻", "👨💻",
"👩💼", "🧑💼", "👨💼", "👩🔧", "🧑🔧", "👨🔧", "👩🔬", "🧑🔬", "👨🔬", "👩🎨", "🧑🎨", "👨🎨", "👩🚒", "🧑🚒", "👨🚒", "👩✈",
"🧑✈", "👨✈", "👩🚀", "🧑🚀", "👨🚀", "👩⚖", "🧑⚖", "👨⚖", "👰", "🤵", "👸", "🤴", "🦸♀", "🦸", "🦸♂", "🦹♀",
"🦹", "🦹♂", "🤶", "🎅", "🧙♀", "🧙", "🧙♂", "🧝♀", "🧝", "🧝♂", "🧛♀", "🧛", "🧛♂", "🧜♀", "🧜",
"🧜♂", "🧚♀", "🧚", "🧚♂", "👼", "🤰", "🤱", "🙇♀", "🙇", "🙇♂", "💁♀", "💁", "💁♂", "🙅♀", "🙅", "🙅♂",
"🙆♀", "🙆", "🙆♂", "🙋♀", "🙋", "🙋♂", "🧏♀", "🧏", "🧏♂", "🤦♀", "🤦", "🤦♂", "🤷♀", "🤷", "🤷♂", "🙎♀",
"🙎", "🙎♂", "🙍♀", "🙍", "🙍♂", "💇♀", "💇", "💇♂", "💆♀", "💆", "💆♂", "🧖♀", "🧖", "🧖♂", "💅", "🤳",
"💃", "🕺", "🕴", "👩🦽", "🧑🦽", "👨🦽", "👩🦼", "🧑🦼", "👨🦼", "🚶♀", "🚶", "🚶♂", "👩🦯", "🧑🦯", "👨🦯", "🧎♀",
"🧎", "🧎♂", "🏃♀", "🏃", "🏃♂", "🧍♀", "🧍", "🧍♂", "🏋♀", "🏋", "🏋♂", "🤸♀", "🤸", "🤸♂", "⛹♀", "⛹",
"⛹♂", "🤾♀", "🤾", "🤾♂", "🏌♀", "🏌", "🏌♂", "🏇", "🧘♀", "🧘", "🧘♂", "🏄♀", "🏄", "🏄♂", "🏊♀", "🏊",
"🏊♂", "🤽♀", "🤽", "🤽♂", "🚣♀", "🚣", "🚣♂", "🧗♀", "🧗", "🧗♂", "🚵♀", "🚵", "🚵♂", "🚴♀", "🚴", "🚴♂",
"🤹♀", "🤹", "🤹♂", "🛀"
};
public static final String[] emojiBigColored = {
"👫", "👭", "👬"
};
public static final String[][] dataColored = {
new String[]{
"😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "☺", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍", "🥰", "😘", "😗", "😙", "😚", "😋", "😛", "😝", "😜", "🤪", "🤨", "🧐", "🤓", "😎", "🤩", "🥳", "😏", "😒", "😞", "😔", "😟", "😕", "🙁", "☹", "😣", "😖", "😫", "😩", "🥺", "😢", "😭", "😤", "😠", "😡", "🤬", "🤯", "😳", "🥵", "🥶", "😱", "😨", "😰", "😥", "😓", "🤗", "🤔", "🤭", "🤫", "🤥", "😶", "😐", "😑", "😬", "🙄", "😯", "😦", "😧", "😮", "😲", "🥱", "😴", "🤤", "😪", "😵", "🤐", "🥴", "🤢", "🤮", "🤧", "😷", "🤒", "🤕", "🤑", "🤠", "😈", "👿", "👹", "👺", "🤡", "💩", "👻", "💀", "☠", "👽", "👾", "🤖", "🎃", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "😿", "😾",
"🤲",
"👐",
"🙌",
"👏",
"🤝",
"👍",
"👎",
"👊",
"✊",
"🤛",
"🤜",
"🤞",
"✌",
"🤟",
"🤘",
"👌",
"🤏",
"👈",
"👉",
"👆",
"👇",
"☝",
"✋",
"🤚",
"🖐",
"🖖",
"👋",
"🤙",
"💪",
"🦾",
"🖕",
"✍",
"🙏",
"🦶",
"🦵",
"🦿", "💄", "💋", "👄", "🦷", "👅",
"👂",
"🦻",
"👃",
"👣", "👁", "👀", "🧠", "🗣", "👤", "👥",
"👶",
"👧",
"🧒",
"👦",
"👩",
"🧑",
"👨",
"👩🦱",
"🧑🦱",
"👨🦱",
"👩🦰",
"🧑🦰",
"👨🦰",
"👱♀",
"👱",
"👱♂",
"👩🦳",
"🧑🦳",
"👨🦳",
"👩🦲",
"🧑🦲",
"👨🦲",
"🧔",
"👵",
"🧓",
"👴",
"👲",
"👳♀",
"👳",
"👳♂",
"🧕",
"👮♀",
"👮",
"👮♂",
"👷♀",
"👷",
"👷♂",
"💂♀",
"💂",
"💂♂",
"🕵♀",
"🕵",
"🕵♂",
"👩⚕",
"🧑⚕",
"👨⚕",
"👩🌾",
"🧑🌾",
"👨🌾",
"👩🍳",
"🧑🍳",
"👨🍳",
"👩🎓",
"🧑🎓",
"👨🎓",
"👩🎤",
"🧑🎤",
"👨🎤",
"👩🏫",
"🧑🏫",
"👨🏫",
"👩🏭",
"🧑🏭",
"👨🏭",
"👩💻",
"🧑💻",
"👨💻",
"👩💼",
"🧑💼",
"👨💼",
"👩🔧",
"🧑🔧",
"👨🔧",
"👩🔬",
"🧑🔬",
"👨🔬",
"👩🎨",
"🧑🎨",
"👨🎨",
"👩🚒",
"🧑🚒",
"👨🚒",
"👩✈",
"🧑✈",
"👨✈",
"👩🚀",
"🧑🚀",
"👨🚀",
"👩⚖",
"🧑⚖",
"👨⚖",
"👰",
"🤵",
"👸",
"🤴",
"🦸♀",
"🦸",
"🦸♂",
"🦹♀",
"🦹",
"🦹♂",
"🤶",
"🎅",
"🧙♀",
"🧙",
"🧙♂",
"🧝♀",
"🧝",
"🧝♂",
"🧛♀",
"🧛",
"🧛♂",
"🧟♀", "🧟", "🧟♂", "🧞♀", "🧞", "🧞♂",
"🧜♀",
"🧜",
"🧜♂",
"🧚♀",
"🧚",
"🧚♂",
"👼",
"🤰",
"🤱",
"🙇♀",
"🙇",
"🙇♂",
"💁♀",
"💁",
"💁♂",
"🙅♀",
"🙅",
"🙅♂",
"🙆♀",
"🙆",
"🙆♂",
"🙋♀",
"🙋",
"🙋♂",
"🧏♀",
"🧏",
"🧏♂",
"🤦♀",
"🤦",
"🤦♂",
"🤷♀",
"🤷",
"🤷♂",
"🙎♀",
"🙎",
"🙎♂",
"🙍♀",
"🙍",
"🙍♂",
"💇♀",
"💇",
"💇♂",
"💆♀",
"💆",
"💆♂",
"🧖♀",
"🧖",
"🧖♂",
"💅",
"🤳",
"💃",
"🕺",
"👯♀", "👯", "👯♂",
"🕴",
"👩🦽",
"🧑🦽",
"👨🦽",
"👩🦼",
"🧑🦼",
"👨🦼",
"🚶♀",
"🚶",
"🚶♂",
"👩🦯",
"🧑🦯",
"👨🦯",
"🧎♀",
"🧎",
"🧎♂",
"🏃♀",
"🏃",
"🏃♂",
"🧍♀",
"🧍",
"🧍♂",
"👫",
"👭",
"👬",
"👩❤👨", "👩❤👩", "👨❤👨", "👩❤💋👨", "👩❤💋👩", "👨❤💋👨", "👨👩👦", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧", "👩👩👦", "👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦", "👨👨👧👧", "👩👦", "👩👧", "👩👧👦", "👩👦👦", "👩👧👧", "👨👦", "👨👧", "👨👧👦", "👨👦👦", "👨👧👧", "🧶", "🧵", "🧥", "🥼", "🦺", "👚", "👕", "👖", "🩲", "🩳", "👔", "👗", "👙", "👘", "🥻", "🩱", "🥿", "👠", "👡", "👢", "👞", "👟", "🥾", "🧦", "🧤", "🧣", "🎩", "🧢", "👒", "🎓", "⛑", "👑", "💍", "👝", "👛", "👜", "💼", "🎒", "🧳", "👓", "🕶", "🥽", "🌂"
},
null,
null,
new String[]{
"⚽", "🏀", "🏈", "⚾", "🥎", "🎾", "🏐", "🏉", "🥏", "🎱", "🪀", "🏓", "🏸", "🏒", "🏑", "🥍", "🏏", "🥅", "⛳", "🪁", "🏹", "🎣", "🤿", "🥊", "🥋", "🎽", "🛹", "🛷", "⛸", "🥌", "🎿", "⛷", "🏂", "🪂",
"🏋♀",
"🏋",
"🏋♂",
"🤼♀", "🤼", "🤼♂",
"🤸♀",
"🤸",
"🤸♂",
"⛹♀",
"⛹",
"⛹♂",
"🤺",
"🤾♀",
"🤾",
"🤾♂",
"🏌♀",
"🏌",
"🏌♂",
"🏇",
"🧘♀",
"🧘",
"🧘♂",
"🏄♀",
"🏄",
"🏄♂",
"🏊♀",
"🏊",
"🏊♂",
"🤽♀",
"🤽",
"🤽♂",
"🚣♀",
"🚣",
"🚣♂",
"🧗♀",
"🧗",
"🧗♂",
"🚵♀",
"🚵",
"🚵♂",
"🚴♀",
"🚴",
"🚴♂",
"🏆", "🥇", "🥈", "🥉", "🏅", "🎖", "🏵", "🎗", "🎫", "🎟", "🎪",
"🤹♀",
"🤹",
"🤹♂",
"🎭", "🩰", "🎨", "🎬", "🎤", "🎧", "🎼", "🎹", "🥁", "🎷", "🎺", "🎸", "🪕", "🎻", "🎲", "♟", "🎯", "🎳", "🎮", "🎰", "🧩"
},
null,
new String[]{
"⌚", "📱", "📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽", "💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞", "📞", "☎", "📟", "📠", "📺", "📻", "🎙", "🎚", "🎛", "🧭", "⏱", "⏲", "⏰", "🕰", "⌛", "⏳", "📡", "🔋", "🔌", "💡", "🔦", "🕯", "🪔", "🧯", "🛢", "💸", "💵", "💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🧰", "🔧", "🔨", "⚒", "🛠", "⛏", "🔩", "⚙", "🧱", "⛓", "🧲", "🔫", "💣", "🧨", "🪓", "🔪", "🗡", "⚔", "🛡", "🚬", "⚰", "⚱", "🏺", "🔮", "📿", "🧿", "💈", "⚗", "🔭", "🔬", "🕳", "🩹", "🩺", "💊", "💉", "🩸", "🧬", "🦠", "🧫", "🧪", "🌡", "🧹", "🧺", "🧻", "🚽", "🚰", "🚿", "🛁",
"🛀",
"🧼", "🪒", "🧽", "🧴", "🛎", "🔑", "🗝", "🚪", "🪑", "🛋", "🛏", "🛌", "🧸", "🖼", "🛍", "🛒", "🎁", "🎈", "🎏", "🎀", "🎊", "🎉", "🎎", "🏮", "🎐", "🧧", "✉", "📩", "📨", "📧", "💌", "📥", "📤", "📦", "🏷", "📪", "📫", "📬", "📭", "📮", "📯", "📜", "📃", "📄", "📑", "🧾", "📊", "📈", "📉", "🗒", "🗓", "📆", "📅", "🗑", "📇", "🗃", "🗳", "🗄", "📋", "📁", "📂", "🗂", "🗞", "📰", "📓", "📔", "📒", "📕", "📗", "📘", "📙", "📚", "📖", "🔖", "🧷", "🔗", "📎", "🖇", "📐", "📏", "🧮", "📌", "📍", "✂", "🖊", "🖋", "✒", "🖌", "🖍", "📝", "✏", "🔍", "🔎", "🔏", "🔐", "🔒", "🔓"
},
null,
null
};
public static final String[] aliasOld = new String[]{
"👱", "👱🏻", "👱🏼", "👱🏽", "👱🏾", "👱🏿",
"👳", "👳🏻", "👳🏼", "👳🏽", "👳🏾", "👳🏿",
"👷", "👷🏻", "👷🏼", "👷🏽", "👷🏾", "👷🏿",
"👮", "👮🏻", "👮🏼", "👮🏽", "👮🏾", "👮🏿",
"💂", "💂🏻", "💂🏼", "💂🏽", "💂🏾", "💂🏿",
"🕵", "🕵🏻", "🕵🏼", "🕵🏽", "🕵🏾", "🕵🏿",
"🙇", "🙇🏻", "🙇🏼", "🙇🏽", "🙇🏾", "🙇🏿",
"💁", "💁🏻", "💁🏼", "💁🏽", "💁🏾", "💁🏿",
"🙅", "🙅🏻", "🙅🏼", "🙅🏽", "🙅🏾", "🙅🏿",
"🙆", "🙆🏻", "🙆🏼", "🙆🏽", "🙆🏾", "🙆🏿",
"🙋", "🙋🏻", "🙋🏼", "🙋🏽", "🙋🏾", "🙋🏿",
"🙎", "🙎🏻", "🙎🏼", "🙎🏽", "🙎🏾", "🙎🏿",
"🙍", "🙍🏻", "🙍🏼", "🙍🏽", "🙍🏾", "🙍🏿",
"💇", "💇🏻", "💇🏼", "💇🏽", "💇🏾", "💇🏿",
"💆", "💆🏻", "💆🏼", "💆🏽", "💆🏾", "💆🏿",
"🏃", "🏃🏻", "🏃🏼", "🏃🏽", "🏃🏾", "🏃🏿",
"🏋", "🏋🏻", "🏋🏼", "🏋🏽", "🏋🏾", "🏋🏿",
"⛹", "⛹🏻", "⛹🏼", "⛹🏽", "⛹🏾", "⛹🏿",
"🏌", "🏌🏻", "🏌🏼", "🏌🏽", "🏌🏾", "🏌🏿",
"🏄", "🏄🏻", "🏄🏼", "🏄🏽", "🏄🏾", "🏄🏿",
"🏊", "🏊🏻", "🏊🏼", "🏊🏽", "🏊🏾", "🏊🏿",
"🚣", "🚣🏻", "🚣🏼", "🚣🏽", "🚣🏾", "🚣🏿",
"🚴", "🚴🏻", "🚴🏼", "🚴🏽", "🚴🏾", "🚴🏿",
"🚵", "🚵🏻", "🚵🏼", "🚵🏽", "🚵🏾", "🚵🏿",
"🦸", "🦸🏻", "🦸🏼", "🦸🏽", "🦸🏾", "🦸🏿",
"🦹", "🦹🏻", "🦹🏼", "🦹🏽", "🦹🏾", "🦹🏿",
"🧙", "🧙🏻", "🧙🏼", "🧙🏽", "🧙🏾", "🧙🏿",
"🧝", "🧝🏻", "🧝🏼", "🧝🏽", "🧝🏾", "🧝🏿",
"🧛", "🧛🏻", "🧛🏼", "🧛🏽", "🧛🏾", "🧛🏿",
"🧟",
"🧞",
"🧜", "🧜🏻", "🧜🏼", "🧜🏽", "🧜🏾", "🧜🏿",
"🧚", "🧚🏻", "🧚🏼", "🧚🏽", "🧚🏾", "🧚🏿",
"🤦", "🤦🏻", "🤦🏼", "🤦🏽", "🤦🏾", "🤦🏿",
"🤷", "🤷🏻", "🤷🏼", "🤷🏽", "🤷🏾", "🤷🏿",
"🧖", "🧖🏻", "🧖🏼", "🧖🏽", "🧖🏾", "🧖🏿",
"👯",
"🚶", "🚶🏻", "🚶🏼", "🚶🏽", "🚶🏾", "🚶🏿",
"🤼",
"🤸", "🤸🏻", "🤸🏼", "🤸🏽", "🤸🏾", "🤸🏿",
"🤾", "🤾🏻", "🤾🏼", "🤾🏽", "🤾🏾", "🤾🏿",
"🧘", "🧘🏻", "🧘🏼", "🧘🏽", "🧘🏾", "🧘🏿",
"🤽", "🤽🏻", "🤽🏼", "🤽🏽", "🤽🏾", "🤽🏿",
"🧗", "🧗🏻", "🧗🏼", "🧗🏽", "🧗🏾", "🧗🏿",
"🤹", "🤹🏻", "🤹🏼", "🤹🏽", "🤹🏾", "🤹🏿",
"\uD83D\uDC91"};
public static final String[] aliasNew = new String[]{
"👱♂", "👱🏻♂", "👱🏼♂", "👱🏽♂", "👱🏾♂", "👱🏿♂",
"👳♂", "👳🏻♂", "👳🏼♂", "👳🏽♂", "👳🏾♂", "👳🏿♂",
"👷♂", "👷🏻♂", "👷🏼♂", "👷🏽♂", "👷🏾♂", "👷🏿♂",
"👮♂", "👮🏻♂", "👮🏼♂", "👮🏽♂", "👮🏾♂", "👮🏿♂",
"💂♂", "💂🏻♂", "💂🏼♂", "💂🏽♂", "💂🏾♂", "💂🏿♂",
"🕵♂", "🕵🏻♂", "🕵🏼♂", "🕵🏽♂", "🕵🏾♂", "🕵🏿♂",
"🙇♂", "🙇🏻♂", "🙇🏼♂", "🙇🏽♂", "🙇🏾♂", "🙇🏿♂",
"💁♀", "💁🏻♀", "💁🏼♀", "💁🏽♀", "💁🏾♀", "💁🏿♀",
"🙅♀", "🙅🏻♀", "🙅🏼♀", "🙅🏽♀", "🙅🏾♀", "🙅🏿♀",
"🙆♀", "🙆🏻♀", "🙆🏼♀", "🙆🏽♀", "🙆🏾♀", "🙆🏿♀",
"🙋♀", "🙋🏻♀", "🙋🏼♀", "🙋🏽♀", "🙋🏾♀", "🙋🏿♀",
"🙎♀", "🙎🏻♀", "🙎🏼♀", "🙎🏽♀", "🙎🏾♀", "🙎🏿♀",
"🙍♀", "🙍🏻♀", "🙍🏼♀", "🙍🏽♀", "🙍🏾♀", "🙍🏿♀",
"💇♀", "💇🏻♀", "💇🏼♀", "💇🏽♀", "💇🏾♀", "💇🏿♀",
"💆♀", "💆🏻♀", "💆🏼♀", "💆🏽♀", "💆🏾♀", "💆🏿♀",
"🏃♂", "🏃🏻♂", "🏃🏼♂", "🏃🏽♂", "🏃🏾♂", "🏃🏿♂",
"🏋♂", "🏋🏻♂", "🏋🏼♂", "🏋🏽♂", "🏋🏾♂", "🏋🏿♂",
"⛹♂", "⛹🏻♂", "⛹🏼♂", "⛹🏽♂", "⛹🏾♂", "⛹🏿♂",
"🏌♂", "🏌🏻♂", "🏌🏼♂", "🏌🏽♂", "🏌🏾♂", "🏌🏿♂",
"🏄♂", "🏄🏻♂", "🏄🏼♂", "🏄🏽♂", "🏄🏾♂", "🏄🏿♂",
"🏊♂", "🏊🏻♂", "🏊🏼♂", "🏊🏽♂", "🏊🏾♂", "🏊🏿♂",
"🚣♂", "🚣🏻♂", "🚣🏼♂", "🚣🏽♂", "🚣🏾♂", "🚣🏿♂",
"🚴♂", "🚴🏻♂", "🚴🏼♂", "🚴🏽♂", "🚴🏾♂", "🚴🏿♂",
"🚵♂", "🚵🏻♂", "🚵🏼♂", "🚵🏽♂", "🚵🏾♂", "🚵🏿♂",
"🦸♀", "🦸🏻♀", "🦸🏼♀", "🦸🏽♀", "🦸🏾♀", "🦸🏿♀",
"🦹♀", "🦹🏻♀", "🦹🏼♀", "🦹🏽♀", "🦹🏾♀", "🦹🏿♀",
"🧙♀", "🧙🏻♀", "🧙🏼♀", "🧙🏽♀", "🧙🏾♀", "🧙🏿♀",
"🧝♂", "🧝🏻♂", "🧝🏼♂", "🧝🏽♂", "🧝🏾♂", "🧝🏿♂",
"🧛♂", "🧛🏻♂", "🧛🏼♂", "🧛🏽♂", "🧛🏾♂", "🧛🏿♂",
"🧟♂",
"🧞♂",
"🧜♂", "🧜🏻♂", "🧜🏼♂", "🧜🏽♂", "🧜🏾♂", "🧜🏿♂",
"🧚♀", "🧚🏻♀", "🧚🏼♀", "🧚🏽♀", "🧚🏾♀", "🧚🏿♀",
"🤦♂", "🤦🏻♂", "🤦🏼♂", "🤦🏽♂", "🤦🏾♂", "🤦🏿♂",
"🤷♀", "🤷🏻♀", "🤷🏼♀", "🤷🏽♀", "🤷🏾♀", "🤷🏿♀",
"🧖♂", "🧖🏻♂", "🧖🏼♂", "🧖🏽♂", "🧖🏾♂", "🧖🏿♂",
"👯♀",
"🚶♂", "🚶🏻♂", "🚶🏼♂", "🚶🏽♂", "🚶🏾♂", "🚶🏿♂",
"🤼♀",
"🤸♂", "🤸🏻♂", "🤸🏼♂", "🤸🏽♂", "🤸🏾♂", "🤸🏿♂",
"🤾♀", "🤾🏻♀", "🤾🏼♀", "🤾🏽♀", "🤾🏾♀", "🤾🏿♀",
"🧘♀", "🧘🏻♀", "🧘🏼♀", "🧘🏽♀", "🧘🏾♀", "🧘🏿♀",
"🤽♂", "🤽🏻♂", "🤽🏼♂", "🤽🏽♂", "🤽🏾♂", "🤽🏿♂",
"🧗♂", "🧗🏻♂", "🧗🏼♂", "🧗🏽♂", "🧗🏾♂", "🧗🏿♂",
"🤹♂", "🤹🏻♂", "🤹🏼♂", "🤹🏽♂", "🤹🏾♂", "🤹🏿♂",
"👩❤👨"};
public static final String[][] data = {
new String[]{
"😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "☺", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍", "🥰", "😘", "😗", "😙", "😚", "😋", "😛", "😝", "😜", "🤪", "🤨", "🧐", "🤓", "😎", "🤩", "🥳", "😏", "😒", "😞", "😔", "😟", "😕", "🙁", "☹", "😣", "😖", "😫", "😩", "🥺", "😢", "😭", "😤", "😠", "😡", "🤬", "🤯", "😳", "🥵", "🥶", "😱", "😨", "😰", "😥", "😓", "🤗", "🤔", "🤭", "🤫", "🤥", "😶", "😐", "😑", "😬", "🙄", "😯", "😦", "😧", "😮", "😲", "🥱", "😴", "🤤", "😪", "😵", "🤐", "🥴", "🤢", "🤮", "🤧", "😷", "🤒", "🤕", "🤑", "🤠", "😈", "👿", "👹", "👺", "🤡", "💩", "👻", "💀", "☠", "👽", "👾", "🤖", "🎃", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "😿", "😾",
"🤲", "🤲🏻", "🤲🏼", "🤲🏽", "🤲🏾", "🤲🏿",
"👐", "👐🏻", "👐🏼", "👐🏽", "👐🏾", "👐🏿",
"🙌", "🙌🏻", "🙌🏼", "🙌🏽", "🙌🏾", "🙌🏿",
"👏", "👏🏻", "👏🏼", "👏🏽", "👏🏾", "👏🏿",
"🤝",
"👍", "👍🏻", "👍🏼", "👍🏽", "👍🏾", "👍🏿",
"👎", "👎🏻", "👎🏼", "👎🏽", "👎🏾", "👎🏿",
"👊", "👊🏻", "👊🏼", "👊🏽", "👊🏾", "👊🏿",
"✊", "✊🏻", "✊🏼", "✊🏽", "✊🏾", "✊🏿",
"🤛", "🤛🏻", "🤛🏼", "🤛🏽", "🤛🏾", "🤛🏿",
"🤜", "🤜🏻", "🤜🏼", "🤜🏽", "🤜🏾", "🤜🏿",
"🤞", "🤞🏻", "🤞🏼", "🤞🏽", "🤞🏾", "🤞🏿",
"✌", "✌🏻", "✌🏼", "✌🏽", "✌🏾", "✌🏿",
"🤟", "🤟🏻", "🤟🏼", "🤟🏽", "🤟🏾", "🤟🏿",
"🤘", "🤘🏻", "🤘🏼", "🤘🏽", "🤘🏾", "🤘🏿",
"👌", "👌🏻", "👌🏼", "👌🏽", "👌🏾", "👌🏿",
"🤏", "🤏🏻", "🤏🏼", "🤏🏽", "🤏🏾", "🤏🏿",
"👈", "👈🏻", "👈🏼", "👈🏽", "👈🏾", "👈🏿",
"👉", "👉🏻", "👉🏼", "👉🏽", "👉🏾", "👉🏿",
"👆", "👆🏻", "👆🏼", "👆🏽", "👆🏾", "👆🏿",
"👇", "👇🏻", "👇🏼", "👇🏽", "👇🏾", "👇🏿",
"☝", "☝🏻", "☝🏼", "☝🏽", "☝🏾", "☝🏿",
"✋", "✋🏻", "✋🏼", "✋🏽", "✋🏾", "✋🏿",
"🤚", "🤚🏻", "🤚🏼", "🤚🏽", "🤚🏾", "🤚🏿",
"🖐", "🖐🏻", "🖐🏼", "🖐🏽", "🖐🏾", "🖐🏿",
"🖖", "🖖🏻", "🖖🏼", "🖖🏽", "🖖🏾", "🖖🏿",
"👋", "👋🏻", "👋🏼", "👋🏽", "👋🏾", "👋🏿",
"🤙", "🤙🏻", "🤙🏼", "🤙🏽", "🤙🏾", "🤙🏿",
"💪", "💪🏻", "💪🏼", "💪🏽", "💪🏾", "💪🏿",
"🦾",
"🖕", "🖕🏻", "🖕🏼", "🖕🏽", "🖕🏾", "🖕🏿",
"✍", "✍🏻", "✍🏼", "✍🏽", "✍🏾", "✍🏿",
"🙏", "🙏🏻", "🙏🏼", "🙏🏽", "🙏🏾", "🙏🏿",
"🦶", "🦶🏻", "🦶🏼", "🦶🏽", "🦶🏾", "🦶🏿",
"🦵", "🦵🏻", "🦵🏼", "🦵🏽", "🦵🏾", "🦵🏿",
"🦿", "💄", "💋", "👄", "🦷", "👅",
"👂", "👂🏻", "👂🏼", "👂🏽", "👂🏾", "👂🏿",
"🦻", "🦻🏻", "🦻🏼", "🦻🏽", "🦻🏾", "🦻🏿",
"👃", "👃🏻", "👃🏼", "👃🏽", "👃🏾", "👃🏿",
"👣", "👁", "👀", "🧠", "🗣", "👤", "👥",
"👶", "👶🏻", "👶🏼", "👶🏽", "👶🏾", "👶🏿",
"👧", "👧🏻", "👧🏼", "👧🏽", "👧🏾", "👧🏿",
"🧒", "🧒🏻", "🧒🏼", "🧒🏽", "🧒🏾", "🧒🏿",
"👦", "👦🏻", "👦🏼", "👦🏽", "👦🏾", "👦🏿",
"👩", "👩🏻", "👩🏼", "👩🏽", "👩🏾", "👩🏿",
"🧑", "🧑🏻", "🧑🏼", "🧑🏽", "🧑🏾", "🧑🏿",
"👨", "👨🏻", "👨🏼", "👨🏽", "👨🏾", "👨🏿",
"👩🦱", "👩🏻🦱", "👩🏼🦱", "👩🏽🦱", "👩🏾🦱", "👩🏿🦱",
"🧑🦱", "🧑🏻🦱", "🧑🏼🦱", "🧑🏽🦱", "🧑🏾🦱", "🧑🏿🦱",
"👨🦱", "👨🏻🦱", "👨🏼🦱", "👨🏽🦱", "👨🏾🦱", "👨🏿🦱",
"👩🦰", "👩🏻🦰", "👩🏼🦰", "👩🏽🦰", "👩🏾🦰", "👩🏿🦰",
"🧑🦰", "🧑🏻🦰", "🧑🏼🦰", "🧑🏽🦰", "🧑🏾🦰", "🧑🏿🦰",
"👨🦰", "👨🏻🦰", "👨🏼🦰", "👨🏽🦰", "👨🏾🦰", "👨🏿🦰",
"👱♀", "👱🏻♀", "👱🏼♀", "👱🏽♀", "👱🏾♀", "👱🏿♀",
"👱", "👱🏻", "👱🏼", "👱🏽", "👱🏾", "👱🏿",
"👱♂", "👱🏻♂", "👱🏼♂", "👱🏽♂", "👱🏾♂", "👱🏿♂",
"👩🦳", "👩🏻🦳", "👩🏼🦳", "👩🏽🦳", "👩🏾🦳", "👩🏿🦳",
"🧑🦳", "🧑🏻🦳", "🧑🏼🦳", "🧑🏽🦳", "🧑🏾🦳", "🧑🏿🦳",
"👨🦳", "👨🏻🦳", "👨🏼🦳", "👨🏽🦳", "👨🏾🦳", "👨🏿🦳",
"👩🦲", "👩🏻🦲", "👩🏼🦲", "👩🏽🦲", "👩🏾🦲", "👩🏿🦲",
"🧑🦲", "🧑🏻🦲", "🧑🏼🦲", "🧑🏽🦲", "🧑🏾🦲", "🧑🏿🦲",
"👨🦲", "👨🏻🦲", "👨🏼🦲", "👨🏽🦲", "👨🏾🦲", "👨🏿🦲",
"🧔", "🧔🏻", "🧔🏼", "🧔🏽", "🧔🏾", "🧔🏿",
"👵", "👵🏻", "👵🏼", "👵🏽", "👵🏾", "👵🏿",
"🧓", "🧓🏻", "🧓🏼", "🧓🏽", "🧓🏾", "🧓🏿",
"👴", "👴🏻", "👴🏼", "👴🏽", "👴🏾", "👴🏿",
"👲", "👲🏻", "👲🏼", "👲🏽", "👲🏾", "👲🏿",
"👳♀", "👳🏻♀", "👳🏼♀", "👳🏽♀", "👳🏾♀", "👳🏿♀",
"👳", "👳🏻", "👳🏼", "👳🏽", "👳🏾", "👳🏿",
"👳♂", "👳🏻♂", "👳🏼♂", "👳🏽♂", "👳🏾♂", "👳🏿♂",
"🧕", "🧕🏻", "🧕🏼", "🧕🏽", "🧕🏾", "🧕🏿",
"👮♀", "👮🏻♀", "👮🏼♀", "👮🏽♀", "👮🏾♀", "👮🏿♀",
"👮", "👮🏻", "👮🏼", "👮🏽", "👮🏾", "👮🏿",
"👮♂", "👮🏻♂", "👮🏼♂", "👮🏽♂", "👮🏾♂", "👮🏿♂",
"👷♀", "👷🏻♀", "👷🏼♀", "👷🏽♀", "👷🏾♀", "👷🏿♀",
"👷", "👷🏻", "👷🏼", "👷🏽", "👷🏾", "👷🏿",
"👷♂", "👷🏻♂", "👷🏼♂", "👷🏽♂", "👷🏾♂", "👷🏿♂",
"💂♀", "💂🏻♀", "💂🏼♀", "💂🏽♀", "💂🏾♀", "💂🏿♀",
"💂", "💂🏻", "💂🏼", "💂🏽", "💂🏾", "💂🏿",
"💂♂", "💂🏻♂", "💂🏼♂", "💂🏽♂", "💂🏾♂", "💂🏿♂",
"🕵♀", "🕵🏻♀", "🕵🏼♀", "🕵🏽♀", "🕵🏾♀", "🕵🏿♀",
"🕵", "🕵🏻", "🕵🏼", "🕵🏽", "🕵🏾", "🕵🏿",
"🕵♂", "🕵🏻♂", "🕵🏼♂", "🕵🏽♂", "🕵🏾♂", "🕵🏿♂",
"👩⚕", "👩🏻⚕", "👩🏼⚕", "👩🏽⚕", "👩🏾⚕", "👩🏿⚕",
"🧑⚕", "🧑🏻⚕", "🧑🏼⚕", "🧑🏽⚕", "🧑🏾⚕", "🧑🏿⚕",
"👨⚕", "👨🏻⚕", "👨🏼⚕", "👨🏽⚕", "👨🏾⚕", "👨🏿⚕",
"👩🌾", "👩🏻🌾", "👩🏼🌾", "👩🏽🌾", "👩🏾🌾", "👩🏿🌾",
"🧑🌾", "🧑🏻🌾", "🧑🏼🌾", "🧑🏽🌾", "🧑🏾🌾", "🧑🏿🌾",
"👨🌾", "👨🏻🌾", "👨🏼🌾", "👨🏽🌾", "👨🏾🌾", "👨🏿🌾",
"👩🍳", "👩🏻🍳", "👩🏼🍳", "👩🏽🍳", "👩🏾🍳", "👩🏿🍳",
"🧑🍳", "🧑🏻🍳", "🧑🏼🍳", "🧑🏽🍳", "🧑🏾🍳", "🧑🏿🍳",
"👨🍳", "👨🏻🍳", "👨🏼🍳", "👨🏽🍳", "👨🏾🍳", "👨🏿🍳",
"👩🎓", "👩🏻🎓", "👩🏼🎓", "👩🏽🎓", "👩🏾🎓", "👩🏿🎓",
"🧑🎓", "🧑🏻🎓", "🧑🏼🎓", "🧑🏽🎓", "🧑🏾🎓", "🧑🏿🎓",
"👨🎓", "👨🏻🎓", "👨🏼🎓", "👨🏽🎓", "👨🏾🎓", "👨🏿🎓",
"👩🎤", "👩🏻🎤", "👩🏼🎤", "👩🏽🎤", "👩🏾🎤", "👩🏿🎤",
"🧑🎤", "🧑🏻🎤", "🧑🏼🎤", "🧑🏽🎤", "🧑🏾🎤", "🧑🏿🎤",
"👨🎤", "👨🏻🎤", "👨🏼🎤", "👨🏽🎤", "👨🏾🎤", "👨🏿🎤",
"👩🏫", "👩🏻🏫", "👩🏼🏫", "👩🏽🏫", "👩🏾🏫", "👩🏿🏫",
"🧑🏫", "🧑🏻🏫", "🧑🏼🏫", "🧑🏽🏫", "🧑🏾🏫", "🧑🏿🏫",
"👨🏫", "👨🏻🏫", "👨🏼🏫", "👨🏽🏫", "👨🏾🏫", "👨🏿🏫",
"👩🏭", "👩🏻🏭", "👩🏼🏭", "👩🏽🏭", "👩🏾🏭", "👩🏿🏭",
"🧑🏭", "🧑🏻🏭", "🧑🏼🏭", "🧑🏽🏭", "🧑🏾🏭", "🧑🏿🏭",
"👨🏭", "👨🏻🏭", "👨🏼🏭", "👨🏽🏭", "👨🏾🏭", "👨🏿🏭",
"👩💻", "👩🏻💻", "👩🏼💻", "👩🏽💻", "👩🏾💻", "👩🏿💻",
"🧑💻", "🧑🏻💻", "🧑🏼💻", "🧑🏽💻", "🧑🏾💻", "🧑🏿💻",
"👨💻", "👨🏻💻", "👨🏼💻", "👨🏽💻", "👨🏾💻", "👨🏿💻",
"👩💼", "👩🏻💼", "👩🏼💼", "👩🏽💼", "👩🏾💼", "👩🏿💼",
"🧑💼", "🧑🏻💼", "🧑🏼💼", "🧑🏽💼", "🧑🏾💼", "🧑🏿💼",
"👨💼", "👨🏻💼", "👨🏼💼", "👨🏽💼", "👨🏾💼", "👨🏿💼",
"👩🔧", "👩🏻🔧", "👩🏼🔧", "👩🏽🔧", "👩🏾🔧", "👩🏿🔧",
"🧑🔧", "🧑🏻🔧", "🧑🏼🔧", "🧑🏽🔧", "🧑🏾🔧", "🧑🏿🔧",
"👨🔧", "👨🏻🔧", "👨🏼🔧", "👨🏽🔧", "👨🏾🔧", "👨🏿🔧",
"👩🔬", "👩🏻🔬", "👩🏼🔬", "👩🏽🔬", "👩🏾🔬", "👩🏿🔬",
"🧑🔬", "🧑🏻🔬", "🧑🏼🔬", "🧑🏽🔬", "🧑🏾🔬", "🧑🏿🔬",
"👨🔬", "👨🏻🔬", "👨🏼🔬", "👨🏽🔬", "👨🏾🔬", "👨🏿🔬",
"👩🎨", "👩🏻🎨", "👩🏼🎨", "👩🏽🎨", "👩🏾🎨", "👩🏿🎨",
"🧑🎨", "🧑🏻🎨", "🧑🏼🎨", "🧑🏽🎨", "🧑🏾🎨", "🧑🏿🎨",
"👨🎨", "👨🏻🎨", "👨🏼🎨", "👨🏽🎨", "👨🏾🎨", "👨🏿🎨",
"👩🚒", "👩🏻🚒", "👩🏼🚒", "👩🏽🚒", "👩🏾🚒", "👩🏿🚒",
"🧑🚒", "🧑🏻🚒", "🧑🏼🚒", "🧑🏽🚒", "🧑🏾🚒", "🧑🏿🚒",
"👨🚒", "👨🏻🚒", "👨🏼🚒", "👨🏽🚒", "👨🏾🚒", "👨🏿🚒",
"👩✈", "👩🏻✈", "👩🏼✈", "👩🏽✈", "👩🏾✈", "👩🏿✈",
"🧑✈", "🧑🏻✈", "🧑🏼✈", "🧑🏽✈", "🧑🏾✈", "🧑🏿✈",
"👨✈", "👨🏻✈", "👨🏼✈", "👨🏽✈", "👨🏾✈", "👨🏿✈",
"👩🚀", "👩🏻🚀", "👩🏼🚀", "👩🏽🚀", "👩🏾🚀", "👩🏿🚀",
"🧑🚀", "🧑🏻🚀", "🧑🏼🚀", "🧑🏽🚀", "🧑🏾🚀", "🧑🏿🚀",
"👨🚀", "👨🏻🚀", "👨🏼🚀", "👨🏽🚀", "👨🏾🚀", "👨🏿🚀",
"👩⚖", "👩🏻⚖", "👩🏼⚖", "👩🏽⚖", "👩🏾⚖", "👩🏿⚖",
"🧑⚖", "🧑🏻⚖", "🧑🏼⚖", "🧑🏽⚖", "🧑🏾⚖", "🧑🏿⚖",
"👨⚖", "👨🏻⚖", "👨🏼⚖", "👨🏽⚖", "👨🏾⚖", "👨🏿⚖",
"👰", "👰🏻", "👰🏼", "👰🏽", "👰🏾", "👰🏿",
"🤵", "🤵🏻", "🤵🏼", "🤵🏽", "🤵🏾", "🤵🏿",
"👸", "👸🏻", "👸🏼", "👸🏽", "👸🏾", "👸🏿",
"🤴", "🤴🏻", "🤴🏼", "🤴🏽", "🤴🏾", "🤴🏿",
"🦸♀", "🦸🏻♀", "🦸🏼♀", "🦸🏽♀", "🦸🏾♀", "🦸🏿♀",
"🦸", "🦸🏻", "🦸🏼", "🦸🏽", "🦸🏾", "🦸🏿",
"🦸♂", "🦸🏻♂", "🦸🏼♂", "🦸🏽♂", "🦸🏾♂", "🦸🏿♂",
"🦹♀", "🦹🏻♀", "🦹🏼♀", "🦹🏽♀", "🦹🏾♀", "🦹🏿♀",
"🦹", "🦹🏻", "🦹🏼", "🦹🏽", "🦹🏾", "🦹🏿",
"🦹♂", "🦹🏻♂", "🦹🏼♂", "🦹🏽♂", "🦹🏾♂", "🦹🏿♂",
"🤶", "🤶🏻", "🤶🏼", "🤶🏽", "🤶🏾", "🤶🏿",
"🎅", "🎅🏻", "🎅🏼", "🎅🏽", "🎅🏾", "🎅🏿",
"🧙♀", "🧙🏻♀", "🧙🏼♀", "🧙🏽♀", "🧙🏾♀", "🧙🏿♀",
"🧙", "🧙🏻", "🧙🏼", "🧙🏽", "🧙🏾", "🧙🏿",
"🧙♂", "🧙🏻♂", "🧙🏼♂", "🧙🏽♂", "🧙🏾♂", "🧙🏿♂",
"🧝♀", "🧝🏻♀", "🧝🏼♀", "🧝🏽♀", "🧝🏾♀", "🧝🏿♀",
"🧝", "🧝🏻", "🧝🏼", "🧝🏽", "🧝🏾", "🧝🏿",
"🧝♂", "🧝🏻♂", "🧝🏼♂", "🧝🏽♂", "🧝🏾♂", "🧝🏿♂",
"🧛♀", "🧛🏻♀", "🧛🏼♀", "🧛🏽♀", "🧛🏾♀", "🧛🏿♀",
"🧛", "🧛🏻", "🧛🏼", "🧛🏽", "🧛🏾", "🧛🏿",
"🧛♂", "🧛🏻♂", "🧛🏼♂", "🧛🏽♂", "🧛🏾♂", "🧛🏿♂",
"🧟♀", "🧟", "🧟♂", "🧞♀", "🧞", "🧞♂",
"🧜♀", "🧜🏻♀", "🧜🏼♀", "🧜🏽♀", "🧜🏾♀", "🧜🏿♀",
"🧜", "🧜🏻", "🧜🏼", "🧜🏽", "🧜🏾", "🧜🏿",
"🧜♂", "🧜🏻♂", "🧜🏼♂", "🧜🏽♂", "🧜🏾♂", "🧜🏿♂",
"🧚♀", "🧚🏻♀", "🧚🏼♀", "🧚🏽♀", "🧚🏾♀", "🧚🏿♀",
"🧚", "🧚🏻", "🧚🏼", "🧚🏽", "🧚🏾", "🧚🏿",
"🧚♂", "🧚🏻♂", "🧚🏼♂", "🧚🏽♂", "🧚🏾♂", "🧚🏿♂",
"👼", "👼🏻", "👼🏼", "👼🏽", "👼🏾", "👼🏿",
"🤰", "🤰🏻", "🤰🏼", "🤰🏽", "🤰🏾", "🤰🏿",
"🤱", "🤱🏻", "🤱🏼", "🤱🏽", "🤱🏾", "🤱🏿",
"🙇♀", "🙇🏻♀", "🙇🏼♀", "🙇🏽♀", "🙇🏾♀", "🙇🏿♀",
"🙇", "🙇🏻", "🙇🏼", "🙇🏽", "🙇🏾", "🙇🏿",
"🙇♂", "🙇🏻♂", "🙇🏼♂", "🙇🏽♂", "🙇🏾♂", "🙇🏿♂",
"💁♀", "💁🏻♀", "💁🏼♀", "💁🏽♀", "💁🏾♀", "💁🏿♀",
"💁", "💁🏻", "💁🏼", "💁🏽", "💁🏾", "💁🏿",
"💁♂", "💁🏻♂", "💁🏼♂", "💁🏽♂", "💁🏾♂", "💁🏿♂",
"🙅♀", "🙅🏻♀", "🙅🏼♀", "🙅🏽♀", "🙅🏾♀", "🙅🏿♀",
"🙅", "🙅🏻", "🙅🏼", "🙅🏽", "🙅🏾", "🙅🏿",
"🙅♂", "🙅🏻♂", "🙅🏼♂", "🙅🏽♂", "🙅🏾♂", "🙅🏿♂",
"🙆♀", "🙆🏻♀", "🙆🏼♀", "🙆🏽♀", "🙆🏾♀", "🙆🏿♀",
"🙆", "🙆🏻", "🙆🏼", "🙆🏽", "🙆🏾", "🙆🏿",
"🙆♂", "🙆🏻♂", "🙆🏼♂", "🙆🏽♂", "🙆🏾♂", "🙆🏿♂",
"🙋♀", "🙋🏻♀", "🙋🏼♀", "🙋🏽♀", "🙋🏾♀", "🙋🏿♀",
"🙋", "🙋🏻", "🙋🏼", "🙋🏽", "🙋🏾", "🙋🏿",
"🙋♂", "🙋🏻♂", "🙋🏼♂", "🙋🏽♂", "🙋🏾♂", "🙋🏿♂",
"🧏♀", "🧏🏻♀", "🧏🏼♀", "🧏🏽♀", "🧏🏾♀", "🧏🏿♀",
"🧏", "🧏🏻", "🧏🏼", "🧏🏽", "🧏🏾", "🧏🏿",
"🧏♂", "🧏🏻♂", "🧏🏼♂", "🧏🏽♂", "🧏🏾♂", "🧏🏿♂",
"🤦♀", "🤦🏻♀", "🤦🏼♀", "🤦🏽♀", "🤦🏾♀", "🤦🏿♀",
"🤦", "🤦🏻", "🤦🏼", "🤦🏽", "🤦🏾", "🤦🏿",
"🤦♂", "🤦🏻♂", "🤦🏼♂", "🤦🏽♂", "🤦🏾♂", "🤦🏿♂",
"🤷♀", "🤷🏻♀", "🤷🏼♀", "🤷🏽♀", "🤷🏾♀", "🤷🏿♀",
"🤷", "🤷🏻", "🤷🏼", "🤷🏽", "🤷🏾", "🤷🏿",
"🤷♂", "🤷🏻♂", "🤷🏼♂", "🤷🏽♂", "🤷🏾♂", "🤷🏿♂",
"🙎♀", "🙎🏻♀", "🙎🏼♀", "🙎🏽♀", "🙎🏾♀", "🙎🏿♀",
"🙎", "🙎🏻", "🙎🏼", "🙎🏽", "🙎🏾", "🙎🏿",
"🙎♂", "🙎🏻♂", "🙎🏼♂", "🙎🏽♂", "🙎🏾♂", "🙎🏿♂",
"🙍♀", "🙍🏻♀", "🙍🏼♀", "🙍🏽♀", "🙍🏾♀", "🙍🏿♀",
"🙍", "🙍🏻", "🙍🏼", "🙍🏽", "🙍🏾", "🙍🏿",
"🙍♂", "🙍🏻♂", "🙍🏼♂", "🙍🏽♂", "🙍🏾♂", "🙍🏿♂",
"💇♀", "💇🏻♀", "💇🏼♀", "💇🏽♀", "💇🏾♀", "💇🏿♀",
"💇", "💇🏻", "💇🏼", "💇🏽", "💇🏾", "💇🏿",
"💇♂", "💇🏻♂", "💇🏼♂", "💇🏽♂", "💇🏾♂", "💇🏿♂",
"💆♀", "💆🏻♀", "💆🏼♀", "💆🏽♀", "💆🏾♀", "💆🏿♀",
"💆", "💆🏻", "💆🏼", "💆🏽", "💆🏾", "💆🏿",
"💆♂", "💆🏻♂", "💆🏼♂", "💆🏽♂", "💆🏾♂", "💆🏿♂",
"🧖♀", "🧖🏻♀", "🧖🏼♀", "🧖🏽♀", "🧖🏾♀", "🧖🏿♀",
"🧖", "🧖🏻", "🧖🏼", "🧖🏽", "🧖🏾", "🧖🏿",
"🧖♂", "🧖🏻♂", "🧖🏼♂", "🧖🏽♂", "🧖🏾♂", "🧖🏿♂",
"💅", "💅🏻", "💅🏼", "💅🏽", "💅🏾", "💅🏿",
"🤳", "🤳🏻", "🤳🏼", "🤳🏽", "🤳🏾", "🤳🏿",
"💃", "💃🏻", "💃🏼", "💃🏽", "💃🏾", "💃🏿",
"🕺", "🕺🏻", "🕺🏼", "🕺🏽", "🕺🏾", "🕺🏿",
"👯♀", "👯", "👯♂",
"🕴", "🕴🏻", "🕴🏼", "🕴🏽", "🕴🏾", "🕴🏿",
"👩🦽", "👩🏻🦽", "👩🏼🦽", "👩🏽🦽", "👩🏾🦽", "👩🏿🦽",
"🧑🦽", "🧑🏻🦽", "🧑🏼🦽", "🧑🏽🦽", "🧑🏾🦽", "🧑🏿🦽",
"👨🦽", "👨🏻🦽", "👨🏼🦽", "👨🏽🦽", "👨🏾🦽", "👨🏿🦽",
"👩🦼", "👩🏻🦼", "👩🏼🦼", "👩🏽🦼", "👩🏾🦼", "👩🏿🦼",
"🧑🦼", "🧑🏻🦼", "🧑🏼🦼", "🧑🏽🦼", "🧑🏾🦼", "🧑🏿🦼",
"👨🦼", "👨🏻🦼", "👨🏼🦼", "👨🏽🦼", "👨🏾🦼", "👨🏿🦼",
"🚶♀", "🚶🏻♀", "🚶🏼♀", "🚶🏽♀", "🚶🏾♀", "🚶🏿♀",
"🚶", "🚶🏻", "🚶🏼", "🚶🏽", "🚶🏾", "🚶🏿",
"🚶♂", "🚶🏻♂", "🚶🏼♂", "🚶🏽♂", "🚶🏾♂", "🚶🏿♂",
"👩🦯", "👩🏻🦯", "👩🏼🦯", "👩🏽🦯", "👩🏾🦯", "👩🏿🦯",
"🧑🦯", "🧑🏻🦯", "🧑🏼🦯", "🧑🏽🦯", "🧑🏾🦯", "🧑🏿🦯",
"👨🦯", "👨🏻🦯", "👨🏼🦯", "👨🏽🦯", "👨🏾🦯", "👨🏿🦯",
"🧎♀", "🧎🏻♀", "🧎🏼♀", "🧎🏽♀", "🧎🏾♀", "🧎🏿♀",
"🧎", "🧎🏻", "🧎🏼", "🧎🏽", "🧎🏾", "🧎🏿",
"🧎♂", "🧎🏻♂", "🧎🏼♂", "🧎🏽♂", "🧎🏾♂", "🧎🏿♂",
"🏃♀", "🏃🏻♀", "🏃🏼♀", "🏃🏽♀", "🏃🏾♀", "🏃🏿♀",
"🏃", "🏃🏻", "🏃🏼", "🏃🏽", "🏃🏾", "🏃🏿",
"🏃♂", "🏃🏻♂", "🏃🏼♂", "🏃🏽♂", "🏃🏾♂", "🏃🏿♂",
"🧍♀", "🧍🏻♀", "🧍🏼♀", "🧍🏽♀", "🧍🏾♀", "🧍🏿♀",
"🧍", "🧍🏻", "🧍🏼", "🧍🏽", "🧍🏾", "🧍🏿",
"🧍♂", "🧍🏻♂", "🧍🏼♂", "🧍🏽♂", "🧍🏾♂", "🧍🏿♂",
"👫", "👫🏻", "👩🏻🤝👨🏼", "👩🏻🤝👨🏽", "👩🏻🤝👨🏾", "👩🏻🤝👨🏿", "👩🏼🤝👨🏻", "👫🏼", "👩🏼🤝👨🏽", "👩🏼🤝👨🏾", "👩🏼🤝👨🏿", "👩🏽🤝👨🏻", "👩🏽🤝👨🏼", "👫🏽", "👩🏽🤝👨🏾", "👩🏽🤝👨🏿", "👩🏾🤝👨🏻", "👩🏾🤝👨🏼", "👩🏾🤝👨🏽", "👫🏾", "👩🏾🤝👨🏿", "👩🏿🤝👨🏻", "👩🏿🤝👨🏼", "👩🏿🤝👨🏽", "👩🏿🤝👨🏾", "👫🏿",
"👭", "👭🏻", "👩🏻🤝👩🏼", "👩🏻🤝👩🏽", "👩🏻🤝👩🏾", "👩🏻🤝👩🏿", "👩🏼🤝👩🏻", "👭🏼", "👩🏼🤝👩🏽", "👩🏼🤝👩🏾", "👩🏼🤝👩🏿", "👩🏽🤝👩🏻", "👩🏽🤝👩🏼", "👭🏽", "👩🏽🤝👩🏾", "👩🏽🤝👩🏿", "👩🏾🤝👩🏻", "👩🏾🤝👩🏼", "👩🏾🤝👩🏽", "👭🏾", "👩🏾🤝👩🏿", "👩🏿🤝👩🏻", "👩🏿🤝👩🏼", "👩🏿🤝👩🏽", "👩🏿🤝👩🏾", "👭🏿",
"👬", "👬🏻", "👨🏻🤝👨🏼", "👨🏻🤝👨🏽", "👨🏻🤝👨🏾", "👨🏻🤝👨🏿", "👨🏼🤝👨🏻", "👬🏼", "👨🏼🤝👨🏽", "👨🏼🤝👨🏾", "👨🏼🤝👨🏿", "👨🏽🤝👨🏻", "👨🏽🤝👨🏼", "👬🏽", "👨🏽🤝👨🏾", "👨🏽🤝👨🏿", "👨🏾🤝👨🏻", "👨🏾🤝👨🏼", "👨🏾🤝👨🏽", "👬🏾", "👨🏾🤝👨🏿", "👨🏿🤝👨🏻", "👨🏿🤝👨🏼", "👨🏿🤝👨🏽", "👨🏿🤝👨🏾", "👬🏿",
"👩❤👨", "👩❤👩", "👨❤👨", "👩❤💋👨", "👩❤💋👩", "👨❤💋👨", "👨👩👦", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧", "👩👩👦", "👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦", "👨👨👧👧", "👩👦", "👩👧", "👩👧👦", "👩👦👦", "👩👧👧", "👨👦", "👨👧", "👨👧👦", "👨👦👦", "👨👧👧", "🧶", "🧵", "🧥", "🥼", "🦺", "👚", "👕", "👖", "🩲", "🩳", "👔", "👗", "👙", "👘", "🥻", "🩱", "🥿", "👠", "👡", "👢", "👞", "👟", "🥾", "🧦", "🧤", "🧣", "🎩", "🧢", "👒", "🎓", "⛑", "👑", "💍", "👝", "👛", "👜", "💼", "🎒", "🧳", "👓", "🕶", "🥽", "🌂"
},
new String[]{
"🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐽", "🐸", "🐵", "🙈", "🙉", "🙊", "🐒", "🐔", "🐧", "🐦", "🐤", "🐣", "🐥", "🦆", "🦅", "🦉", "🦇", "🐺", "🐗", "🐴", "🦄", "🐝", "🐛", "🦋", "🐌", "🐞", "🐜", "🦟", "🦗", "🕷", "🕸", "🦂", "🐢", "🐍", "🦎", "🦖", "🦕", "🐙", "🦑", "🦐", "🦞", "🦀", "🐡", "🐠", "🐟", "🐬", "🐳", "🐋", "🦈", "🐊", "🐅", "🐆", "🦓", "🦍", "🦧", "🐘", "🦛", "🦏", "🐪", "🐫", "🦒", "🦘", "🐃", "🐂", "🐄", "🐎", "🐖", "🐏", "🐑", "🦙", "🐐", "🦌", "🐕", "🐩", "🦮", "🐕🦺", "🐈", "🐓", "🦃", "🦚", "🦜", "🦢", "🦩", "🕊", "🐇", "🦝", "🦨", "🦡", "🦦", "🦥", "🐁", "🐀", "🐿", "🦔", "🐾", "🐉", "🐲", "🌵", "🎄", "🌲", "🌳", "🌴", "🌱", "🌿", "☘", "🍀", "🎍", "🎋", "🍃", "🍂", "🍁", "🍄", "🐚", "🌾", "💐", "🌷", "🌹", "🥀", "🌺", "🌸", "🌼", "🌻", "🌞", "🌝", "🌛", "🌜", "🌚", "🌕", "🌖", "🌗", "🌘", "🌑", "🌒", "🌓", "🌔", "🌙", "🌎", "🌍", "🌏", "🪐", "💫", "⭐", "🌟", "✨", "⚡", "☄", "💥", "🔥", "🌪", "🌈", "☀", "🌤", "⛅", "🌥", "☁", "🌦", "🌧", "⛈", "🌩", "🌨", "❄", "☃", "⛄", "🌬", "💨", "💧", "💦", "☔", "☂", "🌊", "🌫"
},
new String[]{
"🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍈", "🍒", "🍑", "🥭", "🍍", "🥥", "🥝", "🍅", "🍆", "🥑", "🥦", "🥬", "🥒", "🌶", "🌽", "🥕", "🧄", "🧅", "🥔", "🍠", "🥐", "🥯", "🍞", "🥖", "🥨", "🧀", "🥚", "🍳", "🧈", "🥞", "🧇", "🥓", "🥩", "🍗", "🍖", "🦴", "🌭", "🍔", "🍟", "🍕", "🥪", "🥙", "🧆", "🌮", "🌯", "🥗", "🥘", "🥫", "🍝", "🍜", "🍲", "🍛", "🍣", "🍱", "🥟", "🦪", "🍤", "🍙", "🍚", "🍘", "🍥", "🥠", "🥮", "🍢", "🍡", "🍧", "🍨", "🍦", "🥧", "🧁", "🍰", "🎂", "🍮", "🍭", "🍬", "🍫", "🍿", "🍩", "🍪", "🌰", "🥜", "🍯", "🥛", "🍼", "☕", "🍵", "🧃", "🥤", "🍶", "🍺", "🍻", "🥂", "🍷", "🥃", "🍸", "🍹", "🧉", "🍾", "🧊", "🥄", "🍴", "🍽", "🥣", "🥡", "🥢", "🧂"
},
new String[]{
"⚽", "🏀", "🏈", "⚾", "🥎", "🎾", "🏐", "🏉", "🥏", "🎱", "🪀", "🏓", "🏸", "🏒", "🏑", "🥍", "🏏", "🥅", "⛳", "🪁", "🏹", "🎣", "🤿", "🥊", "🥋", "🎽", "🛹", "🛷", "⛸", "🥌", "🎿", "⛷", "🏂", "🪂",
"🏋♀", "🏋🏻♀", "🏋🏼♀", "🏋🏽♀", "🏋🏾♀", "🏋🏿♀",
"🏋", "🏋🏻", "🏋🏼", "🏋🏽", "🏋🏾", "🏋🏿",
"🏋♂", "🏋🏻♂", "🏋🏼♂", "🏋🏽♂", "🏋🏾♂", "🏋🏿♂",
"🤼♀", "🤼", "🤼♂",
"🤸♀", "🤸🏻♀", "🤸🏼♀", "🤸🏽♀", "🤸🏾♀", "🤸🏿♀",
"🤸", "🤸🏻", "🤸🏼", "🤸🏽", "🤸🏾", "🤸🏿",
"🤸♂", "🤸🏻♂", "🤸🏼♂", "🤸🏽♂", "🤸🏾♂", "🤸🏿♂",
"⛹♀", "⛹🏻♀", "⛹🏼♀", "⛹🏽♀", "⛹🏾♀", "⛹🏿♀",
"⛹", "⛹🏻", "⛹🏼", "⛹🏽", "⛹🏾", "⛹🏿",
"⛹♂", "⛹🏻♂", "⛹🏼♂", "⛹🏽♂", "⛹🏾♂", "⛹🏿♂",
"🤺",
"🤾♀", "🤾🏻♀", "🤾🏼♀", "🤾🏽♀", "🤾🏾♀", "🤾🏿♀",
"🤾", "🤾🏻", "🤾🏼", "🤾🏽", "🤾🏾", "🤾🏿",
"🤾♂", "🤾🏻♂", "🤾🏼♂", "🤾🏽♂", "🤾🏾♂", "🤾🏿♂",
"🏌♀", "🏌🏻♀", "🏌🏼♀", "🏌🏽♀", "🏌🏾♀", "🏌🏿♀",
"🏌", "🏌🏻", "🏌🏼", "🏌🏽", "🏌🏾", "🏌🏿",
"🏌♂", "🏌🏻♂", "🏌🏼♂", "🏌🏽♂", "🏌🏾♂", "🏌🏿♂",
"🏇", "🏇🏻", "🏇🏼", "🏇🏽", "🏇🏾", "🏇🏿",
"🧘♀", "🧘🏻♀", "🧘🏼♀", "🧘🏽♀", "🧘🏾♀", "🧘🏿♀",
"🧘", "🧘🏻", "🧘🏼", "🧘🏽", "🧘🏾", "🧘🏿",
"🧘♂", "🧘🏻♂", "🧘🏼♂", "🧘🏽♂", "🧘🏾♂", "🧘🏿♂",
"🏄♀", "🏄🏻♀", "🏄🏼♀", "🏄🏽♀", "🏄🏾♀", "🏄🏿♀",
"🏄", "🏄🏻", "🏄🏼", "🏄🏽", "🏄🏾", "🏄🏿",
"🏄♂", "🏄🏻♂", "🏄🏼♂", "🏄🏽♂", "🏄🏾♂", "🏄🏿♂",
"🏊♀", "🏊🏻♀", "🏊🏼♀", "🏊🏽♀", "🏊🏾♀", "🏊🏿♀",
"🏊", "🏊🏻", "🏊🏼", "🏊🏽", "🏊🏾", "🏊🏿",
"🏊♂", "🏊🏻♂", "🏊🏼♂", "🏊🏽♂", "🏊🏾♂", "🏊🏿♂",
"🤽♀", "🤽🏻♀", "🤽🏼♀", "🤽🏽♀", "🤽🏾♀", "🤽🏿♀",
"🤽", "🤽🏻", "🤽🏼", "🤽🏽", "🤽🏾", "🤽🏿",
"🤽♂", "🤽🏻♂", "🤽🏼♂", "🤽🏽♂", "🤽🏾♂", "🤽🏿♂",
"🚣♀", "🚣🏻♀", "🚣🏼♀", "🚣🏽♀", "🚣🏾♀", "🚣🏿♀",
"🚣", "🚣🏻", "🚣🏼", "🚣🏽", "🚣🏾", "🚣🏿",
"🚣♂", "🚣🏻♂", "🚣🏼♂", "🚣🏽♂", "🚣🏾♂", "🚣🏿♂",
"🧗♀", "🧗🏻♀", "🧗🏼♀", "🧗🏽♀", "🧗🏾♀", "🧗🏿♀",
"🧗", "🧗🏻", "🧗🏼", "🧗🏽", "🧗🏾", "🧗🏿",
"🧗♂", "🧗🏻♂", "🧗🏼♂", "🧗🏽♂", "🧗🏾♂", "🧗🏿♂",
"🚵♀", "🚵🏻♀", "🚵🏼♀", "🚵🏽♀", "🚵🏾♀", "🚵🏿♀",
"🚵", "🚵🏻", "🚵🏼", "🚵🏽", "🚵🏾", "🚵🏿",
"🚵♂", "🚵🏻♂", "🚵🏼♂", "🚵🏽♂", "🚵🏾♂", "🚵🏿♂",
"🚴♀", "🚴🏻♀", "🚴🏼♀", "🚴🏽♀", "🚴🏾♀", "🚴🏿♀",
"🚴", "🚴🏻", "🚴🏼", "🚴🏽", "🚴🏾", "🚴🏿",
"🚴♂", "🚴🏻♂", "🚴🏼♂", "🚴🏽♂", "🚴🏾♂", "🚴🏿♂",
"🏆", "🥇", "🥈", "🥉", "🏅", "🎖", "🏵", "🎗", "🎫", "🎟", "🎪",
"🤹♀", "🤹🏻♀", "🤹🏼♀", "🤹🏽♀", "🤹🏾♀", "🤹🏿♀",
"🤹", "🤹🏻", "🤹🏼", "🤹🏽", "🤹🏾", "🤹🏿",
"🤹♂", "🤹🏻♂", "🤹🏼♂", "🤹🏽♂", "🤹🏾♂", "🤹🏿♂",
"🎭", "🩰", "🎨", "🎬", "🎤", "🎧", "🎼", "🎹", "🥁", "🎷", "🎺", "🎸", "🪕", "🎻", "🎲", "♟", "🎯", "🎳", "🎮", "🎰", "🧩"
},
new String[]{
"🚗", "🚕", "🚙", "🚌", "🚎", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚛", "🚜", "🦯", "🦽", "🦼", "🛴", "🚲", "🛵", "🏍", "🛺", "🚨", "🚔", "🚍", "🚘", "🚖", "🚡", "🚠", "🚟", "🚃", "🚋", "🚞", "🚝", "🚄", "🚅", "🚈", "🚂", "🚆", "🚇", "🚊", "🚉", "✈", "🛫", "🛬", "🛩", "💺", "🛰", "🚀", "🛸", "🚁", "🛶", "⛵", "🚤", "🛥", "🛳", "⛴", "🚢", "⚓", "⛽", "🚧", "🚦", "🚥", "🚏", "🗺", "🗿", "🗽", "🗼", "🏰", "🏯", "🏟", "🎡", "🎢", "🎠", "⛲", "⛱", "🏖", "🏝", "🏜", "🌋", "⛰", "🏔", "🗻", "🏕", "⛺", "🏠", "🏡", "🏘", "🏚", "🏗", "🏭", "🏢", "🏬", "🏣", "🏤", "🏥", "🏦", "🏨", "🏪", "🏫", "🏩", "💒", "🏛", "⛪", "🕌", "🕍", "🛕", "🕋", "⛩", "🛤", "🛣", "🗾", "🎑", "🏞", "🌅", "🌄", "🌠", "🎇", "🎆", "🌇", "🌆", "🏙", "🌃", "🌌", "🌉", "🌁"
},
new String[]{
"⌚", "📱", "📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽", "💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞", "📞", "☎", "📟", "📠", "📺", "📻", "🎙", "🎚", "🎛", "🧭", "⏱", "⏲", "⏰", "🕰", "⌛", "⏳", "📡", "🔋", "🔌", "💡", "🔦", "🕯", "🪔", "🧯", "🛢", "💸", "💵", "💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🧰", "🔧", "🔨", "⚒", "🛠", "⛏", "🔩", "⚙", "🧱", "⛓", "🧲", "🔫", "💣", "🧨", "🪓", "🔪", "🗡", "⚔", "🛡", "🚬", "⚰", "⚱", "🏺", "🔮", "📿", "🧿", "💈", "⚗", "🔭", "🔬", "🕳", "🩹", "🩺", "💊", "💉", "🩸", "🧬", "🦠", "🧫", "🧪", "🌡", "🧹", "🧺", "🧻", "🚽", "🚰", "🚿", "🛁",
"🛀", "🛀🏻", "🛀🏼", "🛀🏽", "🛀🏾", "🛀🏿",
"🧼", "🪒", "🧽", "🧴", "🛎", "🔑", "🗝", "🚪", "🪑", "🛋", "🛏", "🛌", "🧸", "🖼", "🛍", "🛒", "🎁", "🎈", "🎏", "🎀", "🎊", "🎉", "🎎", "🏮", "🎐", "🧧", "✉", "📩", "📨", "📧", "💌", "📥", "📤", "📦", "🏷", "📪", "📫", "📬", "📭", "📮", "📯", "📜", "📃", "📄", "📑", "🧾", "📊", "📈", "📉", "🗒", "🗓", "📆", "📅", "🗑", "📇", "🗃", "🗳", "🗄", "📋", "📁", "📂", "🗂", "🗞", "📰", "📓", "📔", "📒", "📕", "📗", "📘", "📙", "📚", "📖", "🔖", "🧷", "🔗", "📎", "🖇", "📐", "📏", "🧮", "📌", "📍", "✂", "🖊", "🖋", "✒", "🖌", "🖍", "📝", "✏", "🔍", "🔎", "🔏", "🔐", "🔒", "🔓"
},
new String[]{
"❤", "🧡", "💛", "💚", "💙", "💜", "🖤", "🤍", "🤎", "💔", "❣", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "💟", "☮", "✝", "☪", "🕉", "☸", "✡", "🔯", "🕎", "☯", "☦", "🛐", "⛎", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "🆔", "⚛", "🉑", "☢", "☣", "📴", "📳", "🈶", "🈚", "🈸", "🈺", "🈷", "✴", "🆚", "💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈹", "🈲", "🅰", "🅱", "🆎", "🆑", "🅾", "🆘", "❌", "⭕", "🛑", "⛔", "📛", "🚫", "💯", "💢", "♨", "🚷", "🚯", "🚳", "🚱", "🔞", "📵", "🚭", "❗", "❕", "❓", "❔", "‼", "⁉", "🔅", "🔆", "〽", "⚠", "🚸", "🔱", "⚜", "🔰", "♻", "✅", "🈯", "💹", "❇", "✳", "❎", "🌐", "💠", "Ⓜ", "🌀", "💤", "🏧", "🚾", "♿", "🅿", "🈳", "🈂", "🛂", "🛃", "🛄", "🛅", "🚹", "🚺", "🚼", "🚻", "🚮", "🎦", "📶", "🈁", "🔣", "ℹ", "🔤", "🔡", "🔠", "🆖", "🆗", "🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢", "#⃣", "*⃣", "⏏", "▶", "⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "⏫", "⏬", "◀", "🔼", "🔽", "➡", "⬅", "⬆", "⬇", "↗", "↘", "↙", "↖", "↕", "↔", "↪", "↩", "⤴", "⤵", "🔀", "🔁", "🔂", "🔄", "🔃", "🎵", "🎶", "➕", "➖", "➗", "✖", "♾", "💲", "💱", "™", "©", "®", "👁🗨", "🔚", "🔙", "🔛", "🔝", "🔜", "〰", "➰", "➿", "✔", "☑", "🔘", "🔴", "🟠", "🟡", "🟢", "🔵", "🟣", "⚫", "⚪", "🟤", "🔺", "🔻", "🔸", "🔹", "🔶", "🔷", "🔳", "🔲", "▪", "▫", "◾", "◽", "◼", "◻", "🟥", "🟧", "🟨", "🟩", "🟦", "🟪", "⬛", "⬜", "🟫", "🔈", "🔇", "🔉", "🔊", "🔔", "🔕", "📣", "📢", "💬", "💭", "🗯", "♠", "♣", "♥", "♦", "🃏", "🎴", "🀄", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚", "🕛", "🕜", "🕝", "🕞", "🕟", "🕠", "🕡", "🕢", "🕣", "🕤", "🕥", "🕦", "🕧"
},
new String[]{
"🏳", "🏴", "🏴☠", "🏁", "🚩", "🏳🌈", "🇺🇳", "🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦🇴", "🇦🇮", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇺", "🇦🇹", "🇦🇿", "🇧🇸", "🇧🇭", "🇧🇩", "🇧🇧", "🇧🇾", "🇧🇪", "🇧🇿", "🇧🇯", "🇧🇲", "🇧🇹", "🇧🇴", "🇧🇦", "🇧🇼", "🇧🇷", "🇮🇴", "🇻🇬", "🇧🇳", "🇧🇬", "🇧🇫", "🇧🇮", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨", "🇨🇻", "🇧🇶", "🇰🇾", "🇨🇫", "🇹🇩", "🇨🇱", "🇨🇳", "🇨🇽", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩", "🇨🇰", "🇨🇷", "🇨🇮", "🇭🇷", "🇨🇺", "🇨🇼", "🇨🇾", "🇨🇿", "🇩🇰", "🇩🇯", "🇩🇲", "🇩🇴", "🇪🇨", "🇪🇬", "🇸🇻", "🇬🇶", "🇪🇷", "🇪🇪", "🇸🇿", "🇪🇹", "🇪🇺", "🇫🇰", "🇫🇴", "🇫🇯", "🇫🇮", "🇫🇷", "🇬🇫", "🇵🇫", "🇹🇫", "🇬🇦", "🇬🇲", "🇬🇪", "🇩🇪", "🇬🇭", "🇬🇮", "🇬🇷", "🇬🇱", "🇬🇩", "🇬🇵", "🇬🇺", "🇬🇹", "🇬🇬", "🇬🇳", "🇬🇼", "🇬🇾", "🇭🇹", "🇭🇳", "🇭🇰", "🇭🇺", "🇮🇸", "🇮🇳", "🇮🇩", "🇮🇷", "🇮🇶", "🇮🇪", "🇮🇲", "🇮🇱", "🇮🇹", "🇯🇲", "🇯🇵", "🎌", "🇯🇪", "🇯🇴", "🇰🇿", "🇰🇪", "🇰🇮", "🇽🇰", "🇰🇼", "🇰🇬", "🇱🇦", "🇱🇻", "🇱🇧", "🇱🇸", "🇱🇷", "🇱🇾", "🇱🇮", "🇱🇹", "🇱🇺", "🇲🇴", "🇲🇬", "🇲🇼", "🇲🇾", "🇲🇻", "🇲🇱", "🇲🇹", "🇲🇭", "🇲🇶", "🇲🇷", "🇲🇺", "🇾🇹", "🇲🇽", "🇫🇲", "🇲🇩", "🇲🇨", "🇲🇳", "🇲🇪", "🇲🇸", "🇲🇦", "🇲🇿", "🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇱", "🇳🇨", "🇳🇿", "🇳🇮", "🇳🇪", "🇳🇬", "🇳🇺", "🇳🇫", "🇰🇵", "🇲🇰", "🇲🇵", "🇳🇴", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦", "🇵🇬", "🇵🇾", "🇵🇪", "🇵🇭", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇶🇦", "🇷🇪", "🇷🇴", "🇷🇺", "🇷🇼", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇳", "🇷🇸", "🇸🇨", "🇸🇱", "🇸🇬", "🇸🇽", "🇸🇰", "🇸🇮", "🇬🇸", "🇸🇧", "🇸🇴", "🇿🇦", "🇰🇷", "🇸🇸", "🇪🇸", "🇱🇰", "🇧🇱", "🇸🇭", "🇰🇳", "🇱🇨", "🇵🇲", "🇻🇨", "🇸🇩", "🇸🇷", "🇸🇪", "🇨🇭", "🇸🇾", "🇹🇼", "🇹🇯", "🇹🇿", "🇹🇭", "🇹🇱", "🇹🇬", "🇹🇰", "🇹🇴", "🇹🇹", "🇹🇳", "🇹🇷", "🇹🇲", "🇹🇨", "🇹🇻", "🇻🇮", "🇺🇬", "🇺🇦", "🇦🇪", "🇬🇧", "🏴", "🏴", "🏴", "🇺🇸", "🇺🇾", "🇺🇿", "🇻🇺", "🇻🇦", "🇻🇪", "🇻🇳", "🇼🇫", "🇪🇭", "🇾🇪", "🇿🇲", "🇿🇼"
}
};
public static final HashMap<Character, Boolean> emojiToFE0FMap = new HashMap<>(emojiToFE0F.length);
public static final HashMap<Character, Boolean> dataCharsMap = new HashMap<>(dataChars.length);
public static final HashSet<String> emojiColoredMap = new HashSet<>(emojiColored.length);
public static final HashSet<String> emojiBigColoredMap = new HashSet<>(emojiBigColored.length);
public static final HashMap<CharSequence, CharSequence> emojiAliasMap = new HashMap<>(aliasNew.length);
static {
for (int a = 0; a < emojiToFE0F.length; a++) {
emojiToFE0FMap.put(emojiToFE0F[a], true);
}
for (int a = 0; a < dataChars.length; a++) {
dataCharsMap.put(dataChars[a], true);
}
Collections.addAll(emojiColoredMap, emojiColored);
Collections.addAll(emojiBigColoredMap, emojiBigColored);
for (int a = 0; a < aliasNew.length; a++) {
emojiAliasMap.put(aliasOld[a], aliasNew[a]);
}
for (int a = 0; a < dataColored.length; a++) {
if (dataColored[a] == null) {
dataColored[a] = data[a];
}
}
}
private EmojiData(){}
public static boolean isHeartEmoji(String emoji) {
return "❤".equals(emoji) || "🧡".equals(emoji) || "💛".equals(emoji) || "💚".equals(emoji) || "💙".equals(emoji) || "💜".equals(emoji) || "🖤".equals(emoji) || "🤍".equals(emoji) || "🤎".equals(emoji);
}
public static String[] getHeartEmojis(){
return new String[]{"❤" , "🧡" , "💛" , "💚" , "💙" , "💜" , "🖤" , "🤍" , "🤎" , "♥" , "💔" , "❣" , "💕" , "💞" , "💓" , "💗" , "💖" , "💘" ,"💝"};
}
public static boolean isPeachEmoji(String emoji) {
return "\uD83C\uDF51".equals(emoji);
}
public static final String[] titles = new String[]{
"Smileys and people",
"Animals and nature",
"Food and drink",
"Activity",
"Travel and places",
"Objects",
"Symbols",
"Flags"
};
public static String getEmojiColor(String code) {
String color = null;
String toCheck = code.replace("\uD83C\uDFFB", "");
if (!toCheck.equals(code)) {
color = "\uD83C\uDFFB";
}
if (color == null) {
toCheck = code.replace("\uD83C\uDFFC", "");
if (!toCheck.equals(code)) {
color = "\uD83C\uDFFC";
}
}
if (color == null) {
toCheck = code.replace("\uD83C\uDFFD", "");
if (!toCheck.equals(code)) {
color = "\uD83C\uDFFD";
}
}
if (color == null) {
toCheck = code.replace("\uD83C\uDFFE", "");
if (!toCheck.equals(code)) {
color = "\uD83C\uDFFE";
}
}
if (color == null) {
toCheck = code.replace("\uD83C\uDFFF", "");
if (!toCheck.equals(code)) {
color = "\uD83C\uDFFF";
}
}
return color;
}
public static String getBaseEmoji(String code) {
return code.replace("\uD83C\uDFFB", "")
.replace("\uD83C\uDFFC", "")
.replace("\uD83C\uDFFD", "")
.replace("\uD83C\uDFFE", "")
.replace("\uD83C\uDFFF", "");
}
public static boolean isColoredEmoji(String code) {
return emojiColoredMap.contains(getBaseEmoji(code));
}
public static String addColorToCode(String code, String color) {
code = getBaseEmoji(code);
String end = null;
int length = code.length();
if (length > 2 && code.charAt(code.length() - 2) == '\u200D') {
end = code.substring(code.length() - 2);
code = code.substring(0, code.length() - 2);
} else if (length > 3 && code.charAt(code.length() - 3) == '\u200D') {
end = code.substring(code.length() - 3);
code = code.substring(0, code.length() - 3);
}
code += color;
if (end != null) {
code += end;
}
return code;
}
public static String getColorCode (@IntRange(from = 1,to = 5) int index){
switch (index) {
case 1:
return "\uD83C\uDFFB";
case 2:
return "\uD83C\uDFFC";
case 3:
return "\uD83C\uDFFD";
case 4:
return "\uD83C\uDFFE";
case 5:
return "\uD83C\uDFFF";
}
return "";
}
}
| 103,819 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiLoader.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/AXEmojiLoader.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji;
import org.mark.axemojiview.view.AXEmojiImageView;
public interface AXEmojiLoader {
void loadEmoji(AXEmojiImageView imageView, Emoji emoji);
}
| 801 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
Emoji.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/Emoji.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
public class Emoji implements Serializable {
private static final long serialVersionUID = 3L;
private static final List<Emoji> EMPTY_EMOJI_LIST = emptyList();
@NonNull
private final String unicode;
@DrawableRes
private final int resource;
@NonNull
private List<Emoji> variants;
@Nullable
private Emoji base;
public Emoji(@NonNull final int[] codePoints, @DrawableRes final int resource) {
this(codePoints, resource, new Emoji[0]);
}
public Emoji(final int codePoint, @DrawableRes final int resource) {
this(codePoint, resource, new Emoji[0]);
}
public Emoji(final int codePoint, @DrawableRes final int resource,
final Emoji... variants) {
this(new int[]{codePoint}, resource, variants);
}
public Emoji(@NonNull final int[] codePoints, @DrawableRes final int resource, final Emoji... variants) {
this.unicode = new String(codePoints, 0, codePoints.length);
this.resource = resource;
this.variants = variants.length == 0 ? EMPTY_EMOJI_LIST : asList(variants);
for (final Emoji variant : variants) {
variant.base = this;
}
}
public Emoji(String code, int resource, final Emoji[] variants) {
this.unicode = code;
this.resource = resource;
this.variants = variants.length == 0 ? EMPTY_EMOJI_LIST : asList(variants);
for (final Emoji variant : variants) {
variant.base = this;
}
}
public Emoji(String code, int resource) {
this.unicode = code;
this.resource = resource;
this.variants = EMPTY_EMOJI_LIST;
}
public void setVariants(Emoji[] variants) {
this.variants = variants.length == 0 ? EMPTY_EMOJI_LIST : asList(variants);
for (final Emoji variant : variants) {
variant.base = this;
}
}
@NonNull
public String getUnicode() {
return unicode;
}
/**
* @deprecated Please migrate to getDrawable(). May return -1.
*/
@Deprecated
@DrawableRes
public int getResource() {
return resource;
}
@NonNull
public Drawable getDrawable(final Context context) {
return AppCompatResources.getDrawable(context, resource);
}
@NonNull
public Drawable getDrawable(View view) {
return AppCompatResources.getDrawable(view.getContext(), resource);
}
/**
* @return other variants of this emoji
*/
@NonNull
public List<Emoji> getVariants() {
return new ArrayList<>(variants);
}
/**
* @return the base of emoji, or this instance if it doesn't have any other base
*/
@NonNull
public Emoji getBase() {
Emoji result = this;
while (result.base != null) {
result = result.base;
}
return result;
}
public int getLength() {
return unicode.length();
}
public boolean hasVariants() {
return !variants.isEmpty();
}
public void destroy() {
// For inheritors to override.
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Emoji emoji = (Emoji) o;
return unicode.equals(emoji.unicode);
}
@Override
public int hashCode() {
int result = unicode.hashCode();
result = 31 * result + resource;
result = 31 * result + variants.hashCode();
return result;
}
@Override
public String toString() {
return getUnicode();
}
public Bitmap getEmojiBitmap() {
return null;
}
public boolean isLoading() {
return false;
}
}
| 4,951 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiCategory.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/EmojiCategory.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
/**
* Interface for defining emoji category.
*/
public interface EmojiCategory {
/**
* Returns all of the emojis it can display.
*/
@NonNull
Emoji[] getEmojis();
/**
* Returns the icon of the category that should be displayed.
*/
@DrawableRes
int getIcon();
/**
* Returns title of the category
*/
CharSequence getTitle();
}
| 1,120 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiProvider.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/EmojiProvider.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji;
import androidx.annotation.NonNull;
public interface EmojiProvider {
@NonNull
EmojiCategory[] getCategories();
void destroy();
}
| 796 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXIOSEmojiReplacer.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/iosprovider/AXIOSEmojiReplacer.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji.iosprovider;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.graphics.Paint;
import android.text.Spannable;
import android.view.View;
import androidx.annotation.NonNull;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.utils.EmojiRange;
import org.mark.axemojiview.utils.EmojiReplacer;
import org.mark.axemojiview.utils.EmojiSpan;
import org.mark.axemojiview.view.AXEmojiEditText;
public abstract class AXIOSEmojiReplacer implements EmojiReplacer {
@Override
public void replaceWithImages(final Context context, final View view, Spannable text, float emojiSize, Paint.FontMetrics fontMetrics) {
//AXEmojiLoader.replaceEmoji(text,fontMetrics,(int) emojiSize,false);
if (text.length() == 0) return;
final AXEmojiManager emojiManager = AXEmojiManager.getInstance();
final EmojiSpan[] existingSpans = text.getSpans(0, text.length(), EmojiSpan.class);
final List<Integer> existingSpanPositions = new ArrayList<>(existingSpans.length);
final int size = existingSpans.length;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < size; i++) {
existingSpanPositions.add(text.getSpanStart(existingSpans[i]));
}
List<EmojiRange> findAllEmojis = null;
if (existingSpanPositions.size() == 0) {
AXIOSEmojiLoader.replaceEmoji(text, fontMetrics, (int) emojiSize, false);
} else {
findAllEmojis = emojiManager.findAllEmojis(text);
for (int i = 0; i < findAllEmojis.size(); i++) {
final EmojiRange location = findAllEmojis.get(i);
if (!existingSpanPositions.contains(location.start)) {
List<AXIOSEmojiLoader.SpanLocation> list = AXIOSEmojiLoader.replaceEmoji2(location.emoji.getUnicode(), fontMetrics, (int) emojiSize, false, null);
for (AXIOSEmojiLoader.SpanLocation l : list) {
l.start = location.start + l.start;
l.end = location.start + l.end;
if (!existingSpanPositions.contains(l.start)) {
if (l.start == l.end) continue;
text.setSpan(l.span, l.start, l.end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
}
}
if (view != null) {
if (findAllEmojis == null) findAllEmojis = emojiManager.findAllEmojis(text);
postInvalidate(view, findAllEmojis);
}
}
private void postInvalidate(@NonNull final View view, @NonNull final List<EmojiRange> emojis) {
if (!checkEmojisState(emojis)) {
view.postDelayed(new Runnable() {
@Override
public void run() {
if (!checkEmojisState(emojis)) {
view.postDelayed(this, 20);
} else {
if (view instanceof AXEmojiEditText){
try {
int start = ((AXEmojiEditText) view).getSelectionStart();
int end = ((AXEmojiEditText) view).getSelectionEnd();
((AXEmojiEditText) view).setText(((AXEmojiEditText) view).getText());
((AXEmojiEditText) view).setSelection(start,end);
}catch (Exception ignore){
view.invalidate();
}
} else {
view.postInvalidate();
}
}
}
}, 20);
}
}
private boolean checkEmojisState(@NonNull final List<EmojiRange> emojis) {
for (int i = 0; i < emojis.size(); i++) {
final EmojiRange location = emojis.get(i);
if (location.emoji.isLoading()) return false;
}
return true;
}
}
| 4,698 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXIOSEmoji.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/iosprovider/AXIOSEmoji.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji.iosprovider;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiData;
@SuppressWarnings("serial")
public class AXIOSEmoji extends Emoji {
public AXIOSEmoji(final String code) {
super(code, -1);
boolean isVariants = EmojiData.isColoredEmoji(code);
if (isVariants) {
DispatchQueue run = new DispatchQueue("emoji");
run.postRunnable(new Runnable() {
@Override
public void run() {
AXIOSEmoji[] variants = new AXIOSEmoji[5];
for (int i = 0; i < 5; i++) {
String color = "";
switch (i) {
case 0:
color = "\uD83C\uDFFB";
break;
case 1:
color = "\uD83C\uDFFC";
break;
case 2:
color = "\uD83C\uDFFD";
break;
case 3:
color = "\uD83C\uDFFE";
break;
case 4:
color = "\uD83C\uDFFF";
break;
}
variants[i] = new AXIOSEmoji(EmojiData.addColorToCode(code, color), -1, 0);
}
setVariants(variants);
}
});
}
}
private AXIOSEmoji(String code, int resource, int count) {
super(code, resource, new Emoji[count]);
}
@NonNull
@Override
public Drawable getDrawable(final View view) {
return AXIOSEmojiLoader.getEmojiBigDrawable(getUnicode());
}
@NonNull
@Override
public Drawable getDrawable(final Context context) {
return AXIOSEmojiLoader.getEmojiBigDrawable(getUnicode());
}
public Drawable getDrawable() {
return AXIOSEmojiLoader.getEmojiBigDrawable(getUnicode());
}
public Drawable getDrawable(int size, boolean fullSize) {
return AXIOSEmojiLoader.getEmojiDrawable(getUnicode(), size, fullSize);
}
@Override
public Bitmap getEmojiBitmap() {
return AXIOSEmojiLoader.getEmojiBitmap(getUnicode());
}
@Override
public boolean isLoading() {
return getEmojiBitmap() == null;
}
}
| 3,310 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXIOSEmojiProvider.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/iosprovider/AXIOSEmojiProvider.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji.iosprovider;
import android.content.Context;
import androidx.annotation.NonNull;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiCategory;
import org.mark.axemojiview.emoji.EmojiData;
import org.mark.axemojiview.emoji.EmojiProvider;
public final class AXIOSEmojiProvider extends AXIOSEmojiReplacer implements EmojiProvider {
public static EmojiCategory[] emojiCategories = null;
public AXIOSEmojiProvider(Context context) {
AXIOSEmojiLoader.init(context);
if (emojiCategories == null) {
int[] icons = new int[]{
R.drawable.emoji_ios_category_people,
R.drawable.emoji_ios_category_nature,
R.drawable.emoji_ios_category_food,
R.drawable.emoji_ios_category_activity,
R.drawable.emoji_ios_category_travel,
R.drawable.emoji_ios_category_objects,
R.drawable.emoji_ios_category_symbols,
R.drawable.emoji_ios_category_flags
};
emojiCategories = new EmojiCategory[EmojiData.titles.length];
for (int c = 0; c < EmojiData.titles.length; c++) {
emojiCategories[c] = new AXIOSEmojiCategory(c, icons[c]);
}
}
}
public AXIOSEmojiProvider(Context context, int[] icons) {
AXIOSEmojiLoader.init(context);
if (emojiCategories == null) {
emojiCategories = new EmojiCategory[EmojiData.titles.length];
for (int c = 0; c < EmojiData.titles.length; c++) {
emojiCategories[c] = new AXIOSEmojiCategory(c, icons[c]);
}
}
}
@Override
@NonNull
public EmojiCategory[] getCategories() {
return emojiCategories;
}
@Override
public void destroy() {
}
public static class AXIOSEmojiCategory implements EmojiCategory {
Emoji[] DATA;
String title;
int icon;
public AXIOSEmojiCategory(int i, int icon) {
DATA = new Emoji[EmojiData.releaseData[i].length];
for (int j = 0; j < EmojiData.releaseData[i].length; j++) {
DATA[j] = new AXIOSEmoji(EmojiData.releaseData[i][j]);
}
title = EmojiData.titles[i];
this.icon = icon;
}
@NonNull
@Override
public Emoji[] getEmojis() {
return DATA;
}
@Override
public int getIcon() {
return icon;
}
@Override
public CharSequence getTitle() {
return title;
}
}
}
| 3,322 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
DispatchQueue.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/iosprovider/DispatchQueue.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji.iosprovider;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.CountDownLatch;
class DispatchQueue extends Thread {
private volatile Handler handler = null;
private CountDownLatch syncLatch = new CountDownLatch(1);
public DispatchQueue(final String threadName) {
setName(threadName);
start();
}
public void cancelRunnable(Runnable runnable) {
try {
syncLatch.await();
handler.removeCallbacks(runnable);
} catch (Exception ignore) {
}
}
public void postRunnable(Runnable runnable) {
postRunnable(runnable, 0);
}
public void postRunnable(Runnable runnable, long delay) {
try {
syncLatch.await();
} catch (Exception ignore) {
}
if (delay <= 0) {
handler.post(runnable);
} else {
handler.postDelayed(runnable, delay);
}
}
public void cleanupQueue() {
try {
syncLatch.await();
handler.removeCallbacksAndMessages(null);
} catch (Exception ignore) {
}
}
public void recycle() {
handler.getLooper().quit();
}
@Override
public void run() {
Looper.prepare();
handler = new Handler();
syncLatch.countDown();
Looper.loop();
}
}
| 2,024 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXIOSEmojiLoader.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/emoji/iosprovider/AXIOSEmojiLoader.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.emoji.iosprovider;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.Spannable;
import android.text.Spanned;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
import androidx.annotation.Nullable;
import org.mark.axemojiview.emoji.EmojiData;
import org.mark.axemojiview.utils.Utils;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
public class AXIOSEmojiLoader {
private static final String emojiFolderName = "emoji";
private static HashMap<CharSequence, DrawableInfo> rects = new HashMap<>();
private static int drawImgSize;
private static int bigImgSize;
private static Paint placeholderPaint;
private static int[] emojiCounts = new int[]{1620, 184, 115, 328, 125, 207, 288, 258};
private static Bitmap[][] emojiBmp = new Bitmap[8][];
private static boolean[][] loadingEmoji = new boolean[8][];
private static Context context;
private static boolean isTablet = false;
public static volatile DispatchQueue globalQueue = new DispatchQueue("globalQueue");
private static Handler uiThread;
static void init(Context context) {
AXIOSEmojiLoader.context = context;
drawImgSize = Utils.dp(context, 20);
bigImgSize = Utils.dp(context, isTablet ? 40 : 34);
}
static {
uiThread = new Handler(Looper.getMainLooper());
for (int a = 0; a < emojiBmp.length; a++) {
emojiBmp[a] = new Bitmap[emojiCounts[a]];
loadingEmoji[a] = new boolean[emojiCounts[a]];
}
for (int j = 0; j < EmojiData.data.length; j++) {
for (int i = 0; i < EmojiData.data[j].length; i++) {
rects.put(EmojiData.data[j][i], new DrawableInfo((byte) j, (short) i, i));
}
}
placeholderPaint = new Paint();
placeholderPaint.setColor(0x00000000);
}
/**
* try to load emoji before showing EmojiView
*/
public static void preloadEmoji(CharSequence code) {
final DrawableInfo info = getDrawableInfo(code);
if (info != null) {
loadEmoji(info.page, info.page2, null);
}
}
/**
* try to load emoji before showing EmojiView
*/
public static void preloadEmoji(String code, EmojiLoaderListener listener) {
final DrawableInfo info = getDrawableInfo(code);
if (info != null) {
loadEmoji(code, info.page, info.page2, listener);
}
}
private static void loadEmoji(final byte page, final short page2, final EmojiDrawable drawable) {
if (emojiBmp[page][page2] == null) {
if (loadingEmoji[page][page2]) {
return;
}
loadingEmoji[page][page2] = true;
globalQueue.postRunnable(new Runnable() {
@Override
public void run() {
loadEmojiInternal(page, page2);
loadingEmoji[page][page2] = false;
uiThread.post(new Runnable() {
@Override
public void run() {
if (drawable != null) drawable.invalidateSelf();
}
});
}
});
}
}
public interface EmojiLoaderListener {
void onEmojiLoaded(AXIOSEmoji emoji);
}
private static class ListenerData {
EmojiLoaderListener listener;
String code;
ListenerData(EmojiLoaderListener listener, String code) {
this.listener = listener;
this.code = code;
}
}
private static List<ListenerData> loadingListeners = null;
private static void loadEmoji(final String code, final byte page, final short page2, final EmojiLoaderListener listener) {
if (emojiBmp[page][page2] == null) {
if (loadingEmoji[page][page2]) {
if (listener == null) return;
if (loadingListeners == null) loadingListeners = new ArrayList<>();
loadingListeners.add(new ListenerData(listener, code));
return;
}
loadingEmoji[page][page2] = true;
globalQueue.postRunnable(new Runnable() {
@Override
public void run() {
loadEmojiInternal(page, page2);
loadingEmoji[page][page2] = false;
uiThread.post(new Runnable() {
@Override
public void run() {
callListeners(code, listener);
if (listener != null) listener.onEmojiLoaded(new AXIOSEmoji(code));
}
});
}
});
} else {
if (listener != null) listener.onEmojiLoaded(new AXIOSEmoji(code));
}
}
private static void callListeners(String code, EmojiLoaderListener listener) {
if (loadingListeners != null && loadingListeners.size() > 0) {
List<ListenerData> remove = new ArrayList<>();
for (ListenerData data : loadingListeners) {
if (data.code.equals(code) && data.listener != null && data.listener != listener) {
data.listener.onEmojiLoaded(new AXIOSEmoji(code));
remove.add(data);
}
}
if (remove.size() > 0) {
for (ListenerData removeData : remove) {
loadingListeners.remove(removeData);
}
}
}
}
private static void loadEmojiInternal(final byte page, final short page2) {
try {
int imageResize = 1;
if (context.getResources().getDisplayMetrics().density <= 1.0f) {
imageResize = 2;
}
Bitmap bitmap = null;
try {
InputStream is = context.getAssets().open(emojiFolderName + "/" + String.format(Locale.US, "%d_%d.png", page, page2));
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = false;
opts.inSampleSize = imageResize;
bitmap = BitmapFactory.decodeStream(is, null, opts);
is.close();
} catch (Throwable e) {
e.printStackTrace();
}
final Bitmap finalBitmap = bitmap;
emojiBmp[page][page2] = finalBitmap;
} catch (Throwable x) {
x.printStackTrace();
}
}
public static String fixEmoji(String emoji) {
char ch;
int length = emoji.length();
for (int a = 0; a < length; a++) {
ch = emoji.charAt(a);
if (ch >= 0xD83C && ch <= 0xD83E) {
if (ch == 0xD83C && a < length - 1) {
ch = emoji.charAt(a + 1);
if (ch == 0xDE2F || ch == 0xDC04 || ch == 0xDE1A || ch == 0xDD7F) {
emoji = emoji.substring(0, a + 2) + "\uFE0F" + emoji.substring(a + 2);
length++;
a += 2;
} else {
a++;
}
} else {
a++;
}
} else if (ch == 0x20E3) {
return emoji;
} else if (ch >= 0x203C && ch <= 0x3299) {
if (EmojiData.emojiToFE0FMap.containsKey(ch)) {
emoji = emoji.substring(0, a + 1) + "\uFE0F" + emoji.substring(a + 1);
length++;
a++;
}
}
}
return emoji;
}
/**
* @return emoji drawable
*/
public static @Nullable EmojiDrawable getEmojiDrawable(CharSequence code) {
DrawableInfo info = getDrawableInfo(code);
if (info == null) {
//No drawable for emoji + code
return null;
}
EmojiDrawable ed = new EmojiDrawable(info);
ed.setBounds(0, 0, drawImgSize, drawImgSize);
return ed;
}
/**
* @return emoji bitmap or null if emoji hasn't loaded yet (or it's invalid).
*/
public static @Nullable Bitmap getEmojiBitmap(CharSequence code) {
DrawableInfo info = getDrawableInfo(code);
if (info == null) return null;
return emojiBmp[info.page][info.page2];
}
private static DrawableInfo getDrawableInfo(CharSequence code) {
DrawableInfo info = rects.get(code);
if (info == null) {
CharSequence newCode = EmojiData.emojiAliasMap.get(code);
if (newCode != null) {
info = AXIOSEmojiLoader.rects.get(newCode);
}
}
return info;
}
/**
* @return false if there is no emoji for this code
*/
public static boolean isValidEmoji(CharSequence code) {
DrawableInfo info = rects.get(code);
if (info == null) {
CharSequence newCode = EmojiData.emojiAliasMap.get(code);
if (newCode != null) {
info = AXIOSEmojiLoader.rects.get(newCode);
}
}
return info != null;
}
/**
* @return fullSize emoji drawable
*/
public static Drawable getEmojiBigDrawable(String code) {
EmojiDrawable ed = getEmojiDrawable(code);
if (ed == null) {
CharSequence newCode = EmojiData.emojiAliasMap.get(code);
if (newCode != null) {
ed = AXIOSEmojiLoader.getEmojiDrawable(newCode);
}
}
if (ed == null) {
return null;
}
ed.setBounds(0, 0, bigImgSize, bigImgSize);
ed.fullSize = true;
return ed;
}
/**
* @return emoji drawable with custom bounds
*/
public static Drawable getEmojiDrawable(String code, int size, boolean fullSize) {
EmojiDrawable ed = getEmojiDrawable(code);
if (ed == null) {
CharSequence newCode = EmojiData.emojiAliasMap.get(code);
if (newCode != null) {
ed = AXIOSEmojiLoader.getEmojiDrawable(newCode);
}
}
if (ed == null) {
return null;
}
ed.setBounds(0, 0, size, size);
ed.fullSize = fullSize;
return ed;
}
private static class EmojiDrawable extends Drawable {
private DrawableInfo info;
private boolean fullSize = false;
private static Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
private static Rect rect = new Rect();
public EmojiDrawable(DrawableInfo i) {
info = i;
}
public DrawableInfo getDrawableInfo() {
return info;
}
public int getSize() {
return (fullSize ? bigImgSize : drawImgSize);
}
public Rect getDrawRect() {
Rect original = getBounds();
int cX = original.centerX(), cY = original.centerY();
rect.left = cX - getSize() / 2;
rect.right = cX + getSize() / 2;
rect.top = cY - getSize() / 2;
rect.bottom = cY + getSize() / 2;
return rect;
}
@Override
public void draw(Canvas canvas) {
/*if (useSystemEmoji) {
//textPaint.setTextSize(getBounds().width());
canvas.drawText(EmojiData.data[info.page][info.emojiIndex], getBounds().left, getBounds().bottom, textPaint);
return;
}*/
if (emojiBmp[info.page][info.page2] == null) {
loadEmoji(info.page, info.page2, this);
canvas.drawRect(getBounds(), placeholderPaint);
return;
}
Rect b;
if (fullSize) {
b = getDrawRect();
} else {
b = getBounds();
}
//if (!canvas.quickReject(b.left, b.top, b.right, b.bottom, Canvas.EdgeType.AA)) {
canvas.drawBitmap(emojiBmp[info.page][info.page2], null, b, paint);
//}
}
@Override
public int getOpacity() {
return PixelFormat.TRANSPARENT;
}
@Override
public void setAlpha(int alpha) {
}
@Override
public void setColorFilter(ColorFilter cf) {
}
}
private static class DrawableInfo {
public byte page;
public short page2;
public int emojiIndex;
public DrawableInfo(byte p, short p2, int index) {
page = p;
page2 = p2;
emojiIndex = index;
}
}
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetrics fontMetrics, int size, boolean createNew) {
return replaceEmoji(cs, fontMetrics, size, createNew, null);
}
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetrics fontMetrics, int size, boolean createNew, int[] emojiOnly) {
if (cs == null || cs.length() == 0) {
return cs;
}
Spannable s;
if (!createNew && cs instanceof Spannable) {
s = (Spannable) cs;
} else {
s = Spannable.Factory.getInstance().newSpannable(cs.toString());
}
long buf = 0;
int emojiCount = 0;
char c;
int startIndex = -1;
int startLength = 0;
int previousGoodIndex = 0;
StringBuilder emojiCode = new StringBuilder(16);
StringBuilder addionalCode = new StringBuilder(2);
boolean nextIsSkinTone;
EmojiDrawable drawable;
EmojiSpan span;
int length = cs.length();
boolean doneEmoji = false;
int nextValidLength;
boolean nextValid;
//s.setSpansCount(emojiCount);
try {
for (int i = 0; i < length; i++) {
c = cs.charAt(i);
if (c >= 0xD83C && c <= 0xD83E || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (buf & 0xFFFF) == 0xD83C && (c >= 0xDDE6 && c <= 0xDDFF))) {
if (startIndex == -1) {
startIndex = i;
}
emojiCode.append(c);
startLength++;
buf <<= 16;
buf |= c;
} else if (emojiCode.length() > 0 && (c == 0x2640 || c == 0x2642 || c == 0x2695)) {
emojiCode.append(c);
startLength++;
buf = 0;
doneEmoji = true;
} else if (buf > 0 && (c & 0xF000) == 0xD000) {
emojiCode.append(c);
startLength++;
buf = 0;
doneEmoji = true;
} else if (c == 0x20E3) {
if (i > 0) {
char c2 = cs.charAt(previousGoodIndex);
if ((c2 >= '0' && c2 <= '9') || c2 == '#' || c2 == '*') {
startIndex = previousGoodIndex;
startLength = i - previousGoodIndex + 1;
emojiCode.append(c2);
emojiCode.append(c);
doneEmoji = true;
}
}
} else if ((c == 0x00A9 || c == 0x00AE || c >= 0x203C && c <= 0x3299) && EmojiData.dataCharsMap.containsKey(c)) {
if (startIndex == -1) {
startIndex = i;
}
startLength++;
emojiCode.append(c);
doneEmoji = true;
} else if (startIndex != -1) {
emojiCode.setLength(0);
startIndex = -1;
startLength = 0;
doneEmoji = false;
} else if (c != 0xfe0f) {
if (emojiOnly != null) {
emojiOnly[0] = 0;
emojiOnly = null;
}
}
if (doneEmoji && i + 2 < length) {
char next = cs.charAt(i + 1);
if (next == 0xD83C) {
next = cs.charAt(i + 2);
if (next >= 0xDFFB && next <= 0xDFFF) {
emojiCode.append(cs.subSequence(i + 1, i + 3));
startLength += 2;
i += 2;
}
} else if (emojiCode.length() >= 2 && emojiCode.charAt(0) == 0xD83C && emojiCode.charAt(1) == 0xDFF4 && next == 0xDB40) {
i++;
while (true) {
emojiCode.append(cs.subSequence(i, i + 2));
startLength += 2;
i += 2;
if (i >= cs.length() || cs.charAt(i) != 0xDB40) {
i--;
break;
}
}
}
}
previousGoodIndex = i;
char prevCh = c;
for (int a = 0; a < 3; a++) {
if (i + 1 < length) {
c = cs.charAt(i + 1);
if (a == 1) {
if (c == 0x200D && emojiCode.length() > 0) {
emojiCode.append(c);
i++;
startLength++;
doneEmoji = false;
}
} else if (startIndex != -1 || prevCh == '*' || prevCh >= '1' && prevCh <= '9') {
if (c >= 0xFE00 && c <= 0xFE0F) {
i++;
startLength++;
}
}
}
}
if (doneEmoji && i + 2 < length && cs.charAt(i + 1) == 0xD83C) {
char next = cs.charAt(i + 2);
if (next >= 0xDFFB && next <= 0xDFFF) {
emojiCode.append(cs.subSequence(i + 1, i + 3));
startLength += 2;
i += 2;
}
}
if (doneEmoji) {
if (emojiOnly != null) {
emojiOnly[0]++;
}
CharSequence code = emojiCode.subSequence(0, emojiCode.length());
drawable = AXIOSEmojiLoader.getEmojiDrawable(code);
if (drawable != null) {
span = new EmojiSpan(drawable, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
s.setSpan(span, startIndex, startIndex + startLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
emojiCount++;
}
startLength = 0;
startIndex = -1;
emojiCode.setLength(0);
doneEmoji = false;
}
if ((Build.VERSION.SDK_INT < 23 || Build.VERSION.SDK_INT >= 29) && emojiCount >= 50) {
break;
}
}
} catch (Exception e) {
e.printStackTrace();
return cs;
}
if (emojiOnly != null && emojiCode.length() != 0) {
emojiOnly[0] = 0;
}
return s;
}
public static List<SpanLocation> replaceEmoji2(CharSequence cs, Paint.FontMetrics fontMetrics, int size, boolean createNew, int[] emojiOnly) {
if (cs == null || cs.length() == 0) {
return new ArrayList<>();
}
Spannable s;
if (!createNew && cs instanceof Spannable) {
s = (Spannable) cs;
} else {
s = Spannable.Factory.getInstance().newSpannable(cs.toString());
}
long buf = 0;
int emojiCount = 0;
char c;
int startIndex = -1;
int startLength = 0;
int previousGoodIndex = 0;
StringBuilder emojiCode = new StringBuilder(16);
StringBuilder addionalCode = new StringBuilder(2);
boolean nextIsSkinTone;
EmojiDrawable drawable;
EmojiSpan span;
int length = cs.length();
boolean doneEmoji = false;
int nextValidLength;
boolean nextValid;
List<SpanLocation> spans = new ArrayList<>();
//s.setSpansCount(emojiCount);
try {
for (int i = 0; i < length; i++) {
c = cs.charAt(i);
if (c >= 0xD83C && c <= 0xD83E || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (buf & 0xFFFF) == 0xD83C && (c >= 0xDDE6 && c <= 0xDDFF))) {
if (startIndex == -1) {
startIndex = i;
}
emojiCode.append(c);
startLength++;
buf <<= 16;
buf |= c;
} else if (emojiCode.length() > 0 && (c == 0x2640 || c == 0x2642 || c == 0x2695)) {
emojiCode.append(c);
startLength++;
buf = 0;
doneEmoji = true;
} else if (buf > 0 && (c & 0xF000) == 0xD000) {
emojiCode.append(c);
startLength++;
buf = 0;
doneEmoji = true;
} else if (c == 0x20E3) {
if (i > 0) {
char c2 = cs.charAt(previousGoodIndex);
if ((c2 >= '0' && c2 <= '9') || c2 == '#' || c2 == '*') {
startIndex = previousGoodIndex;
startLength = i - previousGoodIndex + 1;
emojiCode.append(c2);
emojiCode.append(c);
doneEmoji = true;
}
}
} else if ((c == 0x00A9 || c == 0x00AE || c >= 0x203C && c <= 0x3299) && EmojiData.dataCharsMap.containsKey(c)) {
if (startIndex == -1) {
startIndex = i;
}
startLength++;
emojiCode.append(c);
doneEmoji = true;
} else if (startIndex != -1) {
emojiCode.setLength(0);
startIndex = -1;
startLength = 0;
doneEmoji = false;
} else if (c != 0xfe0f) {
if (emojiOnly != null) {
emojiOnly[0] = 0;
emojiOnly = null;
}
}
if (doneEmoji && i + 2 < length) {
char next = cs.charAt(i + 1);
if (next == 0xD83C) {
next = cs.charAt(i + 2);
if (next >= 0xDFFB && next <= 0xDFFF) {
emojiCode.append(cs.subSequence(i + 1, i + 3));
startLength += 2;
i += 2;
}
} else if (emojiCode.length() >= 2 && emojiCode.charAt(0) == 0xD83C && emojiCode.charAt(1) == 0xDFF4 && next == 0xDB40) {
i++;
while (true) {
emojiCode.append(cs.subSequence(i, i + 2));
startLength += 2;
i += 2;
if (i >= cs.length() || cs.charAt(i) != 0xDB40) {
i--;
break;
}
}
}
}
previousGoodIndex = i;
char prevCh = c;
for (int a = 0; a < 3; a++) {
if (i + 1 < length) {
c = cs.charAt(i + 1);
if (a == 1) {
if (c == 0x200D && emojiCode.length() > 0) {
emojiCode.append(c);
i++;
startLength++;
doneEmoji = false;
}
} else if (startIndex != -1 || prevCh == '*' || prevCh >= '1' && prevCh <= '9') {
if (c >= 0xFE00 && c <= 0xFE0F) {
i++;
startLength++;
}
}
}
}
if (doneEmoji && i + 2 < length && cs.charAt(i + 1) == 0xD83C) {
char next = cs.charAt(i + 2);
if (next >= 0xDFFB && next <= 0xDFFF) {
emojiCode.append(cs.subSequence(i + 1, i + 3));
startLength += 2;
i += 2;
}
}
if (doneEmoji) {
if (emojiOnly != null) {
emojiOnly[0]++;
}
CharSequence code = emojiCode.subSequence(0, emojiCode.length());
drawable = AXIOSEmojiLoader.getEmojiDrawable(code);
if (drawable != null) {
span = new EmojiSpan(drawable, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
//s.setSpan(span, startIndex, startIndex + startLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spans.add(new SpanLocation(span, startIndex, startIndex + startLength));
emojiCount++;
}
startLength = 0;
startIndex = -1;
emojiCode.setLength(0);
doneEmoji = false;
}
if ((Build.VERSION.SDK_INT < 23 || Build.VERSION.SDK_INT >= 29) && emojiCount >= 50) {
break;
}
}
} catch (Exception e) {
//e.printStackTrace();
return new ArrayList<>();
}
if (emojiOnly != null && emojiCode.length() != 0) {
emojiOnly[0] = 0;
}
return spans;
}
static class SpanLocation {
public EmojiSpan span;
public int start;
public int end;
public SpanLocation(EmojiSpan s, int start, int end) {
span = s;
this.start = start;
this.end = end;
}
}
static class EmojiSpan extends ImageSpan {
private Paint.FontMetrics fontMetrics;
private int size = Utils.dp(context, 20);
public EmojiSpan(EmojiDrawable d, int verticalAlignment, int s, Paint.FontMetrics original) {
super(d, verticalAlignment);
fontMetrics = original;
if (original != null) {
size = (int) (Math.abs(fontMetrics.descent) + Math.abs(fontMetrics.ascent));
if (size == 0) {
size = Utils.dp(context, 20);
}
}
if (s > 0) {
size = s;
}
}
public void replaceFontMetrics(Paint.FontMetrics newMetrics, int newSize) {
fontMetrics = newMetrics;
size = newSize;
}
@Override
public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
if (fm == null) {
fm = new Paint.FontMetricsInt();
}
if (fontMetrics == null) {
int sz = super.getSize(paint, text, start, end, fm);
int offset = Utils.dp(context, 8);
int w = Utils.dp(context, 10);
fm.top = -w - offset;
fm.bottom = w - offset;
fm.ascent = -w - offset;
fm.leading = 0;
fm.descent = w - offset;
return sz;
} else {
if (fm != null) {
fm.ascent = (int) fontMetrics.ascent;
fm.descent = (int) fontMetrics.descent;
fm.top = (int) fontMetrics.top;
fm.bottom = (int) fontMetrics.bottom;
}
if (getDrawable() != null) {
getDrawable().setBounds(0, 0, size, size);
}
return size;
}
}
}
} | 29,779 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXStickerRecyclerView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXStickerRecyclerView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.graphics.Rect;
import android.view.View;
import org.mark.axemojiview.utils.Utils;
/**
* @hide
*/
public class AXStickerRecyclerView extends RecyclerView {
public AXStickerRecyclerView(@NonNull Context context) {
super(context);
final int spanCount = Utils.getStickerGridCount(context);
GridLayoutManager lm = new GridLayoutManager(context, spanCount);
this.setLayoutManager(lm);
final int spacing;
spacing = (context.getResources().getDisplayMetrics().widthPixels - (Utils.getStickerColumnWidth(context) * spanCount)) / (spanCount + 2);
if (spacing > 0) {
this.addItemDecoration(new ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull State state) {
outRect.left = spacing;
}
});
}
setOverScrollMode(OVER_SCROLL_NEVER);
}
}
| 1,832 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiMultiAutoCompleteTextView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiMultiAutoCompleteTextView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView;
import android.util.AttributeSet;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
/**
* Reference implementation for an EmojiAutoCompleteTextView with emoji support.
*/
public class AXEmojiMultiAutoCompleteTextView extends AppCompatMultiAutoCompleteTextView {
private float emojiSize;
public AXEmojiMultiAutoCompleteTextView(final Context context) {
this(context, null);
}
public AXEmojiMultiAutoCompleteTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiMultiAutoCompleteTextView);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiMultiAutoCompleteTextView_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
setText(getText());
}
@Override
@CallSuper
protected void onTextChanged(final CharSequence text, final int start, final int lengthBefore, final int lengthAfter) {
if (!AXEmojiManager.isInstalled()) return;
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
//final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, getText(), emojiSize, fontMetrics);
}
@CallSuper
public void backspace() {
AXEmojiUtils.backspace(this);
}
@CallSuper
public void input(final Emoji emoji) {
AXEmojiUtils.input(this, emoji);
}
/**
* returns the emoji size
*/
public final float getEmojiSize() {
return emojiSize;
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
if (getText()!=null)
setText(getText().toString());
}
}
/**
* sets the emoji size in pixels with the provided resource and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
/**
* sets the emoji size in pixels with the provided resource and invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
}
| 4,244 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXSingleEmojiView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXSingleEmojiView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.widget.EditText;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.adapters.AXSingleEmojiPageAdapter;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.RecentEmojiManager;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.shared.VariantEmojiManager;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.variant.AXEmojiVariantPopup;
public class AXSingleEmojiView extends AXEmojiLayout implements FindVariantListener {
public AXSingleEmojiView(Context context) {
super(context);
init();
}
AXCategoryViews categoryViews;
AXEmojiSingleRecyclerView recyclerView;
RecentEmoji recent;
VariantEmoji variant;
AXEmojiVariantPopup variantPopup;
OnEmojiActions events = new OnEmojiActions() {
@Override
public void onClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant) {
if (!fromVariant && variantPopup != null && variantPopup.isShowing()) return;
if (!fromVariant) recent.addEmoji(emoji);
if (editText != null) AXEmojiUtils.input(editText, emoji);
variant.addVariant(emoji);
if (variantPopup != null) variantPopup.dismiss();
if (emojiActions != null) emojiActions.onClick(view, emoji, fromRecent, fromVariant);
}
@Override
public boolean onLongClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant) {
if (view!=null && (!fromRecent || AXEmojiManager.isRecentVariantEnabled()) && variantPopup != null) {
if (emoji.getBase().hasVariants())
variantPopup.show((AXEmojiImageView) view, emoji, fromRecent);
}
if (emojiActions != null)
return emojiActions.onLongClick(view, emoji, fromRecent, fromVariant);
return false;
}
};
OnEmojiActions emojiActions = null;
public OnEmojiActions getInnerEmojiActions() {
return emojiActions;
}
/**
* add emoji click and longClick listener
*
* @param listener
*/
public void setOnEmojiActionsListener(OnEmojiActions listener) {
emojiActions = listener;
}
public OnEmojiActions getOnEmojiActionsListener() {
return events;
}
public void removeOnEmojiActionsListener() {
emojiActions = null;
}
public VariantEmoji getVariantEmoji() {
return variant;
}
RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener() {
private int[] firstPositions;
private boolean isShowing = true;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (recyclerView == null) {
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled()) {
if (!isShowing) {
isShowing = true;
categoryViews.Divider.setVisibility(GONE);
}
}
return;
}
if (dy == 0) return;
if (dy == 1) dy = 0;
super.onScrolled(recyclerView, dx, dy);
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager == null) return;
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled()) {
if (firstPositions == null) {
firstPositions = new int[staggeredGridLayoutManager.getSpanCount()];
}
staggeredGridLayoutManager.findFirstCompletelyVisibleItemPositions(firstPositions);
int firstVisibleItemPosition = findMin(firstPositions);
int visibleItemCount = layoutManager.getChildCount();
if ((visibleItemCount > 0 && (firstVisibleItemPosition) == 0)) {
if (!isShowing) {
isShowing = true;
categoryViews.Divider.setVisibility(GONE);
}
} else {
if (isShowing) {
isShowing = false;
categoryViews.Divider.setVisibility(VISIBLE);
}
}
}
AXSingleEmojiPageAdapter adapter = (AXSingleEmojiPageAdapter) recyclerView.getAdapter();
int[] firstCPositions = new int[staggeredGridLayoutManager.getSpanCount()];
staggeredGridLayoutManager.findFirstCompletelyVisibleItemPositions(firstCPositions);
int firstCVisibleItemPosition = findMin(firstCPositions);
for (int i = 0; i < adapter.titlesPosition.size(); i++) {
int index = adapter.titlesPosition.get(i);
if (firstCVisibleItemPosition >= index) {
if (adapter.titlesPosition.size() > i + 1 && firstCVisibleItemPosition < adapter.titlesPosition.get(i + 1)) {
categoryViews.setPageIndex(i + 1);
break;
} else if (adapter.titlesPosition.size() <= i + 1) {
categoryViews.setPageIndex(adapter.titlesPosition.size());
break;
}
} else if (i - 1 >= 0 && firstCVisibleItemPosition > adapter.titlesPosition.get(i - 1)) {
categoryViews.setPageIndex(i - 1);
break;
} else if (i - 1 == 0) {
categoryViews.setPageIndex(0);
break;
}
}
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
private int findMin(int[] firstPositions) {
int min = firstPositions[0];
for (int value : firstPositions) {
if (value < min) {
min = value;
}
}
return min;
}
};
AXFooterParallax scrollListener2;
private void init() {
if (AXEmojiManager.getRecentEmoji() != null) {
recent = AXEmojiManager.getRecentEmoji();
} else {
recent = new RecentEmojiManager(getContext());
}
if (AXEmojiManager.getVariantEmoji() != null) {
variant = AXEmojiManager.getVariantEmoji();
} else {
variant = new VariantEmojiManager(getContext());
}
variant = new VariantEmojiManager(getContext());
recyclerView = new AXEmojiSingleRecyclerView(getContext(), this);
recyclerView.setItemAnimator(null);
this.addView(recyclerView, new LayoutParams(0, 0, -1, -1));
recyclerView.setAdapter(new AXSingleEmojiPageAdapter(AXEmojiManager.getInstance().getCategories(), events, recent, variant));
recyclerView.addOnScrollListener(scrollListener);
categoryViews = new AXCategoryViews(getContext(), this, recent);
this.addView(categoryViews, new LayoutParams(0, 0, -1, Utils.dpToPx(getContext(), 39)));
this.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getBackgroundColor());
scrollListener2 = new AXFooterParallax(categoryViews, -Utils.dpToPx(getContext(), 38), 50);
scrollListener2.setDuration(Utils.dpToPx(getContext(), 38));
scrollListener2.setIDLEHideSize(scrollListener2.getDuration() / 2);
scrollListener2.setMinComputeScrollOffset(Utils.dpToPx(getContext(), 38));
scrollListener2.setScrollSpeed((long) 1);
scrollListener2.setChangeOnIDLEState(true);
recyclerView.addOnScrollListener(scrollListener2);
}
public void setPageIndex(int index) {
if (index == 0 && !categoryViews.recent) {
recyclerView.scrollToPosition(0);
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled())
categoryViews.Divider.setVisibility(GONE);
} else {
int index2 = index - 1;
if (categoryViews.recent) index2 = index;
categoryViews.Divider.setVisibility(VISIBLE);
int position = Math.max(0, ((AXSingleEmojiPageAdapter) recyclerView.getAdapter()).titlesPosition.get(index2) - 1);
if (position > 0) {
((StaggeredGridLayoutManager) recyclerView.getLayoutManager())
.scrollToPositionWithOffset(position, -Utils.dp(this.getContext(), 6));
categoryViews.Divider.setVisibility(VISIBLE);
} else {
recyclerView.scrollToPosition(0);
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled())
categoryViews.Divider.setVisibility(GONE);
}
}
categoryViews.setPageIndex(index);
}
@Override
public void dismiss() {
if (variantPopup != null) variantPopup.dismiss();
recent.persist();
variant.persist();
}
@Override
public void setEditText(EditText editText) {
super.setEditText(editText);
variantPopup = AXEmojiManager.getEmojiVariantCreatorListener().create(editText.getRootView(), events);
}
@Override
protected void setScrollListener(RecyclerView.OnScrollListener listener) {
super.setScrollListener(listener);
recyclerView.addOnScrollListener(listener);
}
@Override
protected void refresh() {
super.refresh();
categoryViews.removeAllViews();
categoryViews.init();
((AXSingleEmojiPageAdapter) recyclerView.getAdapter()).refresh();
recyclerView.scrollToPosition(0);
scrollListener2.show();
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled())
categoryViews.Divider.setVisibility(GONE);
categoryViews.setPageIndex(0);
}
@Override
public int getPageIndex() {
return categoryViews.index;
}
public RecyclerView getRecyclerView() {
return recyclerView;
}
@Override
public AXEmojiVariantPopup findVariant() {
return variantPopup;
}
}
| 11,357 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.viewpager.widget.ViewPager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.EditText;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.adapters.AXEmojiViewPagerAdapter;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.RecentEmojiManager;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.shared.VariantEmojiManager;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.variant.AXEmojiVariantPopup;
public class AXEmojiView extends AXEmojiLayout implements FindVariantListener {
public AXEmojiView(Context context) {
super(context);
init();
}
public AXEmojiView(Context context, OnEmojiActions ev) {
super(context);
this.events = ev;
init();
}
AXCategoryViews categoryViews;
ViewPager vp;
RecentEmoji recent;
VariantEmoji variant;
AXEmojiVariantPopup variantPopup;
OnEmojiActions events = new OnEmojiActions() {
@Override
public void onClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant) {
if (!fromVariant && variantPopup != null && variantPopup.isShowing()) return;
if (!fromVariant) recent.addEmoji(emoji);
if (editText != null) AXEmojiUtils.input(editText, emoji);
/**if (!fromRecent && ((AXEmojiViewPagerAdapter) vp.getAdapter()).add==1)
((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.get(0).getAdapter().notifyDataSetChanged();*/
variant.addVariant(emoji);
if (variantPopup != null) variantPopup.dismiss();
if (emojiActions != null) emojiActions.onClick(view, emoji, fromRecent, fromVariant);
}
@Override
public boolean onLongClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant) {
if (view!=null && variantPopup != null && (!fromRecent || AXEmojiManager.isRecentVariantEnabled())) {
if (emoji.getBase().hasVariants())
variantPopup.show((AXEmojiImageView) view, emoji, fromRecent);
}
if (emojiActions != null)
return emojiActions.onLongClick(view, emoji, fromRecent, fromVariant);
return false;
}
};
OnEmojiActions emojiActions = null;
public OnEmojiActions getInnerEmojiActions() {
return events;
}
/**
* add emoji click and longClick listener
*
* @param listener
*/
public void setOnEmojiActionsListener(OnEmojiActions listener) {
emojiActions = listener;
}
public OnEmojiActions getOnEmojiActionsListener() {
return emojiActions;
}
public VariantEmoji getVariantEmoji() {
return variant;
}
RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener() {
private boolean isShowing = true;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (recyclerView == null) {
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled()) {
if (!isShowing) {
isShowing = true;
if (categoryViews != null) categoryViews.Divider.setVisibility(GONE);
}
}
return;
}
if (dy == 0) return;
if (dy == 1) dy = 0;
super.onScrolled(recyclerView, dx, dy);
if (scrollListener2 != null)
scrollListener2.onScrolled(recyclerView, dx, dy);
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled()) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager == null) return;
int firstVisibleItemPosition = ((GridLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition();
int visibleItemCount = layoutManager.getChildCount();
if ((visibleItemCount > 0 && (firstVisibleItemPosition) == 0)) {
if (!isShowing) {
isShowing = true;
if (categoryViews != null) categoryViews.Divider.setVisibility(GONE);
}
} else {
if (isShowing) {
isShowing = false;
if (categoryViews != null) categoryViews.Divider.setVisibility(VISIBLE);
}
}
}
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (scrollListener2 != null)
scrollListener2.onScrollStateChanged(recyclerView, newState);
}
};
RecyclerView.OnScrollListener scrollListener2 = null;
private void init() {
if (AXEmojiManager.getRecentEmoji() != null) {
recent = AXEmojiManager.getRecentEmoji();
} else {
recent = new RecentEmojiManager(getContext());
}
if (AXEmojiManager.getVariantEmoji() != null) {
variant = AXEmojiManager.getVariantEmoji();
} else {
variant = new VariantEmojiManager(getContext());
}
int top = 0;
if (AXEmojiManager.getEmojiViewTheme().isCategoryEnabled())
top = Utils.dpToPx(getContext(), 39);
vp = new ViewPager(getContext());
this.addView(vp, new AXEmojiLayout.LayoutParams(0, top, -1, -1));
vp.setAdapter(new AXEmojiViewPagerAdapter(events, scrollListener, recent, variant, this));
//vp.setPadding(0, 0, 0, top);
if (AXEmojiManager.getEmojiViewTheme().isCategoryEnabled()) {
categoryViews = new AXCategoryViews(getContext(), this, recent);
this.addView(categoryViews, new AXEmojiLayout.LayoutParams(0, 0, -1, top));
} else {
categoryViews = null;
}
this.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getBackgroundColor());
if (categoryViews != null)
categoryViews.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getBackgroundColor());
vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
if (pagerListener2 != null) pagerListener2.onPageScrolled(i, v, i1);
}
@Override
public void onPageSelected(int i) {
vp.setCurrentItem(i, true);
if (((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.size() > i) {
scrollListener.onScrolled(((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i), 0, 1);
} else {
scrollListener.onScrolled(null, 0, 1);
}
if (categoryViews != null) categoryViews.setPageIndex(i);
if (pagerListener2 != null) pagerListener2.onPageSelected(i);
}
@Override
public void onPageScrollStateChanged(int i) {
if (pagerListener2 != null) pagerListener2.onPageScrollStateChanged(i);
}
});
}
ViewPager.OnPageChangeListener pagerListener2 = null;
@Override
public void setPageIndex(int index) {
vp.setCurrentItem(index, true);
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled()) {
if (((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.size() > index) {
scrollListener.onScrolled(((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.get(index), 0, 1);
} else {
scrollListener.onScrolled(null, 0, 1);
}
}
if (categoryViews != null) categoryViews.setPageIndex(index);
}
@Override
public void dismiss() {
if (variantPopup != null) variantPopup.dismiss();
recent.persist();
variant.persist();
}
@Override
public void setEditText(EditText editText) {
super.setEditText(editText);
variantPopup = AXEmojiManager.getEmojiVariantCreatorListener().create(editText.getRootView(), events);
}
@Override
protected void setScrollListener(RecyclerView.OnScrollListener listener) {
super.setScrollListener(listener);
scrollListener2 = listener;
}
@Override
protected void setPageChanged(ViewPager.OnPageChangeListener listener) {
super.setPageChanged(listener);
pagerListener2 = listener;
}
@Override
protected void addItemDecoration(RecyclerView.ItemDecoration itemDecoration) {
((AXEmojiViewPagerAdapter) vp.getAdapter()).itemDecoration = itemDecoration;
for (int i = 0; i < ((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.size(); i++) {
((AXEmojiViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i).addItemDecoration(itemDecoration);
}
}
@Override
protected void refresh() {
super.refresh();
if (categoryViews != null) {
categoryViews.removeAllViews();
categoryViews.init();
}
vp.getAdapter().notifyDataSetChanged();
vp.setCurrentItem(0, false);
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled())
scrollListener.onScrolled(null, 0, 1);
if (categoryViews != null) categoryViews.setPageIndex(0);
}
@Override
public int getPageIndex() {
return vp.getCurrentItem();
}
public ViewPager getViewPager() {
return vp;
}
@Override
public AXEmojiVariantPopup findVariant() {
return variantPopup;
}
}
| 10,843 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiPopupLayout.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiPopupLayout.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import org.mark.axemojiview.listener.PopupListener;
import org.mark.axemojiview.search.AXEmojiSearchView;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiPopupLayout extends FrameLayout implements AXPopupInterface {
AXEmojiPopupView popupView;
private View keyboard;
protected boolean changeHeightWithKeyboard = true;
protected KeyboardHeightProvider heightProvider = null;
public AXEmojiPopupLayout(Context context) {
this(context, null);
}
public AXEmojiPopupLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AXEmojiPopupLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Utils.forceLTR(this);
initKeyboardHeightProvider();
}
public void initPopupView(AXEmojiBase content) {
if (keyboard == null) {
keyboard = new View(getContext());
this.addView(keyboard,new FrameLayout.LayoutParams(-1,0));
}
content.setPopupInterface(this);
popupView = new AXEmojiPopupView(this, content);
popupView.setFocusableInTouchMode(true);
popupView.setFocusable(true);
popupView.requestFocus();
initKeyboardHeightProvider();
}
protected void initKeyboardHeightProvider() {
if (heightProvider == null) heightProvider = new KeyboardHeightProvider(this);
if (popupView != null) {
popupView.post(new Runnable() {
@Override
public void run() {
heightProvider.start();
}
});
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (popupView!=null && popupView.listener!=null)
popupView.listener.onViewHeightChanged(h);
}
public boolean onBackPressed() {
if (popupView == null) return false;
return popupView.onBackPressed();
}
@Override
public void reload() {
if (popupView!=null) popupView.reload();
}
public boolean isKeyboardOpen() {
return (popupView != null && popupView.isKeyboardOpen);
}
public void hidePopupView() {
if (popupView != null) popupView.onlyHide();
}
public int getPopupHeight() {
return ((popupView != null) ? popupView.getPopupHeight() : 0);
}
@Override
public void toggle() {
if (popupView != null) popupView.toggle();
}
@Override
public void show() {
if (popupView != null) popupView.show();
}
@Override
public void dismiss() {
if (popupView != null) popupView.dismiss();
}
@Override
public boolean isShowing() {
return popupView != null && popupView.isShowing;
}
public void setPopupListener(PopupListener listener) {
if (popupView != null) popupView.setPopupListener(listener);
}
public void hideAndOpenKeyboard() {
popupView.dismiss();
popupView.editText.setFocusable(true);
popupView.editText.requestFocus();
InputMethodManager imm = (InputMethodManager) popupView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(popupView.editText, InputMethodManager.SHOW_IMPLICIT);
}
public void openKeyboard() {
popupView.hideSearchView(true);
popupView.editText.setFocusable(true);
popupView.editText.requestFocus();
InputMethodManager imm = (InputMethodManager) popupView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(popupView.editText, InputMethodManager.SHOW_IMPLICIT);
}
public void updateKeyboardStateOpened(int height) {
if (popupView != null) popupView.updateKeyboardStateOpened(height);
}
public void updateKeyboardStateClosed() {
if (popupView != null) popupView.updateKeyboardStateClosed();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (heightProvider != null) {
heightProvider.stickOnStart();
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (heightProvider != null) heightProvider.close();
}
public void setMaxHeight(int maxHeight) {
if (popupView!=null) popupView.setMaxHeight(maxHeight);
}
public int getMaxHeight() {
return popupView!=null ? popupView.getMaxHeight() : -1;
}
public void setMinHeight(int minHeight) {
if (popupView!=null) popupView.setMinHeight(minHeight);
}
public int getMinHeight() {
return popupView!=null ? popupView.getMinHeight() : -1;
}
public void setPopupAnimationEnabled(boolean enabled){
if (popupView!=null) popupView.animationEnabled = enabled;
}
public boolean isPopupAnimationEnabled(){
return popupView == null || popupView.animationEnabled;
}
public void setPopupAnimationDuration(long duration){
if (popupView!=null) popupView.animationDuration = duration;
}
public long getPopupAnimationDuration(){
return popupView!=null ? popupView.animationDuration : 250;
}
public AXEmojiSearchView getSearchView() {
return popupView.getSearchView();
}
public void setSearchView(AXEmojiSearchView searchView) {
popupView.setSearchView(searchView);
}
public void hideSearchView(){
popupView.hideSearchView(true);
}
public void showSearchView(){
popupView.showSearchView();
}
public boolean isShowingSearchView(){
return popupView!=null && popupView.isShowingSearchView();
}
public void setSearchViewAnimationEnabled(boolean enabled){
popupView.searchViewAnimationEnabled = enabled;
}
public boolean isSearchViewAnimationEnabled(){
return popupView == null || popupView.searchViewAnimationEnabled;
}
public void setSearchViewAnimationDuration(long duration){
if (popupView!=null) popupView.searchViewAnimationDuration = duration;
}
public long getSearchViewAnimationDuration(){
return popupView!=null ? popupView.searchViewAnimationDuration : 250;
}
/**
* The keyboard height provider, this class uses a PopupWindow
* to calculate the window height when the floating keyboard is opened and closed.
*/
protected static class KeyboardHeightProvider extends PopupWindow {
/**
* The view that is used to calculate the keyboard height
*/
private View popupView;
/**
* The parent view
*/
private View parentView;
private AXEmojiPopupLayout layout;
/**
* Construct a new KeyboardHeightProvider
*/
public KeyboardHeightProvider(AXEmojiPopupLayout popupLayout) {
super(popupLayout.getContext());
this.popupView = new View(popupLayout.getContext());
this.layout = popupLayout;
setContentView(popupView);
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
parentView = Utils.asActivity(popupLayout.getContext()).findViewById(android.R.id.content);
setWidth(0);
setHeight(WindowManager.LayoutParams.MATCH_PARENT);
popupView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (popupView != null) {
handleOnGlobalLayout();
}
}
});
}
/**
* Start the KeyboardHeightProvider, this must be called after the onResume of the Activity.
* PopupWindows are not allowed to be registered before the onResume has finished
* of the Activity.
*/
public void start() {
if (!isShowing() && parentView.getWindowToken() != null) {
setBackgroundDrawable(new ColorDrawable(0));
showAtLocation(parentView, Gravity.NO_GRAVITY, 0, 0);
}
}
public void stickOnStart() {
final Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
if (!isShowing() && parentView.getWindowToken() != null) {
setBackgroundDrawable(new ColorDrawable(0));
showAtLocation(parentView, Gravity.NO_GRAVITY, 0, 0);
return;
}
if (!isShowing()) {
handler.post(this);
}
}
});
}
/**
* Close the keyboard height provider,
* this provider will not be used anymore.
*/
public void close() {
dismiss();
}
/**
* Popup window itself is as big as the window of the Activity.
* The keyboard can then be calculated by extracting the popup view bottom
* from the activity window height.
*/
private void handleOnGlobalLayout() {
if (layout.popupView == null || layout.popupView.getVisibility() == GONE) return;
final int keyboardHeight = Utils.getInputMethodHeight(popupView.getContext(), layout.popupView.rootView);
layout.popupView.updateKeyboardState(keyboardHeight);
if (layout.changeHeightWithKeyboard) {
layout.keyboard.getLayoutParams().height = keyboardHeight;
layout.requestLayout();
}
}
}
}
| 11,010 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiRecyclerView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiRecyclerView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.utils.Utils;
@SuppressLint("ViewConstructor")
public class AXEmojiRecyclerView extends RecyclerView {
FindVariantListener variantListener;
public AXEmojiRecyclerView(@NonNull Context context, FindVariantListener variantListener) {
super(context);
this.variantListener = variantListener;
GridLayoutManager lm = new GridLayoutManager(context, Utils.getGridCount(context));
this.setLayoutManager(lm);
Utils.forceLTR(this);
setOverScrollMode(OVER_SCROLL_NEVER);
}
public AXEmojiRecyclerView(@NonNull Context context,FindVariantListener variantListener,LayoutManager layoutManager) {
super(context);
this.variantListener = variantListener;
this.setLayoutManager(layoutManager);
setOverScrollMode(OVER_SCROLL_NEVER);
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (variantListener.findVariant() != null && variantListener.findVariant().onTouch(event, this))
return true;
return super.dispatchTouchEvent(event);
}
}
| 2,063 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiImageView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiImageView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.view.View;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.utils.Utils;
public final class AXEmojiImageView extends AppCompatImageView {
private static final int VARIANT_INDICATOR_PART_AMOUNT = 6;
private static final int VARIANT_INDICATOR_PART = 5;
Emoji currentEmoji;
private final Paint variantIndicatorPaint = new Paint();
private final Path variantIndicatorPath = new Path();
private final Point variantIndicatorTop = new Point();
private final Point variantIndicatorBottomRight = new Point();
private final Point variantIndicatorBottomLeft = new Point();
private ImageLoadingTask imageLoadingTask;
private boolean hasVariants;
private boolean asyncLoad = AXEmojiManager.isAsyncLoadEnabled();
boolean showVariants = AXEmojiManager.getEmojiViewTheme().isVariantDividerEnabled();
OnEmojiActions actions;
boolean fromRecent;
public void setOnEmojiActions(OnEmojiActions actions, boolean fromRecent) {
this.actions = actions;
this.fromRecent = fromRecent;
}
public AXEmojiImageView(final Context context) {
super(context);
init();
}
public AXEmojiImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public AXEmojiImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
variantIndicatorPaint.setColor(AXEmojiManager.getEmojiViewTheme().getVariantDividerColor());
variantIndicatorPaint.setStyle(Paint.Style.FILL);
variantIndicatorPaint.setAntiAlias(true);
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendEmoji(currentEmoji, false);
}
});
setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (actions != null) return actions.onLongClick(view, currentEmoji, fromRecent, false);
return false;
}
});
if (AXEmojiManager.isRippleEnabled()) Utils.setClickEffect(this, false);
}
@Override
public void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final int measuredWidth = getMeasuredWidth();
//noinspection SuspiciousNameCombination
setMeasuredDimension(measuredWidth, measuredWidth);
}
@Override
protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
variantIndicatorTop.x = w;
variantIndicatorTop.y = h / VARIANT_INDICATOR_PART_AMOUNT * VARIANT_INDICATOR_PART;
variantIndicatorBottomRight.x = w;
variantIndicatorBottomRight.y = h;
variantIndicatorBottomLeft.x = w / VARIANT_INDICATOR_PART_AMOUNT * VARIANT_INDICATOR_PART;
variantIndicatorBottomLeft.y = h;
variantIndicatorPath.rewind();
variantIndicatorPath.moveTo(variantIndicatorTop.x, variantIndicatorTop.y);
variantIndicatorPath.lineTo(variantIndicatorBottomRight.x, variantIndicatorBottomRight.y);
variantIndicatorPath.lineTo(variantIndicatorBottomLeft.x, variantIndicatorBottomLeft.y);
variantIndicatorPath.close();
}
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (showVariants) {
if (hasVariants && getDrawable() != null) {
canvas.drawPath(variantIndicatorPath, variantIndicatorPaint);
}
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (imageLoadingTask != null) {
imageLoadingTask.cancel(true);
imageLoadingTask = null;
}
}
public void setEmojiAsync(final Emoji emoji) {
if (!emoji.equals(currentEmoji)) {
setImageDrawable(null);
currentEmoji = emoji;
hasVariants = emoji.getBase().hasVariants();
if (imageLoadingTask != null) {
imageLoadingTask.cancel(true);
}
imageLoadingTask = new ImageLoadingTask(this);
imageLoadingTask.execute(emoji);
if (emoji.isLoading()) {
postDelayed(new Runnable() {
@Override
public void run() {
if (emoji.isLoading()) {
postDelayed(this, 10);
return;
}
invalidate();
}
}, 10);
}
}
}
public void setEmoji(@NonNull final Emoji emoji) {
if (!emoji.equals(currentEmoji)) {
setImageDrawable(null);
currentEmoji = emoji;
hasVariants = emoji.getBase().hasVariants();
if (imageLoadingTask != null) {
imageLoadingTask.cancel(true);
}
if (AXEmojiManager.getEmojiLoader() != null) {
AXEmojiManager.getEmojiLoader().loadEmoji(this, emoji);
} else {
if (asyncLoad) {
imageLoadingTask = new ImageLoadingTask(this);
imageLoadingTask.execute(emoji);
} else {
this.setImageDrawable(emoji.getDrawable(this));
}
}
if (emoji.isLoading()) {
postDelayed(new Runnable() {
@Override
public void run() {
if (emoji.isLoading()) {
postDelayed(this, 10);
return;
}
invalidate();
}
}, 10);
}
}
}
/**
* Updates the emoji image directly. This should be called only for updating the variant
* displayed (of the same base emoji)
*
* @param emoji The new emoji variant to show.
*/
public void updateEmoji(@NonNull final Emoji emoji) {
if (!emoji.equals(currentEmoji)) {
currentEmoji = emoji;
if (AXEmojiManager.getEmojiLoader() != null) {
AXEmojiManager.getEmojiLoader().loadEmoji(this, emoji);
} else {
setImageDrawable(emoji.getDrawable(this));
}
}
}
public Emoji getEmoji() {
return currentEmoji;
}
private void sendEmoji(Emoji emoji, boolean variants) {
if (actions != null) actions.onClick(this, emoji, fromRecent, variants);
}
public boolean isShowingVariants() {
return showVariants;
}
public boolean isFromRecent() {
return fromRecent;
}
public void setShowVariants(boolean showVariants) {
this.showVariants = showVariants;
}
}
| 8,145 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiPager.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiPager.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.OnEmojiPagerPageChanged;
import org.mark.axemojiview.utils.Utils;
import java.util.ArrayList;
import java.util.List;
public class AXEmojiPager extends AXEmojiLayout {
boolean isShowing = false;
boolean footer;
public AXEmojiPager(Context context) {
super(context);
init();
}
public AXEmojiPager(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public AXEmojiPager(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
OnEmojiPagerPageChanged pageListener = null;
public void setOnEmojiPageChangedListener(OnEmojiPagerPageChanged listener) {
this.pageListener = listener;
if (pageListener != null && vp != null && getPagesCount() > 0)
pageListener.onPageChanged(this, pages.get(vp.getCurrentItem()).base, vp.getCurrentItem());
}
ViewPager vp;
private void init() {
footer = AXEmojiManager.getEmojiViewTheme().isFooterEnabled();
vp = new ViewPager(getContext()) {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (viewPagerTouchEnabled) {
return super.onInterceptTouchEvent(event);
} else {
return false;
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (viewPagerTouchEnabled) {
return super.onTouchEvent(event);
} else {
return false;
}
}
};
vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int i) {
pages.get(i).base.onShow();
if (footer) {
scrollListener.show();
footerView.setPageIndex(i);
}
if (pageListener != null)
pageListener.onPageChanged(AXEmojiPager.this, pages.get(i).base, i);
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
}
List<AXPage> pages = new ArrayList<AXPage>();
public void addPage(AXEmojiBase parent, @DrawableRes int iconRes) {
if (vp.getAdapter() != null) return;
pages.add(new AXPage(parent, iconRes));
}
public void addPage(AXEmojiBase parent, OnFooterItemBinder binder) {
if (vp.getAdapter() != null) return;
pages.add(new AXPage(parent, binder));
}
public void removePage(int index) {
pages.remove(index);
}
public AXEmojiBase getPage(int index) {
return pages.get(index).base;
}
public @DrawableRes int getPageIcon(int index) {
return pages.get(index).icon;
}
public int getPagesCount() {
return pages.size();
}
public void setPageBinder(int index, OnFooterItemBinder binder) {
pages.get(index).setBinder(binder);
}
public OnFooterItemBinder getPageBinder(int index) {
return pages.get(index).binder;
}
private class AXPage {
AXEmojiBase base;
int icon;
OnFooterItemBinder binder;
public AXPage(AXEmojiBase base, @DrawableRes int icon) {
this.base = base;
this.icon = icon;
}
public AXPage(AXEmojiBase base, OnFooterItemBinder binder) {
this.base = base;
this.binder = binder;
}
public void setBinder(OnFooterItemBinder binder) {
this.binder = binder;
}
}
public AXFooterParallax scrollListener;
AXFooterView footerView;
int Left = -1;
/**
* add footer left view
* NOTE : You should add left icon before call emojiPager.show();
*
* @param res
*/
public void setLeftIcon(@DrawableRes int res) {
Left = res;
}
boolean viewPagerTouchEnabled = false;
public void setSwipeWithFingerEnabled(boolean enabled) {
viewPagerTouchEnabled = enabled;
}
public void show() {
if (isShowing) return;
isShowing = true;
if (vp.getParent() != null) {
((ViewGroup) vp.getParent()).removeView(vp);
}
this.addView(vp, new AXEmojiLayout.LayoutParams());
vp.setAdapter(new PagerAdapter() {
public Object instantiateItem(ViewGroup collection, int position) {
AXEmojiBase base = pages.get(position).base;
collection.addView(base);
return base;
}
@Override
public int getCount() {
return pages.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return view.equals(o);
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
});
pages.get(0).base.onShow();
if (footer) {
if (footerView != null && footerView.getParent() != null) {
((ViewGroup) footerView.getParent()).removeView(footerView);
}
footerView = new AXFooterView(getContext(), this, Left);
footerView.setEditText(editText);
this.addView(footerView, new AXEmojiLayout.LayoutParams( -1, Utils.dpToPx(getContext(), 44)));
} else if (customFooter != null) {
if (customFooter.getParent() != null) {
((ViewGroup) customFooter.getParent()).removeView(customFooter);
}
this.addView(customFooter, customFooter.getLayoutParams());
}
if (footerView!=null) {
((FrameLayout.LayoutParams) footerView.getLayoutParams()).gravity = Gravity.BOTTOM;
}
if (footer || (customFooter != null && parallax)) {
final int f;
if (customFooter != null) {
f = (customFooter.getLayoutParams().height + ((AXEmojiLayout.LayoutParams) customFooter.getLayoutParams()).bottomMargin);
} else {
f = Utils.dpToPx(getContext(), 44);
}
scrollListener = new AXFooterParallax((footer ? footerView : customFooter), f, -1);
scrollListener.setDuration(f);
scrollListener.setIDLEHideSize(scrollListener.getDuration() / 2);
scrollListener.setMinComputeScrollOffset(f);
scrollListener.setScrollSpeed((long) 1.2);
scrollListener.setChangeOnIDLEState(true);
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.setScrollListener(scrollListener);
}
ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int i) {
scrollListener.show();
}
@Override
public void onPageScrollStateChanged(int i) {
}
};
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.setPageChanged(pageChangeListener);
}
}
if (footer || customFooter != null) {
final int footerHeight;
if (customFooter != null) {
footerHeight = customFooter.getLayoutParams().height + (((AXEmojiLayout.LayoutParams) customFooter.getLayoutParams()).bottomMargin * 2);
} else {
footerHeight = Utils.dp(getContext(), 44);
}
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.addItemDecoration(Utils.getRVLastRowBottomMarginDecoration(footerHeight));
}
}
}
@Override
public void dismiss() {
super.dismiss();
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.dismiss();
}
}
@Override
public void setEditText(EditText editText) {
super.setEditText(editText);
if (footerView != null) footerView.setEditText(editText);
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.setEditText(editText);
}
}
@Override
public void setPopupInterface(AXPopupInterface popupInterface) {
super.setPopupInterface(popupInterface);
if (footerView != null) footerView.setPopupInterface(popupInterface);
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.setPopupInterface(popupInterface);
}
}
@Override
protected void refresh() {
super.refresh();
if (footer) {
scrollListener.show();
}
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.refresh();
}
}
/**
* @return emoji view pager
*/
public ViewPager getViewPager() {
return vp;
}
OnFooterItemClicked listener = null;
/**
* set footer left and right (backspace) view click listener
*
* @param listener
*/
public void setOnFooterItemClicked(OnFooterItemClicked listener) {
this.listener = listener;
}
public interface OnFooterItemBinder {
void onBindFooterItem(AppCompatImageView view, int index, boolean selected);
}
public interface OnFooterItemClicked {
void onClick(View view, boolean leftIcon);
}
@Override
public void setPageIndex(int index) {
vp.setCurrentItem(index, true);
pages.get(index).base.onShow();
if (footer) {
scrollListener.show();
footerView.setPageIndex(index);
}
if (pageListener != null)
pageListener.onPageChanged(AXEmojiPager.this, pages.get(index).base, index);
}
@Override
public int getPageIndex() {
return vp.getCurrentItem();
}
/**
* get footer left view.
*/
public AppCompatImageView getFooterLeftView() {
return footerView.leftIcon;
}
/**
* get footer right view. (backspace)
*/
public AppCompatImageView getFooterRightView() {
return footerView.backSpace;
}
@Override
protected void onShow() {
super.onShow();
for (int i = 0; i < pages.size(); i++) {
pages.get(i).base.onShow();
}
}
public void setFooterVisible(boolean enabled) {
scrollListener.starts(enabled);
scrollListener.setEnabled(enabled);
}
public void setBackspaceEnabled(boolean enabled) {
if (footerView != null) footerView.backspaceEnabled = enabled;
}
View customFooter = null;
boolean parallax;
public void setCustomFooter(View view, boolean supportParallax) {
this.parallax = supportParallax;
this.customFooter = view;
if (view.getLayoutParams() == null || !(view.getLayoutParams() instanceof AXEmojiLayout.LayoutParams)) {
throw new ClassCastException("footer layoutParams must be an instance of AXEmojiLayout.LayoutParams");
}
}
}
| 12,689 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
ImageLoadingTask.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/ImageLoadingTask.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import org.mark.axemojiview.emoji.Emoji;
import java.lang.ref.WeakReference;
final class ImageLoadingTask extends AsyncTask<Emoji, Void, Drawable> {
private final WeakReference<AppCompatImageView> imageViewReference;
private final WeakReference<Context> contextReference;
ImageLoadingTask(final AppCompatImageView imageView) {
imageViewReference = new WeakReference<>(imageView);
contextReference = new WeakReference<>(imageView.getContext());
}
@Override
protected Drawable doInBackground(final Emoji... emoji) {
final Context context = contextReference.get();
if (context != null && !isCancelled()) {
return emoji[0].getDrawable(context);
}
return null;
}
@Override
protected void onPostExecute(@Nullable final Drawable drawable) {
if (!isCancelled() && drawable != null) {
final AppCompatImageView imageView = imageViewReference.get();
if (imageView != null) {
imageView.setImageDrawable(drawable);
}
}
}
}
| 1,933 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiButton.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiButton.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import androidx.appcompat.widget.AppCompatButton;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiButton extends AppCompatButton {
private float emojiSize;
public AXEmojiButton(final Context context) {
this(context, null);
}
public AXEmojiButton(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiButton);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiButton_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
setText(getText());
}
public float getEmojiSize() {
return emojiSize;
}
@Override
@CallSuper
public void setText(final CharSequence rawText, final BufferType type) {
if (AXEmojiManager.isInstalled()) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
//final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, spannableStringBuilder,
emojiSize>0 ? emojiSize : Utils.getDefaultEmojiSize(fontMetrics), fontMetrics);
super.setText(spannableStringBuilder, type);
}else{
super.setText(rawText,type);
}
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
setText(getText().toString());
}
}
/**
* sets the emoji size in pixels with the provided resource and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
/**
* sets the emoji size in pixels with the provided resource and invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
}
| 4,078 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXCategoryRecycler.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXCategoryRecycler.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.annotation.SuppressLint;
import android.content.Context;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.adapters.AXCategoryAdapter;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.StickerProvider;
import org.mark.axemojiview.utils.Utils;
@SuppressLint("ViewConstructor")
class AXCategoryRecycler extends AXEmojiLayout {
RecentSticker recentStickerManager;
public AXCategoryRecycler(Context context, AXEmojiLayout pager, StickerProvider provider, RecentSticker recentStickerManager) {
super(context);
this.recentStickerManager = recentStickerManager;
this.pager = pager;
init(provider);
}
AXEmojiLayout pager;
RecyclerView icons;
View Divider;
void init(StickerProvider provider) {
// int iconSize = Utils.dpToPx(getContext(),24);
icons = new RecyclerView(getContext());
this.addView(icons, new LayoutParams(0, 0, -1, -1));
LinearLayoutManager lm = new LinearLayoutManager(getContext());
lm.setOrientation(LinearLayoutManager.HORIZONTAL);
icons.setLayoutManager(lm);
Utils.forceLTR(icons);
icons.setItemAnimator(null);
icons.setAdapter(new AXCategoryAdapter(pager, provider, recentStickerManager));
icons.setOverScrollMode(View.OVER_SCROLL_NEVER);
this.setBackgroundColor(AXEmojiManager.getStickerViewTheme().getCategoryColor());
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
}
});
Divider = new View(getContext());
this.addView(Divider, new LayoutParams(
0, Utils.dpToPx(getContext(), 38), getContext().getResources().getDisplayMetrics().widthPixels, Utils.dpToPx(getContext(), 1)));
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled())
Divider.setVisibility(GONE);
Divider.setBackgroundColor(AXEmojiManager.getStickerViewTheme().getDividerColor());
}
public void setPageIndex(int index) {
((AXCategoryAdapter)icons.getAdapter()).update();
}
}
| 2,972 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiPopupView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiPopupView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.O;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.ResultReceiver;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.autofill.AutofillManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.PopupListener;
import org.mark.axemojiview.search.AXEmojiSearchView;
import org.mark.axemojiview.utils.Utils;
@SuppressLint("ViewConstructor")
public class AXEmojiPopupView extends FrameLayout implements AXPopupInterface {
static final int MIN_KEYBOARD_HEIGHT = 50;
final View rootView;
final Activity context;
AXEmojiBase content;
final EditText editText;
boolean isPendingOpen;
boolean isShowing = false;
boolean isKeyboardOpen;
int keyboardHeight = 0;
int originalImeOptions = -1;
AXEmojiSearchView searchView = null;
public boolean isKeyboardOpen() {
return isKeyboardOpen;
}
PopupListener listener = null;
public void setPopupListener(PopupListener listener) {
this.listener = listener;
}
ViewGroup ap;
FrameLayout.LayoutParams lp;
public AXEmojiPopupView(ViewGroup view, final AXEmojiBase content) {
super(content.getContext());
Utils.forceLTR(view);
popupWindowHeight = Utils.getKeyboardHeight(content.getContext(), 0);
lp = new FrameLayout.LayoutParams(-1, popupWindowHeight);
lp.gravity = Gravity.BOTTOM;
this.ap = view;
this.context = Utils.asActivity(content.getContext());
this.rootView = content.getEditText().getRootView();
this.editText = content.getEditText();
this.content = content;
this.addView(content, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
if (content instanceof AXEmojiPager) {
if (!((AXEmojiPager) content).isShowing) ((AXEmojiPager) content).show();
}
content.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getBackgroundColor());
this.invalidate();
}
private void showAtBottomPending() {
isPendingOpen = true;
final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (Utils.shouldOverrideRegularCondition(context, editText)) {
editText.setImeOptions(editText.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
if (inputMethodManager != null) {
inputMethodManager.restartInput(editText);
}
}
if (inputMethodManager != null) {
inputMethodManager.showSoftInput(editText, InputMethodManager.RESULT_UNCHANGED_SHOWN, new ResultReceiver(new Handler(Looper.getMainLooper())) {
@Override
public void onReceiveResult(final int resultCode, final Bundle data) {
}
});
}
}
void updateKeyboardStateOpened(final int keyboardHeight) {
isKeyboardOpen = true;
if (this.keyboardHeight <= 0 || needToOpen) {
this.keyboardHeight = keyboardHeight;
popupWindowHeight = keyboardHeight;
Utils.updateKeyboardHeight(context, keyboardHeight);
}
lp.height = findHeight(popupWindowHeight);
if (listener != null) listener.onKeyboardOpened(findHeightWithSearchView(popupWindowHeight));
if (needToOpen) {
this.setLayoutParams(lp);
needToOpen = false;
Utils.hideKeyboard(ap);
/**if (isKeyboardOpen){
//disable anim
show();
}else{
show();
}*/
show();
} else {
//disable anim
//dismiss();
}
}
void updateKeyboardState(int keyboardHeight){
if (keyboardHeight > Utils.dpToPx(context, MIN_KEYBOARD_HEIGHT)) {
updateKeyboardStateOpened(keyboardHeight);
} else {
updateKeyboardStateClosed();
}
}
void updateKeyboardStateClosed() {
isKeyboardOpen = false;
isShowing = getParent()!=null && lp.height > MIN_KEYBOARD_HEIGHT;
if (listener != null) {
listener.onKeyboardClosed();
}
/**if (isShowing()) {
dismiss();
}*/
}
int popupWindowHeight = 0;
boolean needToOpen = false;
private int animFrom;
public void toggle() {
AXEmojiManager.setUsingPopupWindow(false);
hideSearchView(false);
//if (isAnimRunning) return;
if (!isShowing) {
if (this.getParent() != null) {
ap.removeView(this);
}
// this is needed because something might have cleared the insets listener
if (popupWindowHeight > 0) {
needToOpen = false;
lp.height = findHeight(popupWindowHeight);
ap.addView(this, lp);
show();
} else {
needToOpen = true;
ap.addView(this, lp);
if (Utils.shouldOverrideRegularCondition(context, editText) && originalImeOptions == -1) {
originalImeOptions = editText.getImeOptions();
}
editText.setFocusableInTouchMode(true);
editText.requestFocus();
showAtBottomPending();
}
} else {
dismiss();
}
}
public void show() {
AXEmojiManager.setUsingPopupWindow(false);
hideSearchView(false);
animFrom = lp.height;
//if (isAnimRunning) return;
if (popupWindowHeight == 0) {
needToOpen = true;
if (this.getParent() != null) {
ap.removeView(this);
}
ap.addView(this, lp);
if (Utils.shouldOverrideRegularCondition(context, editText) && originalImeOptions == -1) {
originalImeOptions = editText.getImeOptions();
}
editText.setFocusableInTouchMode(true);
editText.requestFocus();
showAtBottomPending();
return;
}
if (getParent() == null) {
needToOpen = false;
lp.height = findHeight(popupWindowHeight);
ap.addView(this, lp);
content.refresh();
}
isShowing = true;
Utils.hideKeyboard(ap);
showAtBottom();
}
public boolean isShowing() {
return isShowing;
}
@Override
public boolean onBackPressed() {
if (isShowingSearchView()){
show();
return true;
}
if (isShowing()) {
dismiss();
return true;
}
return false;
}
@Override
public void reload() {
hideSearchView(true);
}
public void dismiss() {
hideSearchView(false);
animFrom = lp.height;
//if (isAnimRunning) return;
anim(false);
isShowing = false;
content.dismiss();
if (listener != null) listener.onDismiss();
if (originalImeOptions != -1) {
editText.setImeOptions(originalImeOptions);
final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.restartInput(editText);
}
if (SDK_INT >= O) {
final AutofillManager autofillManager = context.getSystemService(AutofillManager.class);
if (autofillManager != null) {
autofillManager.cancel();
}
}
}
}
boolean ignoreCall = false;
public void onlyHide() {
ignoreCall = true;
animFrom = lp.height;
anim(false);
isShowing = false;
content.dismiss();
hideSearchView(false);
if (listener != null) listener.onDismiss();
}
void showAtBottom() {
isPendingOpen = false;
anim(true);
if (listener != null) listener.onShow();
}
void anim(final boolean e) {
if (e) {
lp.height = findHeight(popupWindowHeight);
this.setLayoutParams(lp);
loadAnimation(animFrom - lp.height,0,false);
} else {
remove();
loadAnimation(0,-lp.height,true);
}
}
public int getPopupHeight() {
return lp.height;
}
public void remove() {
content.dismiss();
//this.isAnimRunning = false;
this.isShowing = false;
//lp.height = 0;
//if (this.getParent() != null) ap.removeView(this);
if (listener != null) listener.onDismiss();
}
int maxHeight = -1,minHeight = -1;
private int findHeight(int keyboardHeight){
if (searchView!=null && searchView.isShowing()) return keyboardHeight;
int h = keyboardHeight;
if (minHeight!=-1) h = Math.max(minHeight,h);
if (maxHeight!=-1) h = Math.min(maxHeight,h);
//if (searchView!=null && searchView.isShowing()) h += searchView.getSearchViewHeight();
return h;
}
public void setMaxHeight(int maxHeight) {
this.maxHeight = maxHeight;
}
public int getMaxHeight() {
return maxHeight;
}
public void setMinHeight(int minHeight) {
this.minHeight = minHeight;
}
public int getMinHeight() {
return minHeight;
}
private int findHeightWithSearchView(int height) {
int h;
if (searchView!=null && searchView.isShowing()) {
h = height + searchView.getSearchViewHeight();
}else {
h = findHeight(height);
}
return h;
}
public AXEmojiSearchView getSearchView() {
return searchView;
}
public void setSearchView(AXEmojiSearchView searchView) {
hideSearchView(true);
this.searchView = searchView;
}
public void hideSearchView(boolean l){
if (searchView == null || !searchView.isShowing() || (searchViewValueAnimator!=null && searchViewValueAnimator.isRunning())) return;
loadSearchViewAnimation(0,searchView.getSearchViewHeight(),true,l, (LayoutParams) searchView.getView().getLayoutParams());
}
private void removeSearchView(boolean l){
try {
if (searchView.getParent() != null)
ap.removeView(searchView);
}catch (Exception ignore){
}
searchView.hide();
this.lp.topMargin = 0;
if (lp.height!=0) lp.height = findHeight(popupWindowHeight);
isShowing = lp.height>0;
if (l && listener!=null) {
if (isKeyboardOpen) {
listener.onKeyboardOpened(popupWindowHeight);
}else {
if (!isShowing) {
listener.onDismiss();
} else {
listener.onShow();
}
}
}
ap.requestLayout();
}
public void showSearchView(){
if (searchView == null || searchView.isShowing() || searchView.getParent()!=null) return;
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(-1,searchView.getSearchViewHeight());
lp.gravity = Gravity.TOP;
this.lp.height = popupWindowHeight;
this.lp.topMargin = lp.height;
ap.addView(searchView,ap.indexOfChild(this),lp);
loadSearchViewAnimation(searchView.getSearchViewHeight(),0,false,false, (LayoutParams) searchView.getView().getLayoutParams());
searchView.show();
ap.requestLayout();
//if (listener!=null)
// listener.onViewHeightChanged(this.lp.height + lp.height);
searchView.getSearchTextField().setFocusable(true);
searchView.getSearchTextField().requestFocus();
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(searchView.getSearchTextField(), InputMethodManager.SHOW_IMPLICIT);
}
public boolean isShowingSearchView(){
return searchView!=null && searchView.isShowing();
}
ValueAnimator valueAnimator = null;
boolean animationEnabled = true;
long animationDuration = 250;
void loadAnimation(int from, int to, final boolean remove){
try {
if (valueAnimator != null && valueAnimator.isRunning()) {
valueAnimator.end();
}
}catch (Exception ignore){}
if (!animationEnabled || isKeyboardOpen) {
lp.bottomMargin = to;
if (remove) {
lp.height = 0;
ap.removeView(AXEmojiPopupView.this);
}
ap.requestLayout();
return;
}
valueAnimator = ValueAnimator.ofInt(from,to);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (valueAnimator!=null && valueAnimator.getAnimatedValue()!=null) {
lp.bottomMargin = (int) valueAnimator.getAnimatedValue();
ap.requestLayout();
}
}
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (remove) {
try {
lp.height = 0;
ap.removeView(AXEmojiPopupView.this);
}catch (Exception ignore){}
}
}
});
valueAnimator.setDuration(animationDuration);
valueAnimator.start();
}
ValueAnimator searchViewValueAnimator = null;
boolean searchViewAnimationEnabled = true;
long searchViewAnimationDuration = animationDuration;
void loadSearchViewAnimation(int from, int to, final boolean remove,final boolean l,final FrameLayout.LayoutParams lp){
try {
if (valueAnimator != null && valueAnimator.isRunning()) {
valueAnimator.end();
}
if (searchViewValueAnimator != null && searchViewValueAnimator.isRunning()) {
searchViewValueAnimator.end();
}
}catch (Exception ignore){}
if (!searchViewAnimationEnabled) {
lp.topMargin = to;
AXEmojiPopupView.this.lp.topMargin = lp.height - lp.topMargin;
if (remove) {
removeSearchView(l);
}
ap.requestLayout();
return;
}
searchViewValueAnimator = ValueAnimator.ofInt(from,to);
searchViewValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (valueAnimator!=null && valueAnimator.getAnimatedValue()!=null) {
lp.topMargin = (int) valueAnimator.getAnimatedValue();
AXEmojiPopupView.this.lp.topMargin = lp.height - lp.topMargin;
ap.requestLayout();
}
}
});
searchViewValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (remove) {
try {
removeSearchView(l);
}catch (Exception ignore){}
}
}
});
searchViewValueAnimator.setDuration(searchViewAnimationDuration);
searchViewValueAnimator.start();
}
}
| 17,100 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiSingleRecyclerView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiSingleRecyclerView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.utils.Utils;
@SuppressLint("ViewConstructor")
public class AXEmojiSingleRecyclerView extends RecyclerView {
FindVariantListener variantListener;
public AXEmojiSingleRecyclerView(@NonNull Context context, FindVariantListener variantListener) {
super(context);
this.variantListener = variantListener;
StaggeredGridLayoutManager lm = new StaggeredGridLayoutManager(Utils.getGridCount(context), StaggeredGridLayoutManager.VERTICAL);
this.setLayoutManager(lm);
Utils.forceLTR(this);
setOverScrollMode(OVER_SCROLL_NEVER);
}
boolean skipTouch = false;
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (variantListener.findVariant() != null && variantListener.findVariant().onTouch(event, this))
return true;
return super.dispatchTouchEvent(event);
}
}
| 1,867 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXFooterParallax.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXFooterParallax.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.animation.ObjectAnimator;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
class AXFooterParallax extends RecyclerView.OnScrollListener {
RecyclerView RecyclerView;
ObjectAnimator anim;
private boolean menabled;
private boolean monIdle;
private long AnimTime;
private int mComputeScrollOffset;
private long Accept;
private long scrollspeed;
int minDy = -1;
AXFooterParallax(View Toolbar, int ParalaxSize, int minDy) {
this.minDy = minDy;
this.menabled = true;
this.monIdle = true;
anim = ObjectAnimator.ofFloat(Toolbar, "translationY", 0, ParalaxSize);
this.setDuration(Toolbar.getHeight());
this.Accept = Toolbar.getHeight() / 2;
this.scrollspeed = (long) 1.2;
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
RecyclerView = recyclerView;
if (menabled) {
if (monIdle && newState == androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE) {
IDLE();
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
this.RecyclerView = recyclerView;
if (anim.getDuration() == anim.getCurrentPlayTime()) {
if (minDy > Math.abs(dy)) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager == null) return;
int firstVisibleItemPosition = 0;
int visibleItemCount = layoutManager.getChildCount();
if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
firstVisibleItemPosition = ((GridLayoutManager) layoutManager).findFirstVisibleItemPosition();
} else if (recyclerView.getLayoutManager() instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
int[] firstPositions = new int[staggeredGridLayoutManager.getSpanCount()];
staggeredGridLayoutManager.findFirstVisibleItemPositions(firstPositions);
firstVisibleItemPosition = findMin(firstPositions);
}
if ((visibleItemCount > 0 && (firstVisibleItemPosition) > 0)) {
return;
}
}
}
if (menabled) {
SCROLL(dy);
}
}
private int findMin(int[] firstPositions) {
int min = firstPositions[0];
for (int value : firstPositions) {
if (value < min) {
min = value;
}
}
return min;
}
public boolean isEnabled() {
return menabled;
}
public void setEnabled(boolean enabled) {
this.menabled = enabled;
}
public void setChangeOnIDLEState(boolean enabled) {
this.monIdle = enabled;
}
public long getDuration() {
return anim.getDuration();
}
public void setDuration(long duration) {
anim.setDuration(duration);
}
public void setMinComputeScrollOffset(int ComputeScrollOffset) {
mComputeScrollOffset = ComputeScrollOffset;
}
public void setScrollSpeed(long s) {
scrollspeed = s;
}
public void setIDLEHideSize(long s) {
this.Accept = s;
}
public void onIDLE(boolean WithAnimation) {
if (WithAnimation) {
IDLE();
} else {
if (RecyclerView.computeVerticalScrollOffset() > mComputeScrollOffset) {
if (AnimTime > 0 && AnimTime < anim.getDuration()) {
if (AnimTime < Accept) {
starts2(true);
} else {
starts2(false);
}
}
} else {
if (AnimTime > 0 && AnimTime < anim.getDuration()) {
starts2(true);
}
}
}
}
private void IDLE() {
if (RecyclerView.computeVerticalScrollOffset() > mComputeScrollOffset) {
if (AnimTime > 0 && AnimTime < anim.getDuration()) {
if (AnimTime < Accept) {
starts(true);
} else {
starts(false);
}
}
} else {
if (AnimTime > 0 && AnimTime < anim.getDuration()) {
starts(true);
}
}
}
void starts(boolean e) {
if (e) {
anim.reverse();
AnimTime = 0;
} else {
anim.start();
AnimTime = anim.getDuration();
}
}
private void starts2(boolean e) {
if (e) {
AnimTime = 0;
anim.setCurrentPlayTime(AnimTime);
} else {
AnimTime = anim.getDuration();
anim.setCurrentPlayTime(AnimTime);
}
}
void show() {
if (anim.getCurrentPlayTime() == anim.getDuration()) starts(true);
}
private void SCROLL(int dy) {
if (AnimTime <= anim.getDuration() && AnimTime >= 0) {
if (dy > 0) {
AnimTime = AnimTime + Math.abs(dy / scrollspeed);
} else {
AnimTime = AnimTime - Math.abs(dy / scrollspeed);
}
if (AnimTime > anim.getDuration())
AnimTime = anim.getDuration();
if (AnimTime < 0)
AnimTime = 0;
anim.setCurrentPlayTime(AnimTime);
} else {
if (AnimTime > anim.getDuration())
AnimTime = anim.getDuration();
if (AnimTime < 0)
AnimTime = 0;
}
}
}
| 6,684 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiBase.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiBase.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.viewpager.widget.ViewPager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.EditText;
import android.widget.FrameLayout;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiBase extends FrameLayout {
public AXEmojiBase(Context context) {
super(context);
Utils.forceLTR(this);
}
public AXEmojiBase(Context context, AttributeSet attrs) {
super(context, attrs);
Utils.forceLTR(this);
}
public AXEmojiBase(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Utils.forceLTR(this);
}
EditText editText;
AXPopupInterface popupInterface;
public void setEditText(EditText editText) {
this.editText = editText;
if (popupInterface!=null && editText instanceof AXEmojiEditText){
((AXEmojiEditText) editText).popupInterface = popupInterface;
}
}
public EditText getEditText() {
return editText;
}
public void setPopupInterface(AXPopupInterface popupInterface) {
this.popupInterface = popupInterface;
if (editText!=null && editText instanceof AXEmojiEditText){
((AXEmojiEditText) editText).popupInterface = popupInterface;
}
}
public AXPopupInterface getPopupInterface() {
return popupInterface;
}
public void dismiss() {
}
protected void addItemDecoration(RecyclerView.ItemDecoration decoration) {
}
protected void setScrollListener(RecyclerView.OnScrollListener listener) {
}
protected void setPageChanged(ViewPager.OnPageChangeListener listener) {
}
protected void refresh() {
}
public void setPageIndex(int Position) {
}
public int getPageIndex() {
return 0;
}
protected void onShow() {
}
}
| 2,611 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXStickerView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXStickerView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import androidx.viewpager.widget.ViewPager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.adapters.AXStickerViewPagerAdapter;
import org.mark.axemojiview.listener.OnStickerActions;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.RecentStickerManager;
import org.mark.axemojiview.sticker.Sticker;
import org.mark.axemojiview.sticker.StickerProvider;
import org.mark.axemojiview.utils.Utils;
public class AXStickerView extends AXEmojiLayout {
StickerProvider stickerProvider;
RecentSticker recent;
final String type;
public AXStickerView(Context context, String type, StickerProvider stickerProvider) {
super(context);
this.type = type;
this.stickerProvider = stickerProvider;
init();
}
public final String getType() {
return type;
}
AXCategoryRecycler categoryViews;
ViewPager vp;
@SuppressWarnings("rawtypes")
OnStickerActions events = new OnStickerActions() {
@Override
public void onClick(View view, Sticker sticker, boolean fromRecent) {
if (recent != null) recent.addSticker(sticker);
if (stickerActions != null) stickerActions.onClick(view, sticker, fromRecent);
}
@Override
public boolean onLongClick(View view, Sticker sticker, boolean fromRecent) {
if (stickerActions != null) return stickerActions.onLongClick(view, sticker, fromRecent);
return false;
}
};
OnStickerActions stickerActions = null;
/**
* add sticker click and longClick listener
*
* @param listener
*/
public void setOnStickerActionsListener(OnStickerActions listener) {
stickerActions = listener;
}
RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener() {
private boolean isShowing = true;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (recyclerView == null) {
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled()) {
if (!isShowing) {
isShowing = true;
if (categoryViews != null) categoryViews.Divider.setVisibility(GONE);
}
}
return;
}
if (dy == 0) return;
if (dy == 1) dy = 0;
super.onScrolled(recyclerView, dx, dy);
if (scrollListener2 != null) scrollListener2.onScrolled(recyclerView, dx, dy);
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled()) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager == null) return;
int firstVisibleItemPosition = 1;
if (layoutManager instanceof GridLayoutManager) {
firstVisibleItemPosition = ((GridLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition();
} else if (layoutManager instanceof LinearLayoutManager) {
firstVisibleItemPosition = ((LinearLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition();
}
int visibleItemCount = layoutManager.getChildCount();
if ((visibleItemCount > 0 && (firstVisibleItemPosition) == 0)) {
if (!isShowing) {
isShowing = true;
if (categoryViews != null) categoryViews.Divider.setVisibility(GONE);
}
} else {
if (isShowing) {
isShowing = false;
if (categoryViews != null) categoryViews.Divider.setVisibility(VISIBLE);
}
}
}
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (scrollListener2 != null)
scrollListener2.onScrollStateChanged(recyclerView, newState);
}
};
RecyclerView.OnScrollListener scrollListener2 = null;
private void init() {
if (AXEmojiManager.getInstance().getRecentSticker() != null) {
recent = AXEmojiManager.getInstance().getRecentSticker();
} else {
recent = new RecentStickerManager(getContext(), type);
}
int top = 0;
if (AXEmojiManager.getStickerViewTheme().isCategoryEnabled())
top = Utils.dpToPx(getContext(), 39);
vp = new ViewPager(getContext());
this.addView(vp, new LayoutParams(0, top, -1, -1));
vp.setAdapter(new AXStickerViewPagerAdapter(events, scrollListener, stickerProvider, recent));
//vp.setPadding(0, 0, 0, top);
if (AXEmojiManager.getStickerViewTheme().isCategoryEnabled()) {
categoryViews = new AXCategoryRecycler(getContext(), this, stickerProvider, recent);
this.addView(categoryViews, new LayoutParams(0, 0, -1, top));
} else {
categoryViews = null;
}
this.setBackgroundColor(AXEmojiManager.getStickerViewTheme().getBackgroundColor());
if (categoryViews != null)
categoryViews.setBackgroundColor(AXEmojiManager.getStickerViewTheme().getBackgroundColor());
vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
if (pagerListener2 != null) pagerListener2.onPageScrolled(i, v, i1);
}
@Override
public void onPageSelected(int i) {
vp.setCurrentItem(i, true);
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled()) {
if (((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.size() > i) {
View view = ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i);
if (view instanceof RecyclerView)
scrollListener.onScrolled((RecyclerView) view, 0, 1);
} else {
scrollListener.onScrolled(null, 0, 1);
}
}
if (categoryViews != null) categoryViews.setPageIndex(i);
if (pagerListener2 != null) pagerListener2.onPageSelected(i);
}
@Override
public void onPageScrollStateChanged(int i) {
if (pagerListener2 != null) pagerListener2.onPageScrollStateChanged(i);
}
});
}
ViewPager.OnPageChangeListener pagerListener2 = null;
@Override
public void setPageIndex(int index) {
vp.setCurrentItem(index, true);
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled()) {
if (((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.size() > index) {
View view = ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.get(index);
if (view instanceof RecyclerView)
scrollListener.onScrolled((RecyclerView) view, 0, 1);
} else {
scrollListener.onScrolled(null, 0, 1);
}
}
if (categoryViews != null) categoryViews.setPageIndex(index);
}
@Override
public void dismiss() {
recent.persist();
}
@Override
protected void setScrollListener(RecyclerView.OnScrollListener listener) {
super.setScrollListener(listener);
scrollListener2 = listener;
}
@Override
protected void setPageChanged(ViewPager.OnPageChangeListener listener) {
super.setPageChanged(listener);
pagerListener2 = listener;
}
@Override
public int getPageIndex() {
return vp.getCurrentItem();
}
@Override
protected void addItemDecoration(RecyclerView.ItemDecoration itemDecoration) {
((AXStickerViewPagerAdapter) vp.getAdapter()).itemDecoration = itemDecoration;
for (int i = 0; i < ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.size(); i++) {
View view = ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i);
if (view instanceof RecyclerView)
((RecyclerView) view).addItemDecoration(itemDecoration);
}
}
@Override
protected void refresh() {
super.refresh();
try {
if (categoryViews != null) {
categoryViews.removeAllViews();
categoryViews.init(stickerProvider);
}
vp.getAdapter().notifyDataSetChanged();
vp.setCurrentItem(0, false);
for (int i = 0; i < ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.size(); i++) {
View view = ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i);
if (view instanceof RecyclerView)
((RecyclerView) view).getAdapter().notifyDataSetChanged();
}
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled())
scrollListener.onScrolled(null, 0, 1);
if (categoryViews != null) categoryViews.setPageIndex(0);
} catch (Exception e) {
e.printStackTrace();
}
}
public void refreshNow(int scrollToPosition) {
super.refresh();
try {
for (int i = 0; i < ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.size(); i++) {
View view = ((AXStickerViewPagerAdapter) vp.getAdapter()).recyclerViews.get(i);
if (view instanceof RecyclerView)
((RecyclerView) view).getAdapter().notifyDataSetChanged();
}
vp.getAdapter().notifyDataSetChanged();
int stp = scrollToPosition + ((AXStickerViewPagerAdapter) vp.getAdapter()).add;
if (categoryViews != null) {
categoryViews.removeAllViews();
categoryViews.init(stickerProvider);
}
vp.setCurrentItem(stp, false);
if (!AXEmojiManager.getStickerViewTheme().isAlwaysShowDividerEnabled())
scrollListener.onScrolled(null, 0, 1);
if (categoryViews != null) categoryViews.setPageIndex(0);
} catch (Exception e) {
e.printStackTrace();
}
}
public ViewPager getViewPager() {
return vp;
}
View l = null;
public View getLoadingView() {
return l;
}
public void setLoadingView(View view) {
if (l != null) this.removeView(l);
l = view;
if (l == null) return;
if (l.getLayoutParams() == null) {
l.setLayoutParams(new LayoutParams(0, 0, -1, -1));
}
this.addView(l, l.getLayoutParams());
l.setVisibility(GONE);
}
public void setLoadingMode(boolean enabled) {
if (l != null) {
if (enabled) {
l.setVisibility(VISIBLE);
if (categoryViews != null) categoryViews.setVisibility(GONE);
vp.setVisibility(GONE);
} else {
l.setVisibility(GONE);
if (categoryViews != null) categoryViews.setVisibility(VISIBLE);
vp.setVisibility(VISIBLE);
}
}
}
public void refreshNow() {
refresh();
}
}
| 12,456 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiCheckbox.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiCheckbox.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import androidx.appcompat.widget.AppCompatCheckBox;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiCheckbox extends AppCompatCheckBox {
private float emojiSize;
public AXEmojiCheckbox(final Context context) {
this(context, null);
}
public AXEmojiCheckbox(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiCheckbox);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiCheckbox_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
}
public AXEmojiCheckbox(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiCheckbox);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiCheckbox_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
}
@Override
@CallSuper
public void setText(final CharSequence rawText, final BufferType type) {
if (isInEditMode() || !AXEmojiManager.isInstalled()) {
super.setText(rawText, type);
return;
}
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
//final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (AXEmojiManager.isInstalled())
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, spannableStringBuilder,
emojiSize>0 ? emojiSize : Utils.getDefaultEmojiSize(fontMetrics), fontMetrics);
super.setText(spannableStringBuilder, type);
}
public float getEmojiSize() {
return emojiSize;
}
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
setText(getText().toString());
}
}
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
} | 4,195 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXCategoryViews.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXCategoryViews.java | package org.mark.axemojiview.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.AppCompatImageView;
import android.view.View;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiCategory;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.utils.Utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@SuppressLint("ViewConstructor")
class AXCategoryViews extends AXEmojiLayout {
public AXCategoryViews(Context context, AXEmojiBase view, RecentEmoji recentEmoji) {
super(context);
this.emojiView = view;
this.recentEmoji = recentEmoji;
init();
}
RecentEmoji recentEmoji;
AXEmojiBase emojiView;
View selection;
View Divider;
boolean recent;
List<AppCompatImageView> icons;
int index = 0;
void init() {
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
}
});
icons = new ArrayList<>();
int left = 0;
List<EmojiCategory> categories = new ArrayList<>(Arrays.asList(AXEmojiManager.getInstance().getCategories()));
recent = recentEmoji.isEmpty();
if (!recent) {
categories.add(0, new EmojiCategory() {
@NonNull
@Override
public Emoji[] getEmojis() {
return null;
}
@Override
public int getIcon() {
return R.drawable.emoji_recent;
}
@Override
public CharSequence getTitle() {
return "";
}
});
}
boolean backspace = false;
if (!AXEmojiManager.getEmojiViewTheme().isFooterEnabled() && AXEmojiManager.isBackspaceCategoryEnabled()) {
backspace = true;
categories.add(new EmojiCategory() {
@NonNull
@Override
public Emoji[] getEmojis() {
return null;
}
@Override
public int getIcon() {
return R.drawable.emoji_backspace;
}
@Override
public CharSequence getTitle() {
return "";
}
});
}
int size = getContext().getResources().getDisplayMetrics().widthPixels / categories.size();
int iconSize = Utils.dpToPx(getContext(), 22);
for (int i = 0; i < categories.size(); i++) {
AXEmojiLayout layout = new AXEmojiLayout(getContext());
this.addView(layout, new LayoutParams(left, 0, size, -1));
AppCompatImageView icon = new AppCompatImageView(getContext());
layout.addView(icon, new LayoutParams
((size / 2) - (iconSize / 2), Utils.dpToPx(getContext(), 9), iconSize, iconSize));
Drawable dr = AppCompatResources.getDrawable(getContext(), categories.get(i).getIcon());
icon.setTag(dr);
if (i == 0) {
setIconImage(icon, true);
} else {
setIconImage(icon, false);
}
if (backspace && i == categories.size() - 1) {
icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (emojiView.getEditText() != null)
AXEmojiUtils.backspace(emojiView.getEditText());
}
});
} else {
addClick(icon, i);
addClick(layout, i);
}
Utils.setClickEffect(icon, true);
left = left + size;
icons.add(icon);
}
selection = new View(getContext());
this.addView(selection, new LayoutParams(
0, Utils.dpToPx(getContext(), 36), size, Utils.dpToPx(getContext(), 2)));
selection.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getSelectionColor());
Divider = new View(getContext());
this.addView(Divider, new LayoutParams(
0, Utils.dpToPx(getContext(), 38), getContext().getResources().getDisplayMetrics().widthPixels, Utils.dpToPx(getContext(), 1)));
if (!AXEmojiManager.getEmojiViewTheme().isAlwaysShowDividerEnabled())
Divider.setVisibility(GONE);
Divider.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getDividerColor());
this.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getCategoryColor());
}
public void setPageIndex(int index) {
if (this.index == index) return;
this.index = index;
for (int i = 0; i < icons.size(); i++) {
AppCompatImageView icon = icons.get(i);
if (i == index) {
setIconImage(icon, true);
setSelectionPage((AXEmojiLayout) icon.getParent());
} else {
setIconImage(icon, false);
}
}
}
private void setIconImage(AppCompatImageView icon, boolean selected) {
Drawable dr = ((Drawable) icon.getTag()).getConstantState().newDrawable();
if (selected) {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getSelectedColor());
} else {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getDefaultColor());
}
icon.setImageDrawable(dr);
}
private void setSelectionPage(AXEmojiLayout icon) {
((LayoutParams) selection.getLayoutParams()).leftMargin = ((LayoutParams) icon.getLayoutParams()).leftMargin;
this.requestLayout();
}
private void addClick(final View icon, final int i) {
icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (index == i) return;
emojiView.setPageIndex(i);
}
});
}
}
| 6,500 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXFooterView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXFooterView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.View;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.R;
import org.mark.axemojiview.adapters.AXFooterIconsAdapter;
import org.mark.axemojiview.utils.Utils;
class AXFooterView extends AXEmojiLayout {
public AXFooterView(Context context, AXEmojiPager pager, int Left) {
super(context);
this.Left = Left;
this.pager = pager;
init();
}
int Left;
AXEmojiPager pager;
RecyclerView icons;
AppCompatImageView backSpace;
AppCompatImageView leftIcon;
private boolean backspacePressed;
private boolean backspaceOnce;
boolean backspaceEnabled = true;
private void init() {
int iconSize = Utils.dpToPx(getContext(), 24);
backSpace = new AppCompatImageView(getContext()) {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (!backspaceEnabled) return super.onTouchEvent(event);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
backspacePressed = true;
backspaceOnce = false;
postBackspaceRunnable(350);
} else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
backspacePressed = false;
if (!backspaceOnce) {
AXEmojiUtils.backspace(editText);
backSpace.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
}
super.onTouchEvent(event);
return true;
}
};
this.addView(backSpace, new LayoutParams(
getContext().getResources().getDisplayMetrics().widthPixels - Utils.dpToPx(getContext(), 38), Utils.dpToPx(getContext(), 10), iconSize, iconSize));
Drawable back = ContextCompat.getDrawable(getContext(), R.drawable.emoji_backspace);
DrawableCompat.setTint(DrawableCompat.wrap(back), AXEmojiManager.getEmojiViewTheme().getFooterItemColor());
backSpace.setImageDrawable(back);
Utils.setClickEffect(backSpace, true);
backSpace.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//if (pager.getEditText()!=null) AXEmojiUtils.backspace(pager.getEditText());
if (pager.listener != null) pager.listener.onClick(view, false);
}
});
if (Left != -1) {
leftIcon = new AppCompatImageView(getContext());
this.addView(leftIcon, new LayoutParams(Utils.dpToPx(getContext(), 8), Utils.dpToPx(getContext(), 10), iconSize, iconSize));
Drawable leftIconDr = AppCompatResources.getDrawable(getContext(), Left);
DrawableCompat.setTint(DrawableCompat.wrap(leftIconDr), AXEmojiManager.getEmojiViewTheme().getFooterItemColor());
leftIcon.setImageDrawable(leftIconDr);
Utils.setClickEffect(leftIcon, true);
leftIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (pager.listener != null) pager.listener.onClick(view, true);
}
});
}
icons = new RecyclerView(getContext());
this.addView(icons, new AXEmojiLayout.LayoutParams(
Utils.dpToPx(getContext(), 44), 0, getContext().getResources().getDisplayMetrics().widthPixels - Utils.dpToPx(getContext(), 88), -1));
LinearLayoutManager lm = new LinearLayoutManager(getContext());
lm.setOrientation(LinearLayoutManager.HORIZONTAL);
icons.setLayoutManager(lm);
Utils.forceLTR(icons);
icons.setItemAnimator(null);
icons.setAdapter(new AXFooterIconsAdapter(pager));
icons.setOverScrollMode(View.OVER_SCROLL_NEVER);
if (icons.getLayoutParams().width > pager.getPagesCount() * Utils.dpToPx(getContext(), 40)) {
icons.getLayoutParams().width = pager.getPagesCount() * Utils.dpToPx(getContext(), 40);
((LayoutParams) icons.getLayoutParams()).leftMargin = 0;
((LayoutParams) icons.getLayoutParams()).gravity = Gravity.CENTER_HORIZONTAL;
this.requestLayout();
}
this.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getFooterBackgroundColor());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.setElevation(Utils.dpToPx(getContext(), 2));
}
this.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
public void setPageIndex(int index) {
icons.getAdapter().notifyDataSetChanged();
}
private void postBackspaceRunnable(final int time) {
backSpace.postDelayed(new Runnable() {
@Override
public void run() {
if (!backspaceEnabled || !backspacePressed) return;
AXEmojiUtils.backspace(editText);
backSpace.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
backspaceOnce = true;
postBackspaceRunnable(Math.max(50, time - 100));
}
}, time);
}
}
| 6,575 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiRadioButton.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiRadioButton.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import androidx.appcompat.widget.AppCompatRadioButton;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiRadioButton extends AppCompatRadioButton {
private float emojiSize;
public AXEmojiRadioButton(final Context context) {
this(context, null);
}
public AXEmojiRadioButton(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiRadioButton);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiRadioButton_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
}
public AXEmojiRadioButton(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiCheckbox);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiRadioButton_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
}
@Override
@CallSuper
public void setText(final CharSequence rawText, final BufferType type) {
if (isInEditMode() || !AXEmojiManager.isInstalled()) {
super.setText(rawText, type);
return;
}
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
if (AXEmojiManager.isInstalled())
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, spannableStringBuilder,
emojiSize>0 ? emojiSize : Utils.getDefaultEmojiSize(fontMetrics), fontMetrics);
super.setText(spannableStringBuilder, type);
}
public float getEmojiSize() {
return emojiSize;
}
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
setText(getText().toString());
}
}
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
} | 4,139 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiTextView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiTextView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import com.google.android.material.textview.MaterialTextView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
public class AXEmojiTextView extends MaterialTextView {
private float emojiSize;
public AXEmojiTextView(final Context context) {
this(context, null);
}
public AXEmojiTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiTextView);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiTextView_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
setText(getText());
}
@Override
@CallSuper
public void setText(final CharSequence rawText, final BufferType type) {
if (AXEmojiManager.isInstalled()) {
final CharSequence text = rawText == null ? "" : rawText;
final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
//final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, spannableStringBuilder, emojiSize, fontMetrics);
super.setText(spannableStringBuilder, type);
} else {
super.setText(rawText, type);
}
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
setText(getText().toString());
}
}
public float getEmojiSize() {
return emojiSize;
}
/**
* sets the emoji size in pixels with the provided resource and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
/**
* sets the emoji size in pixels with the provided resource and invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
}
| 3,988 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXPopupInterface.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXPopupInterface.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
public interface AXPopupInterface {
void toggle();
void show();
void dismiss();
boolean isShowing();
boolean onBackPressed();
void reload();
}
| 823 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiLayout.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiLayout.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.FrameLayout;
public class AXEmojiLayout extends AXEmojiBase {
public AXEmojiLayout(Context context) {
super(context);
}
public AXEmojiLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AXEmojiLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public static class LayoutParams extends FrameLayout.LayoutParams {
public LayoutParams(int left, int top, int width, int height) {
super(width, height);
this.width = width;
this.height = height;
this.leftMargin = left;
this.topMargin = top;
}
public LayoutParams(int width, int height) {
super(width, height);
this.width = width;
this.height = height;
}
public LayoutParams() {
super(-1, -1);
}
public LayoutParams(ViewGroup.LayoutParams lp) {
super(lp);
}
}
}
| 1,806 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXSearchViewInterface.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXSearchViewInterface.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.view.View;
import android.widget.EditText;
public interface AXSearchViewInterface {
int getSearchViewHeight();
void show();
void hide();
boolean isShowing();
View getView();
EditText getSearchTextField();
}
| 898 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiPopup.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiPopup.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
import static android.os.Build.VERSION_CODES.O;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.autofill.AutofillManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.PopupListener;
import org.mark.axemojiview.search.AXEmojiSearchView;
import org.mark.axemojiview.utils.EmojiResultReceiver;
import org.mark.axemojiview.utils.Utils;
/**
* @deprecated
* Use AXEmojiPopupLayout instead
*/
public final class AXEmojiPopup implements EmojiResultReceiver.Receiver, AXPopupInterface {
static final int MIN_KEYBOARD_HEIGHT = 50;
final View rootView;
final Activity context;
final PopupWindow popupWindow;
final FrameLayout ap;
AXEmojiBase content;
AXEmojiSearchView searchView = null;
final EditText editText;
boolean isPendingOpen;
boolean isKeyboardOpen;
int keyboardHeight;
int maxHeight = -1,minHeight = -1;
int originalImeOptions = -1;
final EmojiResultReceiver emojiResultReceiver = new EmojiResultReceiver(new Handler(Looper.getMainLooper()));
final ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
@SuppressWarnings("PMD.CyclomaticComplexity")
public void onGlobalLayout() {
updateKeyboardState();
}
};
final View.OnAttachStateChangeListener onAttachStateChangeListener = new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(final View v) {
start();
}
@Override
public void onViewDetachedFromWindow(final View v) {
stop();
popupWindow.setOnDismissListener(null);
if (SDK_INT < LOLLIPOP) {
rootView.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayoutListener);
}
rootView.removeOnAttachStateChangeListener(this);
}
};
PopupListener listener = null;
public void setPopupListener(PopupListener listener) {
this.listener = listener;
}
public AXEmojiPopup(final AXEmojiBase content) {
this.context = Utils.asActivity(content.getContext());
this.rootView = content.getEditText().getRootView();
this.editText = content.getEditText();
this.content = content;
this.content.setPopupInterface(this);
this.keyboardHeight = Utils.getKeyboardHeight(context, 0);
popupWindow = new PopupWindow(context);
ap = new FrameLayout(context);
ap.addView(content,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,0));
((FrameLayout.LayoutParams) content.getLayoutParams()).gravity = Gravity.BOTTOM;
popupWindow.setContentView(ap);
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
popupWindow.setBackgroundDrawable(new BitmapDrawable(context.getResources(), (Bitmap) null)); // To avoid borders and overdraw.
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (listener != null) listener.onDismiss();
}
});
if (content instanceof AXEmojiPager) {
if (!((AXEmojiPager) content).isShowing) ((AXEmojiPager) content).show();
}
content.setBackgroundColor(AXEmojiManager.getEmojiViewTheme().getBackgroundColor());
rootView.addOnAttachStateChangeListener(onAttachStateChangeListener);
if (keyboardHeight >= MIN_KEYBOARD_HEIGHT) {
popupWindow.setHeight(findHeightWithSearchView(keyboardHeight));
}
}
public PopupWindow getPopupWindow() {
return popupWindow;
}
void updateKeyboardState() {
final int keyboardHeight = Utils.getInputMethodHeight(context, rootView);
this.keyboardHeight = keyboardHeight;
if (keyboardHeight > Utils.dpToPx(context, MIN_KEYBOARD_HEIGHT)) {
updateKeyboardStateOpened(keyboardHeight);
} else {
updateKeyboardStateClosed();
}
}
void start() {
if (SDK_INT >= LOLLIPOP) {
context.getWindow().getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
int previousOffset;
@Override
public WindowInsets onApplyWindowInsets(final View v, final WindowInsets insets) {
final int offset;
if (insets.getSystemWindowInsetBottom() < insets.getStableInsetBottom()) {
offset = insets.getSystemWindowInsetBottom();
} else {
offset = insets.getSystemWindowInsetBottom() - insets.getStableInsetBottom();
}
if (offset != previousOffset || offset == 0) {
previousOffset = offset;
if (offset > Utils.dpToPx(context, MIN_KEYBOARD_HEIGHT)) {
updateKeyboardStateOpened(offset);
} else {
updateKeyboardStateClosed();
}
}
return context.getWindow().getDecorView().onApplyWindowInsets(insets);
}
});
} else {
rootView.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayoutListener);
rootView.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener);
}
}
void stop() {
dismiss();
if (SDK_INT >= LOLLIPOP) {
context.getWindow().getDecorView().setOnApplyWindowInsetsListener(null);
}
}
void updateKeyboardStateOpened(final int keyboardHeight) {
if (popupWindowHeight <= 0) {
popupWindowHeight = keyboardHeight;
}
if (popupWindow.getHeight() != popupWindowHeight) {
popupWindow.setHeight(findHeightWithSearchView(popupWindowHeight));
}
final int properWidth = Utils.getProperWidth(context);
if (popupWindow.getWidth() != properWidth) {
popupWindow.setWidth(properWidth);
}
Utils.updateKeyboardHeight(context, keyboardHeight);
if (!isKeyboardOpen) {
isKeyboardOpen = true;
if (listener != null) {
listener.onKeyboardOpened(keyboardHeight);
}
}
if (isPendingOpen) {
showAtBottom();
}
}
void updateKeyboardStateClosed() {
isKeyboardOpen = false;
if (listener != null) {
listener.onKeyboardClosed();
}
if (isShowing()) {
dismiss();
}
}
int popupWindowHeight = 0;
public void toggle() {
AXEmojiManager.setUsingPopupWindow(true);
if (!popupWindow.isShowing()) {
// this is needed because something might have cleared the insets listener
start();
show();
} else {
dismiss();
}
}
public void show() {
hideSearchView(false);
AXEmojiManager.setUsingPopupWindow(true);
content.refresh();
if (Utils.shouldOverrideRegularCondition(context, editText) && originalImeOptions == -1) {
originalImeOptions = editText.getImeOptions();
}
editText.setFocusableInTouchMode(true);
editText.requestFocus();
showAtBottomPending();
}
private void showAtBottomPending() {
isPendingOpen = true;
final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (Utils.shouldOverrideRegularCondition(context, editText)) {
editText.setImeOptions(editText.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
if (inputMethodManager != null) {
inputMethodManager.restartInput(editText);
}
}
if (inputMethodManager != null) {
emojiResultReceiver.setReceiver(this);
inputMethodManager.showSoftInput(editText, InputMethodManager.RESULT_UNCHANGED_SHOWN, emojiResultReceiver);
}
}
public boolean isShowing() {
return popupWindow.isShowing();
}
@Override
public boolean onBackPressed() {
if (isShowingSearchView()){
show();
return true;
}
if (isShowing()) {
dismiss();
return true;
}
return false;
}
@Override
public void reload() {
dismiss();
}
public void dismiss() {
hideSearchView(false);
popupWindow.dismiss();
content.dismiss();
emojiResultReceiver.setReceiver(null);
if (originalImeOptions != -1) {
editText.setImeOptions(originalImeOptions);
final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.restartInput(editText);
}
if (SDK_INT >= O) {
final AutofillManager autofillManager = context.getSystemService(AutofillManager.class);
if (autofillManager != null) {
autofillManager.cancel();
}
}
}
}
void showAtBottom() {
isPendingOpen = false;
if (popupWindow.isShowing()) return;
popupWindow.showAtLocation(rootView, Gravity.BOTTOM, 0, 0);
if (listener != null) listener.onShow();
}
@Override
public void onReceiveResult(final int resultCode, final Bundle data) {
if (resultCode == 0 || resultCode == 1) {
showAtBottom();
}
}
private int findHeight(int keyboardHeight){
if (searchView!=null && searchView.isShowing()) return keyboardHeight;
int h = keyboardHeight;
if (minHeight!=-1) h = Math.max(minHeight,h);
if (maxHeight!=-1) h = Math.min(maxHeight,h);
return h;
}
public void setMaxHeight(int maxHeight) {
this.maxHeight = maxHeight;
}
public int getMaxHeight() {
return maxHeight;
}
public void setMinHeight(int minHeight) {
this.minHeight = minHeight;
}
public int getMinHeight() {
return minHeight;
}
private int findHeightWithSearchView(int height) {
int h;
if (searchView!=null && searchView.isShowing()) {
h = searchView.getSearchViewHeight();
content.getLayoutParams().height = -1;
}else {
h = findHeight(height);
content.getLayoutParams().height = h;
}
return h;
}
public AXEmojiSearchView getSearchView() {
return searchView;
}
public void setSearchView(AXEmojiSearchView searchView) {
hideSearchView(true);
this.searchView = searchView;
}
public void hideSearchView(){
hideSearchView(true);
}
private void hideSearchView(boolean l){
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
if (searchView == null || !searchView.isShowing()) return;
try {
if (searchView.getParent() != null)
ap.removeView(searchView);
}catch (Exception ignore){
}
searchView.hide();
if (l && listener!=null) {
if (content.getLayoutParams().height == 0) {
listener.onKeyboardClosed();
} else {
content.getLayoutParams().height = findHeight(popupWindowHeight);
listener.onKeyboardOpened(content.getLayoutParams().height);
}
}
ap.requestLayout();
}
public void showSearchView(){
if (searchView == null || searchView.isShowing() || searchView.getParent()!=null) return;
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(-1,searchView.getSearchViewHeight());
lp.gravity = Gravity.BOTTOM;
content.getLayoutParams().height = -1;
ap.addView(searchView,lp);
searchView.show();
popupWindow.dismiss();
popupWindow.setHeight(lp.height);
popupWindow.setFocusable(true);
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_FROM_FOCUSABLE);
popupWindow.update();
popupWindow.showAtLocation(rootView, Gravity.BOTTOM, 0, 0);
ap.requestLayout();
if (listener!=null)
listener.onKeyboardOpened(popupWindowHeight + lp.height);
searchView.getSearchTextField().setFocusable(true);
searchView.getSearchTextField().requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(searchView.getSearchTextField(), InputMethodManager.SHOW_FORCED);
}
}
public boolean isShowingSearchView(){
return searchView!=null && searchView.isShowing();
}
}
| 14,444 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiEditText.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/view/AXEmojiEditText.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import androidx.annotation.CallSuper;
import androidx.annotation.DimenRes;
import androidx.annotation.Px;
import androidx.appcompat.widget.AppCompatEditText;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.inputmethod.InputMethodManager;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.utils.Utils;
public class AXEmojiEditText extends AppCompatEditText {
private float emojiSize;
AXPopupInterface popupInterface;
public AXEmojiEditText(final Context context) {
this(context, null);
}
public AXEmojiEditText(final Context context, final AttributeSet attrs) {
super(context, attrs);
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AXEmojiEditText);
try {
emojiSize = a.getDimension(R.styleable.AXEmojiEditText_emojiSize, defaultEmojiSize);
} finally {
a.recycle();
}
}
setText(getText());
}
@Override
@CallSuper
protected void onTextChanged(final CharSequence text, final int start, final int lengthBefore, final int lengthAfter) {
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
if (AXEmojiManager.isInstalled())
AXEmojiManager.getInstance().replaceWithImages(getContext(), this, getText(),
emojiSize>0 ? emojiSize : Utils.getDefaultEmojiSize(fontMetrics), fontMetrics);
}
@CallSuper
public void backspace() {
AXEmojiUtils.backspace(this);
}
@CallSuper
public void input(final Emoji emoji) {
AXEmojiUtils.input(this, emoji);
if (listener != null) listener.onInput(this, emoji);
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
try {
if (popupInterface != null && keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN && hasFocus()) {
InputMethodManager mgr = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (popupInterface.isShowing()) {
mgr.hideSoftInputFromWindow(this.getWindowToken(), 0);
popupInterface.onBackPressed();
return true;
}
}
}catch (Exception ignore){}
return super.onKeyPreIme(keyCode,event);
}
OnInputEmojiListener listener;
public void setOnInputEmojiListener(OnInputEmojiListener listener) {
this.listener = listener;
}
public void removeOnInputEmojiListener() {
this.listener = null;
}
public interface OnInputEmojiListener {
void onInput(AXEmojiEditText editText, Emoji emoji);
}
public float getEmojiSize() {
return emojiSize;
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSize(@Px final int pixels) {
setEmojiSize(pixels, true);
}
/**
* sets the emoji size in pixels and automatically invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSize(@Px final int pixels, final boolean shouldInvalidate) {
emojiSize = pixels;
if (shouldInvalidate) {
if (getText()!=null) {
setText(getText().toString());
}
}
}
/**
* sets the emoji size in pixels with the provided resource and automatically invalidates the text and renders it with the new size
*/
public final void setEmojiSizeRes(@DimenRes final int res) {
setEmojiSizeRes(res, true);
}
/**
* sets the emoji size in pixels with the provided resource and invalidates the text and renders it with the new size when {@code shouldInvalidate} is true
*/
public final void setEmojiSizeRes(@DimenRes final int res, final boolean shouldInvalidate) {
setEmojiSize(getResources().getDimensionPixelSize(res), shouldInvalidate);
}
}
| 5,239 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
PopupListener.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/PopupListener.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
public interface PopupListener {
void onDismiss();
void onShow();
void onKeyboardOpened(int height);
void onKeyboardClosed();
void onViewHeightChanged (int height);
}
| 847 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EditTextInputListener.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/EditTextInputListener.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.mark.axemojiview.emoji.Emoji;
public interface EditTextInputListener {
void input(@NonNull final EditText editText, @Nullable final Emoji emoji);
}
| 927 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiVariantCreatorListener.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/EmojiVariantCreatorListener.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;;
import org.mark.axemojiview.variant.AXEmojiVariantPopup;
public interface EmojiVariantCreatorListener {
AXEmojiVariantPopup create(@NonNull final View rootView, @Nullable final OnEmojiActions listener);
}
| 968 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
OnStickerActions.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/OnStickerActions.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import android.view.View;
import org.mark.axemojiview.sticker.Sticker;
public interface OnStickerActions {
@SuppressWarnings("rawtypes")
void onClick(View view, Sticker sticker, boolean fromRecent);
@SuppressWarnings("rawtypes")
boolean onLongClick(View view, Sticker sticker, boolean fromRecent);
}
| 977 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
FindVariantListener.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/FindVariantListener.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import org.mark.axemojiview.variant.AXEmojiVariantPopup;
public interface FindVariantListener {
AXEmojiVariantPopup findVariant();
}
| 794 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
StickerViewCreatorListener.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/StickerViewCreatorListener.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import android.content.Context;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.mark.axemojiview.sticker.StickerCategory;
public interface StickerViewCreatorListener {
@SuppressWarnings("rawtypes")
View onCreateStickerView(@NonNull final Context context, @Nullable final StickerCategory category, final boolean isRecent);
View onCreateCategoryView(@NonNull final Context context);
} | 1,116 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
SimplePopupAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/SimplePopupAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
public abstract class SimplePopupAdapter implements PopupListener {
@Override
public void onDismiss() {
}
@Override
public void onShow() {
}
@Override
public void onKeyboardOpened(int height) {
}
@Override
public void onKeyboardClosed() {
}
@Override
public void onViewHeightChanged(int height) {
}
}
| 1,021 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
OnEmojiPagerPageChanged.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/OnEmojiPagerPageChanged.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import org.mark.axemojiview.view.AXEmojiBase;
import org.mark.axemojiview.view.AXEmojiPager;
public interface OnEmojiPagerPageChanged {
void onPageChanged(AXEmojiPager emojiPager, AXEmojiBase base, int position);
}
| 876 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
OnEmojiActions.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/listener/OnEmojiActions.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.listener;
import android.view.View;
import org.mark.axemojiview.emoji.Emoji;
public interface OnEmojiActions {
void onClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant);
boolean onLongClick(View view, Emoji emoji, boolean fromRecent, boolean fromVariant);
}
| 936 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiResultReceiver.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/utils/EmojiResultReceiver.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.utils;
import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;
import androidx.annotation.Nullable;
public final class EmojiResultReceiver extends ResultReceiver {
@Nullable
private Receiver receiver;
/**
* Create a new EmojiResultReceiver to receive results. Your
* {@link #onReceiveResult} method will be called from the thread running
* <var>handler</var> if given, or from an arbitrary thread if null.
*/
public EmojiResultReceiver(final Handler handler) {
super(handler);
}
public void setReceiver(final Receiver receiver) {
this.receiver = receiver;
}
@Override
protected void onReceiveResult(final int resultCode, final Bundle resultData) {
if (receiver != null) {
receiver.onReceiveResult(resultCode, resultData);
}
}
public interface Receiver {
void onReceiveResult(int resultCode, Bundle data);
}
}
| 1,613 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiSpan.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/utils/EmojiSpan.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.utils;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.style.DynamicDrawableSpan;
import org.mark.axemojiview.emoji.Emoji;
public final class EmojiSpan extends DynamicDrawableSpan {
private final float size;
private final Context context;
private final Emoji emoji;
private Drawable deferredDrawable;
public EmojiSpan(final Context context, final Emoji emoji, final float size) {
this.context = context;
this.emoji = emoji;
this.size = size;
}
@Override
public Drawable getDrawable() {
if (deferredDrawable == null) {
deferredDrawable = emoji.getDrawable(context);
deferredDrawable.setBounds(0, 0, (int) size, (int) size);
}
return deferredDrawable;
}
@Override
public int getSize(final Paint paint, final CharSequence text, final int start,
final int end, final Paint.FontMetricsInt fontMetrics) {
if (fontMetrics != null) {
final Paint.FontMetrics paintFontMetrics = paint.getFontMetrics();
final float fontHeight = paintFontMetrics.descent - paintFontMetrics.ascent;
final float centerY = paintFontMetrics.ascent + fontHeight / 2;
fontMetrics.ascent = (int) (centerY - size / 2);
fontMetrics.top = fontMetrics.ascent;
fontMetrics.bottom = (int) (centerY + size / 2);
fontMetrics.descent = fontMetrics.bottom;
}
return (int) size;
}
@Override
public void draw(final Canvas canvas, final CharSequence text, final int start,
final int end, final float x, final int top, final int y,
final int bottom, final Paint paint) {
final Drawable drawable = getDrawable();
final Paint.FontMetrics paintFontMetrics = paint.getFontMetrics();
final float fontHeight = paintFontMetrics.descent - paintFontMetrics.ascent;
final float centerY = y + paintFontMetrics.descent - fontHeight / 2;
final float transitionY = centerY - size / 2;
canvas.save();
canvas.translate(x, transitionY);
drawable.draw(canvas);
canvas.restore();
}
}
| 2,959 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiReplacer.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/utils/EmojiReplacer.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.utils;
import android.content.Context;
import android.graphics.Paint;
import android.text.Spannable;
import android.view.View;
public interface EmojiReplacer {
void replaceWithImages(Context context, View view, Spannable text, float emojiSize, Paint.FontMetrics fontMetrics);
}
| 929 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
EmojiRange.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/utils/EmojiRange.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.utils;
import androidx.annotation.NonNull;
import org.mark.axemojiview.emoji.Emoji;
public final class EmojiRange {
public final int start;
public final int end;
public final Emoji emoji;
public EmojiRange(final int start, final int end, @NonNull final Emoji emoji) {
this.start = start;
this.end = end;
this.emoji = emoji;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final EmojiRange that = (EmojiRange) o;
return start == that.start && end == that.end && emoji.equals(that.emoji);
}
@Override
public int hashCode() {
int result = start;
result = 31 * result + end;
result = 31 * result + emoji.hashCode();
return result;
}
}
| 1,556 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
Utils.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/utils/Utils.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.utils;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.PopupWindow;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
import org.mark.axemojiview.AXEmojiUtils;
import org.mark.axemojiview.R;
public class Utils {
public static void setClickEffect(View View, boolean Borderless) {
int[] attrs;
if (Borderless) {
attrs = new int[]{android.R.attr.selectableItemBackgroundBorderless};
} else {
attrs = new int[]{android.R.attr.selectableItemBackground};
}
TypedArray typedArray = View.getContext().obtainStyledAttributes(attrs);
int backgroundResource = typedArray.getResourceId(0, 0);
View.setBackgroundResource(backgroundResource);
}
public static void setForegroundClickEffect(View View, boolean Borderless) {
int[] attrs;
if (Borderless) {
attrs = new int[]{android.R.attr.selectableItemBackgroundBorderless};
} else {
attrs = new int[]{android.R.attr.selectableItemBackground};
}
TypedArray typedArray = View.getContext().obtainStyledAttributes(attrs);
int backgroundResource = typedArray.getResourceId(0, 0);
if (SDK_INT >= Build.VERSION_CODES.M) {
View.setForeground(View.getContext().getDrawable(backgroundResource));
}
}
public static int getGridCount(Context context) {
int w = context.getResources().getDisplayMetrics().widthPixels;
int c_w = getColumnWidth(context);
return (int) w / c_w;
}
public static int getColumnWidth(Context context) {
return (int) context.getResources().getDimension(R.dimen.emoji_grid_view_column_width);
}
public static int getStickerGridCount(Context context) {
int w = context.getResources().getDisplayMetrics().widthPixels;
int c_w = getStickerColumnWidth(context);
return (int) w / c_w;
}
public static int getStickerColumnWidth(Context context) {
return (int) context.getResources().getDimension(R.dimen.sticker_grid_view_column_width);
}
static final int DONT_UPDATE_FLAG = -1;
public static int dpToPx(@NonNull final Context context, final float dp) {
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
context.getResources().getDisplayMetrics()) + 0.5f);
}
public static int getOrientation(final Context context) {
return context.getResources().getConfiguration().orientation;
}
public static int getProperHeight(final Activity activity) {
return Utils.windowVisibleDisplayFrame(activity).bottom;
}
public static int getProperWidth(final Activity activity) {
final Rect rect = Utils.windowVisibleDisplayFrame(activity);
return Utils.getOrientation(activity) == Configuration.ORIENTATION_PORTRAIT ? rect.right : getScreenWidth(activity);
}
public static boolean shouldOverrideRegularCondition(@NonNull final Context context, final EditText editText) {
if ((editText.getImeOptions() & EditorInfo.IME_FLAG_NO_EXTRACT_UI) == 0) {
return getOrientation(context) == Configuration.ORIENTATION_LANDSCAPE;
}
return false;
}
public static int getInputMethodHeight(final Context context, final View rootView) {
try {
final InputMethodManager imm = (InputMethodManager) context.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
final Class<?> inputMethodManagerClass = imm.getClass();
final Method visibleHeightMethod = inputMethodManagerClass.getDeclaredMethod("getInputMethodWindowVisibleHeight");
visibleHeightMethod.setAccessible(true);
return (int) visibleHeightMethod.invoke(imm);
} catch (NoSuchMethodException exception) {
exception.printStackTrace();
} catch (IllegalAccessException exception) {
exception.printStackTrace();
} catch (InvocationTargetException exception) {
exception.printStackTrace();
}
return alternativeInputMethodHeight(rootView);
}
public @TargetApi(LOLLIPOP)
static int getViewBottomInset(final View rootView) {
try {
final Field attachInfoField = View.class.getDeclaredField("mAttachInfo");
attachInfoField.setAccessible(true);
final Object attachInfo = attachInfoField.get(rootView);
if (attachInfo != null) {
final Field stableInsetsField = attachInfo.getClass().getDeclaredField("mStableInsets");
stableInsetsField.setAccessible(true);
return ((Rect) stableInsetsField.get(attachInfo)).bottom;
}
} catch (NoSuchFieldException noSuchFieldException) {
noSuchFieldException.printStackTrace();
} catch (IllegalAccessException illegalAccessException) {
illegalAccessException.printStackTrace();
}
return 0;
}
public static int alternativeInputMethodHeight(final View rootView) {
int viewInset = 0;
if (SDK_INT >= LOLLIPOP) {
viewInset = getViewBottomInset(rootView);
}
final Rect rect = new Rect();
rootView.getWindowVisibleDisplayFrame(rect);
final int availableHeight = rootView.getHeight() - viewInset - rect.top;
return availableHeight - (rect.bottom - rect.top);
}
public static int getScreenWidth(@NonNull final Activity context) {
return dpToPx(context, context.getResources().getConfiguration().screenWidthDp);
}
public static int getScreenHeight(@NonNull final Activity context) {
return dpToPx(context, context.getResources().getConfiguration().screenHeightDp);
}
public static void hideKeyboard(View v) {
InputMethodManager imm = (InputMethodManager) v.getContext().getApplicationContext().getSystemService("input_method");
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
public @NonNull
static Point locationOnScreen(@NonNull final View view) {
final int[] location = new int[2];
view.getLocationOnScreen(location);
return new Point(location[0], location[1]);
}
public @NonNull
static Rect windowVisibleDisplayFrame(@NonNull final Activity context) {
final Rect result = new Rect();
context.getWindow().getDecorView().getWindowVisibleDisplayFrame(result);
return result;
}
public static Activity asActivity(@NonNull final Context context) {
Context result = context;
while (result instanceof ContextWrapper) {
if (result instanceof Activity) {
return (Activity) result;
}
result = ((ContextWrapper) result).getBaseContext();
}
throw new IllegalArgumentException("The passed Context is not an Activity.");
}
public static void fixPopupLocation(@NonNull final PopupWindow popupWindow, @NonNull final Point desiredLocation) {
popupWindow.getContentView().post(new Runnable() {
@Override
public void run() {
final Point actualLocation = locationOnScreen(popupWindow.getContentView());
if (!(actualLocation.x == desiredLocation.x && actualLocation.y == desiredLocation.y)) {
final int differenceX = actualLocation.x - desiredLocation.x;
final int differenceY = actualLocation.y - desiredLocation.y;
final int fixedOffsetX;
final int fixedOffsetY;
if (actualLocation.x > desiredLocation.x) {
fixedOffsetX = desiredLocation.x - differenceX;
} else {
fixedOffsetX = desiredLocation.x + differenceX;
}
if (actualLocation.y > desiredLocation.y) {
fixedOffsetY = desiredLocation.y - differenceY;
} else {
fixedOffsetY = desiredLocation.y + differenceY;
}
popupWindow.update(fixedOffsetX, fixedOffsetY, DONT_UPDATE_FLAG, DONT_UPDATE_FLAG);
}
}
});
}
public static int dp(Context context, float value) {
if (value == 0) return 0;
return (int) Math.ceil(context.getResources().getDisplayMetrics().density * value);
}
public static float dpf2(Context context, float value) {
if (value == 0) return 0;
return (context.getResources().getDisplayMetrics().density * value);
}
public static float getPixelsInCM(Context context, float cm, boolean isX) {
return (cm / 2.54f) * (isX ? context.getResources().getDisplayMetrics().xdpi : context.getResources().getDisplayMetrics().ydpi);
}
public static boolean isTablet() {
return false;
}
static Point displaySize = new Point();
public static void checkDisplaySize(Context context) {
try {
float density = context.getResources().getDisplayMetrics().density;
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
Configuration configuration = context.getResources().getConfiguration();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (manager != null) {
Display display = manager.getDefaultDisplay();
if (display != null) {
display.getMetrics(displayMetrics);
display.getSize(displaySize);
}
}
if (configuration.screenWidthDp != Configuration.SCREEN_WIDTH_DP_UNDEFINED) {
int newSize = (int) Math.ceil(configuration.screenWidthDp * density);
if (Math.abs(displaySize.x - newSize) > 3) {
displaySize.x = newSize;
}
}
if (configuration.screenHeightDp != Configuration.SCREEN_HEIGHT_DP_UNDEFINED) {
int newSize = (int) Math.ceil(configuration.screenHeightDp * density);
if (Math.abs(displaySize.y - newSize) > 3) {
displaySize.y = newSize;
}
}
} catch (Exception e) {
}
}
private static String orientation(Context context) {
return (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? "landscape" : "portrait");
}
public static int getKeyboardHeight(Context context, int def) {
return context.getSharedPreferences("emoji-preference-manager", Context.MODE_PRIVATE)
.getInt("keyboard_height_" + orientation(context), def);
}
public static void updateKeyboardHeight(Context context, int value) {
context.getSharedPreferences("emoji-preference-manager", Context.MODE_PRIVATE)
.edit().putInt("keyboard_height_" + orientation(context), value).apply();
}
public static RecyclerView.ItemDecoration getRVLastRowBottomMarginDecoration(final int bottomMargin) {
return new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
int position = parent.getChildAdapterPosition(view);
int max = parent.getAdapter().getItemCount();
int spanCount = 1;
if (parent.getLayoutManager() instanceof GridLayoutManager) {
spanCount = ((GridLayoutManager) parent.getLayoutManager()).getSpanCount();
if (max % spanCount == 0) {
if ((parent.getAdapter().getItemCount() - position) > spanCount) {
outRect.bottom = 0;
} else {
outRect.bottom = bottomMargin;
}
} else if (max % spanCount >= max - position) {
if ((parent.getAdapter().getItemCount() - position) > spanCount) {
outRect.bottom = 0;
} else {
outRect.bottom = bottomMargin;
}
}
} else if (parent.getLayoutManager() instanceof LinearLayoutManager) {
if (position == max - 1) {
outRect.bottom = bottomMargin;
} else {
outRect.bottom = 0;
}
}
}
};
}
public static void enableBackspaceTouch(View backspaceView, EditText editText) {
backspaceView.setOnTouchListener(new BackspaceTouchListener(backspaceView, editText));
}
static class BackspaceTouchListener implements View.OnTouchListener {
private boolean backspacePressed;
private boolean backspaceOnce;
private View backSpace;
private EditText editText;
BackspaceTouchListener(View backspaceView, EditText editText) {
this.backSpace = backspaceView;
this.editText = editText;
}
@Override
public boolean onTouch(View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
backspacePressed = true;
backspaceOnce = false;
postBackspaceRunnable(350);
} else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
backspacePressed = false;
if (!backspaceOnce) {
AXEmojiUtils.backspace(editText);
backSpace.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
}
return true;
}
private void postBackspaceRunnable(final int time) {
backSpace.postDelayed(new Runnable() {
@Override
public void run() {
if (!backspacePressed) return;
AXEmojiUtils.backspace(editText);
backSpace.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
backspaceOnce = true;
postBackspaceRunnable(Math.max(50, time - 100));
}
}, time);
}
}
public static float getDefaultEmojiSize(Paint.FontMetrics fontMetrics){
return fontMetrics.descent - fontMetrics.ascent;
}
public static void forceLTR(View view){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
view.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
}
}
| 16,662 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXCategoryAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXCategoryAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.StickerProvider;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiLayout;
public class AXCategoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
AXEmojiLayout pager;
StickerProvider provider;
RecentSticker recentSticker;
boolean recent;
public AXCategoryAdapter(AXEmojiLayout pager, StickerProvider provider, RecentSticker RecentStickerManager) {
recent = !RecentStickerManager.isEmpty() && provider.isRecentEnabled();
this.recentSticker = RecentStickerManager;
this.pager = pager;
this.provider = provider;
}
public void update() {
recent = !recentSticker.isEmpty() && provider.isRecentEnabled();;
notifyDataSetChanged();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
int iconSize = Utils.dpToPx(viewGroup.getContext(), 24);
AXEmojiLayout layout = new AXEmojiLayout(viewGroup.getContext());
View icon;
if (i == 10) {
icon = new AppCompatImageView(viewGroup.getContext());
} else {
icon = AXEmojiManager.getInstance().getStickerViewCreatorListener().onCreateCategoryView(viewGroup.getContext());
}
layout.addView(icon, new AXEmojiLayout.LayoutParams(Utils.dpToPx(viewGroup.getContext(), 7), Utils.dpToPx(viewGroup.getContext(), 7), iconSize, iconSize));
layout.setLayoutParams(new ViewGroup.LayoutParams(Utils.dpToPx(viewGroup.getContext(), 38), Utils.dpToPx(viewGroup.getContext(), 38)));
View selection = new View(viewGroup.getContext());
layout.addView(selection, new AXEmojiLayout.LayoutParams(
0, Utils.dpToPx(viewGroup.getContext(), 36), Utils.dpToPx(viewGroup.getContext(), 38), Utils.dpToPx(viewGroup.getContext(), 2)));
selection.setBackgroundColor(AXEmojiManager.getStickerViewTheme().getSelectionColor());
selection.setVisibility(View.GONE);
return new RecyclerView.ViewHolder(layout) {
};
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, final int i) {
boolean selected = pager.getPageIndex() == i;
AXEmojiLayout layout = (AXEmojiLayout) viewHolder.itemView;
View icon = layout.getChildAt(0);
View selection = (View) layout.getChildAt(1);
if (selected) selection.setVisibility(View.VISIBLE);
else selection.setVisibility(View.GONE);
if (recent && i == 0) {
Drawable dr0 = AppCompatResources.getDrawable(layout.getContext(), R.drawable.emoji_recent);
Drawable dr = dr0.getConstantState().newDrawable();
if (selected) {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getStickerViewTheme().getSelectedColor());
} else {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getStickerViewTheme().getDefaultColor());
}
((AppCompatImageView) icon).setImageDrawable(dr);
} else {
int i2 = i;
if (recent) i2--;
provider.getLoader().onLoadStickerCategory(((ImageView) icon), provider.getCategories()[i2], selected);
}
Utils.setClickEffect(icon, true);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
pager.setPageIndex(i);
}
};
icon.setOnClickListener(listener);
layout.setOnClickListener(listener);
}
@Override
public int getItemCount() {
if (recent) return provider.getCategories().length + 1;
return provider.getCategories().length;
}
@Override
public int getItemViewType(int position) {
if (recent && position == 0) return 10;
return -1;
}
}
| 5,118 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiRecyclerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXEmojiRecyclerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiImageView;
public class AXEmojiRecyclerAdapter extends RecyclerView.Adapter<AXEmojiRecyclerAdapter.ViewHolder> {
Emoji[] emojis;
int count;
OnEmojiActions events;
VariantEmoji variantEmoji;
public AXEmojiRecyclerAdapter(Emoji[] emojis, OnEmojiActions events, VariantEmoji variantEmoji) {
this.emojis = emojis;
this.count = emojis.length;
this.events = events;
this.variantEmoji = variantEmoji;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
AXEmojiImageView emojiView = new AXEmojiImageView(viewGroup.getContext());
int cw = Utils.getColumnWidth(viewGroup.getContext());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
frameLayout.addView(emojiView);
int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
emojiView.setPadding(dp6, dp6, dp6, dp6);
return new ViewHolder(frameLayout);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final AXEmojiImageView emojiView = (AXEmojiImageView) frameLayout.getChildAt(0);
Emoji emoji = emojis[i];
emojiView.setEmoji(variantEmoji.getVariant(emoji));
//ImageLoadingTask currentTask = new ImageLoadingTask(emojiView);
//currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, emoji, null, null);
emojiView.setOnEmojiActions(events, false);
}
@Override
public int getItemCount() {
return count;
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}
| 2,931 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXStickerViewPagerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXStickerViewPagerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;
import org.mark.axemojiview.listener.OnStickerActions;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.StickerProvider;
import org.mark.axemojiview.view.AXStickerRecyclerView;
import java.util.ArrayList;
import java.util.List;
public class AXStickerViewPagerAdapter extends PagerAdapter {
OnStickerActions events;
RecyclerView.OnScrollListener scrollListener;
public List<View> recyclerViews;
public int add = 0;
StickerProvider provider;
RecentSticker recent;
public AXStickerViewPagerAdapter(OnStickerActions events, RecyclerView.OnScrollListener scrollListener, StickerProvider provider, RecentSticker recentStickerManager) {
this.events = events;
this.scrollListener = scrollListener;
recyclerViews = new ArrayList<View>();
this.provider = provider;
this.recent = recentStickerManager;
}
public RecyclerView.ItemDecoration itemDecoration = null;
public Object instantiateItem(ViewGroup collection, int position) {
if ((position == 0 && add == 1) || !provider.getCategories()[position - add].useCustomView()) {
AXStickerRecyclerView recycler = new AXStickerRecyclerView(collection.getContext());
collection.addView(recycler);
if (position == 0 && add == 1) {
recycler.setAdapter(new AXRecentStickerRecyclerAdapter(recent, events, provider.getLoader()));
} else {
recycler.setAdapter(new AXStickerRecyclerAdapter(provider.getCategories()[position - add]
, provider.getCategories()[position - add].getStickers(), events, provider.getLoader()
, provider.getCategories()[position - add].getEmptyView(collection)));
}
recyclerViews.add(recycler);
if (itemDecoration != null) recycler.addItemDecoration(itemDecoration);
if (scrollListener != null) recycler.addOnScrollListener(scrollListener);
if (position != 0 || add == 0)
provider.getCategories()[position - add].bindView(recycler);
return recycler;
} else {
View view = provider.getCategories()[position - add].getView(collection);
collection.addView(view);
provider.getCategories()[position - add].bindView(view);
recyclerViews.add(view);
if (view instanceof RecyclerView) {
if (itemDecoration != null) ((RecyclerView) view).addItemDecoration(itemDecoration);
if (scrollListener != null)
((RecyclerView) view).addOnScrollListener(scrollListener);
}
return view;
}
}
@Override
public int getCount() {
if (!recent.isEmpty() && provider.isRecentEnabled()) {
add = 1;
} else {
add = 0;
}
return provider.getCategories().length + add;
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
recyclerViews.remove(object);
}
}
| 4,166 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXRecentEmojiRecyclerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXRecentEmojiRecyclerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiImageView;
public class AXRecentEmojiRecyclerAdapter extends RecyclerView.Adapter<AXRecentEmojiRecyclerAdapter.ViewHolder> {
RecentEmoji recentEmoji;
OnEmojiActions events;
VariantEmoji variantEmoji;
public AXRecentEmojiRecyclerAdapter(RecentEmoji recentEmoji, OnEmojiActions events, VariantEmoji variantEmoji) {
this.recentEmoji = recentEmoji;
this.events = events;
this.variantEmoji = variantEmoji;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
AXEmojiImageView emojiView = new AXEmojiImageView(viewGroup.getContext());
int cw = Utils.getColumnWidth(viewGroup.getContext());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
frameLayout.addView(emojiView);
int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
emojiView.setPadding(dp6, dp6, dp6, dp6);
return new ViewHolder(frameLayout);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final AXEmojiImageView emojiView = (AXEmojiImageView) frameLayout.getChildAt(0);
Emoji emoji = variantEmoji.getVariant((Emoji) recentEmoji.getRecentEmojis().toArray()[i]);
emojiView.setEmoji(emoji);
emojiView.setOnEmojiActions(events, true);
if (!AXEmojiManager.getInstance().isRecentVariantEnabled()) {
emojiView.setShowVariants(false);
} else {
emojiView.setShowVariants(AXEmojiManager.getTheme().isVariantDividerEnabled());
}
}
@Override
public int getItemCount() {
return recentEmoji.getRecentEmojis().size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}
| 3,150 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiViewPagerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXEmojiViewPagerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.view.AXEmojiRecyclerView;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
public class AXEmojiViewPagerAdapter extends PagerAdapter {
OnEmojiActions events;
RecyclerView.OnScrollListener scrollListener;
RecentEmoji recentEmoji;
VariantEmoji variantEmoji;
public List<AXEmojiRecyclerView> recyclerViews;
public int add = 0;
private Queue<View> destroyedItems = new LinkedList<>();
FindVariantListener findVariantListener;
public AXEmojiViewPagerAdapter(OnEmojiActions events, RecyclerView.OnScrollListener scrollListener,
RecentEmoji recentEmoji, VariantEmoji variantEmoji, FindVariantListener listener) {
this.events = events;
this.findVariantListener = listener;
this.scrollListener = scrollListener;
this.recentEmoji = recentEmoji;
this.variantEmoji = variantEmoji;
recyclerViews = new ArrayList<AXEmojiRecyclerView>();
}
public RecyclerView.ItemDecoration itemDecoration = null;
public Object instantiateItem(ViewGroup collection, int position) {
AXEmojiRecyclerView recycler = null;
try {
recycler = (AXEmojiRecyclerView) destroyedItems.poll();
} catch (Exception e) {
recycler = null;
}
if (recycler == null)
recycler = new AXEmojiRecyclerView(collection.getContext(), findVariantListener);
collection.addView(recycler);
if (position == 0 && add == 1) {
recycler.setAdapter(new AXRecentEmojiRecyclerAdapter(recentEmoji, events, variantEmoji));
} else {
recycler.setAdapter(new AXEmojiRecyclerAdapter(AXEmojiManager.getInstance().getCategories()[position - add].getEmojis(),
events, variantEmoji));
}
recyclerViews.add(recycler);
if (itemDecoration != null) {
recycler.removeItemDecoration(itemDecoration);
recycler.addItemDecoration(itemDecoration);
}
if (scrollListener != null) {
recycler.removeOnScrollListener(scrollListener);
recycler.addOnScrollListener(scrollListener);
}
return recycler;
}
@Override
public int getCount() {
if (!recentEmoji.isEmpty()) {
add = 1;
} else {
add = 0;
}
return AXEmojiManager.getInstance().getCategories().length + add;
}
@Override
public int getItemPosition(@NonNull Object object) {
return POSITION_NONE;
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
recyclerViews.remove(object);
destroyedItems.add((View) object);
}
}
| 4,058 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXFooterIconsAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXFooterIconsAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;;import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiLayout;
import org.mark.axemojiview.view.AXEmojiPager;
public class AXFooterIconsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
AXEmojiPager pager;
public AXFooterIconsAdapter(AXEmojiPager pager) {
this.pager = pager;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
int iconSize = Utils.dpToPx(viewGroup.getContext(), 24);
AXEmojiLayout layout = new AXEmojiLayout(viewGroup.getContext());
AppCompatImageView icon = new AppCompatImageView(viewGroup.getContext());
layout.addView(icon, new AXEmojiLayout.LayoutParams(Utils.dpToPx(viewGroup.getContext(), 8), Utils.dpToPx(viewGroup.getContext(), 10), iconSize, iconSize));
layout.setLayoutParams(new ViewGroup.LayoutParams(Utils.dpToPx(viewGroup.getContext(), 40), Utils.dpToPx(viewGroup.getContext(), 44)));
return new RecyclerView.ViewHolder(layout) {
};
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, final int i) {
boolean selected = pager.getViewPager().getCurrentItem() == i;
AXEmojiLayout layout = (AXEmojiLayout) viewHolder.itemView;
AppCompatImageView icon = (AppCompatImageView) layout.getChildAt(0);
if (pager.getPageBinder(i) != null) {
pager.getPageBinder(i).onBindFooterItem(icon, i, selected);
} else {
Drawable dr = ContextCompat.getDrawable(icon.getContext().getApplicationContext(), pager.getPageIcon(i));
if (selected) {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getFooterSelectedItemColor());
} else {
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getFooterItemColor());
}
icon.setImageDrawable(dr);
}
Utils.setClickEffect(icon, true);
icon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (pager.getViewPager().getCurrentItem() != i) {
pager.setPageIndex(i);
}
}
});
}
@Override
public int getItemCount() {
return pager.getPagesCount();
}
}
| 3,466 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXSingleEmojiPageAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXSingleEmojiPageAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiCategory;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.RecentEmoji;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiImageView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AXSingleEmojiPageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
EmojiCategory[] categories;
RecentEmoji recentEmoji;
VariantEmoji variantEmoji;
OnEmojiActions events;
public List<Integer> titlesPosition = new ArrayList<Integer>();
List<Emoji> emojis = new ArrayList<Emoji>();
public int getLastEmojiCategoryCount() {
return categories[categories.length - 1].getEmojis().length;
}
public int getFirstTitlePosition() {
return titlesPosition.get(0);
}
public AXSingleEmojiPageAdapter(EmojiCategory[] categories, OnEmojiActions events, RecentEmoji recentEmoji, VariantEmoji variantEmoji) {
this.categories = categories;
this.recentEmoji = recentEmoji;
this.variantEmoji = variantEmoji;
this.events = events;
calItemsCount();
}
public void refresh() {
titlesPosition.clear();
emojis.clear();
calItemsCount();
this.notifyDataSetChanged();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
if (i == 1) {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
StaggeredGridLayoutManager.LayoutParams lm = new StaggeredGridLayoutManager.LayoutParams(-1, Utils.dpToPx(viewGroup.getContext(), 28));
lm.setFullSpan(true);
frameLayout.setLayoutParams(lm);
TextView tv = new TextView(viewGroup.getContext());
frameLayout.addView(tv, new FrameLayout.LayoutParams(-1, -1));
tv.setTextColor(AXEmojiManager.getTheme().getTitleColor());
tv.setTypeface(AXEmojiManager.getTheme().getTitleTypeface());
tv.setTextSize(16);
tv.setPadding(Utils.dpToPx(viewGroup.getContext(), 16), Utils.dpToPx(viewGroup.getContext(), 4),
Utils.dpToPx(viewGroup.getContext(), 16), Utils.dpToPx(viewGroup.getContext(), 4));
return new TitleHolder(frameLayout, tv);
} else if (i == 2) {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
StaggeredGridLayoutManager.LayoutParams lm = new StaggeredGridLayoutManager.LayoutParams(-1, Utils.dpToPx(viewGroup.getContext(), 38));
lm.setFullSpan(true);
frameLayout.setLayoutParams(lm);
return new SpaceHolder(frameLayout);
} else {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
AXEmojiImageView emojiView = new AXEmojiImageView(viewGroup.getContext());
int cw = Utils.getColumnWidth(viewGroup.getContext());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
frameLayout.addView(emojiView);
int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
emojiView.setPadding(dp6, dp6, dp6, dp6);
return new EmojiHolder(frameLayout, emojiView);
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
if (viewHolder instanceof TitleHolder) {
EmojiCategory category = categories[titlesPosition.indexOf(i)];
((TextView) ((FrameLayout) viewHolder.itemView).getChildAt(0)).setText(category.getTitle());
} else if (viewHolder instanceof EmojiHolder) {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final AXEmojiImageView emojiView = (AXEmojiImageView) frameLayout.getChildAt(0);
Emoji emoji = emojis.get(i);
if (emoji == null) return;
emojiView.setEmoji(variantEmoji.getVariant(emoji));
//ImageLoadingTask currentTask = new ImageLoadingTask(emojiView);
//currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, emoji, null, null);
boolean fromRecent = false;
if (i < recentEmoji.getRecentEmojis().size()) fromRecent = true;
emojiView.setOnEmojiActions(events, fromRecent);
}
}
@Override
public int getItemCount() {
return emojis.size();
}
@Override
public int getItemViewType(int position) {
if (position == 0) return 2;
if (titlesPosition.contains(position)) return 1;
return 0;
}
int calItemsCount() {
emojis.add(null);
int number = 0;
Emoji[] recents = new Emoji[recentEmoji.getRecentEmojis().size()];
recents = recentEmoji.getRecentEmojis().toArray(recents);
number = number + recents.length;
emojis.addAll(Arrays.asList(recents));
for (int i = 0; i < categories.length; i++) {
number++;
titlesPosition.add(number);
emojis.add(null);
number = number + categories[i].getEmojis().length;
emojis.addAll(Arrays.asList(categories[i].getEmojis()));
}
return emojis.size();
}
public class TitleHolder extends RecyclerView.ViewHolder {
TextView tv;
public TitleHolder(@NonNull View itemView, TextView tv) {
super(itemView);
this.tv = tv;
}
}
public class SpaceHolder extends RecyclerView.ViewHolder {
public SpaceHolder(@NonNull View itemView) {
super(itemView);
}
}
public class EmojiHolder extends RecyclerView.ViewHolder {
AXEmojiImageView imageView;
public EmojiHolder(@NonNull View itemView, AXEmojiImageView imageView) {
super(itemView);
this.imageView = imageView;
}
}
}
| 7,003 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXRecentStickerRecyclerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXRecentStickerRecyclerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.OnStickerActions;
import org.mark.axemojiview.sticker.RecentSticker;
import org.mark.axemojiview.sticker.Sticker;
import org.mark.axemojiview.sticker.StickerLoader;
import org.mark.axemojiview.utils.Utils;
public class AXRecentStickerRecyclerAdapter extends RecyclerView.Adapter<AXRecentStickerRecyclerAdapter.ViewHolder> {
RecentSticker recent;
OnStickerActions events;
StickerLoader loader;
public AXRecentStickerRecyclerAdapter(RecentSticker recent, OnStickerActions events, StickerLoader loader){
this.recent = recent;
this.events = events;
this.loader = loader;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
View emojiView = AXEmojiManager.getInstance().getStickerViewCreatorListener().onCreateStickerView(viewGroup.getContext(),null,true);
int cw = Utils.getStickerColumnWidth(viewGroup.getContext());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw,cw));
frameLayout.addView(emojiView);
int dp6=Utils.dpToPx(viewGroup.getContext(),6);
emojiView.setPadding(dp6,dp6,dp6,dp6);
View ripple = new View(viewGroup.getContext());
frameLayout.addView(ripple,new ViewGroup.MarginLayoutParams(cw,cw));
return new ViewHolder(frameLayout);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final AppCompatImageView stickerView = (AppCompatImageView) frameLayout.getChildAt(0);
View ripple = (View) frameLayout.getChildAt(1);
@SuppressWarnings("rawtypes")
final Sticker sticker = (Sticker) recent.getRecentStickers().toArray()[i];
loader.onLoadSticker(stickerView,sticker);
Utils.setClickEffect(ripple,false);
ripple.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (events != null) events.onClick(stickerView, sticker, true);
}
});
ripple.setOnLongClickListener(view -> {
if (events!=null) return events.onLongClick(stickerView,sticker,true);
return false;
});
}
@Override
public int getItemCount() {
return recent.getRecentStickers().size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}
| 3,594 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXStickerRecyclerAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/adapters/AXStickerRecyclerAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.adapters;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.listener.OnStickerActions;
import org.mark.axemojiview.sticker.Sticker;
import org.mark.axemojiview.sticker.StickerCategory;
import org.mark.axemojiview.sticker.StickerLoader;
import org.mark.axemojiview.utils.Utils;
@SuppressWarnings("rawtypes")
public class AXStickerRecyclerAdapter extends RecyclerView.Adapter<AXStickerRecyclerAdapter.ViewHolder> {
Sticker[] stickers;
int count;
OnStickerActions events;
StickerLoader loader;
boolean isEmptyLoading = false;
View empty;
StickerCategory category;
public AXStickerRecyclerAdapter(StickerCategory category, Sticker[] stickers, OnStickerActions events, StickerLoader loader, View empty) {
this.stickers = stickers;
this.category = category;
this.count = stickers.length;
this.events = events;
this.loader = loader;
this.empty = empty;
if (empty != null) {
isEmptyLoading = true;
} else {
isEmptyLoading = false;
}
}
RecyclerView rv = null;
@Override
public void onAttachedToRecyclerView(RecyclerView r) {
super.onAttachedToRecyclerView(r);
rv = r;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
if (i == 1) {
return new ViewHolder(empty);
} else {
FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
View emojiView = AXEmojiManager.getInstance().getStickerViewCreatorListener().onCreateStickerView(viewGroup.getContext(), category, false);
int cw = Utils.getStickerColumnWidth(viewGroup.getContext());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
frameLayout.addView(emojiView);
int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
emojiView.setPadding(dp6, dp6, dp6, dp6);
View ripple = new View(viewGroup.getContext());
frameLayout.addView(ripple, new ViewGroup.MarginLayoutParams(cw, cw));
return new ViewHolder(frameLayout);
}
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
if (viewHolder.getItemViewType() == 1) {
if (rv != null && rv.getLayoutParams() != null) {
if (viewHolder.itemView.getLayoutParams() == null) {
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(rv.getMeasuredWidth(), rv.getLayoutParams().height);
lp.gravity = Gravity.CENTER;
viewHolder.itemView.setLayoutParams(lp);
} else {
viewHolder.itemView.getLayoutParams().width = rv.getMeasuredWidth();
viewHolder.itemView.getLayoutParams().height = rv.getLayoutParams().height;
}
}
} else {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final View stickerView = frameLayout.getChildAt(0);
View ripple = (View) frameLayout.getChildAt(1);
final Sticker sticker = stickers[i];
loader.onLoadSticker(stickerView, sticker);
Utils.setClickEffect(ripple, false);
ripple.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (events != null) events.onClick(stickerView, sticker, false);
}
});
ripple.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (events != null) return events.onLongClick(stickerView, sticker, false);
return false;
}
});
}
}
@Override
public int getItemCount() {
if (count == 0 && isEmptyLoading) return 1;
return count;
}
@Override
public int getItemViewType(int position) {
if (position == 0 && stickers.length == 0 && isEmptyLoading) return 1;
return super.getItemViewType(position);
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}
| 5,256 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
RecentEmojiManager.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/shared/RecentEmojiManager.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.shared;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class RecentEmojiManager implements RecentEmoji {
static String PREFERENCE_NAME = "emoji-recent-manager";
static String RECENT_EMOJIS = "recent-saved-emojis";
public static boolean FILL_DEFAULT_HISTORY = true;
public static int MAX_RECENT = -1;
private static HashMap<String, Integer> emojiUseHistory = new HashMap<>();
private static ArrayList<Emoji> recentEmoji = new ArrayList<>();
public static String[] FILL_DEFAULT_RECENT_DATA = new String[]{
"\uD83D\uDE02", "\uD83D\uDE18", "\u2764", "\uD83D\uDE0D", "\uD83D\uDE0A", "\uD83D\uDE01",
"\uD83D\uDC4D", "\u263A", "\uD83D\uDE14", "\uD83D\uDE04", "\uD83D\uDE2D", "\uD83D\uDC8B",
"\uD83D\uDE12", "\uD83D\uDE33", "\uD83D\uDE1C", "\uD83D\uDE48", "\uD83D\uDE09", "\uD83D\uDE03",
"\uD83D\uDE22", "\uD83D\uDE1D", "\uD83D\uDE31", "\uD83D\uDE21", "\uD83D\uDE0F", "\uD83D\uDE1E",
"\uD83D\uDE05", "\uD83D\uDE1A", "\uD83D\uDE4A", "\uD83D\uDE0C", "\uD83D\uDE00", "\uD83D\uDE0B",
"\uD83D\uDE06", "\uD83D\uDC4C", "\uD83D\uDE10", "\uD83D\uDE15"};
@NonNull
private final Context context;
public static boolean isEmpty(Context context) {
return emojiUseHistory.isEmpty();
}
@Override
public boolean isEmpty() {
if (!emojiUseHistory.isEmpty()) return false;
if (!AXEmojiManager.isShowingEmptyRecentEnabled()) {
return true;
}
return false;
}
public RecentEmojiManager(@NonNull final Context context) {
this.context = context.getApplicationContext();
reload();
}
@NonNull
@Override
public Collection<Emoji> getRecentEmojis() {
return recentEmoji;
}
@Override
public void reload() {
loadRecentEmoji();
}
@Override
public void addEmoji(@NonNull final Emoji emoji) {
addRecentEmoji(emoji.getBase());
}
@Override
public void persist() {
saveRecentEmoji();
}
private SharedPreferences getPreferences() {
return context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
}
public void addRecentEmoji(Emoji emoji) {
Integer count = emojiUseHistory.get(emoji.getBase().getUnicode());
if (count == null) {
count = 0;
}
if (MAX_RECENT <= 0) MAX_RECENT = 48;
if (count == 0 && emojiUseHistory.size() >= MAX_RECENT) {
Emoji mEmoji = recentEmoji.get(recentEmoji.size() - 1);
emojiUseHistory.remove(mEmoji.getBase().getUnicode());
recentEmoji.set(recentEmoji.size() - 1, emoji.getBase());
} else {
if (!emojiUseHistory.containsKey(emoji.getBase().getUnicode()))
recentEmoji.add(emoji.getBase());
}
emojiUseHistory.put(emoji.getBase().getUnicode(), ++count);
}
public void sortEmoji() {
recentEmoji.clear();
for (HashMap.Entry<String, Integer> entry : emojiUseHistory.entrySet()) {
recentEmoji.add(AXEmojiManager.getInstance().findEmoji(entry.getKey()));
}
Collections.sort(recentEmoji, new Comparator<Emoji>() {
@Override
public int compare(Emoji lhs, Emoji rhs) {
Integer count1 = emojiUseHistory.get(lhs.getBase().getUnicode());
Integer count2 = emojiUseHistory.get(rhs.getBase().getUnicode());
if (count1 == null) {
count1 = 0;
}
if (count2 == null) {
count2 = 0;
}
if (count1 > count2) {
return -1;
} else if (count1 < count2) {
return 1;
}
return 0;
}
});
if (MAX_RECENT <= 0) MAX_RECENT = 48;
while (recentEmoji.size() > MAX_RECENT) {
recentEmoji.remove(recentEmoji.size() - 1);
}
}
public void saveRecentEmoji() {
SharedPreferences preferences = this.getPreferences();
StringBuilder stringBuilder = new StringBuilder();
for (HashMap.Entry<String, Integer> entry : emojiUseHistory.entrySet()) {
if (stringBuilder.length() != 0) {
stringBuilder.append(",");
}
stringBuilder.append(entry.getKey());
stringBuilder.append("=");
stringBuilder.append(entry.getValue());
}
preferences.edit().putString(RECENT_EMOJIS, stringBuilder.toString()).commit();
}
public void clearRecentEmoji() {
emojiUseHistory.clear();
recentEmoji.clear();
saveRecentEmoji();
}
public void loadRecentEmoji() {
SharedPreferences preferences = getPreferences();
String str;
try {
emojiUseHistory.clear();
if (preferences.contains(RECENT_EMOJIS)) {
str = preferences.getString(RECENT_EMOJIS, "");
if (str != null && str.length() > 0) {
String[] args = str.split(",");
for (String arg : args) {
String[] args2 = arg.split("=");
emojiUseHistory.put(args2[0], parseInt(args2[1]));
}
}
}
if (emojiUseHistory.isEmpty() && FILL_DEFAULT_HISTORY) {
if (FILL_DEFAULT_RECENT_DATA != null && FILL_DEFAULT_RECENT_DATA.length != 0) {
for (int i = 0; i < FILL_DEFAULT_RECENT_DATA.length; i++) {
emojiUseHistory.put(FILL_DEFAULT_RECENT_DATA[i], FILL_DEFAULT_RECENT_DATA.length - i);
}
saveRecentEmoji();
}
}
sortEmoji();
} catch (Exception e) {
e.printStackTrace();
}
}
static Integer parseInt(CharSequence value) {
if (value == null) {
return 0;
}
int val = 0;
try {
Matcher matcher = Pattern.compile("[\\-0-9]+").matcher(value);
if (matcher.find()) {
String num = matcher.group(0);
val = Integer.parseInt(num);
}
} catch (Exception ignore) {
}
return val;
}
}
| 7,366 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
VariantEmojiManager.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/shared/VariantEmojiManager.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.shared;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public final class VariantEmojiManager implements VariantEmoji {
private static final String PREFERENCE_NAME = "variant-emoji-manager";
private static final String EMOJI_DELIMITER = "~";
private static final String VARIANT_EMOJIS = "variant-emojis";
static final int EMOJI_GUESS_SIZE = 5;
@NonNull
private final Context context;
@NonNull
private List<Emoji> variantsList = new ArrayList<>(0);
public VariantEmojiManager(@NonNull final Context context) {
this.context = context.getApplicationContext();
}
@NonNull
@Override
public Emoji getVariant(final Emoji desiredEmoji) {
if (variantsList.isEmpty()) {
initFromSharedPreferences();
}
final Emoji baseEmoji = desiredEmoji.getBase();
for (int i = 0; i < variantsList.size(); i++) {
final Emoji emoji = variantsList.get(i);
if (baseEmoji.equals(emoji.getBase())) {
return emoji;
}
}
return desiredEmoji;
}
@Override
public void addVariant(@NonNull final Emoji newVariant) {
final Emoji newVariantBase = newVariant.getBase();
for (int i = 0; i < variantsList.size(); i++) {
final Emoji variant = variantsList.get(i);
if (variant.getBase().equals(newVariantBase)) {
if (variant.equals(newVariant)) {
return; // Same skin-tone was used.
} else {
variantsList.remove(i);
variantsList.add(newVariant);
return;
}
}
}
variantsList.add(newVariant);
}
@Override
public void persist() {
if (variantsList.size() > 0) {
final StringBuilder stringBuilder = new StringBuilder(variantsList.size() * EMOJI_GUESS_SIZE);
for (int i = 0; i < variantsList.size(); i++) {
stringBuilder.append(variantsList.get(i).getUnicode()).append(EMOJI_DELIMITER);
}
stringBuilder.setLength(stringBuilder.length() - EMOJI_DELIMITER.length());
getPreferences().edit().putString(VARIANT_EMOJIS, stringBuilder.toString()).apply();
} else {
getPreferences().edit().remove(VARIANT_EMOJIS).apply();
}
}
private void initFromSharedPreferences() {
final String savedRecentVariants = getPreferences().getString(VARIANT_EMOJIS, "");
if (savedRecentVariants.length() > 0) {
final StringTokenizer stringTokenizer = new StringTokenizer(savedRecentVariants, EMOJI_DELIMITER);
variantsList = new ArrayList<>(stringTokenizer.countTokens());
while (stringTokenizer.hasMoreTokens()) {
final String token = stringTokenizer.nextToken();
final Emoji emoji = AXEmojiManager.getInstance().findEmoji(token);
if (emoji != null && emoji.getLength() == token.length()) {
variantsList.add(emoji);
}
}
}
}
private SharedPreferences getPreferences() {
return context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
}
}
| 4,164 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
VariantEmoji.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/shared/VariantEmoji.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.shared;
import androidx.annotation.NonNull;
import org.mark.axemojiview.emoji.Emoji;
/**
* Interface for providing some custom implementation for variant emojis.
*/
public interface VariantEmoji {
/**
* Returns the variant for the passed emoji. Could be loaded from a database, shared preferences or just hard
* coded.<br>
* <p>
* This method will be called more than one time hence it is recommended to hold a collection of
* desired emojis.
*
* @param desiredEmoji The emoji to retrieve the variant for. If none is found,
* the passed emoji should be returned.
*/
@NonNull
Emoji getVariant(Emoji desiredEmoji);
/**
* Should add the emoji to the variants. After calling this method, {@link #getVariant(Emoji)}
* should return the emoji that was just added.
*
* @param newVariant The new variant to save.
*/
void addVariant(@NonNull Emoji newVariant);
/**
* Should persist all emojis.
*/
void persist();
}
| 1,686 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
RecentEmoji.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/shared/RecentEmoji.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.shared;
import androidx.annotation.NonNull;
import org.mark.axemojiview.emoji.Emoji;
import java.util.Collection;
/**
* Interface for providing some custom implementation for recent emojis.
*/
public interface RecentEmoji {
/**
* Returns the recent emojis. Could be loaded from a database, shared preferences or just hard
* coded.<br>
* <p>
* This method will be called more than one time hence it is recommended to hold a collection of
* recent emojis.
*/
@NonNull
Collection<Emoji> getRecentEmojis();
/**
* Should add the emoji to the recent ones. After calling this method, {@link #getRecentEmojis()}
* should return the emoji that was just added.
*/
void addEmoji(@NonNull Emoji emoji);
/**
* Should persist all emojis.
*/
void persist();
/**
* request to reload recent data
*/
void reload();
/**
* Returns true if recent is empty
*/
boolean isEmpty();
}
| 1,634 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiSearchView.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/search/AXEmojiSearchView.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.search;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.AXEmojiTheme;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.FindVariantListener;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.shared.VariantEmoji;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiBase;
import org.mark.axemojiview.view.AXEmojiEditText;
import org.mark.axemojiview.view.AXEmojiImageView;
import org.mark.axemojiview.view.AXEmojiRecyclerView;
import org.mark.axemojiview.view.AXEmojiView;
import org.mark.axemojiview.view.AXSearchViewInterface;
import org.mark.axemojiview.view.AXSingleEmojiView;
import java.util.ArrayList;
import java.util.List;
@SuppressLint("ViewConstructor")
public class AXEmojiSearchView extends FrameLayout implements AXSearchViewInterface {
AXEmojiTheme theme;
protected AXEmojiBase base;
boolean showing;
AXDataAdapter<Emoji> dataAdapter;
protected RecyclerView recyclerView;
protected AppCompatEditText editText;
protected AppCompatImageView backButton;
protected AppCompatTextView noResultTextView;
public AXEmojiSearchView(Context context, AXEmojiBase emojiView) {
super(context);
if (!AXEmojiManager.isAXEmojiView(emojiView))
throw new RuntimeException("EmojiView must be an instance of AXEmojiView or AXSingleEmojiView.");
this.theme = AXEmojiManager.getEmojiViewTheme();
this.base = emojiView;
setDataAdapter(new AXSimpleEmojiDataAdapter(context));
}
public @NonNull AXDataAdapter<Emoji> getDataAdapter() {
return dataAdapter;
}
public void setDataAdapter(@NonNull AXDataAdapter<Emoji> dataAdapter) {
if (this.dataAdapter != null) this.dataAdapter.destroy();
this.dataAdapter = dataAdapter;
this.dataAdapter.init();
}
public AXEmojiTheme getTheme() {
return theme;
}
/**
* Theme needed properties :
* - CategoryColor (BackgroundColor)
* - TitleTypeface (EditTextTypeface)
* - TitleColor (EditTextTextColor)
* - DefaultColor (EditTextHintColor)
*/
public void setTheme(AXEmojiTheme theme) {
this.theme = theme;
this.setBackgroundColor(theme.getCategoryColor());
if (editText!=null && editText.getParent()!=null) {
editText.setTypeface(theme.getTitleTypeface());
editText.setHintTextColor(theme.getDefaultColor());
editText.setTextColor(theme.getTitleColor());
editText.setBackgroundColor(Color.TRANSPARENT);
noResultTextView.setTextColor(theme.getDefaultColor());
noResultTextView.setTypeface(theme.getTitleTypeface());
Drawable dr = AppCompatResources.getDrawable(getContext(), R.drawable.arrow_back);
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getDefaultColor());
backButton.setImageDrawable(dr);
}
}
@Override
public int getSearchViewHeight() {
return Utils.dp(getContext(),98);
}
@Override
public void show() {
if (showing) return;
showing = true;
init();
}
@Override
public void hide() {
showing = false;
removeAllViews();
}
@Override
public boolean isShowing() {
return showing;
}
@Override
public View getView() {
return this;
}
@Override
public EditText getSearchTextField() {
return editText;
}
protected void searched (boolean hasResult){
if (noResultTextView!=null)
noResultTextView.setVisibility(hasResult?GONE:VISIBLE);
}
protected void init(){
removeAllViews();
this.setBackgroundColor(theme.getCategoryColor());
recyclerView = new AXEmojiRecyclerView(getContext(), (FindVariantListener) base,
new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false));
FrameLayout.LayoutParams lp_rv = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, Utils.dp(getContext(),38));
lp_rv.topMargin = Utils.dp(getContext(),8);
this.addView(recyclerView,lp_rv);
recyclerView.setAdapter(createAdapter());
recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
int position = parent.getChildAdapterPosition(view);
if (position == 0) {
outRect.left = Utils.dp(parent.getContext(),16);
} else {
outRect.left = Utils.dp(parent.getContext(),6);
}
if (position == parent.getAdapter().getItemCount()-1) outRect.right = Utils.dp(parent.getContext(),16);
}
});
editText = new CustomEditText(getContext());
editText.setHint("Search");
editText.setTypeface(theme.getTitleTypeface());
editText.setTextSize(18);
editText.setHintTextColor(theme.getDefaultColor());
editText.setTextColor(theme.getTitleColor());
editText.setSingleLine();
editText.setBackgroundColor(Color.TRANSPARENT);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(-1,-1);
lp.leftMargin = Utils.dp(getContext(),48);
lp.rightMargin = Utils.dp(getContext(),48);
lp.bottomMargin = Utils.dp(getContext(),0);
lp.topMargin = Utils.dp(getContext(),46);
lp.gravity = Gravity.BOTTOM;
this.addView(editText,lp);
final TextWatcher textWatcherSearchListener = new TextWatcher() {
final android.os.Handler handler = new android.os.Handler();
Runnable runnable;
public void onTextChanged(final CharSequence s, int start, final int before, int count) {
handler.removeCallbacks(runnable);
}
@Override
public void afterTextChanged(final Editable s) {
runnable = new Runnable() {
@Override
public void run() {
searchFor(s.toString());
}
};
handler.postDelayed(runnable, 100);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
};
editText.addTextChangedListener(textWatcherSearchListener);
noResultTextView = new AppCompatTextView(getContext());
this.addView(noResultTextView,lp_rv);
noResultTextView.setVisibility(GONE);
noResultTextView.setTextSize(18);
noResultTextView.setText("No emoji found");
noResultTextView.setTypeface(theme.getTitleTypeface());
noResultTextView.setGravity(Gravity.CENTER);
noResultTextView.setTextColor(theme.getDefaultColor());
backButton = new AppCompatImageView(getContext());
FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(Utils.dp(getContext(),26),-1);
lp2.leftMargin = Utils.dp(getContext(),13);
lp2.bottomMargin = Utils.dp(getContext(),8);
lp2.topMargin = Utils.dp(getContext(),54);
lp2.gravity = Gravity.BOTTOM;
this.addView(backButton,lp2);
Utils.setClickEffect(backButton,true);
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (editText instanceof CustomEditText){
((CustomEditText) editText).reload();
}else{
base.getPopupInterface().reload();
}
base.getPopupInterface().show();
}
});
Drawable dr = AppCompatResources.getDrawable(getContext(), R.drawable.arrow_back);
DrawableCompat.setTint(DrawableCompat.wrap(dr), AXEmojiManager.getEmojiViewTheme().getDefaultColor());
backButton.setImageDrawable(dr);
}
protected void searchFor (String value){
if (recyclerView.getAdapter() == null) return;
((AXUISearchAdapter) recyclerView.getAdapter()).searchFor(value);
}
protected OnEmojiActions findActions(){
if (base instanceof AXEmojiView){
return ((AXEmojiView) base).getInnerEmojiActions();
} else if (base instanceof AXSingleEmojiView){
return ((AXSingleEmojiView) base).getInnerEmojiActions();
}
return null;
}
protected VariantEmoji findVariant(){
if (base instanceof AXEmojiView){
return ((AXEmojiView) base).getVariantEmoji();
} else if (base instanceof AXSingleEmojiView){
return ((AXSingleEmojiView) base).getVariantEmoji();
}
return AXEmojiManager.getVariantEmoji();
}
private RecyclerView.Adapter<?> createAdapter(){
return new SearchAdapter(this);
}
protected static class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder> implements AXUISearchAdapter {
AXEmojiSearchView searchView;
List<Emoji> list;
public SearchAdapter(AXEmojiSearchView searchView){
super();
this.searchView = searchView;
list = new ArrayList<>();
searchFor("");
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
FrameLayout frameLayout = new FrameLayout(parent.getContext());
AXEmojiImageView emojiView = new AXEmojiImageView(parent.getContext());
int cw = Utils.dp(parent.getContext(),38);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
frameLayout.addView(emojiView);
int dp6 = Utils.dp(parent.getContext(), 6);
emojiView.setPadding(dp6, dp6, dp6, dp6);
return new ViewHolder(frameLayout);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
final AXEmojiImageView emojiView = (AXEmojiImageView) frameLayout.getChildAt(0);
Emoji emoji = list.get(position);
emojiView.setEmoji(searchView.findVariant().getVariant(emoji));
emojiView.setOnEmojiActions(searchView.findActions(), true);
}
@Override
public int getItemCount() {
return list.size();
}
@Override
public void searchFor(String value) {
list.clear();
if (value.trim().isEmpty()){
list.addAll(AXEmojiManager.getRecentEmoji().getRecentEmojis());
}else {
list.addAll(searchView.getDataAdapter().searchFor(value));
}
searchView.searched(!list.isEmpty());
notifyDataSetChanged();
}
protected static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}
protected static class CustomEditText extends AXEmojiEditText {
boolean req = false;
public CustomEditText(@NonNull Context context) {
super(context);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.clearFocus();
}
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
if (focused) req = false;
if (!req && !focused && getParent()!=null) reload();
}
public void reload(){
((AXEmojiSearchView) getParent()).base.getPopupInterface().reload();
req = true;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (getParent() != null && !req && keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN && hasFocus()) {
req = true;
InputMethodManager mgr = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (mgr != null) {
mgr.hideSoftInputFromWindow(this.getWindowToken(), 0);
}
if (((AXEmojiSearchView) getParent()).base.getPopupInterface() != null) {
((AXEmojiSearchView) getParent()).base.getPopupInterface().reload();
}
return true;
}
if (keyCode == KeyEvent.KEYCODE_BACK && req) return true;
return super.onKeyPreIme(keyCode,event);
}
}
}
| 14,590 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXUISearchAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/search/AXUISearchAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.search;
public interface AXUISearchAdapter {
void searchFor (String value);
} | 727 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXDataAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/search/AXDataAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.search;
import androidx.annotation.NonNull;
import java.util.List;
public interface AXDataAdapter<T> {
void init();
@NonNull List<T> searchFor(String value);
void destroy();
}
| 838 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXSimpleEmojiDataAdapter.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/search/AXSimpleEmojiDataAdapter.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.search;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.NonNull;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiData;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
public class AXSimpleEmojiDataAdapter extends SQLiteOpenHelper implements AXDataAdapter<Emoji> {
private static File DB_FILE;
private static final String DATABASE_NAME = "emoji.db";
private static final int DATABASE_VERSION = 1;
public boolean querySearchLikeEnabled = true;
public Context context;
static SQLiteDatabase sqliteDataBase;
public AXSimpleEmojiDataAdapter(Context context) {
super(context, DATABASE_NAME, null ,DATABASE_VERSION);
DB_FILE = context.getDatabasePath(DATABASE_NAME);
this.context = context;
}
private void createDataBase(){
if(!DB_FILE.exists()){
this.getReadableDatabase();
this.close();
try {
InputStream myInput = context.getAssets().open(DATABASE_NAME);
OutputStream myOutput = new FileOutputStream(DB_FILE);
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
myOutput.flush();
myOutput.close();
myInput.close();
openDataBase();
} catch (IOException e){
e.printStackTrace();
}
} else {
if (sqliteDataBase == null) openDataBase();
}
}
private void openDataBase() throws SQLException {
sqliteDataBase = SQLiteDatabase.openDatabase(DB_FILE.getAbsolutePath(), null, SQLiteDatabase.OPEN_READWRITE);
}
@Override
public synchronized void close() {
if(sqliteDataBase != null)
sqliteDataBase.close();
super.close();
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
@Override
public void init() {
try {
createDataBase();
}catch (Exception e){
e.printStackTrace();
}
}
@NonNull
@Override
public List<Emoji> searchFor(String value) {
String search = fixSearchValue(value);
List<Emoji> list = new ArrayList<>();
if (customs!=null){
list.addAll(customs);
customs = null;
}
if (sqliteDataBase == null || search.isEmpty()) return list;
load("SELECT * FROM emojis WHERE name = ? COLLATE NOCASE",search,list);
if (querySearchLikeEnabled) load("SELECT * FROM emojis WHERE name LIKE ? COLLATE NOCASE",search+"%",list);
return list;
}
protected void load (String query,String search,List<Emoji> list){
Cursor cursor = sqliteDataBase.rawQuery(query, new String[] {search});
try {
while (cursor.moveToNext()) {
Emoji em = AXEmojiManager.getInstance().findEmoji(cursor.getString(cursor.getColumnIndex("unicode")));
if (em!=null && list.indexOf(em) == -1) list.add(em);
}
} finally {
cursor.close();
}
}
@Override
public void destroy() {
close();
}
public String fixSearchValue(String value){
String text = value.trim().toLowerCase();
if (text.equalsIgnoreCase("heart")){
loadSpecialEmoji(EmojiData.getHeartEmojis());
return text;
}
if (text.equals(":)") || text.equals(":-)")) text = "smile";
if (text.equals(":(") || text.equals(":-(")) {
loadSpecialEmoji("😔","😕","☹","🙁","🥺","😢","😥","\uD83D\uDE2D","\uD83D\uDE3F","\uD83D\uDC94");
return "";
}
if (text.equals(":|") || text.equals(":/") || text.equals(":\\")
|| text.equals(":-/" )|| text.equals(":-\\") || text.equals(":-|")) text = "meh";
if (text.equals(";)") || text.equals(";-)") || text.equals(";-]")) text = "wink";
if (text.equals(":]")) {
loadSpecialEmoji("😏");
return "";
}
if (text.equals(":D") || text.equals(";D")){
loadSpecialEmoji("😁","😃","😄","\uD83D\uDE06");
return "";
}
if (text.equals("=|") || text.equals("=/") || text.equals("=\\")) {
loadSpecialEmoji("😐","😕","😟");
return "";
}
return text;
}
List<Emoji> customs = null;
protected void loadSpecialEmoji(String... emoji){
customs = new ArrayList<>();
for (String e : emoji){
Emoji em = AXEmojiManager.getInstance().findEmoji(e);
if (em!=null && customs.indexOf(em) == -1) customs.add(em);
}
}
}
| 5,920 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
StickerLoader.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/StickerLoader.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import android.view.View;
@SuppressWarnings("rawtypes")
public interface StickerLoader {
void onLoadSticker(View view, Sticker sticker);
void onLoadStickerCategory(View icon, StickerCategory stickerCategory, boolean selected);
}
| 894 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
RecentSticker.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/RecentSticker.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import androidx.annotation.NonNull;
import java.util.Collection;
/**
* Interface for providing some custom implementation for recent stickers.
*/
@SuppressWarnings("rawtypes")
public interface RecentSticker {
/**
* Returns the recent sticker. Could be loaded from a database, shared preferences or just hard
* coded.<br>
* <p>
* This method will be called more than one time hence it is recommended to hold a collection of
* recent sticker.
*/
@NonNull
Collection<Sticker> getRecentStickers();
/**
* Should add the sticker to the recent ones. After calling this method, {@link #getRecentStickers()}
* should return the sticker that was just added.
*/
void addSticker(@NonNull Sticker sticker);
/**
* Should persist all sticker.
*/
void persist();
/**
* Returns true if recent is empty
*/
boolean isEmpty();
}
| 1,572 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
StickerProvider.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/StickerProvider.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import androidx.annotation.NonNull;
public interface StickerProvider {
/**
* @return The Array of categories.
*/
@SuppressWarnings("rawtypes")
@NonNull
StickerCategory[] getCategories();
@NonNull
StickerLoader getLoader();
/**
* Returns true if there is a recent tab
*/
boolean isRecentEnabled();
}
| 1,010 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
Sticker.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/Sticker.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Base64;
import android.util.Log;
import androidx.annotation.NonNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class Sticker<T> implements Serializable {
private static final long serialVersionUID = 3L;
T data;
public Sticker(T data) {
this.data = data;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@NonNull
@Override
public String toString() {
return data.toString();
}
@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object o) {
if (!(o instanceof Sticker)) return false;
return getData().equals(((Sticker) o).getData());
}
@SuppressWarnings("unchecked")
public static <T extends Serializable> T load(String string) {
byte[] bytes = Base64.decode(string, 0);
T object = null;
try {
ObjectInputStream objectInputStream = new ObjectInputStream(new ByteArrayInputStream(bytes));
object = (T) objectInputStream.readObject();
} catch (Exception e) {
e.printStackTrace();
}
return object;
}
public static String toString(@SuppressWarnings("rawtypes") Sticker object) {
Log.d("sticker", object.getClass().getSimpleName());
String encoded = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(object);
objectOutputStream.close();
encoded = new String(Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0));
} catch (IOException e) {
e.printStackTrace();
}
return encoded;
}
public RecentStickerManager getDefaultRecentManager(Context context, String type) {
return new RecentStickerManager(context, type);
}
public boolean isInstance(Class<?> o) {
return o.isInstance(getData());
}
}
| 2,991 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
RecentStickerManager.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/RecentStickerManager.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import org.mark.axemojiview.AXEmojiManager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;
@SuppressWarnings("rawtypes")
public final class RecentStickerManager implements RecentSticker {
private static String PREFERENCE_NAME = "recent-manager";
static String TIME_DELIMITER = ";";
static String EMOJI_DELIMITER = "~";
private static String RECENT_STICKER = "recents";
static int EMOJI_GUESS_SIZE = 5;
public static int MAX_RECENTS = -1;
final Context context;
StickerList StickersList = new StickerList(0);
public static boolean isEmpty(Context context) {
final String savedRecentEmojis = context.getApplicationContext()
.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE).getString(RECENT_STICKER, "");
if (savedRecentEmojis.length() > 0) return false;
return true;
}
@Override
public boolean isEmpty() {
final String savedRecentEmojis = context.getApplicationContext()
.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE).getString(RECENT_STICKER, "");
if (savedRecentEmojis.length() > 0) return false;
if (AXEmojiManager.isShowingEmptyRecentEnabled() == false) {
return true;
}
return false;
}
public RecentStickerManager(@NonNull final Context context, final String type) {
RECENT_STICKER = type + "-recents";
PREFERENCE_NAME = type + "-recent-manager";
this.context = context.getApplicationContext();
}
@NonNull
@Override
public Collection<Sticker> getRecentStickers() {
if (StickersList.size() == 0) {
final String savedRecentEmojis = getPreferences().getString(RECENT_STICKER, "");
if (savedRecentEmojis.length() > 0) {
final StringTokenizer stringTokenizer = new StringTokenizer(savedRecentEmojis, EMOJI_DELIMITER);
StickersList = new StickerList(stringTokenizer.countTokens());
while (stringTokenizer.hasMoreTokens()) {
final String token = stringTokenizer.nextToken();
final String[] parts = token.split(TIME_DELIMITER);
if (parts.length == 2) {
final Sticker sticker = Sticker.load(parts[0]);
if (sticker != null && sticker.getData() != null && sticker.getData().toString().length() > 0) {
final long timestamp = Long.parseLong(parts[1]);
StickersList.add(sticker, timestamp);
}
}
}
} else {
StickersList = new StickerList(0);
}
}
return StickersList.getStickers();
}
@Override
public void addSticker(@NonNull final Sticker sticker) {
StickersList.add(sticker);
}
@Override
public void persist() {
if (StickersList.size() > 0) {
final StringBuilder stringBuilder = new StringBuilder(StickersList.size() * EMOJI_GUESS_SIZE);
for (int i = 0; i < StickersList.size(); i++) {
final Data data = StickersList.get(i);
stringBuilder.append(Sticker.toString(data.Sticker))
.append(TIME_DELIMITER)
.append(data.timestamp)
.append(EMOJI_DELIMITER);
}
stringBuilder.setLength(stringBuilder.length() - EMOJI_DELIMITER.length());
getPreferences().edit().putString(RECENT_STICKER, stringBuilder.toString()).apply();
}
}
public void clear() {
getPreferences().edit().putString(RECENT_STICKER, "").apply();
StickersList.clear();
}
public void removeStickerFromRecent(Sticker sticker) {
if (StickersList.size() > 0) {
final StringBuilder stringBuilder = new StringBuilder(StickersList.size() * EMOJI_GUESS_SIZE);
for (int i = 0; i < StickersList.size(); i++) {
final Data data = StickersList.get(i);
if (data.Sticker.equals(sticker)) {
} else {
stringBuilder.append(Sticker.toString(data.Sticker))
.append(TIME_DELIMITER)
.append(data.timestamp)
.append(EMOJI_DELIMITER);
}
}
stringBuilder.setLength(stringBuilder.length() - EMOJI_DELIMITER.length());
getPreferences().edit().putString(RECENT_STICKER, stringBuilder.toString()).apply();
}
}
private SharedPreferences getPreferences() {
return context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
}
static class StickerList {
static final Comparator<Data> COMPARATOR = new Comparator<Data>() {
@Override
public int compare(final Data lhs, final Data rhs) {
return Long.valueOf(rhs.timestamp).compareTo(lhs.timestamp);
}
};
@NonNull
public final List<Data> Stickers;
public void remove(int position) {
Stickers.remove(position);
}
public void clear() {
Stickers.clear();
}
StickerList(final int size) {
Stickers = new ArrayList<>(size);
}
public void add(final Sticker Sticker) {
add(Sticker, System.currentTimeMillis());
}
public void add(final Sticker Sticker, final long timestamp) {
boolean exit = false;
for (int i = 0; i < Stickers.size(); i++) {
Data data = Stickers.get(i);
if (data.Sticker.equals(Sticker)) {
data.timestamp = timestamp;
exit = true;
break;
}
}
if (exit) return;
Stickers.add(0, new Data(Sticker, timestamp));
if (Stickers.size() > MAX_RECENTS) {
Stickers.remove(MAX_RECENTS);
}
}
Collection<Sticker> getStickers() {
Collections.sort(Stickers, COMPARATOR);
final Collection<Sticker> sortedEmojis = new ArrayList<>(Stickers.size());
for (final Data data : Stickers) {
sortedEmojis.add(data.Sticker);
}
return sortedEmojis;
}
public int size() {
return Stickers.size();
}
public Data get(final int index) {
return Stickers.get(index);
}
}
static class Data {
public final Sticker Sticker;
public long timestamp;
Data(final Sticker Sticker, final long timestamp) {
this.Sticker = Sticker;
this.timestamp = timestamp;
}
}
}
| 7,766 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
StickerCategory.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/sticker/StickerCategory.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.sticker;
import androidx.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
/**
* Interface for defining a category.
*/
public interface StickerCategory<T> {
/**
* Returns all of the stickers it can display.
*/
@SuppressWarnings("rawtypes")
@NonNull
Sticker[] getStickers();
/**
* Returns the icon of the category that should be displayed.
*/
T getCategoryData();
/**
* Return true if you want to build your own CustomView
*/
boolean useCustomView();
/**
* @return add custom view
*/
View getView(ViewGroup viewGroup);
/**
* update your custom view
*/
void bindView(View view);
/**
* set an emptyView if you aren't using custom view
*/
View getEmptyView(ViewGroup viewGroup);
}
| 1,475 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXEmojiVariantPopup.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/variant/AXEmojiVariantPopup.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.variant;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.view.AXEmojiImageView;
public abstract class AXEmojiVariantPopup {
public AXEmojiVariantPopup(@NonNull final View rootView, @Nullable final OnEmojiActions listener) {}
public abstract boolean isShowing();
public abstract void show(@NonNull final AXEmojiImageView clickedImage, @NonNull final Emoji emoji, boolean fromRecent);
public abstract void dismiss();
public boolean onTouch(MotionEvent event, RecyclerView recyclerView) {
return false;
}
}
| 1,446 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXTouchEmojiVariantPopup.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/variant/AXTouchEmojiVariantPopup.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.variant;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.PopupWindow;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.emoji.EmojiData;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiImageView;
import java.lang.reflect.Field;
public class AXTouchEmojiVariantPopup extends AXEmojiVariantPopup {
@NonNull
final View rootView;
@Nullable
private PopupWindow popupWindow;
@Nullable
final OnEmojiActions listener;
@Nullable
AXEmojiImageView rootImageView;
EmojiColorPickerView pickerView;
int popupWidth, popupHeight;
boolean fromRecent;
public AXTouchEmojiVariantPopup(@NonNull final View rootView, @Nullable final OnEmojiActions listener) {
super(rootView, listener);
this.rootView = rootView;
this.listener = listener;
init();
}
private void init() {
mEmojiSize = Utils.dp(rootView.getContext(), 34);
pickerView = new EmojiColorPickerView(rootView.getContext());
popupWindow = new EmojiPopupWindow(pickerView, popupWidth = Utils.dp(rootView.getContext(), (34 * 6 + 10 + 4 * 5) + 2), popupHeight = Utils.dp(rootView.getContext(), 58));
popupWindow.setOutsideTouchable(true);
popupWindow.setClippingEnabled(true);
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
popupWindow.getContentView().setFocusableInTouchMode(true);
popupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0 && event.getAction() == KeyEvent.ACTION_UP && popupWindow != null && popupWindow.isShowing()) {
dismiss();
return true;
}
return false;
}
});
}
boolean isShowing;
public boolean isShowing() {
return isShowing;
}
int mEmojiSize;
public void show(@NonNull final AXEmojiImageView clickedImage, @NonNull final Emoji emoji, boolean fromRecent) {
dismiss();
this.fromRecent = fromRecent;
if (popupWindow == null || pickerView == null) init();
isShowing = true;
rootImageView = clickedImage;
emojiTouchedX = emojiLastX;
emojiTouchedY = emojiLastY;
String color = EmojiData.getEmojiColor(emoji.getUnicode());
if (color != null) {
switch (color) {
case "\uD83C\uDFFB":
pickerView.setSelection(1);
break;
case "\uD83C\uDFFC":
pickerView.setSelection(2);
break;
case "\uD83C\uDFFD":
pickerView.setSelection(3);
break;
case "\uD83C\uDFFE":
pickerView.setSelection(4);
break;
case "\uD83C\uDFFF":
pickerView.setSelection(5);
break;
}
} else {
pickerView.setSelection(0);
}
final int[] location = new int[2];
rootImageView.getLocationOnScreen(location);
popupWindow.setFocusable(true);
final Point loc;
if (AXEmojiManager.isUsingPopupWindow()) {
loc = new Point(location[0] - popupWidth / 2 + clickedImage.getWidth() / 2, location[1] - popupHeight + (rootImageView.getMeasuredHeight() - mEmojiSize) / 2);
pickerView.setEmoji(emoji.getBase(), -100);
popupWindow.showAtLocation(rootView, Gravity.NO_GRAVITY, loc.x, loc.y);
} else {
loc = null;
int x = mEmojiSize * pickerView.getSelection() + Utils.dp(rootImageView.getContext(), 4 * pickerView.getSelection() - 1);
if (location[0] - x < Utils.dp(rootImageView.getContext(), 5)) {
x += (location[0] - x) - Utils.dp(rootImageView.getContext(), 5);
} else if (location[0] - x + popupWidth > rootImageView.getContext().getResources().getDisplayMetrics().widthPixels - Utils.dp(rootImageView.getContext(), 5)) {
x += (location[0] - x + popupWidth) - (rootImageView.getContext().getResources().getDisplayMetrics().widthPixels - Utils.dp(rootImageView.getContext(), 5));
}
int xOffset = -x;
int yOffset = rootImageView.getTop() < 0 ? rootImageView.getTop() : 0;
pickerView.setEmoji(emoji.getBase(), Utils.dp(rootImageView.getContext(), 22) - xOffset + (int) Utils.dpf2(rootImageView.getContext(), 0.5f));
popupWindow.showAsDropDown(rootImageView, xOffset, -rootImageView.getMeasuredHeight() - popupHeight + (rootImageView.getMeasuredHeight() - mEmojiSize) / 2 - yOffset);
}
clickedImage.getParent().getParent().getParent().requestDisallowInterceptTouchEvent(true);
clickedImage.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, location[0], location[1], 0));
if (AXEmojiManager.isUsingPopupWindow()) {
Utils.fixPopupLocation(popupWindow, loc);
popupWindow.getContentView().post(new Runnable() {
@Override
public void run() {
if (popupWindow.getContentView().getMeasuredHeight() <= 0) {
popupWindow.getContentView().post(this);
return;
}
Point wLoc = Utils.locationOnScreen(popupWindow.getContentView());
pickerView.setEmoji(emoji.getBase(), (location[0] - wLoc.x) + (clickedImage.getWidth() / 2));
}
});
}
}
public void dismiss() {
isShowing = false;
rootImageView = null;
if (popupWindow != null) {
popupWindow.dismiss();
}
}
private class EmojiColorPickerView extends View {
private Drawable backgroundDrawable;
private Drawable arrowDrawable;
private Emoji currentEmoji;
private int arrowX;
private int selection;
private Paint rectPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private RectF rect = new RectF();
private boolean loaded = false;
public void setEmoji(Emoji emoji, int arrowPosition) {
currentEmoji = emoji;
arrowX = arrowPosition;
rectPaint.setColor(0x2f000000);
invalidate();
}
public Emoji getEmoji() {
return currentEmoji;
}
public void setSelection(int position) {
if (selection == position) {
return;
}
selection = position;
invalidate();
}
public int getSelection() {
return selection;
}
public EmojiColorPickerView(Context context) {
super(context);
backgroundDrawable = getResources().getDrawable(R.drawable.stickers_back_all);
arrowDrawable = getResources().getDrawable(R.drawable.stickers_back_arrow);
setDrawableColor(backgroundDrawable, AXEmojiManager.getEmojiViewTheme().getVariantPopupBackgroundColor());
setDrawableColor(arrowDrawable, AXEmojiManager.getEmojiViewTheme().getVariantPopupBackgroundColor());
}
void setDrawableColor(Drawable drawable, int color) {
if (drawable == null) return;
drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
}
@Override
protected void onDraw(Canvas canvas) {
loaded = true;
backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), Utils.dp(getContext(), 54));
backgroundDrawable.draw(canvas);
arrowDrawable.setBounds(arrowX - Utils.dp(getContext(), 9), Utils.dp(getContext(), 49.5f), arrowX + Utils.dp(getContext(), 9), Utils.dp(getContext(), 47.5f + 8));
arrowDrawable.draw(canvas);
if (currentEmoji != null) {
for (int a = 0; a < 6; a++) {
int x = mEmojiSize * a + Utils.dp(getContext(), 5 + 4 * a);
int y = Utils.dp(getContext(), 9);
if (selection == a) {
rect.set(x, y - (int) Utils.dpf2(getContext(), 3.5f), x + mEmojiSize, y + mEmojiSize + Utils.dp(getContext(), 3));
canvas.drawRoundRect(rect, Utils.dp(getContext(), 4), Utils.dp(getContext(), 4), rectPaint);
}
Emoji sEmoji;
if (a == 0) {
sEmoji = currentEmoji.getBase();
} else {
sEmoji = currentEmoji.getVariants().get(a - 1);
}
Drawable drawable = sEmoji.getDrawable(getContext());
if (drawable != null) {
drawable.setBounds(x, y, x + mEmojiSize, y + mEmojiSize);
drawable.draw(canvas);
}
if (loaded) {
if (sEmoji.isLoading()) loaded = false;
}
}
}
if (!loaded) {
postDelayed(new Runnable() {
@Override
public void run() {
invalidate();
}
}, 10);
}
}
}
private static final Field superListenerField;
static {
Field f = null;
try {
f = PopupWindow.class.getDeclaredField("mOnScrollChangedListener");
f.setAccessible(true);
} catch (NoSuchFieldException e) {
/* ignored */
}
superListenerField = f;
}
private static final ViewTreeObserver.OnScrollChangedListener NOP = new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
/* do nothing */
}
};
private class EmojiPopupWindow extends PopupWindow {
private ViewTreeObserver.OnScrollChangedListener mSuperScrollListener;
private ViewTreeObserver mViewTreeObserver;
public EmojiPopupWindow() {
super();
init();
}
public EmojiPopupWindow(Context context) {
super(context);
init();
}
public EmojiPopupWindow(int width, int height) {
super(width, height);
init();
}
public EmojiPopupWindow(View contentView) {
super(contentView);
init();
}
public EmojiPopupWindow(View contentView, int width, int height, boolean focusable) {
super(contentView, width, height, focusable);
init();
}
public EmojiPopupWindow(View contentView, int width, int height) {
super(contentView, width, height);
init();
}
private void init() {
if (superListenerField != null) {
try {
mSuperScrollListener = (ViewTreeObserver.OnScrollChangedListener) superListenerField.get(this);
superListenerField.set(this, NOP);
} catch (Exception e) {
mSuperScrollListener = null;
}
}
}
private void unregisterListener() {
if (mSuperScrollListener != null && mViewTreeObserver != null) {
if (mViewTreeObserver.isAlive()) {
mViewTreeObserver.removeOnScrollChangedListener(mSuperScrollListener);
}
mViewTreeObserver = null;
}
}
private void registerListener(View anchor) {
if (mSuperScrollListener != null) {
ViewTreeObserver vto = (anchor.getWindowToken() != null) ? anchor.getViewTreeObserver() : null;
if (vto != mViewTreeObserver) {
if (mViewTreeObserver != null && mViewTreeObserver.isAlive()) {
mViewTreeObserver.removeOnScrollChangedListener(mSuperScrollListener);
}
if ((mViewTreeObserver = vto) != null) {
vto.addOnScrollChangedListener(mSuperScrollListener);
}
}
}
}
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
try {
super.showAsDropDown(anchor, xoff, yoff);
registerListener(anchor);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void update(View anchor, int xoff, int yoff, int width, int height) {
super.update(anchor, xoff, yoff, width, height);
registerListener(anchor);
}
@Override
public void update(View anchor, int width, int height) {
super.update(anchor, width, height);
registerListener(anchor);
}
@Override
public void showAtLocation(View parent, int gravity, int x, int y) {
super.showAtLocation(parent, gravity, x, y);
unregisterListener();
}
@Override
public void dismiss() {
setFocusable(false);
try {
super.dismiss();
} catch (Exception ignore) {
}
unregisterListener();
}
}
float emojiTouchedX, emojiTouchedY;
float emojiLastX, emojiLastY;
private int location[] = new int[2];
@Override
public boolean onTouch(MotionEvent event, RecyclerView recyclerView) {
if (rootImageView != null) {
if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
Emoji emoji;
if (pickerView.getSelection() == 0) {
emoji = pickerView.getEmoji().getBase();
} else {
emoji = pickerView.getEmoji().getVariants().get(pickerView.getSelection() - 1);
}
rootImageView.updateEmoji(emoji);
if (listener != null) listener.onClick(rootImageView, emoji, fromRecent, true);
}
rootImageView = null;
emojiTouchedX = -10000;
emojiTouchedY = -10000;
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
boolean ignore = false;
if (emojiTouchedX != -10000) {
if (Math.abs(emojiTouchedX - event.getX()) > Utils.getPixelsInCM(rootImageView.getContext(), 0.2f, true) || Math.abs(emojiTouchedY - event.getY()) > Utils.getPixelsInCM(rootImageView.getContext(), 0.2f, false)) {
emojiTouchedX = -10000;
emojiTouchedY = -10000;
} else {
ignore = true;
}
}
if (!ignore) {
recyclerView.getLocationOnScreen(location);
float x = location[0] + event.getX();
pickerView.getLocationOnScreen(location);
x -= location[0] + Utils.dp(rootImageView.getContext(), 3);
int position = (int) (x / (mEmojiSize + Utils.dp(rootImageView.getContext(), 4)));
if (position < 0) {
position = 0;
} else if (position > 5) {
position = 5;
}
pickerView.setSelection(position);
}
}
return true;
}
emojiLastX = event.getX();
emojiLastY = event.getY();
return super.onTouch(event, recyclerView);
}
}
| 17,564 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
AXSimpleEmojiVariantPopup.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/main/java/org/mark/axemojiview/variant/AXSimpleEmojiVariantPopup.java | /*
* Copyright (C) 2020 - Amir Hossein Aghajari
*
* 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 org.mark.axemojiview.variant;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import java.util.List;
import static android.view.View.MeasureSpec.makeMeasureSpec;
import org.mark.axemojiview.AXEmojiManager;
import org.mark.axemojiview.R;
import org.mark.axemojiview.emoji.Emoji;
import org.mark.axemojiview.listener.OnEmojiActions;
import org.mark.axemojiview.utils.Utils;
import org.mark.axemojiview.view.AXEmojiImageView;
public class AXSimpleEmojiVariantPopup extends AXEmojiVariantPopup {
private static final int MARGIN = 2;
@NonNull
final View rootView;
@Nullable
private PopupWindow popupWindow;
@Nullable
final OnEmojiActions listener;
@Nullable
AXEmojiImageView rootImageView;
public AXSimpleEmojiVariantPopup(@NonNull final View rootView, @Nullable final OnEmojiActions listener) {
super(rootView, listener);
this.rootView = rootView;
this.listener = listener;
}
View content;
boolean isShowing;
public boolean isShowing() {
return isShowing;
}
public void show(@NonNull final AXEmojiImageView clickedImage, @NonNull final Emoji emoji, final boolean fromRecent) {
dismiss();
isShowing = true;
rootImageView = clickedImage;
content = initView(clickedImage.getContext(), emoji, clickedImage.getWidth(), fromRecent);
popupWindow = new PopupWindow(content, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
isShowing = false;
}
});
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
popupWindow.setBackgroundDrawable(new BitmapDrawable(clickedImage.getContext().getResources(), (Bitmap) null));
content.measure(makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
final Point location = Utils.locationOnScreen(clickedImage);
final Point desiredLocation = new Point(
location.x - content.getMeasuredWidth() / 2 + clickedImage.getWidth() / 2,
location.y - content.getMeasuredHeight()
);
popupWindow.showAtLocation(rootView, Gravity.NO_GRAVITY, desiredLocation.x, desiredLocation.y);
rootImageView.getParent().requestDisallowInterceptTouchEvent(true);
Utils.fixPopupLocation(popupWindow, desiredLocation);
}
public void dismiss() {
isShowing = false;
rootImageView = null;
if (popupWindow != null) {
popupWindow.dismiss();
popupWindow = null;
}
}
LinearLayout imageContainer;
private View initView(@NonNull final Context context, @NonNull final Emoji emoji, final int width, final boolean fromRecent) {
final View result = View.inflate(context, R.layout.emoji_skin_popup, null);
imageContainer = (LinearLayout) result.findViewById(R.id.container);
CardView cardView = (CardView) result.findViewById(R.id.cardview);
cardView.setCardBackgroundColor(AXEmojiManager.getEmojiViewTheme().getVariantPopupBackgroundColor());
final List<Emoji> variants = emoji.getBase().getVariants();
variants.add(0, emoji.getBase());
final LayoutInflater inflater = LayoutInflater.from(context);
for (final Emoji variant : variants) {
final ImageView emojiImage = (ImageView) inflater.inflate(R.layout.emoji_item, imageContainer, false);
final ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) emojiImage.getLayoutParams();
final int margin = Utils.dpToPx(context, MARGIN);
// Use the same size for Emojis as in the picker.
layoutParams.width = width;
layoutParams.setMargins(margin, margin, margin, margin);
emojiImage.setImageDrawable(variant.getDrawable(emojiImage));
emojiImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
if (listener != null && rootImageView != null) {
rootImageView.updateEmoji(variant);
listener.onClick(rootImageView, variant, fromRecent, true);
}
}
});
imageContainer.addView(emojiImage);
}
return result;
}
}
| 5,736 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
ExampleInstrumentedTest.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/AXEmojiView/src/androidTest/java/com/aghajari/emojiview/ExampleInstrumentedTest.java | package com.aghajari.emojiview;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.aghajari.emojiview.test", appContext.getPackageName());
}
} | 763 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
ExampleUnitTest.java | /FileExtraction/Java_unseen/MoonMeet_MoonMeet-Android/MoonMeet-Android/src/test/java/org/mark/moonmeet/ExampleUnitTest.java | package org.mark.moonmeet;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | 378 | Java | .java | MoonMeet/MoonMeet-Android | 25 | 5 | 0 | 2021-04-24T16:21:03Z | 2022-08-02T22:42:51Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.