blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
6f6a6d0e4d07b435961036756b27191aa035a204
4701dc93d7c7b7a3072e71c8266d0a7b22ee427d
/app/src/main/java/com/binvshe/binvshe/http/model/CancelLikeModel.java
15856865230c1654431fc751ee4c6b4043389ffd
[]
no_license
ZoieImTeam/modo
b65a1005ba40502d47103f5b298087b10917ed28
fdd6b244ff71be85003f4c90252f76e329d9e092
refs/heads/master
2021-01-17T12:07:58.738742
2016-08-19T12:34:38
2016-08-19T12:34:38
64,627,857
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.binvshe.binvshe.http.model; import com.binvshe.binvshe.http.base.HttpTask; /** * 给专题点赞Model * Created by Administrator on 2016/3/13. */ public class CancelLikeModel extends BaseModel{ public static final String ADD_LIKE_FALSE = "0"; public static final String ADD_LIKE_TRUE = "1"; @Override protected void onLoad(Object... params) throws Exception { String specialId = (String) params[0]; String id = (String) params[1]; HttpTask.getInstance().cancelLike(this, specialId, id); } }
[ "h617717344@gmail.com" ]
h617717344@gmail.com
b8911c481f04886ff6f84224fd9a4a0d1f761c7e
1caba6f70a8e2d00f80084513e072bef13cd3aa6
/calendar/src/main/java/com/necer/view/WeekView.java
d29ff138ce8a0232ebde576cb758e068aa44871a
[]
no_license
xia7410/NCalendar
392f5c6c2d1b7f97fdf25077d6b52c4392928c27
81e9d2b8ff0d7826609998b6b4f0c8be81049e03
refs/heads/master
2020-04-07T01:51:10.407096
2018-11-16T10:36:55
2018-11-16T10:36:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
package com.necer.view; import android.content.Context; import com.necer.entity.NDate; import com.necer.listener.OnClickWeekViewListener; import com.necer.utils.Attrs; import com.necer.utils.Util; import org.joda.time.LocalDate; import java.util.List; /** * Created by necer on 2018/9/11. * qq群:127278900 */ public class WeekView extends BaseCalendarView { private OnClickWeekViewListener mOnClickWeekViewListener; public WeekView(Context context, Attrs attrs, LocalDate localDate, OnClickWeekViewListener onClickWeekViewListener) { super(context, attrs, localDate); this.mOnClickWeekViewListener = onClickWeekViewListener; } @Override protected List<NDate> getNCalendar(LocalDate localDate, int type) { return Util.getWeekCalendar(localDate,type); } @Override protected void onClick(LocalDate clickData, LocalDate initialDate) { mOnClickWeekViewListener.onClickCurrentWeek(clickData); } @Override protected boolean isEqualsMonthOrWeek(LocalDate date, LocalDate initialDate) { return true; } }
[ "619008099@qq.com" ]
619008099@qq.com
f52131f0299c35a6c49ee7bef1612ef05e7e2535
056df75be825fb8ca4db6eb55d06451cbab5946b
/sqyjktw/Design-patterns/src/com/lhr/singleton/Singleton4.java
58630e032c4a83b9470cd0ff68908645d5e4906c
[]
no_license
FengLicoder/p-ssm
9cb21b34d175dbde456142e0a0f7789f9806fa79
cd1210beca83145eb4d0c4643495fdad7abced39
refs/heads/master
2023-03-09T07:42:49.232517
2021-02-23T01:30:06
2021-02-23T01:30:06
292,569,881
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.lhr.singleton; //双重校验锁 public class Singleton4 { private volatile static Singleton4 singleton; public static Singleton4 getInstance(){ if(singleton==null){ synchronized (Singleton4.class){ if(singleton == null){ singleton = new Singleton4(); } } } return singleton; } }
[ "2093336542@qq.com" ]
2093336542@qq.com
7c39a82290d5f212ea437ae64969ef758887cd27
a5b4d479d928d1c5a8eca42fbf4f24aeb88f989a
/emailcommon/src/main/java/org/apache/james/mime4j/decoder/DecoderUtil.java
00281babf7b5f5cbdeb8d99aea892c2c5faee8d3
[]
no_license
nazarcybulskij/Email44
84d10a9440b5cd834cd85e197f06e3186f289b77
afc0b6cc5597ca562793d3d2b2619af5b7a3a204
refs/heads/master
2021-03-12T19:59:17.349666
2015-04-20T11:46:38
2015-04-20T11:46:38
32,014,715
0
0
null
null
null
null
UTF-8
Java
false
false
10,380
java
/**************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * * regarding copyright ownership. The ASF licenses this file * * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * ****************************************************************/ package org.apache.james.mime4j.decoder; //BEGIN android-changed: Stubbing out logging import org.apache.james.mime4j.Log; import org.apache.james.mime4j.LogFactory; //END android-changed import org.apache.james.mime4j.util.CharsetUtil; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; /** * Static methods for decoding strings, byte arrays and encoded words. * * * @version $Id: DecoderUtil.java,v 1.3 2005/02/07 15:33:59 ntherning Exp $ */ public class DecoderUtil { private static Log log = LogFactory.getLog(DecoderUtil.class); /** * Decodes a string containing quoted-printable encoded data. * * @param s the string to decode. * @return the decoded bytes. */ public static byte[] decodeBaseQuotedPrintable(String s) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { byte[] bytes = s.getBytes("US-ASCII"); QuotedPrintableInputStream is = new QuotedPrintableInputStream( new ByteArrayInputStream(bytes)); int b = 0; while ((b = is.read()) != -1) { baos.write(b); } } catch (IOException e) { /* * This should never happen! */ log.error(e); } return baos.toByteArray(); } /** * Decodes a string containing base64 encoded data. * * @param s the string to decode. * @return the decoded bytes. */ public static byte[] decodeBase64(String s) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { byte[] bytes = s.getBytes("US-ASCII"); Base64InputStream is = new Base64InputStream( new ByteArrayInputStream(bytes)); int b = 0; while ((b = is.read()) != -1) { baos.write(b); } } catch (IOException e) { /* * This should never happen! */ log.error(e); } return baos.toByteArray(); } /** * Decodes an encoded word encoded with the 'B' encoding (described in * RFC 2047) found in a header field body. * * @param encodedWord the encoded word to decode. * @param charset the Java charset to use. * @return the decoded string. * @throws java.io.UnsupportedEncodingException if the given Java charset isn't * supported. */ public static String decodeB(String encodedWord, String charset) throws UnsupportedEncodingException { return new String(decodeBase64(encodedWord), charset); } /** * Decodes an encoded word encoded with the 'Q' encoding (described in * RFC 2047) found in a header field body. * * @param encodedWord the encoded word to decode. * @param charset the Java charset to use. * @return the decoded string. * @throws java.io.UnsupportedEncodingException if the given Java charset isn't * supported. */ public static String decodeQ(String encodedWord, String charset) throws UnsupportedEncodingException { /* * Replace _ with =20 */ StringBuffer sb = new StringBuffer(); for (int i = 0; i < encodedWord.length(); i++) { char c = encodedWord.charAt(i); if (c == '_') { sb.append("=20"); } else { sb.append(c); } } return new String(decodeBaseQuotedPrintable(sb.toString()), charset); } /** * Decodes a string containing encoded words as defined by RFC 2047. * Encoded words in have the form * =?charset?enc?Encoded word?= where enc is either 'Q' or 'q' for * quoted-printable and 'B' or 'b' for Base64. * * ANDROID: COPIED FROM A NEWER VERSION OF MIME4J * * @param body the string to decode. * @return the decoded string. */ public static String decodeEncodedWords(String body) { // ANDROID: Most strings will not include "=?" so a quick test can prevent unneeded // object creation. This could also be handled via lazy creation of the StringBuilder. if (body.indexOf("=?") == -1) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); // ANDROID: The mime4j original version has an error here. It gets confused if // the encoded string begins with an '=' (just after "?Q?"). This patch seeks forward // to find the two '?' in the "header", before looking for the final "?=". int endScan = begin + 2; if (begin != -1) { int qm1 = body.indexOf('?', endScan + 2); int qm2 = body.indexOf('?', qm1 + 1); if (qm2 != -1) { endScan = qm2 + 1; } } int end = begin == -1 ? -1 : body.indexOf("?=", endScan); if (end == -1) { if (previousEnd == 0) return body; sb.append(body.substring(previousEnd)); return sb.toString(); } end += 2; String sep = body.substring(previousEnd, begin); String decoded = decodeEncodedWord(body, begin, end); if (decoded == null) { sb.append(sep); sb.append(body.substring(begin, end)); } else { if (!previousWasEncoded || !CharsetUtil.isWhitespace(sep)) { sb.append(sep); } sb.append(decoded); } previousEnd = end; previousWasEncoded = decoded != null; } } // return null on error private static String decodeEncodedWord(String body, int begin, int end) { int qm1 = body.indexOf('?', begin + 2); if (qm1 == end - 2) return null; int qm2 = body.indexOf('?', qm1 + 1); if (qm2 == end - 2) return null; String mimeCharset = body.substring(begin + 2, qm1); String encoding = body.substring(qm1 + 1, qm2); String encodedText = body.substring(qm2 + 1, end - 2); String charset = CharsetUtil.toJavaCharset(mimeCharset); if (charset == null) { if (log.isWarnEnabled()) { log.warn("MIME charset '" + mimeCharset + "' in encoded word '" + body.substring(begin, end) + "' doesn't have a " + "corresponding Java charset"); } return null; } else if (!CharsetUtil.isDecodingSupported(charset)) { if (log.isWarnEnabled()) { log.warn("Current JDK doesn't support decoding of charset '" + charset + "' (MIME charset '" + mimeCharset + "' in encoded word '" + body.substring(begin, end) + "')"); } return null; } if (encodedText.length() == 0) { if (log.isWarnEnabled()) { log.warn("Missing encoded text in encoded word: '" + body.substring(begin, end) + "'"); } return null; } try { if (encoding.equalsIgnoreCase("Q")) { return DecoderUtil.decodeQ(encodedText, charset); } else if (encoding.equalsIgnoreCase("B")) { return DecoderUtil.decodeB(encodedText, charset); } else { if (log.isWarnEnabled()) { log.warn("Warning: Unknown encoding in encoded word '" + body.substring(begin, end) + "'"); } return null; } } catch (UnsupportedEncodingException e) { // should not happen because of isDecodingSupported check above if (log.isWarnEnabled()) { log.warn("Unsupported encoding in encoded word '" + body.substring(begin, end) + "'", e); } return null; } catch (RuntimeException e) { if (log.isWarnEnabled()) { log.warn("Could not decode encoded word '" + body.substring(begin, end) + "'", e); } return null; } } }
[ "nazar.cybulskij@optigra-soft.com" ]
nazar.cybulskij@optigra-soft.com
b4c762df0a229af7d27b7bce1c9887779dfbdeb1
276453be34c831ef7bb535580128237356711fa7
/src/main/java/com/company/HelloLib.java
48c5a3ea18b02f272f7ef5b8fd1edd13541c48bb
[]
no_license
Sergprh/Hello_n
5b5c6196a11100b80ac6d1014b1400b4bfcb3041
6a51e8e7a1307c03a2a4462073ecd3d15eb893d1
refs/heads/master
2021-01-09T20:32:04.078911
2017-02-08T22:45:44
2017-02-08T22:45:44
81,261,754
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package com.company; public class HelloLib { public static void Hello(){ System.out.println("Hello1") ; } }
[ "sprhs@mail.ru" ]
sprhs@mail.ru
59905210ade81316e5487b688ea32ac8577c41f9
471a1d9598d792c18392ca1485bbb3b29d1165c5
/jadx-MFP/src/main/java/io/requery/query/OrderBy.java
0a645ca302593af2a08596302940a657b136fd3c
[]
no_license
reed07/MyPreferencePal
84db3a93c114868dd3691217cc175a8675e5544f
365b42fcc5670844187ae61b8cbc02c542aa348e
refs/heads/master
2020-03-10T23:10:43.112303
2019-07-08T00:39:32
2019-07-08T00:39:32
129,635,379
2
0
null
null
null
null
UTF-8
Java
false
false
152
java
package io.requery.query; public interface OrderBy<Q> { <V> Q orderBy(Expression<V> expression); Q orderBy(Expression<?>... expressionArr); }
[ "anon@ymous.email" ]
anon@ymous.email
d43376f699d89e4fba4e5347efd5fd4b96e9be66
ad2014e62e7bd3fc5765c9eebfea8d4aa2fa780a
/src/main/java/com/qa/persistence/dao/OrderDaoMysql.java
0de69018cea62a369a34823e1b4f2cfba45992b0
[]
no_license
ChrisRea646/IMS-ChrisRea
d33fe14046efb3f145e453a37ea8bd8b5a16c01f
ff70250dc32f09a5563a53a1671283a4cf4e9bed
refs/heads/master
2022-06-29T21:43:05.660632
2020-02-14T14:47:26
2020-02-14T14:47:26
239,818,083
0
0
null
2022-06-21T02:47:00
2020-02-11T17:06:21
Java
UTF-8
Java
false
false
2,477
java
package com.qa.persistence.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.qa.controller.OrderController; import com.qa.persistence.domain.Order; import com.qa.utils.Config; import com.qa.utils.Utils; public class OrderDaoMysql implements Dao<Order> { public static final Logger LOGGER = Logger.getLogger(OrderController.class); private Statement statement = null; private ResultSet resultSet = null; public OrderDaoMysql(String username, String password) { Config.username = username; Config.password = password; } Order orderFromResultSet(ResultSet resultSet) throws SQLException { int num = resultSet.getInt("Order_Num"); double total = resultSet.getDouble("Order_Total"); int quantity = resultSet.getInt("Order_Quantity"); int cusid = resultSet.getInt("Customer_ID"); int cardid = resultSet.getInt("Card_ID"); return new Order(num, total, quantity, cusid, cardid); } public List<Order> readAll() { ArrayList<Order> orders = new ArrayList<Order>(); try (Connection connection = DriverManager.getConnection(Config.url, Config.username, Config.password)) { statement = connection.createStatement(); resultSet = statement.executeQuery("select * from Orders"); while (resultSet.next()) { int num = resultSet.getInt("Order_Num"); double total = resultSet.getDouble("Order_Total"); int quantity = resultSet.getInt("Order_Quantity"); int cusid = resultSet.getInt("Customer_ID"); int cardid = resultSet.getInt("Card_ID"); Order order = new Order(num, total, quantity, cusid, cardid); orders.add(order); } } catch (Exception e) { LOGGER.debug(e.getStackTrace()); LOGGER.error(e.getMessage()); } finally { Utils.close(statement, resultSet); } return orders; } public Order create(Order t) { return null; } public Order update(Order t) { return null; } public void delete(int num) { try (Connection connection = DriverManager.getConnection(Config.url, Config.username, Config.password)) { statement = connection.createStatement(); statement.executeUpdate("DELETE FROM Orders WHERE Order_Num = '" + num + " ';"); } catch (Exception e) { LOGGER.debug(e.getStackTrace()); LOGGER.error(e.getMessage()); } finally { Utils.close(statement, resultSet); } } }
[ "chris.j.rea1999@gmail.com" ]
chris.j.rea1999@gmail.com
1137713815c413e57adaa11b88251d390b72dfed
533bf5f52b8a317e72b0e184e59a7766fe8bd799
/app/src/main/java/customer/gajamove/com/gajamove_customer/adapter/AdditionalPriceServicesAdapter.java
aa8c83a593ec779be2af9919d641641496d734cd
[]
no_license
Asim-altitude/GajaMoveAndroid
2d32430bfc6e848aa61322db3a4405b5e55ea5af
2915a702d9b852f6ae3af79efd640be58b5b83af
refs/heads/master
2023-06-25T16:07:56.432045
2021-07-29T04:45:37
2021-07-29T04:45:37
371,274,419
0
0
null
null
null
null
UTF-8
Java
false
false
1,635
java
package customer.gajamove.com.gajamove_customer.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import customer.gajamove.com.gajamove_customer.R; public class AdditionalPriceServicesAdapter extends BaseAdapter { String[] list,priceList; Context context; public AdditionalPriceServicesAdapter(String[] list, String[] priceList, Context context) { this.list = list; this.priceList = priceList; this.context = context; } @Override public int getCount() { return list.length; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public View getView(int position, View convertView, ViewGroup viewGroup) { if (convertView==null) convertView = LayoutInflater.from(context).inflate(R.layout.additional_service_item,null); TextView service_name = convertView.findViewById(R.id.service_name); TextView service_price = convertView.findViewById(R.id.service_price); if (!list[position].trim().toString().equalsIgnoreCase("") && !priceList[position].trim().toString().equalsIgnoreCase("")) { convertView.setVisibility(View.VISIBLE); }else { convertView.setVisibility(View.GONE); } service_name.setText(list[position]); service_price.setText("RM"+priceList[position]); return convertView; } }
[ "smilie.app.magic@gmail.com" ]
smilie.app.magic@gmail.com
24936cf06164be1fb16b106b81d1bf8ad8ae5d09
032a0ab20b20fbc3e9421d26488564e6150504d9
/src/main/java/pl/pabilo8/immersiveintelligence/common/blocks/wooden/BlockIIRubberLog.java
220d8ecb91d7e31f2f98ca90d94bc26eabb5858b
[]
no_license
OneLousyDev/ImmersiveIntelligence
9c96afc8631591313157a0f605321dbed44bbe67
5df76f762cfd57d6ce7a581b80054a0b0677f84b
refs/heads/master
2023-07-25T15:44:15.259438
2021-09-04T11:51:39
2021-09-04T11:51:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,128
java
package pl.pabilo8.immersiveintelligence.common.blocks.wooden; import blusunrize.immersiveengineering.api.IEProperties; import blusunrize.immersiveengineering.common.blocks.BlockIEBase; import blusunrize.immersiveengineering.common.blocks.ItemBlockIEBase; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockLog.EnumAxis; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.*; import net.minecraft.util.EnumFacing.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import pl.pabilo8.immersiveintelligence.common.blocks.BlockIIBase; import pl.pabilo8.immersiveintelligence.common.blocks.wooden.BlockIIRubberLog.IIBlockTypesRubberLog; import java.util.Locale; /** * @author Pabilo8 * @since 2019-05-17 */ public class BlockIIRubberLog extends BlockIIBase<IIBlockTypesRubberLog> { public BlockIIRubberLog() { super("rubber_log", Material.WOOD, PropertyEnum.create("type", IIBlockTypesRubberLog.class), ItemBlockIEBase.class, BlockLog.LOG_AXIS); this.setHardness(2.0F); this.setSoundType(SoundType.WOOD); lightOpacity = 0; } @Override protected IBlockState getInitDefaultState() { return super.getInitDefaultState().withProperty(property,IIBlockTypesRubberLog.RUBBER).withProperty(BlockLog.LOG_AXIS, EnumAxis.NONE); } @Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(property, IIBlockTypesRubberLog.RUBBER).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.values()[MathHelper.clamp(meta,0,3)]); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(BlockLog.LOG_AXIS).ordinal(); } @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos) { return true; } @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos) { return true; } @Override public int damageDropped(IBlockState state) { return 0; } public enum IIBlockTypesRubberLog implements IStringSerializable, BlockIEBase.IBlockEnum { RUBBER; @Override public String getName() { return this.toString().toLowerCase(Locale.ENGLISH); } @Override public int getMeta() { return ordinal(); } @Override public boolean listForCreative() { return true; } } }
[ "pabilo1.pg@gmail.com" ]
pabilo1.pg@gmail.com
8a2a11472f80bbbac5fbb14946312d2e5cc8484e
8c74fdee766ed322a6789dd7db57a8e428c7c283
/app/src/main/java/com/example/readerdemo/Reader/data/EN_CNBookBean.java
6c9a954dbe879f53907076983542f01eaff6fffd
[]
no_license
coder-zt/ReaderDemo
19f0fcd392dcf736875c8089e136be49045c13a4
08f887861073f8f732fb8dddeca989ba019655c8
refs/heads/master
2022-10-28T18:43:03.513201
2020-06-14T17:58:38
2020-06-14T17:58:38
271,458,787
0
0
null
null
null
null
UTF-8
Java
false
false
3,591
java
package com.example.readerdemo.Reader.data; import java.util.ArrayList; import java.util.List; /** * 书的数据结构 * 书本结构: * 书:书名、章的集合 * 章:id\段的集合 * 段:id\句子的集合 * 句:id\startTime\endTime\chinese\english */ /** * 双语书 */ public class EN_CNBookBean { //书名 String bookName; //一本书中章的集合 List<ChapterBean> mChapterBeans = new ArrayList<>(); public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } public List<ChapterBean> getChapterBeans() { return mChapterBeans; } public void setChapterBeans(List<ChapterBean> chapterBeans) { mChapterBeans = chapterBeans; } /** * 章 */ public static class ChapterBean{ //一章中的段的集合 List<ParagraphBean> mParagraphBean = new ArrayList<>(); //章的id int mChapterId; public int getChapterId() { return mChapterId; } public void setChapterId(int chapterId) { mChapterId = chapterId; } public List<ParagraphBean> getParagraphBean() { return mParagraphBean; } public void setSentenceBeans(List<ParagraphBean> sentenceBeans) { mParagraphBean = sentenceBeans; } /** * 段 */ public static class ParagraphBean{ //段的id private int paragraphId; //一段中句子的集合 List<SentenceBean> mSentenceBeans = new ArrayList<>(); public List<SentenceBean> getSentenceBeans() { return mSentenceBeans; } public void setSentenceBeans(List<SentenceBean> sentenceBeans) { mSentenceBeans = sentenceBeans; } public int getParagraphId() { return paragraphId; } public void setParagraphId(int paragraphId) { this.paragraphId = paragraphId; } /** * 句子 */ public static class SentenceBean{ //句子的id int sentenceId; long starTime; long endTime; String chinese; String english; public int getSentenceId() { return sentenceId; } public void setSentenceId(int sentenceId) { this.sentenceId = sentenceId; } public long getStarTime() { return starTime; } public void setStarTime(long starTime) { this.starTime = starTime; } public long getEndTime() { return endTime; } public void setEndTime(long endTime) { this.endTime = endTime; } public String getChinese() { return chinese; } public void setChinese(String chinese) { this.chinese = chinese; } public String getEnglish() { return english; } public void setEnglish(String english) { this.english = english; } } } } }
[ "691076379@qq.com" ]
691076379@qq.com
910c153f199f30babe1ed937c1a6237f267b55ab
4d9befd0e0a320a6cd50452d0c52e0889d5e2e69
/geco-lib/src/com/MAVLink/common/msg_local_position_ned_system_global_offset.java
1c003ee963183c71ea2e72358c7b1a08101f2365
[]
no_license
SwitchMan92/Geco
716f246d5c6e32fb19eb06780ad0e8647d76e8bf
e030e1aaae9da51efdca32ab473c1f4d64a080e4
refs/heads/master
2020-04-12T08:16:42.975329
2016-10-12T16:32:58
2016-10-12T16:32:58
66,340,222
0
1
null
null
null
null
UTF-8
Java
false
false
3,754
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * java mavlink generator tool. It should not be modified by hand. */ // MESSAGE LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET PACKING package com.MAVLink.common; import com.MAVLink.Messages.MAVLinkMessage; import com.MAVLink.Messages.MAVLinkPayload; import MAVLink.MAVLinkPacket; /** * The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages of MAV X and the global coordinate frame in NED coordinates. Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) */ public class msg_local_position_ned_system_global_offset extends MAVLinkMessage{ public static final int MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET = 89; public static final int MAVLINK_MSG_LENGTH = 28; private static final long serialVersionUID = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; /** * Timestamp (milliseconds since system boot) */ public long time_boot_ms; /** * X Position */ public float x; /** * Y Position */ public float y; /** * Z Position */ public float z; /** * Roll */ public float roll; /** * Pitch */ public float pitch; /** * Yaw */ public float yaw; /** * Generates the payload for a mavlink message for a message of this type * @return */ public MAVLinkPacket pack(){ MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); packet.sysid = 255; packet.compid = 190; packet.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; packet.payload.putUnsignedInt(time_boot_ms); packet.payload.putFloat(x); packet.payload.putFloat(y); packet.payload.putFloat(z); packet.payload.putFloat(roll); packet.payload.putFloat(pitch); packet.payload.putFloat(yaw); return packet; } /** * Decode a local_position_ned_system_global_offset message into this class fields * * @param payload The message to decode */ public void unpack(MAVLinkPayload payload) { payload.resetIndex(); this.time_boot_ms = payload.getUnsignedInt(); this.x = payload.getFloat(); this.y = payload.getFloat(); this.z = payload.getFloat(); this.roll = payload.getFloat(); this.pitch = payload.getFloat(); this.yaw = payload.getFloat(); } /** * Constructor for a new message, just initializes the msgid */ public msg_local_position_ned_system_global_offset(){ msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; } /** * Constructor for a new message, initializes the message with the payload * from a mavlink packet * */ public msg_local_position_ned_system_global_offset(MAVLinkPacket mavLinkPacket){ this.sysid = mavLinkPacket.sysid; this.compid = mavLinkPacket.compid; this.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; unpack(mavLinkPacket.payload); } /** * Returns a string with the MSG name and data */ public String toString(){ return "MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET -"+" time_boot_ms:"+time_boot_ms+" x:"+x+" y:"+y+" z:"+z+" roll:"+roll+" pitch:"+pitch+" yaw:"+yaw+""; } }
[ "tom.langfeldt@sigfox.com" ]
tom.langfeldt@sigfox.com
a0eaaa3e33c50286383dd16d04809dc42b66488d
83987137adfc5197e73311d7978feab4ebae4cb8
/app/src/main/java/com/example/danishali/assignment03/myapplication/com/example/danishali/assignment03/myapplication/Mailer/SendMail.java
e110c1770eef06ad9e61101562610e88c5004e87
[]
no_license
DanishAli01/Medi_Assist
18f6fee753f57127d64403d4f182729f74e4c282
ce21e3b23577b71dfdaf679ed10515f0417ca591
refs/heads/master
2020-04-28T12:56:37.964717
2019-06-07T01:18:18
2019-06-07T01:18:18
175,292,132
0
0
null
null
null
null
UTF-8
Java
false
false
3,241
java
package com.example.danishali.assignment03.myapplication.com.example.danishali.assignment03.myapplication.Mailer; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; import android.widget.Toast; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SendMail extends AsyncTask<Void,Void,Void> { //Declaring Variables private Context context; private Session session; //Information to send email private String email; private String subject; private String message; //Progressdialog to show while sending email private ProgressDialog progressDialog; //Class Constructor public SendMail(Context context, String email, String subject, String message){ //Initializing variables this.context = context; this.email = email; this.subject = subject; this.message = message; } @Override protected void onPreExecute() { super.onPreExecute(); //Showing progress dialog while sending email progressDialog = ProgressDialog.show(context,"Sending message","Please wait...",false,false); } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); //Dismissing the progress dialog progressDialog.dismiss(); //Showing a success message Toast.makeText(context,"Message Sent",Toast.LENGTH_LONG).show(); } @Override protected Void doInBackground(Void... params) { //Creating properties Properties props = new Properties(); //Configuring properties for gmail //If you are not using gmail you may need to change the values props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); //Creating a new session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { //Authenticating the password protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(Config.EMAIL, Config.PASSWORD); } }); try { //Creating MimeMessage object MimeMessage mm = new MimeMessage(session); //Setting sender address mm.setFrom(new InternetAddress(Config.EMAIL)); //Adding receiver mm.addRecipient(Message.RecipientType.TO, new InternetAddress(email)); //Adding subject mm.setSubject(subject); //Adding message mm.setText(message); //Sending email Transport.send(mm); } catch (MessagingException e) { e.printStackTrace(); } return null; } }
[ "danishali2158@gmail.com" ]
danishali2158@gmail.com
fddc7503fcc1e359a4134a5c51b4f32cd95c7ae6
2b2cec304186df1b753704b9c7aab82f25d89565
/src/com/syntax/class17_1/AccessingMembersOfDifferentClass.java
d0b2a0f2c5977e729e43f6c15cb7be96aed2520d
[]
no_license
UmedKasymov/JavaBatch6
37b1cd2a28cf149adf16394b116af1cde85995e0
d90102cf3d4acabb009889e3606a83dd87332617
refs/heads/master
2021-04-03T14:44:47.810828
2020-04-29T00:31:00
2020-04-29T00:31:00
248,367,840
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package com.syntax.class17_1; import com.syntax.class17.Employee; public class AccessingMembersOfDifferentClass { public static void main(String[] args) { Employee emp=new Employee(); Employee.title="QA Engineer"; emp.name="Ahmet"; //below variables not available due to restrictions //emp.lastName="";-->protected(within the package) //emp.salary=;-->default(within the package) //emp.ssn--->private Employee.method1(); emp.method1(); //below variables not available due to restrictions //emp.method2();-->protected //emp.method3();-->default //emp.method4();--->private } }
[ "umedkasymov1@gmail.com" ]
umedkasymov1@gmail.com
03c7514957e13441ced2f391cc6c7c6becca8c38
b5e72abd04cdd5dd698ef10d8ccf952648a8fb61
/BaekJoon/src/com/ssafy/Main_2613_숫자구슬.java
f7afa6a568cc061a5aa6a4243fcb9613725e922f
[]
no_license
mkl0819/algorithm
c577bbfda152b2671138e37b9dbb71175095011e
e9f3e3837508a6d4e2b8b0488e76f04fcd394afa
refs/heads/master
2020-07-08T06:13:48.049967
2019-10-17T13:09:56
2019-10-17T13:09:56
203,589,338
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.ssafy; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main_2613_숫자구슬 { static int N, M, beads[]; static StringTokenizer st; public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(in.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); st = new StringTokenizer(in.readLine()); for(int i=0; i<N; i++) { } } }
[ "mkl0819@naver.com" ]
mkl0819@naver.com
b9498717cff6107eeb8db5282c5bfab74fecdb95
43baa190817c186dbc52540ecf0d90e10c63174f
/desktop/src/com/catinthedark/cw_inc/desktop/DesktopLauncher.java
fb1d5b305d6b99464726566582ec5a76be506b71
[]
no_license
NoviaDroid/cw-inc-ultra
6fffe49a1a05e993be2203031973ccc93521a5f8
9fd0951edffaab1a7a70204fa1e02f5045305a81
refs/heads/master
2020-04-01T23:29:16.544982
2014-12-05T08:54:53
2014-12-05T08:54:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.catinthedark.cw_inc.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.catinthedark.cw_inc.impl.CwInc; public class DesktopLauncher { public static void main(String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = 1024; config.height = 640; new LwjglApplication(new CwInc(), config); } }
[ "overln2@gmail.com" ]
overln2@gmail.com
70b0dc7680828c01a5c46d0fb661ce1edcc36d0c
5cf7cf211f5b82bc3c436f7b38443cf2a3699af7
/FluffyUnicorn/src/org/usfirst/frc3932/commands/DriveFast.java
4bfa72cae56d0905c4cff8e74e5172b528e83737
[]
no_license
dirty-mechanics-3932/2016Robot
29ff803fd96e00f558dc21d410e01f8295122522
a44a60f10f59dc131de03991fa56b1cf64a6d297
refs/heads/master
2020-04-06T21:52:55.290979
2016-10-21T15:05:24
2016-10-21T15:05:24
50,884,834
2
1
null
2016-10-21T15:05:24
2016-02-02T01:27:55
Java
UTF-8
Java
false
false
1,887
java
// RobotBuilder Version: 2.0 // // This file was generated by RobotBuilder. It contains sections of // code that are automatically generated and assigned by robotbuilder. // These sections will be updated in the future when you export to // Java from RobotBuilder. Do not put any code or make any change in // the blocks indicating autogenerated code or it will be lost on an // update. Deleting the comments indicating the section will prevent // it from being updated in the future. package org.usfirst.frc3932.commands; import edu.wpi.first.wpilibj.command.Command; import org.usfirst.frc3932.Robot; /** * */ public class DriveFast extends Command { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR public DriveFast() { // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES } // Called just before this Command runs the first time protected void initialize() { Robot.driveSystem.goFast(); } // Called repeatedly when this Command is scheduled to run protected void execute() { } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return true; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { } }
[ "myles.first@gmail.com" ]
myles.first@gmail.com
1fc89aea9865468f6dd386f2e63cd6782a7b01b3
aedb022e3f23a93cd48cedb58af0599132534f3d
/src/main/java/com/looveh/blog_web/dao/UserRolesMapper.java
f6a4484d8d1d0e45143edd73a322fe88184ec214
[]
no_license
MrRohwei/blog_web
456b53e3c57d6c538cdde8074d7bea070b5b0a72
ca6ceaa7f3a278a06b397ffd7f653336cc02146f
refs/heads/master
2022-07-01T12:11:22.268739
2019-06-19T07:51:29
2019-06-19T07:51:29
187,319,244
0
0
null
2022-06-17T02:12:15
2019-05-18T05:42:14
JavaScript
UTF-8
Java
false
false
387
java
package com.looveh.blog_web.dao; import com.looveh.blog_web.entity.UserRoles; public interface UserRolesMapper { int deleteByPrimaryKey(Integer id); int insert(UserRoles record); int insertSelective(UserRoles record); UserRoles selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(UserRoles record); int updateByPrimaryKey(UserRoles record); }
[ "96555635@qq.com" ]
96555635@qq.com
f209cc99ecd64d527258931232205566ee57e903
6d1f91a76d19ec12f3a1e2a31e246be1d78a4237
/src/Truxican/Tacos.java
1a4cfa2746a52d47bbfc81f3bbda1a77b23dc86a
[]
no_license
RichardF12/Parcial-2-POO
ba891309c7944b9df32fac4c2d11807d0370226b
36c248d40033771643110b6a810adfdca042099b
refs/heads/master
2020-03-19T08:18:04.360495
2018-06-15T02:28:09
2018-06-15T02:28:09
136,192,650
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Truxican; /** * * @author ricky */ public class Tacos implements Interfacer { private int price; private int life; private final int ATKUnit = 30; private final int ATKEdif = 20; public Tacos(){} public Tacos(int price, int life) { this.price = price; this.life = life; } @Override public void Attack() { } @Override public void Defend() { } /* @Override public void Abscond() { } */ }
[ "00168117@uca.edu.sv" ]
00168117@uca.edu.sv
e40ae105df41040d440e7794aa7bc6f164022deb
9a71efac4d1dbde9e574685c62a171adbddc7366
/eta-projetofinal-marcelle/src/test/java/system/pages/PickATimeDialog.java
41f410bd0de924a19882e3fd7ee4fdafc58d9aea
[ "MIT" ]
permissive
cellecamara/eta-teste-sistemas
a8651cbca376f9ea86c4a183535d650a60ae00e4
76b478a616aa18de30762a5ab1a6ed6fb03ccfe6
refs/heads/main
2023-04-07T14:49:04.215743
2021-04-11T14:53:16
2021-04-11T14:53:16
342,879,678
0
0
null
null
null
null
UTF-8
Java
false
false
1,629
java
package system.pages; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import system.helpers.DriverManager; public class PickATimeDialog { private WebDriver driver; private WebDriverWait wait; private By dialog = By.cssSelector("[role=dialog]"); private By scheduleButton = By.cssSelector("[role=dialog] > div:nth-child(3) > button:first-of-type"); private By timeSelect = By.cssSelector("[role=dialog] > div:nth-child(3) > div:nth-child(4) select"); public PickATimeDialog() { driver = DriverManager.getDriver(); wait = DriverManager.getDriverWait(); } public void setTime(String deliveryTime){ try { wait.until(ExpectedConditions.elementToBeClickable(timeSelect)); Select select = new Select(driver.findElement(timeSelect)); try { select.selectByVisibleText(deliveryTime); } catch (NoSuchElementException e){ //In case of a time not available to schedule, Keep going and click on Schedule button } clickSchedule(); } catch (Exception e) { } } public void clickSchedule(){ try { wait.until(ExpectedConditions.elementToBeClickable(scheduleButton)); driver.findElement(scheduleButton).click(); } catch (Exception e) { System.out.println(e); } } }
[ "marcellecamara@calada-015967.local" ]
marcellecamara@calada-015967.local
b192a041336ab037da90804bc9861e6e6a12a0a7
5882bf08511ee567d112047590106614cb90d8d4
/pickpack-operation-schema/src/main/java/com/mb/demo/beans/ticket/TicketTarget.java
b13e64715c0a5244e34ce2505ded34c1af5b89e7
[]
no_license
sohanKumawat/java-sample-project
c91ca805d9f35f85d2ba7568e79b65e9f75130fc
645e57116710919c25b9592cb53997f6dcc93f8c
refs/heads/master
2021-10-10T22:01:24.271795
2019-01-18T01:50:54
2019-01-18T01:50:54
46,863,763
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.mb.demo.beans.ticket; import java.io.Serializable; import com.mb.demo.beans.Attributes; import lombok.Data; @Data public class TicketTarget implements Serializable{ private static final long serialVersionUID = 3442398973572120303L; private String targetId; private Attributes attribute; }
[ "sohan.kumawat@milkbasket.com" ]
sohan.kumawat@milkbasket.com
6728fac4718679bc98e0ff7ba43ccbea22f37c04
454ec0cf6bd52bd53d3a7bc5cb750b3a9597e2b5
/src/main/java/in/keepgrowing/hibernatebasicscheatsheet/meal/model/Menu.java
6f81942475d3c84368cfa656885ee444418f662a
[ "Unlicense" ]
permissive
little-pinecone/hibernate-basics-cheatsheet
37d18125b5c35926da2726a3e021383abca44500
74dba2a63afb541f34a85ac1e5ce07156d3c7d77
refs/heads/master
2021-07-11T20:57:34.890801
2020-07-22T13:53:57
2020-07-22T13:53:57
169,281,953
1
1
null
null
null
null
UTF-8
Java
false
false
820
java
package in.keepgrowing.hibernatebasicscheatsheet.meal.model; import in.keepgrowing.hibernatebasicscheatsheet.category.Category; import javax.persistence.*; import java.time.LocalDate; import java.util.List; @Entity public class Menu { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private LocalDate start; private LocalDate end; @OneToMany @JoinColumn(name = "menu_id") private List<Category> categories; public Menu() { } public static Menu ofRange(LocalDate start, LocalDate end) { Menu menu = new Menu(); menu.start = start; menu.end = end; return menu; } @Override public String toString() { return "Menu{" + "categories=" + categories + '}'; } }
[ "marta.szymek.mail@gmail.com" ]
marta.szymek.mail@gmail.com
9e5e01da322b92cfc66f2bbe57992ce24981aa4f
60d5a6442d1a5d64ad42c16465188233d43a38d6
/src/webscraper/Constants.java
f3f627af741888053b3c4aa44d278c478cb24eba
[]
no_license
reillyisawesome/Webscraper
4879d792e1635471ed6141305be5d055289d0f15
d0d7bf717e5a8980f5d9581d4df2c38f0c111b28
refs/heads/master
2021-01-10T05:01:16.950915
2016-02-08T15:58:43
2016-02-08T15:58:43
51,307,814
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package webscraper; public class Constants { public static String BASE_URL = "http://services.runescape.com/m=itemdb_oldschool"; public static String API_URL = "/api/catalogue/detail.json?item="; }
[ "justinproductionz@gmail.com" ]
justinproductionz@gmail.com
fcb5425fd1a14b77cea11c6ff3072c5516e791c0
f3eeab728655f916528b974aa737d4a8bfca89b2
/src/main/java/com/okme/fam/repository/CustomAuditEventRepository.java
f065f59ff3c8a3728814a9c44bfcd9ec862ff796
[]
no_license
lovelylip/okmemongo
ecec1e453d99145f658bd2ab9e5837f0a1981b02
29a053971c6c194e55d5bc0f1c5471cb24361e59
refs/heads/master
2022-12-28T22:48:02.880530
2020-10-05T03:34:25
2020-10-05T03:34:25
300,492,540
0
0
null
null
null
null
UTF-8
Java
false
false
3,592
java
package com.okme.fam.repository; import com.okme.fam.config.Constants; import com.okme.fam.config.audit.AuditEventConverter; import com.okme.fam.domain.PersistentAuditEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.boot.actuate.audit.AuditEventRepository; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.time.Instant; import java.util.*; /** * An implementation of Spring Boot's {@link AuditEventRepository}. */ @Repository public class CustomAuditEventRepository implements AuditEventRepository { private static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE"; /** * Should be the same as in Liquibase migration. */ protected static final int EVENT_DATA_COLUMN_MAX_LENGTH = 255; private final PersistenceAuditEventRepository persistenceAuditEventRepository; private final AuditEventConverter auditEventConverter; private final Logger log = LoggerFactory.getLogger(getClass()); public CustomAuditEventRepository(PersistenceAuditEventRepository persistenceAuditEventRepository, AuditEventConverter auditEventConverter) { this.persistenceAuditEventRepository = persistenceAuditEventRepository; this.auditEventConverter = auditEventConverter; } @Override public List<AuditEvent> find(String principal, Instant after, String type) { Iterable<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findByPrincipalAndAuditEventDateAfterAndAuditEventType(principal, after, type); return auditEventConverter.convertToAuditEvent(persistentAuditEvents); } @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void add(AuditEvent event) { if (!AUTHORIZATION_FAILURE.equals(event.getType()) && !Constants.ANONYMOUS_USER.equals(event.getPrincipal())) { PersistentAuditEvent persistentAuditEvent = new PersistentAuditEvent(); persistentAuditEvent.setPrincipal(event.getPrincipal()); persistentAuditEvent.setAuditEventType(event.getType()); persistentAuditEvent.setAuditEventDate(event.getTimestamp()); Map<String, String> eventData = auditEventConverter.convertDataToStrings(event.getData()); persistentAuditEvent.setData(truncate(eventData)); persistenceAuditEventRepository.save(persistentAuditEvent); } } /** * Truncate event data that might exceed column length. */ private Map<String, String> truncate(Map<String, String> data) { Map<String, String> results = new HashMap<>(); if (data != null) { for (Map.Entry<String, String> entry : data.entrySet()) { String value = entry.getValue(); if (value != null) { int length = value.length(); if (length > EVENT_DATA_COLUMN_MAX_LENGTH) { value = value.substring(0, EVENT_DATA_COLUMN_MAX_LENGTH); log.warn("Event data for {} too long ({}) has been truncated to {}. Consider increasing column width.", entry.getKey(), length, EVENT_DATA_COLUMN_MAX_LENGTH); } } results.put(entry.getKey(), value); } } return results; } }
[ "manhpt0101@gmail.com" ]
manhpt0101@gmail.com
81bc3972bfebdb69b76f9cc88d3a95d02a9802e6
845dedadb0236ef1fe355febf9ebd4621235298a
/src/model/manager/ProduitManager.java
56db5e394aca4ab4ba5cea2e90cc442f86dd7b7f
[]
no_license
pado140/gestion
bd37cbc101cd6509fe03a29edcdec55a1332158d
50a24d65847938717f891f7eacd6b97105fc8586
refs/heads/master
2020-05-14T20:04:00.088896
2019-04-17T17:33:46
2019-04-17T17:33:46
181,939,149
1
0
null
null
null
null
UTF-8
Java
false
false
10,951
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model.manager; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import model.Categorie; import model.Commande; import model.CommandeLine; import model.Produits; import model.Stocks; import model.Suppliers; import model.image_produit; import services.ConnectionSql; /** * * @author Padovano */ public class ProduitManager extends ModelManager<Produits>{ public ProduitManager() { } public ProduitManager(ConnectionSql connection) { super(connection); } @Override public Produits ajouter(Produits objet) { boolean isSave=false; requete="insert into produits(Nom,code,Description,qty,prix_achat,prix_vente,barcode,tva,benefice) values(?,?,?,?,?,?,?,?,?)"; Object [] ob=new Object[]{objet.getNom(),objet.getCode(),objet.getDescription(),objet.getQtyProperty().get(), objet.getPrix_achat(),objet.getPrix_vente(),objet.getCodebar(), objet.getTva().get(),objet.getBenefice().get()}; if(this.connection.Update(requete,1, ob)){ int pro_id=this.connection.getLastinsert(); for(image_produit im:objet.getImageProuit()){ im.setProduit_id(pro_id); ManagerFactory.createModel(ModelName.image).ajouter(im); } String requete1="insert into categorie_produits values(?,?)"; for(Categorie cat:objet.getCategorieCollection()){ this.connection.Update(requete1, 1, pro_id,cat.getCatId()); } objet.setId(pro_id); }else objet=null; return objet; } @Override public boolean supprimer(Produits Objet) { requete= "delete from produits where pro_id=?"; return this.connection.Update(requete,0,Objet.getId()); } @Override public ObservableList<Produits> Dynamicrecherche(String objet) { ObservableList<Produits> deps=FXCollections.observableArrayList(); requete="select * from produits where dep_nom like ? or dep_code like ?"; ResultSet rs=this.connection.select(requete,new Object[]{"%"+objet+"%","%"+objet+"%"}); try { while(rs.next()){ } } catch (SQLException ex) { Logger.getLogger(ProduitManager.class.getName()).log(Level.SEVERE, null, ex); } return deps; } @Override public ObservableList<Produits> Dynamicsearch(Produits objet) { return null; } @Override public ObservableList<Produits> liste() { ObservableList<Produits> pros=FXCollections.observableArrayList(); requete="select * from produit"; ResultSet rs=this.connection.select(requete); try { while(rs.next()){ Produits p=new Produits(); p.setId(rs.getInt("pro_id")); p.setNom(rs.getString("nom")); p.setDescription(rs.getString("description")); p.setCode(rs.getString("code")); p.setCreated(rs.getDate("date_ajout_produit").toLocalDate()); p.setPrix_achat(rs.getDouble("prix_achat")); p.setPrix_vente(rs.getDouble("prix_vente")); p.setTva(rs.getDouble("tva")); p.setBenefice(rs.getDouble("benefice")); image_produit imp=new image_produit(); imp.setId(rs.getInt("id")); imp.setProduit(p); imp.setImagePath(rs.getString("image_path")); imp.setImage(rs.getBinaryStream("image")); Stocks s=new Stocks(); s.setQty(rs.getInt("qty")); s.setAlert_qty(rs.getInt("alert_qty")); s.setMinQty(rs.getInt("minqty")); s.setId(rs.getInt("idstock")); p.setStocks(s); p.setQty(rs.getInt("qty")); p.setCategorieCollection(Dynamicsearch(p.getId())); p.getImageProuit().add(imp); p.setCodebar(rs.getString("barcode")); p.setSupIdProperty((Suppliers)ManagerFactory.createModel(ModelName.supplier).searchById(rs.getInt("sup_id"))); pros.add(p); } } catch (SQLException ex) { Logger.getLogger(ProduitManager.class.getName()).log(Level.SEVERE, null, ex); } return pros; } @Override public Produits search(Produits objet) { requete="select * from produit where code=?"; ResultSet rs=this.connection.select(requete,objet.getCode()); try { while(rs.next()){ Produits p=new Produits(); p.setId(rs.getInt("pro_id")); p.setNom(rs.getString("nom")); p.setDescription(rs.getString("description")); p.setCode(rs.getString("code")); p.setCreated(rs.getDate("date_ajout_produit").toLocalDate()); p.setPrix_achat(rs.getDouble("prix_achat")); p.setPrix_vente(rs.getDouble("prix_vente")); p.setTva(rs.getDouble("tva")); p.setBenefice(rs.getDouble("benefice")); image_produit imp=new image_produit(); imp.setId(rs.getInt("id")); imp.setProduit(p); imp.setImagePath(rs.getString("image_path")); imp.setImage(rs.getBinaryStream("image")); Stocks s=new Stocks(); s.setQty(rs.getInt("qty")); s.setAlert_qty(rs.getInt("alert_qty")); s.setMinQty(rs.getInt("minqty")); s.setId(rs.getInt("idstock")); p.setStocks(s); p.setCategorieCollection(Dynamicsearch(p.getId())); p.getImageProuit().add(imp); p.setSupIdProperty((Suppliers)ManagerFactory.createModel(ModelName.supplier).searchById(rs.getInt("sup_id"))); p.setCodebar(rs.getString("barcode")); return p; } } catch (SQLException ex) { Logger.getLogger(ProduitManager.class.getName()).log(Level.SEVERE, null, ex); } return null; } @Override public Produits modifier(Produits ancien, Produits nouveau) { requete="update produits set nom=?,code=?,Description=?,prix_achat=?,prix_vente=?" + ",barcode=?,supplier_id=? where pro_id=?"; Object [] ob=new Object[]{nouveau.getNom(),nouveau.getCode(),nouveau.getDescription() ,nouveau.getPrix_achat(),nouveau.getPrix_vente(),nouveau.getCodebar(),nouveau.getSupId().getId(),ancien.getId()}; if(this.connection.Update(requete,0, ob)) return nouveau; return null; } @Override public Produits searchById(int id) { requete="select * from produit where pro_id=?"; ResultSet rs=this.connection.select(requete,id); try { while(rs.next()){ Produits p=new Produits(); p.setId(rs.getInt("pro_id")); p.setNom(rs.getString("nom")); p.setDescription(rs.getString("description")); p.setCode(rs.getString("code")); p.setCreated(rs.getDate("date_ajout_produit").toLocalDate()); image_produit imp=new image_produit(); imp.setId(rs.getInt("id")); imp.setProduit(p); imp.setImagePath(rs.getString("image_path")); imp.setImage(rs.getBinaryStream("image")); p.setAchatTransacCollection(((AchatLineManager)ManagerFactory.createModel(ModelName.line_achat)).search_by_produit(p)); p.setCommandeLineCollection(vente_Produit(p.getId())); p.setCategorieCollection(Dynamicsearch(p.getId())); p.getImageProuit().add(imp); p.setSupIdProperty((Suppliers)ManagerFactory.createModel(ModelName.supplier).searchById(rs.getInt("sup_id"))); return p; } } catch (SQLException ex) { Logger.getLogger(ProduitManager.class.getName()).log(Level.SEVERE, null, ex); return null; } return null; } @Override public Produits save(Produits objet) { if(objet.getId()==0) return ajouter(objet); else return modifier(objet, objet); } public ObservableList<Categorie> Dynamicsearch(int pro) { ObservableList<Categorie> categories=FXCollections.observableArrayList(); requete="select * from categorie inner join categorie_produits using(cat_id) where pro_id=?"; ResultSet rs=this.connection.select(requete,pro); try { while(rs.next()){ Categorie categorie=new Categorie(); categorie.setCatId(rs.getInt("cat_id")); categorie.setCategorie(rs.getString("categorie")); categories.add(categorie); } } catch (SQLException ex) { Logger.getLogger(CategorieManager.class.getName()).log(Level.SEVERE, null, ex); } return categories; } @Override protected void aftersave(Produits ob) { if(ob.getSupId()!=null){ modifier(ob, ob); } } public ObservableList<CommandeLine> vente_Produit(int pro_id){ requete="select * from commandelines where pro_id=?"; ObservableList<CommandeLine> liste=FXCollections.observableArrayList(); ResultSet rs=connection.select(requete,pro_id); try { while(rs.next()){ CommandeLine cl=new CommandeLine(); cl.setId(rs.getInt("cl_id")); cl.setPrix(rs.getDouble("prix")); cl.setQty(rs.getInt("qty")); Commande c=new Commande(); c.setId(rs.getInt("com_id")); c.setComCode(rs.getString("com_code")); c.setCreated(rs.getDate("created").toLocalDate()); cl.setComId(c); liste.add(cl); } } catch (SQLException ex) { Logger.getLogger(CommandeLineManager.class.getName()).log(Level.SEVERE, null, ex); } return liste; } }
[ "padovano.marcelin@agacorp.com" ]
padovano.marcelin@agacorp.com
c2d135fb54cd53414cf199e49ae2d37859431c11
e39046d6d65ea80c2e59f7832b597ef33985571c
/src/nfe/nfe-proxy/src/test/java/com/nordstrom/nfe/nlpmanagement/ServiceRegistrationGrpcServiceTest.java
a25f215a70afb8909fff02dc51b8ddb7c47ef6db
[ "Apache-2.0" ]
permissive
khappucino/global-traffic-management
40a70c2a0f220c5974321ba332228f98d023c7e4
81a80ae86c9119066c92df0727554cb5b61f9899
refs/heads/master
2022-03-04T03:09:49.369973
2022-02-24T03:19:36
2022-02-24T03:19:36
185,322,699
0
0
NOASSERTION
2019-05-07T04:48:11
2019-05-07T04:48:11
null
UTF-8
Java
false
false
5,727
java
/** * Copyright (C) 2018 Nordstrom, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.nordstrom.nfe.nlpmanagement; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import com.nordstrom.gtm.serviceregistration.CreateServiceRegistrationRequest; import com.nordstrom.gtm.serviceregistration.CreateServiceRegistrationResponse; import com.nordstrom.nfe.config.NfeConfig; import com.nordstrom.nfe.testhelpers.GrpcTestHelpers; import com.nordstrom.nfe.testhelpers.MockExternalCoreDataService; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigValueFactory; import com.xjeffrose.xio.grpc.GrpcRoute; import com.xjeffrose.xio.http.GrpcRequestHandler; import io.grpc.Status; import io.grpc.StatusException; import org.junit.After; import org.junit.Before; import org.junit.Test; public class ServiceRegistrationGrpcServiceTest { private ServiceRegistrationGrpcService subject; private ServiceRegistrationUpdatedWatcher serviceRegistrationUpdatedWatcher; private MockExternalCoreDataService coreDataService; private Config config; @Before public void beforeEach() { coreDataService = new MockExternalCoreDataService(); coreDataService.start(); config = ConfigFactory.load("reference.conf") .withValue("nfe.coreDatabase.host", ConfigValueFactory.fromAnyRef("127.0.0.1")) .withValue( "nfe.coreDatabase.port", ConfigValueFactory.fromAnyRef(coreDataService.getPort())); NfeConfig nfeConfig = new NfeConfig(config); serviceRegistrationUpdatedWatcher = mock(ServiceRegistrationUpdatedWatcher.class); subject = new ServiceRegistrationGrpcService( nfeConfig.coreDatabaseConfig(), serviceRegistrationUpdatedWatcher); } @After public void afterEach() { coreDataService.stop(); } @Test public void testRouteCount() { assertEquals(1, subject.getRoutes().size()); } @Test public void testPackageName() { assertEquals("nordstrom.gtm.serviceregistration", subject.getPackageName()); } @Test public void testServiceName() { assertEquals("ServiceRegistration", subject.getServiceName()); } @Test public void testCreateServiceRegistrationRoute_HappyPath() throws Exception { GrpcRoute route = GrpcTestHelpers.findRoute(subject.getRoutes(), "CreateServiceRegistration"); // should have correct method name and service assertEquals("CreateServiceRegistration", route.methodName); assertEquals(subject, route.service); // test handler String serviceName = "Awesome Service"; CreateServiceRegistrationRequest originalRequest = CreateServiceRegistrationRequest.newBuilder().setServiceName(serviceName).build(); CreateServiceRegistrationResponse expectedResponse = CreateServiceRegistrationResponse.newBuilder().build(); coreDataService.setCreateServiceRegistrationLogic( request -> { if (request.equals(originalRequest)) { return expectedResponse; } throw new StatusException(Status.INTERNAL); }); GrpcRequestHandler<CreateServiceRegistrationRequest, CreateServiceRegistrationResponse> handler = route.handler; CreateServiceRegistrationResponse response = handler.getAppLogic().apply(originalRequest); // should tell the ServiceRegistrationUpdatedWatcher that data was updated verify(serviceRegistrationUpdatedWatcher).postServiceRegistrationDataUpdated(); // should pass the gRPC response to the client assertEquals(expectedResponse, response); } @Test public void testCreateServiceRegistrationRoute_ErrorPath() throws Exception { GrpcRoute route = GrpcTestHelpers.findRoute(subject.getRoutes(), "CreateServiceRegistration"); // should have correct method name and service assertEquals("CreateServiceRegistration", route.methodName); assertEquals(subject, route.service); // test handler Status expectedStatus = Status.ABORTED.withDescription("I'm too tired.."); coreDataService.setCreateServiceRegistrationLogic( request -> { throw new StatusException(expectedStatus); }); GrpcRequestHandler<CreateServiceRegistrationRequest, CreateServiceRegistrationResponse> handler = route.handler; CreateServiceRegistrationRequest request = CreateServiceRegistrationRequest.newBuilder().build(); StatusException statusException = null; try { handler.getAppLogic().apply(request); } catch (StatusException e) { statusException = e; } // should NOT tell the ServiceRegistrationUpdatedWatcher that data was updated verify(serviceRegistrationUpdatedWatcher, never()).postServiceRegistrationDataUpdated(); // should pass the gRPC error through to the client assertNotNull(statusException); assertEquals(expectedStatus.getCode(), statusException.getStatus().getCode()); assertEquals(expectedStatus.getDescription(), statusException.getStatus().getDescription()); } }
[ "jon.richards@nordstrom.com" ]
jon.richards@nordstrom.com
72e2afee27e65c86a1f40c068b2316bbdd35d098
392e624ea2d6886bf8e37167ebbda0387e7e4a9a
/uxcrm-devtools/src/main/java/com/github/yuri0x7c1/uxcrm/devtools/service/ui/view/ServiceDetailView.java
2742d2f039a1138d492f22ba0dcf7dea7fa695e4
[ "Apache-2.0" ]
permissive
yuri0x7c1/uxcrm
11eee75f3a9cffaea4e97dedc8bc46d8d92bee58
1a0bf4649bee0a3a62e486a9d6de26f1d25d540f
refs/heads/master
2018-10-30T07:29:54.123270
2018-08-26T18:25:35
2018-08-26T18:25:35
104,251,350
0
0
null
null
null
null
UTF-8
Java
false
false
2,948
java
package com.github.yuri0x7c1.uxcrm.devtools.service.ui.view; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import org.apache.ofbiz.service.ModelParam; import org.apache.ofbiz.service.ModelService; import org.springframework.beans.factory.annotation.Autowired; import org.vaadin.spring.i18n.I18N; import org.vaadin.viritin.button.MButton; import com.github.yuri0x7c1.uxcrm.devtools.config.DevtoolsConfiguration.ModelOfbiz; import com.github.yuri0x7c1.uxcrm.devtools.service.util.ServiceUtil; import com.github.yuri0x7c1.uxcrm.common.navigation.util.NavigationUtil; import com.github.yuri0x7c1.uxcrm.common.ui.view.CommonView; import com.vaadin.icons.VaadinIcons; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.spring.annotation.SpringView; import com.vaadin.spring.annotation.UIScope; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Grid; import com.vaadin.ui.themes.ValoTheme; import lombok.extern.slf4j.Slf4j; @Slf4j @UIScope @SpringView(name = ServiceDetailView.NAME) public class ServiceDetailView extends CommonView implements View { private static final long serialVersionUID = 719002900696360148L; public static final String NAME = "service-detail"; @Autowired private I18N i18n; @Autowired private ModelOfbiz ofbizInstance; @Autowired private ServiceUtil serviceUtil; private Grid<ModelParam> parametersGrid; @PostConstruct public void init() { // back button addHeaderComponent( new MButton(VaadinIcons.ARROW_BACKWARD, i18n.get("Back"), (ClickListener) event -> NavigationUtil.back()) .withStyleName(ValoTheme.BUTTON_PRIMARY) ); // field grid parametersGrid = new Grid<>(); parametersGrid.setWidth("100%"); parametersGrid.setCaption(i18n.get("Parameters")); parametersGrid.addColumn(ModelParam::getName).setCaption(i18n.get("Parameter.name")); parametersGrid.addColumn(ModelParam::isOptional).setCaption(i18n.get("Parameter.optional")); parametersGrid.addColumn(ModelParam::getType).setCaption(i18n.get("Parameter.type")); parametersGrid.addColumn(ModelParam::getMode).setCaption(i18n.get("Parameter.mode")); parametersGrid.addColumn(ModelParam::getEntityName).setCaption(i18n.get("Parameter.entityName")); addComponent(parametersGrid); } @Override public void enter(ViewChangeEvent event) { // validate params if (event.getParameters() == null || event.getParameters().isEmpty()) { log.error("Parameters is empty"); NavigationUtil.back(); } String serviceName = event.getParameters(); ModelService service = ofbizInstance.getServices().get(serviceName); // TODO: move to separate method List<ModelParam> serviceParams = new ArrayList<>(); for (String paramName : service.getAllParamNames()) { serviceParams.add(service.getParam(paramName)); } parametersGrid.setItems(serviceParams); setHeaderText(serviceName); } }
[ "yuri0x7c1@gmail.com" ]
yuri0x7c1@gmail.com
81bc98a11820060e4c455bd56ee2c1f0cc2465d6
4245d3b867adc949e4554f26d58ab84718628b37
/gmall-order/src/main/java/com/atguigu/gmall/order/pojo/UserInfo.java
4b23f057b86eb207c27431a027b174b5f3ecb1c8
[ "Apache-2.0" ]
permissive
pandaJian/gmall-0821
44704615784de2fe34ef95779ed4e51b1e808cf6
57b9c1de93588308ce40f81ad6985767686b5e55
refs/heads/main
2023-03-10T19:06:32.554060
2021-02-28T16:04:05
2021-02-28T16:04:05
330,564,732
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.atguigu.gmall.order.pojo; import lombok.Data; /** * @author : panda Jian * @date : 2021-02-23 18:35 * Description */ @Data public class UserInfo { private Long userId; private String userKey; }
[ "1014668770@qq.com" ]
1014668770@qq.com
c1ef0c134fc6bdecff5cd64f64a648b96044197d
1469efaed22804381ff1361380954114dd4ecc74
/spark-jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/write/create/mysql/MysqlHiveCreateBooleanJdbc.java
d96fdb4b1b45744c05b5b29b801763543a9089ef
[]
no_license
zhangqi3910/spark
1700a1028fcbfb55955ef1b4970c47cf75cfec44
53cfda04d441bc20c4f53541b162d5a11744d610
refs/heads/master
2020-04-14T16:02:10.140444
2019-01-03T08:15:08
2019-01-03T08:15:08
163,942,285
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package org.apache.hive.storage.jdbc.write.create.mysql; import org.apache.hive.storage.jdbc.write.create.IHiveCreateChangeJdbcType; public class MysqlHiveCreateBooleanJdbc implements IHiveCreateChangeJdbcType { @Override public String hiveTypeChangeJdbcType(String hiveType) { return "BOOLEAN"; } }
[ "2456010290@qq.com" ]
2456010290@qq.com
f06a3da191d36bbc7d89e460bb1aa0af5d0058dd
c92e4f33ce425077c430c7a1e6ec24b0323ea63c
/src/CheckCycle.java
bc18c3953bb0b7e39708ff7837ec1156f92686c1
[]
no_license
gajjalabhanukrishna/Algorithms
7313f2ebcfaa45cb1f5aae5a950791d59b0814c6
52027c4de91a05d85811a4c45fc4d849541ed857
refs/heads/master
2022-07-18T21:16:39.711053
2020-05-14T07:38:40
2020-05-14T07:38:40
263,846,530
0
0
null
null
null
null
UTF-8
Java
false
false
1,954
java
public class CheckCycle { public static boolean detectCycle(Graph g){ int num_of_vertices = g.vertices; //Boolean Array to hold the history of visited nodes (by default-false) boolean[] visited = new boolean [num_of_vertices]; //Holds a flag if the node is currently in Stack or not (by default- false) boolean[] stackFlag = new boolean[num_of_vertices]; for (int i = 0; i < num_of_vertices; i++){ //Check cyclic on each node if (cyclic(g, i, visited, stackFlag)){ return true; } } return false; } public static boolean cyclic(Graph g, int v, boolean[] visited, boolean[] stackFlag){ //if node is currently in stack that means we have found a cycle if (stackFlag[v]) return true; //if it is already visited (and not in Stack) then there is no cycle if (visited[v]) return false; visited[v] = true; stackFlag[v] = true; // check adjacency list of the node DoublyLinkedList<Integer>.Node temp = null; if (g.adjacencyList[v] != null) temp = g.adjacencyList[v].headNode; while (temp != null) { //run cyclic function recursively on each outgowing path if(cyclic(g, temp.data, visited, stackFlag)){ return true; } temp = temp.nextNode; } stackFlag[v] = false; return false; } public static void main(String args[]) { Graph g1 = new Graph(4); g1.addEdge(0,1); g1.addEdge(1,2); g1.addEdge(1,3); g1.addEdge(3,0); g1.printGraph(); System.out.println(detectCycle(g1)); System.out.println(); Graph g2 = new Graph(3); g2.addEdge(0,1); g2.addEdge(1,2); g2.printGraph(); System.out.println(detectCycle(g2)); } }
[ "bhanukrishna.gajjala@logmein.com" ]
bhanukrishna.gajjala@logmein.com
007c923701cb446951c69bc624aaf95eedfaec1b
9db714044fa42f2c3bb9c57e7b11a8e1e7e6f435
/bishe/E4A/workspace/2019572195/build/com/newapp/R.java
60b27e3c0d059f025f3604d0a6a887464abe34ca
[]
no_license
refinement/VR
5146b5b42b1e6d5f9b52385ed9746d1f76b1eb46
d625da80edbd1c6188305a4ffc2c160eaaf55f2c
refs/heads/master
2022-02-20T12:43:36.539144
2019-08-24T03:31:37
2019-08-24T03:31:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
917
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.newapp; public final class R { public static final class attr { } public static final class drawable { public static final int e4alistview_new_message=0x7f020000; public static final int icon=0x7f020001; } public static final class string { public static final int app_name=0x7f030000; } public static final class style { public static final int BlackBaseTheme=0x7f040001; public static final int BlackTheme=0x7f040003; public static final int ClassicTheme=0x7f040004; public static final int StartTheme=0x7f040005; public static final int WhiteBaseTheme=0x7f040000; public static final int WhiteTheme=0x7f040002; } }
[ "506870155@qq.com" ]
506870155@qq.com
ffd810a665f2adee0390d444fdc13532f5b814e4
8de5ffae2684a0f777966819cbfc1e17390817ed
/Drawisor/src/com/tripadvisor/drawisor/entities/Point.java
a66287aa2d6b9b585789d0168ba8e1954a7c3c8e
[]
no_license
Sjith/drawisor
f20c3f31a650fa42ab4d613a42f76954c58c3f5a
2c13d0c75e42ecada1233ff904d3b8a7e0e04be5
refs/heads/master
2016-09-05T18:10:34.832572
2013-02-23T07:16:10
2013-02-23T07:16:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package com.tripadvisor.drawisor.entities; import com.activeandroid.Model; import com.activeandroid.annotation.Column; import com.activeandroid.annotation.Column.ForeignKeyAction; import com.activeandroid.annotation.Table; @Table(name = "Points") public class Point extends Model { @Column(name = "Path", onDelete = ForeignKeyAction.CASCADE) public Path path; @Column(name = "X") public int x; @Column(name = "Y") public int y; public Point() { super(); } public Point(int x, int y) { super(); this.x = x; this.y = y; } }
[ "gaspard01@gmail.com" ]
gaspard01@gmail.com
dfdebb66e05e2f22987c8b6fad467597b91bdea4
d668ddee644f8f0ef60a0baa7bbfdf5572b8c58f
/src/main/java/me/ham/estimate/entity/EstimateTry.java
3a951dd799e08e135b4f41728fbb38d3246ded78
[]
no_license
hhs9102/JPA-DEMO
01f2480e2b9ad5aeff36b6cf847e4d867ead54d1
13bc7a47d9b72ca6c63098db853e080a37c199ce
refs/heads/master
2022-05-09T22:22:54.516462
2020-07-08T15:28:42
2020-07-08T15:28:42
216,586,744
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package me.ham.estimate.entity; import lombok.Setter; import javax.persistence.*; @Entity(name = "estimate_try") @Setter public class EstimateTry { @Id @GeneratedValue @Column(name = "estimate_try_id") private Integer estimateTryId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "estimate_id") private Estimate estimate; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "dealer_id") private Dealer dealer; @Column(name = "price") private Integer price; }
[ "hhs9102@naver.com" ]
hhs9102@naver.com
2c8433654dc56c998361c33121f2391929e27373
9c4781f1757bda34c5223cb70111888467b98374
/lego-ros-android/src/elmot/ros/android/NXTBluetoothNodeService.java
71632e9345da8c928c45f7c0d923f536f9112e6a
[]
no_license
elmot/ev3javabrick
ab323919ec18b6d76b7412dffcf9acb2ba1e1f14
cdab77270336a26abf2176cb80696cf273141da9
refs/heads/master
2022-06-17T00:10:20.741682
2022-05-27T14:47:29
2022-05-27T14:47:29
44,567,892
4
1
null
2022-05-27T14:47:30
2015-10-19T22:30:44
Java
UTF-8
Java
false
false
3,088
java
package elmot.ros.android; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.content.Intent; import android.os.IBinder; import elmot.javabrick.nxt.android.NXTBluetoothAndroid; import elmot.ros.nxt.NXTNode; import org.ros.namespace.GraphName; import org.ros.node.DefaultNodeMainExecutor; import org.ros.node.NodeConfiguration; import org.ros.node.NodeMainExecutor; /** * @author elmot * Date: 13.08.14 */ public class NXTBluetoothNodeService extends Service { private NXTNode nxtNode; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); String bluetoothAddress = Settings.bluetoothAddress(this); if (bluetoothAddress == null) { Notification notification = newNotification(R.string.no_bt_device_title, R.string.no_bt_device_msg); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(0, notification); stopSelf(); return START_NOT_STICKY; } BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bluetoothAddress); if (device.getBondState() != BluetoothDevice.BOND_BONDED) { newNotification(R.string.no_bt_not_bonded_title, R.string.no_bt_not_bonded_msg); stopSelf(); return START_NOT_STICKY; } Notification notification = newNotification(R.string.nxt_service_event_title, R.string.click_to_stop); startForeground(R.drawable.ic_nxt_logo, notification); nxtNode = new NXTNode(new NXTBluetoothAndroid(device), Settings.NODE_NAME.join("nxt"), GraphName.of(Settings.namespace(this)), Settings.SAMPLING_LOOP_MS); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(Settings.ownIpAddress(NXTBluetoothNodeService.this)); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(nxtNode, nodeConfiguration); return START_NOT_STICKY; } private Notification newNotification(int eventTitleId, int contentId) { Notification.Builder notification = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_nxt_logo) .setTicker(getString(R.string.nxt_derice_notification_ticker)) .setWhen(System.currentTimeMillis()) .setContentTitle(getString(eventTitleId)); if (contentId > 0) notification.setContentText(getString(contentId)); return notification.build(); } @Override public void onDestroy() { if (nxtNode != null) nxtNode.shutdown(); } }
[ "elijah.mot@gmail.com" ]
elijah.mot@gmail.com
400c8a39168da8aeedae005db3ab2c3b36c8c22a
b34fee23fde0636fd930d3450f7ee5e0ae1b5a84
/liquigraph-connection/src/main/java/org/liquigraph/connector/connection/NodeAdaptor.java
5ee1041ff22c2d69ea03301b2274f69a3d5bf424
[ "Apache-2.0" ]
permissive
pointwisefixed/liquigraph
300c387310419401eca5c7e99717cad255f96eef
bcab18558f3b74a5a7616971979cc2b443d4add0
refs/heads/master
2020-12-25T22:30:17.860584
2016-06-13T15:09:05
2016-06-13T15:09:05
55,528,833
0
0
null
2016-04-05T17:39:48
2016-04-05T17:39:48
null
UTF-8
Java
false
false
1,507
java
package org.liquigraph.connector.connection; import org.neo4j.driver.v1.Value; import org.neo4j.driver.v1.Values; import org.neo4j.graphdb.DynamicLabel; import org.neo4j.graphdb.Label; import org.neo4j.graphdb.Node; import java.util.ArrayList; import java.util.List; import java.util.Map; public class NodeAdaptor { private Node graphDbNode; private Value boltNode; private Map mapNode; public NodeAdaptor(Node graphNode) { this.graphDbNode = graphNode; } public NodeAdaptor(Value nd) { this.boltNode = nd; } public long id() { return graphDbNode != null ? graphDbNode.getId() : boltNode.asNode().id(); } public Value get(String key) { return graphDbNode != null ? Values.value(graphDbNode.getProperty(key)) : boltNode.get(key); } public long getId() { return graphDbNode != null ? graphDbNode.getId() : boltNode.asNode().id(); } public Iterable<Label> getLabels() { if (graphDbNode != null) return graphDbNode.getLabels(); List<Label> lbls = new ArrayList<>(); Iterable<String> labels = boltNode.asNode().labels(); for (String lb : labels) { lbls.add(DynamicLabel.label(lb)); } return lbls; } public String getPropertyAsString(String checksum) { return graphDbNode != null ? graphDbNode.getProperty(checksum).toString() : boltNode.get(checksum).asString().replaceAll("\"", ""); } }
[ "gary.rosales@walmart.com" ]
gary.rosales@walmart.com
5e9989832a6623df970a5e0a61cb468911bc761b
68902abf0dc9f68e712191ce1a2f134da9a35728
/src/com/heaven/ServerHandler.java
341ec3d04cbf488cfce10b6c20076a6f33606617
[]
no_license
Heavenzhao/HeavenChart
7e0654355d30ae47bb25a552b61e7cadd6a735d2
da6f512b32c8e45f4d733e44ed47a1abd5b4abcf
refs/heads/master
2020-04-04T11:18:21.758777
2018-11-02T16:27:19
2018-11-02T16:27:34
155,886,092
0
0
null
null
null
null
UTF-8
Java
false
false
1,540
java
/** * 客户端消息处理线程 */ package com.heaven; import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class ServerHandler implements Runnable { private Socket socket; BufferedReader in = null; public ServerHandler(Socket socket) throws IOException{ this.socket = socket; in = new BufferedReader(new InputStreamReader(socket.getInputStream())); } @Override public void run() { BufferedReader in = null; PrintWriter out = null; try { String msg; while (true) { if ((msg = readFromClient()) == null) break; System.out.println(("服务端收到信息:" + msg)); for(Socket s:ChartServer.clientList) { if(s != this.socket){ out = new PrintWriter(s.getOutputStream(), true); out.println(msg); } } } } catch (Exception e) { e.printStackTrace(); }finally { if(out != null){ out.close(); } } } private String readFromClient() { try { return in.readLine(); }catch (IOException e) { ChartServer.clientList.remove(socket); e.printStackTrace(); } return null; } }
[ "zhaowuyi2008@163.com" ]
zhaowuyi2008@163.com
2fa15724565d7472d87195f3ed33ffdb865c4f41
c160cbcc6c63f50fd81d3f68b4f74f0ec573491e
/src/main/java/dmz/fleetapp/repositories/SupplierRepository.java
a11aa7466aedb015e004920d805ccb4676de5671
[]
no_license
dima-ian/fleetapp
cb6d0520678466994b20f2c33c03abaf3a88abba
fda923a8eb51927ba10b08f864529673b446e857
refs/heads/master
2022-08-20T18:46:31.751940
2020-05-27T12:10:32
2020-05-27T12:10:32
262,136,272
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package dmz.fleetapp.repositories; import dmz.fleetapp.models.Supplier; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface SupplierRepository extends JpaRepository<Supplier, Integer> { }
[ "ltr.tsts@mail.ru" ]
ltr.tsts@mail.ru
1151954041a24e9efed077e6e07e99aacd8321e0
82baebcb300434d4f7139eb39cdc083dadacab99
/library/src/com/db/chart/view/LineChartView.java
6b5c08cb6c9fb3fec4c317cb77e9a18c928b20ec
[]
no_license
Vingtoft/epital
329c431100889e7a62cd95a0b17859b19c24d1e3
ab73832ce6a1e2794f1084cf88b8d753ee10cab2
refs/heads/master
2021-05-03T14:01:47.390622
2014-12-16T22:53:51
2014-12-16T22:53:51
24,475,295
1
0
null
null
null
null
UTF-8
Java
false
false
11,161
java
/* * Copyright 2014 Diogo Bernardino * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.db.chart.view; import java.util.ArrayList; import com.db.williamchart.R; import com.db.chart.model.ChartEntry; import com.db.chart.model.ChartSet; import com.db.chart.model.LineSet; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.DashPathEffect; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Region; import android.util.AttributeSet; import android.graphics.Shader; /** * Implements a line chart extending {@link ChartView} */ public class LineChartView extends ChartView { /** Radius clickable region */ private static float sRegionRadius; /** Style applied to line chart */ private Style mStyle; public LineChartView(Context context, AttributeSet attrs) { super(context, attrs); mStyle = new Style(context.getTheme() .obtainStyledAttributes(attrs, R.styleable.ChartAttrs, 0, 0)); sRegionRadius = (float) getResources() .getDimension(R.dimen.dot_region_radius); } public LineChartView(Context context) { super(context); mStyle = new Style(); } @Override public void onAttachedToWindow(){ super.onAttachedToWindow(); mStyle.init(); } @Override public void onDetachedFromWindow(){ super.onDetachedFromWindow(); mStyle.clean(); } /** * Method responsible to draw a line with the parsed screen points. * @param canvas * The canvas to draw on. * @param screenPoints * The parsed screen points ready to be used/drawn. */ @Override public void onDrawChart(Canvas canvas, ArrayList<ChartSet> data) { LineSet lineSet; for(int i = 0; i < data.size(); i++){ lineSet = (LineSet) data.get(i); mStyle.mLinePaint.setColor(lineSet.getLineColor()); mStyle.mLinePaint.setStrokeWidth(lineSet.getLineThickness()); handleAlpha(mStyle.mLinePaint, lineSet.getAlpha()); if(lineSet.isDashed()) mStyle.mLinePaint .setPathEffect(new DashPathEffect(new float[] {10,10}, 0)); else mStyle.mLinePaint.setPathEffect(null); //Draw line if (!lineSet.isSmooth()) drawLine(canvas, lineSet); else drawSmoothLine(canvas, lineSet); //Draw points if(lineSet.hasDots()) drawPoints(canvas, lineSet); } } /** * Responsible for drawing points */ private void drawPoints(Canvas canvas, LineSet set) { mStyle.mDotsPaint.setColor(set.getDotsColor()); mStyle.mDotsPaint.setAlpha((set.getAlpha() < 1) ? (int)(set.getAlpha() * 255) : 255); handleAlpha(mStyle.mDotsPaint, set.getAlpha()); mStyle.mDotsStrokePaint.setStrokeWidth(set.getDotsStrokeThickness()); mStyle.mDotsStrokePaint.setColor(set.getDotsStrokeColor()); handleAlpha(mStyle.mDotsStrokePaint, set.getAlpha()); final Path path = new Path(); for(ChartEntry e : set.getEntries()) path.addCircle(e.getX(), e.getY(), set.getDotsRadius(), Path.Direction.CW); //Draw dots fill canvas.drawPath(path, mStyle.mDotsPaint); //Draw dots stroke if(set.hasDotsStroke()) canvas.drawPath(path, mStyle.mDotsStrokePaint); } /** * Responsible for drawing a (non smooth) line */ public void drawLine(Canvas canvas, LineSet set) { float minY = this.getInnerChartBottom(); final Path path = new Path(); final Path bgPath = new Path(); for (int i = 0; i < set.size(); i++) { // Get minimum display Y to optimize gradient if(set.getEntry(i).getY() < minY) minY = set.getEntry(i).getY(); if (i == 0){ //Defining outline path.moveTo(set.getEntry(i).getX(), set.getEntry(i).getY()); //Defining background bgPath.moveTo(set.getEntry(i).getX(), set.getEntry(i).getY()); }else{ //Defining outline path.lineTo(set.getEntry(i).getX(), set.getEntry(i).getY()); //Defining background bgPath.lineTo(set.getEntry(i).getX(), set.getEntry(i).getY()); } } //Draw background if(set.hasFill() || set.hasGradientFill()) drawBackground(canvas, bgPath, set, minY); //Draw line canvas.drawPath(path, mStyle.mLinePaint); } /** * Credits: http://www.jayway.com/author/andersericsson/ * Method responsible to draw a smooth line with the parsed screen points. */ private void drawSmoothLine(Canvas canvas, LineSet set) { float minY = this.getInnerChartBottom(); float thisPointX; float thisPointY; float nextPointX; float nextPointY; float startdiffX; float startdiffY; float endDiffX; float endDiffY; float firstControlX; float firstControlY; float secondControlX; float secondControlY; final Path path = new Path(); path.moveTo(set.getEntry(0).getX(),set.getEntry(0).getY()); final Path bgPath= new Path(); bgPath.moveTo(set.getEntry(0).getX(), set.getEntry(0).getY()); for (int i = 0; i < set.size() - 1; i++) { // Get minimum display Y to optimize gradient if(set.getEntry(i).getY() < minY) minY = set.getEntry(i).getY(); thisPointX = set.getEntry(i).getX(); thisPointY = set.getEntry(i).getY(); nextPointX = set.getEntry(i+1).getX(); nextPointY = set.getEntry(i+1).getY(); startdiffX = (nextPointX - set.getEntry( si(set.size(), i - 1)).getX()); startdiffY = (nextPointY - set.getEntry( si(set.size(), i - 1)).getY()); endDiffX = (set.getEntry(si(set.size(), i + 2)).getX() - thisPointX); endDiffY = (set.getEntry(si(set.size(), i + 2)).getY() - thisPointY); firstControlX = thisPointX + (0.15f * startdiffX); firstControlY = thisPointY + (0.15f * startdiffY); secondControlX = nextPointX - (0.15f * endDiffX); secondControlY = nextPointY - (0.15f * endDiffY); //Define outline path.cubicTo(firstControlX, firstControlY, secondControlX, secondControlY, nextPointX, nextPointY); //Define background bgPath.cubicTo(firstControlX, firstControlY, secondControlX, secondControlY, nextPointX, nextPointY); } //Draw background if(set.hasFill() || set.hasGradientFill()) drawBackground(canvas, bgPath, set, minY); //Draw outline canvas.drawPath(path, mStyle.mLinePaint); } /** * Responsible for drawing line background */ private void drawBackground(Canvas canvas, Path path, LineSet set, float minDisplayY){ mStyle.mFillPaint.setAlpha((int)(set.getAlpha() * 255)); if(set.hasFill()) mStyle.mFillPaint.setColor(set.getFillColor()); if(set.hasGradientFill()) mStyle.mFillPaint.setShader( new LinearGradient( super.getInnerChartLeft(), minDisplayY, super.getInnerChartLeft(), super.getInnerChartBottom(), set.getGradientColors(), set.getGradientPositions(), Shader.TileMode.MIRROR)); path.lineTo(set.getEntry(set.size()-1).getX(), this.getInnerChartBottom()); path.lineTo(set.getEntry(0).getX(), this.getInnerChartBottom()); path.close(); canvas.drawPath(path, mStyle.mFillPaint); } @Override public ArrayList<ArrayList<Region>> defineRegions(ArrayList<ChartSet> data){ final ArrayList<ArrayList<Region>> result = new ArrayList<ArrayList<Region>>(); ArrayList<Region> regionSet; for(ChartSet set : data){ regionSet = new ArrayList<Region>(set.size()); for(ChartEntry e : set.getEntries()) regionSet.add(new Region((int)(e.getX() - sRegionRadius), (int)(e.getY() - sRegionRadius), (int)(e.getX() + sRegionRadius), (int)(e.getY() + sRegionRadius))); result.add(regionSet); } return result; } private void handleAlpha(Paint paint, float alpha){ paint.setAlpha((int)(alpha * 255)); paint.setShadowLayer( mStyle.mShadowRadius, mStyle.mShadowDx, mStyle.mShadowDy, Color.argb(((int)(alpha * 255) < mStyle.mAlpha) ? (int)(alpha * 255) : mStyle.mAlpha, mStyle.mRed, mStyle.mGreen, mStyle.mBlue)); } /** * Credits: http://www.jayway.com/author/andersericsson/ * Given an index in points, it will make sure the the returned index is * within the array. */ private static int si(int setSize, int i) { if (i > setSize - 1) return setSize - 1; else if (i < 0) return 0; return i; } /** * Class responsible to style the LineChart! * Can be instantiated with or without attributes. */ class Style { /** Paint variables */ private Paint mDotsPaint; private Paint mDotsStrokePaint; private Paint mLinePaint; private Paint mFillPaint; /** Shadow variables */ private final int mShadowColor; private final float mShadowRadius; private final float mShadowDx; private final float mShadowDy; /** Shadow color */ private int mAlpha; private int mRed; private int mBlue; private int mGreen; protected Style() { mShadowRadius = 0; mShadowDx = 0; mShadowDy = 0; mShadowColor = 0; } protected Style(TypedArray attrs) { mShadowRadius = attrs.getDimension( R.styleable.ChartAttrs_chart_shadowRadius, 0); mShadowDx = attrs.getDimension( R.styleable.ChartAttrs_chart_shadowDx, 0); mShadowDy = attrs.getDimension( R.styleable.ChartAttrs_chart_shadowDy, 0); mShadowColor = attrs.getColor( R.styleable.ChartAttrs_chart_shadowColor, 0); } private void init(){ mAlpha = Color.alpha(mShadowColor); mRed = Color.red(mShadowColor); mBlue = Color.blue(mShadowColor); mGreen = Color.green(mShadowColor); mDotsPaint = new Paint(); mDotsPaint.setStyle(Paint.Style.FILL_AND_STROKE); mDotsPaint.setAntiAlias(true); mDotsStrokePaint = new Paint(); mDotsStrokePaint.setStyle(Paint.Style.STROKE); mDotsStrokePaint.setAntiAlias(true); mLinePaint = new Paint(); mLinePaint.setStyle(Paint.Style.STROKE); mLinePaint.setAntiAlias(true); mFillPaint = new Paint(); mFillPaint.setStyle(Paint.Style.FILL); } private void clean(){ mLinePaint = null; mFillPaint = null; mDotsPaint = null; } } }
[ "vingtoftoscar@gmail.com" ]
vingtoftoscar@gmail.com
d5e5cb033d885929525694ff0456dda7d868f55a
c2fb6846d5b932928854cfd194d95c79c723f04c
/java_backup/my java/codmw3/file.java
5c53d913011076f653570fd9dd6a16a3da6715fa
[ "MIT" ]
permissive
Jimut123/code-backup
ef90ccec9fb6483bb6dae0aa6a1f1cc2b8802d59
8d4c16b9e960d352a7775786ea60290b29b30143
refs/heads/master
2022-12-07T04:10:59.604922
2021-04-28T10:22:19
2021-04-28T10:22:19
156,666,404
9
5
MIT
2022-12-02T20:27:22
2018-11-08T07:22:48
Jupyter Notebook
UTF-8
Java
false
false
652
java
import java.util.*; import java.io.*; public class file { void main()throws IOException { Scanner sc=new Scanner(System.in); int a,b; FileOutputStream fs=new FileOutputStream("data.txt"); System.out.println("Enter limit"); a=sc.nextInt(); for(b=0;b<a;b++) { System.out.println("Enter data"); fs.write(sc.nextInt()); } fs.close(); FileInputStream fs1=new FileInputStream("data.txt"); int k; for(b=0;b<a;b++) { System.out.println(k=(int)fs1.read()); } } }
[ "jimutbahanpal@yahoo.com" ]
jimutbahanpal@yahoo.com
09132235bb68c3b640521f4f124cb06b22ce42aa
3a5b7466b04f5c55d79e872de6fbff19ae6ec7ca
/src/mvc/Controller.java
ed252c162517f7215398521753c2140b7b9426f3
[]
no_license
martip23/MVC-Simple-Calculator
18b6f8cdea4621f6ab39a7599142c84738837848
882213dd4affeff37acde17c0f9f4185c537e413
refs/heads/master
2021-05-15T20:04:42.020433
2017-11-26T03:09:02
2017-11-26T03:09:02
107,832,624
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package mvc; /** * The Controller interface is the interface which must be implemented by * all classes which wish to take the role of a Controller. * All controllers must be able to reference a model and a view object. * <p> * The primary role of a Controller within the MVC is to determine what * should happen in response to user input. * @author martip23 * */ public interface Controller { void setModel(Model model); Model getModel(); View getView(); void setView(View view); }
[ "patrickmartinez77@gmail.com" ]
patrickmartinez77@gmail.com
e237b212aa9301a52bf7747fdfa3694d7e15d73e
c91d418f5effd04ebe0ecb08f4119044312c997e
/app/src/main/java/com/example/ashley/gamestate/game/GameComputerPlayer.java
e979d5b189f58e0af51feaeb8afc5638e8c9b2ff
[]
no_license
kima21/presentation
29007a8b16d5164c7130b530355c472bb671ee73
b32bfe012185a38c548fefae2f76c1be5767edf2
refs/heads/master
2020-04-03T14:18:16.016360
2018-10-26T06:23:14
2018-10-26T06:23:14
155,317,233
0
0
null
null
null
null
UTF-8
Java
false
false
8,670
java
package com.example.ashley.gamestate.game; import android.os.Handler; import android.os.Looper; import com.example.ashley.gamestate.game.util.Tickable; import com.example.ashley.gamestate.game.actionMsg.GameOverAckAction; import com.example.ashley.gamestate.game.actionMsg.MyNameIsAction; import com.example.ashley.gamestate.game.actionMsg.ReadyAction; import com.example.ashley.gamestate.game.infoMsg.BindGameInfo; import com.example.ashley.gamestate.game.infoMsg.GameInfo; import com.example.ashley.gamestate.game.infoMsg.GameOverInfo; import com.example.ashley.gamestate.game.infoMsg.StartGameInfo; import com.example.ashley.gamestate.game.infoMsg.TimerInfo; import com.example.ashley.gamestate.game.util.GameTimer; import com.example.ashley.gamestate.game.util.MessageBox; import com.example.ashley.gamestate.game.util.Tickable; /** * An abstract computerized game player player. This is an abstract class, that * should be sub-classed to implement different AIs. The subclass must implement * the {@link #receiveInfo} method. * * @author Steven R. Vegdahl * @author Andrew Nuxoll * @version July 2013 */ public abstract class GameComputerPlayer implements GamePlayer, Tickable { /** * the current game state */ protected Game game; // the game object protected int playerNum; // which player number I am protected String name; // my name protected String[] allPlayerNames; // list of all player names, in ID order private Handler myHandler; // the handler for this player's thread private boolean running; // whether the player's thread is running private boolean gameOver = false; // whether the game is over private GameMainActivity myActivity; // the game's main activity, set only // this game is connected to the GUI private GameTimer myTimer = new GameTimer(this); // my timer /** * Returns this game's timer. * * @return this game's timer object */ protected final GameTimer getTimer() { return myTimer; } /** * Called when the timer ticks; satisfies the Tickable interface. */ public final void tick(GameTimer timer) { sendInfo(new TimerInfo(timer)); } /* * ==================================================================== * Abstract Methods * * Create the game specific functionality for this human player by * sub-classing this class and implementing the following methods. * -------------------------------------------------------------------- */ /* * ==================================================================== * Public Methods * -------------------------------------------------------------------- */ /** * constructor * * @param name * the player's name (e.g., "John") */ public GameComputerPlayer(String name) { this.name = name; } /** * Sets this player to be the one connected to the GUI. * Should only be called if the supportsGUI method returns * true. * * @param a * the activity that is being run */ public final void gameSetAsGui(GameMainActivity a) { myActivity = a; setAsGui(a); } /** * Subclass-behavior for setting this player to be the * one associated with the GUI. Typically, changes the * current screen to have a new layout, and sets up * listeners, animators, etc. * * @param activity * the activity that is being run */ public void setAsGui(GameMainActivity activity) { // default behavior is to do nothing } /** * perform any initialization that needs to be done after the player * knows what their game-position and opponents' names are. */ protected void initAfterReady() { // by default, we do nothing } /** * Method used to send updated state to this player. * * @param info * the information message to send */ public final void sendInfo(GameInfo info) { // post the state to the player's thread, waiting (if needed) until handler is there while (myHandler == null) Thread.yield(); myHandler.post(new MyRunnable(info)); } /** * Starts the player. */ public final void start() { // if the player's thread is not presently running, start it up, keeping // track of its handler so that messages can be sent to the thread. synchronized(this) { if (running) return; running = true; Runnable runnable = new Runnable() { public void run() { Looper.prepare(); myHandler = new Handler(); Looper.loop(); } }; Thread thread = new Thread(runnable); thread.setName("Computer Player"); thread.start(); } } /** * Callback-method implemented in the subclass whenever updated * state is received. * * @param info * the object representing the information from the game */ protected abstract void receiveInfo(GameInfo info); /** * Helper-class to post a message to this player's thread * */ private class MyRunnable implements Runnable { // the object to post private Object data; // constructor public MyRunnable(Object data) { this.data = data; } // run-method: executed in this player's thread, handling a message from // the game, or the timer public void run() { // if game is over, do nothing if (gameOver) return; // if it's a GameInfo object, process it if (data instanceof GameInfo) { // ignore non GameInfo objects GameInfo myInfo = (GameInfo)data; if (game == null) { // CASE 1: we don't know who our game is; the only thing we're // looking for is BindGameInfo object; ignore everything else if (myInfo instanceof BindGameInfo) { BindGameInfo bgs = (BindGameInfo)myInfo; game = bgs.getGame(); // set our game playerNum = bgs.getPlayerNum(); // set our player ID // send a message to the game with our player's name game.sendAction(new MyNameIsAction(GameComputerPlayer.this, name)); } } else if (allPlayerNames == null) { // CASE 2: we don't know the names of a the players; the only thing we're // looking for is a StartGameInfo object; ignore everything else if (myInfo instanceof StartGameInfo) { // set our instance variable with the players' names allPlayerNames = ((StartGameInfo)myInfo).getPlayerNames(); // perform game-specific initialization initAfterReady(); // tell game that we're ready to play game.sendAction(new ReadyAction(GameComputerPlayer.this)); } } else if (myInfo instanceof GameOverInfo) { // CASE 3: we get a "game over" message // if we are the GUI, pop up a message box and tell the // activity that the game is over if (myActivity != null) { gameIsOver(((GameOverInfo)myInfo).getMessage()); myActivity.setGameOver(true); } // acknowledge to the game that we have receive the message game.sendAction(new GameOverAckAction(GameComputerPlayer.this)); // mark game as being over gameOver = true; } else if (myInfo instanceof TimerInfo) { // CASE 4: we have a timer "tick" // if we have a timer-tick, and it's our timer object, // directly invoke the subclass method; otherwise, pass // it on as a message if (((TimerInfo)myInfo).getTimer() == myTimer) { // checking that it's from our timer timerTicked(); } else { receiveInfo(myInfo); } } else { // invoke subclass method receiveInfo(myInfo); } } } } /** * callback method--called when we are notified that the game is over * * @param msg * the "game over" message sent by the game */ protected void gameIsOver(String msg) { // the default behavior is to put a pop-up for the user to see that tells // the game's result MessageBox.popUpMessage(msg, myActivity); } /** * Sleeps for a particular amount of time. Utility method. * * @param milliseconds * the number of milliseconds to sleep for */ protected void sleep(int milliseconds) { try { Thread.sleep(milliseconds); } catch (InterruptedException e) { } } /** * Tells whether this player requires a GUI. Since this is a computer * player, the answer should be 'false'. */ public final boolean requiresGui() { return false; } /** tells whether this player supports a GUI. Some computer players may be * implemented to do so. In that case, they should implement the 'setAsGui' * method. */ public boolean supportsGui() { return false; } /** * Invoked whenever the player's timer has ticked. It is expected * that this will be overridden in many games. */ protected void timerTicked() { // by default, do nothing } }// class GameComputerPlayer
[ "kima21@up.edu" ]
kima21@up.edu
6b661f15e915685862c28cd77f17dadd3deaef05
6d59de527de6bb3fed378aabb218b0aad8e14802
/Week_03/[47]全排列 II.java
82dfa7ccb5bc624e82b384a6ba8baf320f1053b9
[]
no_license
yuqiu-pp/algorithm008-class02
b31e38154970662081606da32df03cbefc9e9d0d
0561e1a3a01a15a8d68fb238ff7c9423ba2131ed
refs/heads/master
2022-11-18T09:34:17.429896
2020-06-28T15:42:00
2020-06-28T15:42:00
255,080,755
0
0
null
2020-04-12T12:46:26
2020-04-12T12:46:25
null
UTF-8
Java
false
false
3,081
java
//给定一个可包含重复数字的序列,返回所有不重复的全排列。 // // 示例: // // 输入: [1,1,2] //输出: //[ // [1,1,2], // [1,2,1], // [2,1,1] //] // Related Topics 回溯算法 package leetcode.editor.cn; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; class LC47{ public static void main(String[] args) { Solution solution = new LC47().new Solution(); // TO TEST System.out.println(solution.permuteUnique(new int[] {1, 1, 2})); } //leetcode submit region begin(Prohibit modification and deletion) // 1. 在46题基础上,利用set排重。 有可能需要排序后,才能通过set排重。 这里不需要排序 // 2. 想清楚是什么情况下回产生相同结果:curr 相同, 剩余 集合相同。 想到的是用hash表保存,递归时查询 class Solution { List<List<Integer>> res = new ArrayList<>(); Set<List<Integer>> set = new HashSet<>(); public List<List<Integer>> permuteUnique(int[] nums) { List<Integer> list = new ArrayList<>(); for (int i : nums) { list.add(i); } helper(list, nums.length, nums.length, new ArrayList<>()); // for (List<Integer> r : set) { // res.add(r); // } // 替换上面代码 res.addAll(set); return res; } // 时间复杂度:O(n * n!)O(n∗n!) 2ms // list 剩余的元素。 每次删除 // n 总的格子数量 // m 还需要填几个元素 // curr private void helper(List<Integer> list, int n, int m, List<Integer> curr) { // 递归终结条件 if (curr.size() == n) { set.add(new ArrayList<>(curr)); return; } // 当前层:每次取剩余元素集合的第一个,恢复集合时插入在末尾 for (int i = 0; i < m; i++) { Integer d = list.get(0); curr.add(d); list.remove(d); // 下一层 helper(list, n, n - curr.size(), curr); // 清除当前层 list.add(d); curr.remove(curr.size() - 1); } } // 剩余集合:helper 通过remove结点方式 // 也可以 用list.contains方式 // 每次递归都执行for n 效率没有helper的高 3ms private void backtrack(int[] nums, List<Integer> curr) { if (curr.size() == nums.length) { res.add(new ArrayList<>(curr)); return; } for (int i = 0; i < nums.length; i++) { if (!curr.contains(nums[i])) { curr.add(nums[i]); backtrack(nums, curr); curr.remove(curr.size() - 1); } } } } //leetcode submit region end(Prohibit modification and deletion) }
[ "41912446@qq.com" ]
41912446@qq.com
5f8791a402b71f0ace3be0082b803f0902c0c6cd
f6a1ed0383eb1331072a42a8fb4309e13056495b
/app/src/main/java/com/example/kk/arttraining/bean/modelbean/AppInfoBean.java
ed84a5b8d8e21a9d65366df3c470e385e158fd7a
[]
no_license
kanghuicong/ArtTraining
b02250a3a6dd20ef32d0b6f92a378791363a6824
82eb115f2771faaf9eec1fbfa6259158ac52f9e6
refs/heads/master
2021-01-24T01:03:03.553578
2017-05-11T07:16:06
2017-05-11T07:16:06
68,698,436
2
1
null
null
null
null
UTF-8
Java
false
false
2,157
java
package com.example.kk.arttraining.bean.modelbean; /** * 作者:wschenyongyin on 2016/10/17 09:51 * 说明: */ public class AppInfoBean extends NoDataResponseBean { private int version_no; private String update_time; private String version_url; private String describle; private String appName; private String version_name; // private Drawable icon; private String pName; public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getDescrible() { return describle; } public void setDescrible(String describle) { this.describle = describle; } // public Drawable getIcon() { // return icon; // } // // public void setIcon(Drawable icon) { // this.icon = icon; // } public String getpName() { return pName; } public void setpName(String pName) { this.pName = pName; } public String getUpdate_time() { return update_time; } public void setUpdate_time(String update_time) { this.update_time = update_time; } public String getVersion_url() { return version_url; } public void setVersion_url(String version_url) { this.version_url = version_url; } public String getVersion_name() { return version_name; } public void setVersion_name(String version_name) { this.version_name = version_name; } public int getVersion_no() { return version_no; } public void setVersion_no(int version_no) { this.version_no = version_no; } @Override public String toString() { return "AppInfoBean{" + "appName='" + appName + '\'' + ", version_no=" + version_no + ", update_time='" + update_time + '\'' + ", version_url='" + version_url + '\'' + ", describle='" + describle + '\'' + ", version_name='" + version_name + '\'' + ", pName='" + pName + '\'' + '}'; } }
[ "wschenyongyin@qq.com" ]
wschenyongyin@qq.com
00ca4c5c35f17aa79c84f312286b99bc72dabe07
288ec59d577a69b74535a081c0ae852497b849ad
/app/src/main/java/Main.java
dc63b348c4d61b2c8fd6ce6ac1cefdc01c12dec5
[]
no_license
naltoma/ex-gradle
8b1fb3874fcdeccc1e3c6dd891dd70a1f2462e09
767f1bb8ae58dbd15b1768a3b648377fdd145d5d
refs/heads/main
2023-01-18T16:14:50.812698
2020-11-19T05:36:33
2020-11-19T05:36:33
310,199,986
1
0
null
null
null
null
UTF-8
Java
false
false
559
java
import jp.ac.uryukyu.ie.tnal.*; public class Main { public static void main(String[] args){ Hero hero = new Hero("勇者", 10, 5); Enemy enemy = new Enemy("スライム", 6, 3); System.out.printf("%s vs. %s\n", hero.name, enemy.name); int turn = 0; while( hero.dead == false && enemy.dead == false ){ turn++; System.out.printf("%dターン目開始!\n", turn); hero.attack(enemy); enemy.attack(hero); } System.out.println("戦闘終了"); } }
[ "tnal@ie.u-ryukyu.ac.jp" ]
tnal@ie.u-ryukyu.ac.jp
b2056db0ccc8b734dc36fe684fccba09b7e0b318
75f43681db453bf674a63fa47f4a033852adc5cd
/bsp4j/src/main/xtend-gen/ch/epfl/scala/bsp4j/CancelFileWatcherResult.java
f0eb744e6f7fdf391c077c555ef96a219cffe604
[ "Apache-2.0" ]
permissive
olafurpg/bsp
cca8b902a7c6728b9bc03232e5ebd18d50707105
2a1d4c885642f7cb22fbc153c6e880314ee21884
refs/heads/master
2021-03-22T00:13:30.956153
2018-10-25T11:07:02
2018-10-25T11:09:32
116,853,612
1
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package ch.epfl.scala.bsp4j; import org.eclipse.lsp4j.jsonrpc.validation.NonNull; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; @SuppressWarnings("all") public class CancelFileWatcherResult { @NonNull private Boolean cancelled; public CancelFileWatcherResult(@NonNull final Boolean cancelled) { this.cancelled = cancelled; } @Pure @NonNull public Boolean getCancelled() { return this.cancelled; } public void setCancelled(@NonNull final Boolean cancelled) { this.cancelled = cancelled; } @Override @Pure public String toString() { ToStringBuilder b = new ToStringBuilder(this); b.add("cancelled", this.cancelled); return b.toString(); } @Override @Pure public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CancelFileWatcherResult other = (CancelFileWatcherResult) obj; if (this.cancelled == null) { if (other.cancelled != null) return false; } else if (!this.cancelled.equals(other.cancelled)) return false; return true; } @Override @Pure public int hashCode() { return 31 * 1 + ((this.cancelled== null) ? 0 : this.cancelled.hashCode()); } }
[ "olafurpg@gmail.com" ]
olafurpg@gmail.com
40635b4c9d7fe4285560b2a0cf177fa8293f12b5
9a9d8f24ba72c02a4bb053c1b1a377b38d4b5008
/src/officeHours/Practice_06_22_2021/Walmart.java
700b32cd15bfd043edd4c38ad773f2b2da3beeee
[]
no_license
AlimAlan/java-programming
9cc06f50f0f18aab9d9bd64f276a1ca91e33ce99
d8d4a4e7974a14c073ea2a9d3bbfeefbaeb22013
refs/heads/master
2023-06-21T19:15:14.864555
2021-07-14T14:11:54
2021-07-14T14:11:54
360,293,013
0
0
null
2021-06-01T13:34:36
2021-04-21T20:08:17
Java
UTF-8
Java
false
false
337
java
package officeHours.Practice_06_22_2021; public class Walmart extends OnlineShopping{ @Override public void viewCart() { } @Override public boolean payForShipping(double price) { return false; } @Override public void buyItem() { } @Override public void returnItem() { } }
[ "alimbekova25m@gmail.com" ]
alimbekova25m@gmail.com
fca31725e5394542b3bc41f39867089f941c45f0
594cff8c985fd3691e9870ac060365fc96d0440b
/src/multiply.java
9379cf1fc5356c969e9c42a0d11a7cb254e5197b
[]
no_license
bluong14/bluong03-307-1T
ea3b819886a68cd8ae371928a46f82ee45419969
1c7fd158a3cc3aa79ad7eda20d6211948a059026
refs/heads/master
2020-03-31T00:50:25.792222
2018-10-05T20:23:09
2018-10-05T20:23:09
151,756,281
0
0
null
null
null
null
UTF-8
Java
false
false
124
java
public class multiply { public static void multiplyInt(){ int x = 1; int y = 1; int result; result = x*y; } }
[ "brandonluong14@gmail.com" ]
brandonluong14@gmail.com
9f056f5757007379ada28b1dae25a843b1c7ef7a
e8244d2d87bc9e61f8aafeae0103a20cda2c6f37
/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/Med.java
4ce73bef7e5dae34f9ea07564257be3e4b164fa1
[ "Apache-2.0" ]
permissive
wangqilei/onos
28b61b2ecadee4883ba336e1208b7f4ae24c0742
00e156e151e82bc688f1060433381865a07e8fe2
refs/heads/master
2021-01-14T10:16:43.813413
2015-11-27T07:30:46
2015-11-27T08:11:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
/* * Copyright 2015 Open Networking Laboratory * * 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.onosproject.bgpio.types; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.bgpio.exceptions.BgpParseException; import org.onosproject.bgpio.util.Constants; import org.onosproject.bgpio.util.Validation; import com.google.common.base.MoreObjects; /** * Provides Implementation of Med BGP Path Attribute. */ public class Med implements BgpValueType { public static final byte MED_TYPE = 4; public static final byte MED_MAX_LEN = 4; private int med; /** * Constructor to initialize med. * * @param med MULTI_EXIT_DISC value */ public Med(int med) { this.med = med; } /** * Returns Med value. * * @return Med value */ public int med() { return this.med; } /** * Reads the channel buffer and returns object of Med. * * @param cb ChannelBuffer * @return object of Med * @throws BgpParseException while parsing Med path attribute */ public static Med read(ChannelBuffer cb) throws BgpParseException { int med; ChannelBuffer tempCb = cb.copy(); Validation parseFlags = Validation.parseAttributeHeader(cb); if ((parseFlags.getLength() > MED_MAX_LEN) || cb.readableBytes() < parseFlags.getLength()) { Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, parseFlags.getLength()); } int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : parseFlags .getLength() + Constants.TYPE_AND_LEN_AS_BYTE; ChannelBuffer data = tempCb.readBytes(len); if (!parseFlags.getFirstBit() && parseFlags.getSecondBit() && parseFlags.getThirdBit()) { throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data); } med = cb.readInt(); return new Med(med); } @Override public short getType() { return MED_TYPE; } @Override public int hashCode() { return Objects.hash(med); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Med) { Med other = (Med) obj; return Objects.equals(med, other.med); } return false; } @Override public String toString() { return MoreObjects.toStringHelper(getClass()) .add("med", med) .toString(); } @Override public int write(ChannelBuffer cb) { //Not to implement as of now return 0; } }
[ "gerrit@onlab.us" ]
gerrit@onlab.us
e9d2defba6650d1631234eb4597b9938ded4fdda
d605eafd058795b5183ab418c601bffd651f4dc3
/workspace/JavaBootcamp2017/src/main/java/Clase1OPP/KeyPointProxy/Proxy.java
7a945fce652dbf459904094664837636ad3a27c6
[ "Apache-2.0" ]
permissive
acastaneda1/java-bootcamp-2017
b559973baf3c9dd72d7cfeefe1b85d4a16e3de37
11caa5ebb9b749ed1113f15154a93f8bb8f6fba1
refs/heads/master
2021-01-23T02:15:04.693383
2017-04-20T11:44:08
2017-04-20T11:44:08
85,974,336
0
0
null
2017-03-23T16:49:52
2017-03-23T16:49:51
null
UTF-8
Java
false
false
309
java
package Clase1OPP.KeyPointProxy; import java.util.Date; public class Proxy { SlowAccessDB slowThing; public Proxy() { System.out.println("Creating proxy at " + new Date()); } public void showDateProxy() { if (slowThing == null) { slowThing = new SlowAccessDB(); } slowThing.Access(); } }
[ "yiyi65526@users.noreply.github.co" ]
yiyi65526@users.noreply.github.co
6d166dc92d07a37ad02ed3f92c05f3dfa1f87cf5
794f622aa6cc2e5703bbd72b600debc7dcc45dcb
/src/tree/IdenticalTrees.java
a5ec6d31d425f650bf184e918e19a7e9ebabc81b
[]
no_license
parul3067/Algorithm-Practice-Questions
d51030d464ebc5ff6515256bb19412f25d0607f3
b2484e4913cf21d0d7dd76332f26664c28c6d0ad
refs/heads/master
2021-01-20T01:35:23.203340
2017-02-15T22:18:21
2017-02-15T22:18:21
78,190,160
0
0
null
null
null
null
UTF-8
Java
false
false
1,817
java
package tree; public class IdenticalTrees<T> { TreeNode<T> root; boolean isIdentical = true; public IdenticalTrees() { this.root = null; } public IdenticalTrees(T root) { this.root = new TreeNode<T>(root); } private boolean isIdentical(TreeNode<T> root1, TreeNode<T> root2) { if(root1 != null && root2 != null) { if(root1.data != root2.data) { System.out.println("Enter not equals : root1 :"+root1.data+" root2 :"+root2.data); isIdentical = false; return isIdentical; } else { System.out.println("root1 :"+root1.data+" root2 :"+root2.data); isIdentical(root1.left,root2.left); isIdentical(root1.right,root2.right); } } return isIdentical; } public static void main(String[] args) { // TODO Auto-generated method stub IdenticalTrees<Character> tree1 = new IdenticalTrees<Character>('a'); if(tree1.root != null) { tree1.root.left = new TreeNode<Character>('b'); tree1.root.right = new TreeNode<Character>('c'); tree1.root.left.left = new TreeNode<Character>('d'); tree1.root.left.right = new TreeNode<Character>('e'); tree1.root.right.left = new TreeNode<Character>('f'); tree1.root.right.right = new TreeNode<Character>('g'); } IdenticalTrees<Character> tree2 = new IdenticalTrees<Character>('a'); if(tree2.root != null) { tree2.root.left = new TreeNode<Character>('b'); tree2.root.right = new TreeNode<Character>('c'); tree2.root.left.left = new TreeNode<Character>('d'); tree2.root.left.right = new TreeNode<Character>('e'); tree2.root.right.left = new TreeNode<Character>('f'); tree2.root.right.right = new TreeNode<Character>('g'); } System.out.println("Are both trees identical :"+tree1.isIdentical(tree1.root, tree2.root)); } }
[ "p7verma@uwaterloo.ca" ]
p7verma@uwaterloo.ca
ee3dedad9ea0be4ff707f99e91ef80ed13c4b141
be9103baf8d24d4b3b8606a41208e96d288c3208
/src/test/java/com/github/msemys/esjc/SystemSettingsJsonAdapterTest.java
c69f622d96e383a26b980a8cc0ab23b2cab37c73
[ "MIT" ]
permissive
trevorbernard/esjc
998bf1ef48a967f8153f3bd22c11861ed8ac8792
2c9787cb20543e60b73a40f9e090f06c24bb7e11
refs/heads/master
2021-01-18T03:37:13.670381
2016-07-24T10:50:10
2016-07-24T10:50:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,912
java
package com.github.msemys.esjc; import org.junit.Test; import static java.util.Arrays.asList; import static org.junit.Assert.*; public class SystemSettingsJsonAdapterTest { @Test public void serializesWithAllAcls() { StreamAcl userStreamAcl = new StreamAcl(asList("eric", "kyle", "stan", "kenny"), asList("butters"), asList("$admins"), asList("victoria", "mackey"), asList("randy")); StreamAcl systemStreamAcl = new StreamAcl(asList("$admins"), asList("$all"), asList("$admins"), null, asList("$all")); SystemSettings settings = new SystemSettings(userStreamAcl, systemStreamAcl); assertEquals("{\"$userStreamAcl\":{\"$r\":[\"eric\",\"kyle\",\"stan\",\"kenny\"]," + "\"$w\":\"butters\"," + "\"$d\":\"$admins\"," + "\"$mr\":[\"victoria\",\"mackey\"]," + "\"$mw\":\"randy\"}," + "\"$systemStreamAcl\":{\"$r\":\"$admins\"," + "\"$w\":\"$all\"," + "\"$d\":\"$admins\"," + "\"$mw\":\"$all\"}}", settings.toJson()); } @Test public void serializesWithSystemStreamAclOnly() { StreamAcl systemStreamAcl = new StreamAcl(asList("$admins"), asList("$all"), null, null, asList("$all")); SystemSettings settings = new SystemSettings(null, systemStreamAcl); assertEquals("{\"$systemStreamAcl\":{\"$r\":\"$admins\"," + "\"$w\":\"$all\"," + "\"$mw\":\"$all\"}}", settings.toJson()); } @Test public void serializesWithoutAcls() { SystemSettings settings = new SystemSettings(null, null); assertEquals("{}", settings.toJson()); } @Test public void deserializesWithAllAcls() { SystemSettings settings = SystemSettings.fromJson("{\"$userStreamAcl\":{\"$r\":[\"eric\",\"kyle\",\"stan\",\"kenny\"]," + "\"$w\":\"butters\"," + "\"$d\":\"$admins\"," + "\"$mr\":[\"victoria\",\"mackey\"]," + "\"$mw\":\"randy\"}," + "\"$systemStreamAcl\":{\"$r\":\"$admins\"," + "\"$w\":\"$all\"," + "\"$d\":\"$admins\"," + "\"$mw\":\"$all\"}}"); assertNotNull(settings.userStreamAcl); assertEquals(asList("eric", "kyle", "stan", "kenny"), settings.userStreamAcl.readRoles); assertEquals(asList("butters"), settings.userStreamAcl.writeRoles); assertEquals(asList("$admins"), settings.userStreamAcl.deleteRoles); assertEquals(asList("victoria", "mackey"), settings.userStreamAcl.metaReadRoles); assertEquals(asList("randy"), settings.userStreamAcl.metaWriteRoles); assertNotNull(settings.systemStreamAcl); assertEquals(asList("$admins"), settings.systemStreamAcl.readRoles); assertEquals(asList("$all"), settings.systemStreamAcl.writeRoles); assertEquals(asList("$admins"), settings.userStreamAcl.deleteRoles); assertNull(settings.systemStreamAcl.metaReadRoles); assertEquals(asList("$all"), settings.systemStreamAcl.metaWriteRoles); } @Test public void deserializesWithUserStreamAclOnly() { SystemSettings settings = SystemSettings.fromJson("{\"$userStreamAcl\":{\"$w\":\"butters\"," + "\"$d\":\"$admins\"," + "\"$mr\":[\"victoria\",\"mackey\"]," + "\"$mw\":\"randy\"}}"); assertNotNull(settings.userStreamAcl); assertNull(settings.userStreamAcl.readRoles); assertEquals(asList("butters"), settings.userStreamAcl.writeRoles); assertEquals(asList("$admins"), settings.userStreamAcl.deleteRoles); assertEquals(asList("victoria", "mackey"), settings.userStreamAcl.metaReadRoles); assertEquals(asList("randy"), settings.userStreamAcl.metaWriteRoles); assertNull(settings.systemStreamAcl); } }
[ "mindaugas.semys@gmail.com" ]
mindaugas.semys@gmail.com
cd773a00857178d5ae438364f8154a85d93b68b3
3839eb1e8537999ae1af61ea8c289043027e209b
/src/main/java/com/yml/designpatterns/abstractfactory/SqlServerFactory.java
9134d1d899ad5b08775a7a970d95299c03e03b62
[]
no_license
sydml/designpatterns
633c190e1a7167c5c3f0c4b141cbbd7423fb2026
6a0b192e6324e358e3bb831a113ca0b91464a7f9
refs/heads/master
2021-06-23T14:30:08.514080
2020-12-04T02:07:39
2020-12-04T02:07:39
163,142,436
0
1
null
null
null
null
UTF-8
Java
false
false
348
java
package com.yml.designpatterns.abstractfactory; /** * @author Liuym * @date 2018/12/25 0025 */ public class SqlServerFactory implements IFactory { @Override public IUser createUser() { return new SqlServerUser(); } @Override public IDepartment createDepartment() { return new SqlServerDepartment(); } }
[ "liuym@startimes.com.cn" ]
liuym@startimes.com.cn
bcfa5908a6bc3cd0c49af92eeca764624f9f492d
5182be94cba95f6164ce0b6dd2e8167c8cedac5a
/guanwu-modules/guanwu-admin/src/main/java/com/github/guanwu/security/modules/auth/mapper/ClientServiceMapper.java
43218911d5fb39ababc0eb4caba21cf447ebb24c
[]
no_license
wangguanwu/cloud-platform-security
0d9aa2bded4b781b072fbc8eebb0c4ac856c47fc
7acaeaf71855555d4476c0fc9cafc5615651df7b
refs/heads/main
2023-07-08T09:54:41.286664
2021-08-14T00:21:45
2021-08-14T00:21:45
391,525,143
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.github.guanwu.security.modules.auth.mapper; import com.github.guanwu.security.modules.auth.entity.ClientService; import tk.mybatis.mapper.common.Mapper; /** * * * @author guanwu * @email 2531507093@qq.com * @version 2021-07-31 18:11:14 */ public interface ClientServiceMapper extends Mapper<ClientService> { void deleteByServiceId(int id); }
[ "guanwu@wangguanwudeMacBook-Pro.local" ]
guanwu@wangguanwudeMacBook-Pro.local
a9182e21a3aba5c489778cef93bdab775ef63b3a
efde683108a149727d1f4f5f1a3c0e777c5a7d9d
/QuantoSauros.Common/src/main/java/com/quantosauros/common/calendar/DefaultCalendar.java
bcb7511459870d1f5e0bd1a961a198bd97a165db
[]
no_license
quantosauros/QuantoSauros
da4162f396879f4384bf2438f556a819bd16a1b0
f21879284e0c9f51f15af92b3da336dee3868ec6
refs/heads/master
2021-01-21T13:30:13.561156
2016-05-16T09:50:02
2016-05-16T09:50:02
48,434,338
1
0
null
null
null
null
UTF-8
Java
false
false
1,568
java
package com.quantosauros.common.calendar; import com.quantosauros.common.date.Date; /** * {@code DefaultCalendar}는 주말만 휴일로 지정되어 있는 기본 달력이다. * <p>이 클래스에는 인스턴스가 1개만 존재하므로 공개된 생성자는 두지 않으며, * {@code getInstance} 함수를 통해 객체를 가져온다. * * @author Kang Seok-Chan * @since 3.2 * */ /*------------------------------------------------------------------------------ * Implementation Note * - Creation: 2009.09 ------------------------------------------------------------------------------*/ public final class DefaultCalendar extends AbstractCalendar { private static DefaultCalendar instance = null; /** * {@code DefaultCalendar} 객체를 가져온다. * * @return {@code DefaultCalendar} 객체 */ public static DefaultCalendar getInstance() { if (instance == null) { instance = new DefaultCalendar(); } return instance; } private DefaultCalendar() { // cannot be directly instantiated - Singleton instance } /** * 이 {@code DefaultCalendar} 객체의 이름을 반환한다. * * @return 이름 */ public String getName() { return "Default Calendar"; } /** * 입력된 날짜가 휴일인지를 판단한다. * * @param date 날짜 * @return 주말 외의 휴일이 없으므로 주말인 경우에는 {@code true}, * 그렇지 않으면 {@code false} */ public boolean isHoliday(final Date date) { // Check Weekend if (isWeekend(date)) { return true; } return false; } }
[ "jayjlee12@gmail.com" ]
jayjlee12@gmail.com
261bba06d9947b5f25decf529906adafa1ff490f
bca4733ccd060dca5bcc36f5c0326b10a003ec91
/src/main/java/org/mobicents/servlet/sip/tools/RegexGroup.java
167725acde68f7de51ea93c46daae289e176232c
[]
no_license
spicyramen/opencall
59921a9d12cf7261f36c359719cf31fec0c76fda
8c67e17e36eb29941f678dc311fb82d663c822f3
refs/heads/Development
2021-01-23T20:11:56.116726
2015-03-27T00:08:58
2015-03-27T00:08:58
10,187,534
8
3
null
2013-11-02T00:30:06
2013-05-21T04:00:35
Java
UTF-8
Java
false
false
2,090
java
package org.mobicents.servlet.sip.tools; import java.util.ArrayList; import java.util.List; public class RegexGroup { /** * group 1: index start: 15 index end: 29 offset: 16 elements: 8 group 2: index start: 35 index end: 37 offset: 4 elements: 2 */ private int indexStart = 0; private int indexEnd = 0; private int offset = 0; private int elements = 0; private int groupID = 0; private List<Integer> regexGroupElementsList = new ArrayList<Integer>(); public int getIndexStart() { return indexStart; } public int getIndexEnd() { return indexEnd; } public int getOffset() { return offset; } public int getElements() { return elements; } public int getGroupID() { return groupID; } public void setIndexStart(int indexStart) { this.indexStart = indexStart; } public void setIndexEnd(int indexEnd) { this.indexEnd = indexEnd; } public void setOffset(int offset) { this.offset = offset; } public void setElements(int elements) { this.elements = elements; } public RegexGroup(int groupId) { this.groupID = groupId; } public void processElements(int groupId, List<Integer> regexGroupElements) { String digits = "\\d"; int ptrGroup = 1; if (regexGroupElements.size()==0) { return; } for (int i=0;i<regexGroupElements.size();i++) { if( i+1 < regexGroupElements.size()) { if(regexGroupElements.get(i) == regexGroupElements.get(i+1) - digits.length()) { if(ptrGroup == groupId) { regexGroupElementsList.add(regexGroupElements.get(i)); } } else { if(ptrGroup == groupId) { regexGroupElementsList.add(regexGroupElements.get(i)); } ptrGroup++; } } else { if(ptrGroup == groupId) { regexGroupElementsList.add(regexGroupElements.get(i)); } } } setIndexStart(regexGroupElementsList.get(0)); setIndexEnd(regexGroupElementsList.get(regexGroupElementsList.size()-1)); setOffset((getIndexEnd() - getIndexStart()) + digits.length()); setElements(regexGroupElementsList.size()); } }
[ "gascagonzalo@gmail.com" ]
gascagonzalo@gmail.com
951d1916f87b2f05cc6fcddd6ae29f52e52e1b77
954a3676e8116e6b42e3ccf43524c7f856d99527
/TeamCode/src/main/java/virtualRobot/MonitorThread.java
ae92bcf4fb0d077c2dfcd7069b07cb48c6b873ed
[ "BSD-3-Clause" ]
permissive
MillburnHighSchoolRobotics/FTCRobot2016-17
13fc28fd5b04f9be335b04e55b35206bde3019b6
723db3162ee2bffcd9b51bc2298d28d9a0e5340b
refs/heads/master
2021-03-27T08:37:36.025051
2017-02-26T11:32:32
2017-02-26T11:32:32
68,617,309
0
0
null
null
null
null
UTF-8
Java
false
false
1,340
java
package virtualRobot; import android.util.Log; import virtualRobot.commands.Command; /** * Created by shant on 1/10/2016. * Monitor threads are used by delegateMonitor in godthread. * They have the abstract method setStatus, where a particular monitor thread is told how to determine whether * the monitor thread should be triggered or not. */ public abstract class MonitorThread<T extends AutonomousRobot> implements Runnable { private boolean status; //usually should be TRUE, if stuff goes wrong, make it FALSE public static boolean NORMAL; protected T robot; public MonitorThread () { robot = (T) Command.ROBOT; NORMAL = true; status = true; } @Override public void run() { //Constantly Runs as long as the status is normal. As soon as it isn't, it stops running. The god Thread in the meantime will have detected that the status is not normal. while (!Thread.currentThread().isInterrupted() && (status == NORMAL)) { status = setStatus(); Log.d("Monitor", Boolean.toString(status)); if (status == false) { break; } } if (status != NORMAL) { return; } } public boolean getStatus() { return status; } public abstract boolean setStatus (); }
[ "17osullivand@millburn.org" ]
17osullivand@millburn.org
0a79891a5eba19f8d320634f7e57ef74652a5c31
a1709e076ec85c3e156f09eacfabdd6c3cc840f9
/src/main/kotlin/com/ksb/ksb_with_mybatis/model/Tag.java
2a9d66763b4403361b535368f31a9057591c4b17
[ "Apache-2.0" ]
permissive
KotlinSpringBoot/ksb_with_mybatis
37fd8ce6defa5d1b6642b40ea425ebc4cf77e97e
e92e331b4bdc52ed9eaad88795354d3b82790cbc
refs/heads/master
2021-08-23T05:25:29.333017
2017-12-03T16:36:14
2017-12-03T16:36:14
112,068,314
2
0
null
null
null
null
UTF-8
Java
false
false
964
java
package com.ksb.ksb_with_mybatis.model; import com.fasterxml.jackson.annotation.JsonFormat; import java.util.Date; public class Tag { private Long id; private String name; private Date gmtCreate; private Date gmtModify; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") public Date getGmtCreate() { return gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") public Date getGmtModify() { return gmtModify; } public void setGmtModify(Date gmtModify) { this.gmtModify = gmtModify; } }
[ "guangjian.cgj@alibaba-inc.com" ]
guangjian.cgj@alibaba-inc.com
163cd9fd04183737336776f21c4eb0aeb3414580
96234dedce91a66489233d519ae470566cafce7b
/src/Stream_IntOut/Practice8_File_ConstructMethod.java
d1c4726477e86804cb23ca517fb961d2d784553b
[]
no_license
linj21a/java
edb434ffb921390b47c52f2a4a99cd3aefe70c2c
eb95568495b5af1100939681a066b1b3220222a1
refs/heads/master
2023-03-31T06:39:01.122102
2021-03-12T02:56:41
2021-03-12T02:56:41
256,404,199
0
0
null
null
null
null
UTF-8
Java
false
false
2,547
java
package Stream_IntOut; import java.io.File; /** * IO流使用来 操作文件里边的数据的 * 但是无法操作文件的属性——如大小,修改时间,目录等。 * File对象于是就产生了。 * <p> * public class File * extends Object * implements Serializable, Comparable<File> * <p> * 将文件与其目录路径名、其他属性进行封装,成为一个类。 * 构造器: * 1、File​(String pathname) 通过将给定的路径名字符串转换为抽象路径名来创建新的 File实例。 * 2、File​(String parent, String child) 从父路径名字符串和子路径名字符串创建新的 File实例。 * 实际就是将第一个构造器的文件路径分割出父目录和文件名 * 3、File​(File parent, String child) 从父抽象路径名和子路径名字符串创建新的 File实例。 * 而这个构造器则是将父目录封装为了一个文件对象。 * <p> * 4、File​(URI uri) 通过将给定的 file: URI转换为抽象路径名来创建新的 File实例。 * <p> * 所以文件对象可以是文件夹或者文件 * File */ public class Practice8_File_ConstructMethod { public static void main(String[] args) { fileConstructDemo(); } private static void fileConstructDemo() { //第一个构造器 File file1 = new File("a.txt");//绝对目录 //第二个构造器,更加便于修改,灵活 File file2 = new File("E:\\", "a.txt"); //第三个构造器,将父目录封装为了file对象 File file3 = new File(new File("E:\\"), "a.txt"); //打印出每个文件对象的属性——文件名,绝对路径,相对路径 System.out.println("file1 name:" + file1.getName() + " " + "absPath:" + file1.getAbsolutePath() + " Path: " + file1.getPath()+"Parent: "+file1.getParent()); //注意此时File("a.txt");path就是a.txt,意味则父目录为null System.out.println("file2 name:" + file2.getName() + " " + "absPath:" + file2.getAbsolutePath() + " Path: " + file2.getPath()); System.out.println("file3 name:" + file3.getName() + " " + "absPath:" + file3.getAbsolutePath() + " Path: " + file3.getPath()); //说明一点:相对路径是相对一个路径下是表述 //getPath()方法是构造的文件对象所给的路径是什么就是什么,而绝对路径则不会变化。 //如File("a.txt");path就是a.txt,File("c:\\de\\a.txt")path就是c:\de\a.txt } }
[ "604178275@qq.com" ]
604178275@qq.com
65dfba6e74a2cdfd46f9e52f9969ded42465eac5
c638aadca88b06db34af812e2ffbcef7da041fa7
/soap-server/src/main/java/com/ctl/as/domain/geo/v2/types/response/GeoPoint.java
d9bb8b06e81aef2a77d6c7baf4285e8f7c78814d
[]
no_license
Bloody-Indians/WebService_publish_consume
bc858c0e8db1f6408d8863ee7f45add50cd6a0c1
d661fd6d778809267f9fdfcbc4135d60df342413
refs/heads/master
2020-06-12T14:15:26.159976
2016-12-07T05:43:54
2016-12-07T05:43:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,976
java
package com.ctl.as.domain.geo.v2.types.response; //import com.thoughtworks.xstream.annotations.XStreamAlias; public class GeoPoint { // //@XStreamAlias("Source") protected GeoPointSource source; // //@XStreamAlias("Latitude") protected Double latitude; //@XStreamAlias("Longitude") protected Double longitude; //@XStreamAlias("CoordinateLevel") protected String coordinateLevel; //@XStreamAlias("Accuracy") protected String accuracy; //@XStreamAlias("Elevation") protected Double elevation; //@XStreamAlias("Horizontal") protected Double horizontal; //@XStreamAlias("Vertical") protected Double vertical; public String getAccuracy() { return accuracy; } public void setAccuracy(String accuracy) { this.accuracy = accuracy; } public String getCoordinateLevel() { return coordinateLevel; } public void setCoordinateLevel(String coordinateLevel) { this.coordinateLevel = coordinateLevel; } public Double getElevation() { return elevation; } public void setElevation(Double elevation) { this.elevation = elevation; } public Double getHorizontal() { return horizontal; } public void setHorizontal(Double horizontal) { this.horizontal = horizontal; } public Double getLatitude() { return latitude; } public void setLatitude(Double latitude) { this.latitude = latitude; } public Double getLongitude() { return longitude; } public void setLongitude(Double longitude) { this.longitude = longitude; } public GeoPointSource getSource() { return source; } public void setSource(GeoPointSource source) { this.source = source; } public Double getVertical() { return vertical; } public void setVertical(Double vertical) { this.vertical = vertical; } }
[ "haribabu.ka@hcl.com" ]
haribabu.ka@hcl.com
1e1b6d0476621d391f9464993ec546099369bce9
bdcd5f83b4b49cf374b708f0c806b1ffa694253a
/server/applet-server/src/main/java/com/imengli/appletServer/service/UserService.java
81dbfe8f9bcafc582ae2045b9253b7799c9e5b7e
[ "MIT" ]
permissive
MMMMMMLi/Account
f47469a0deb74dcab9d692a49643a06ffe423833
8a4b2139db709728c09c7eb830f66ff769ee216a
refs/heads/master
2023-03-13T01:28:18.119100
2021-03-02T13:28:13
2021-03-02T13:28:13
291,652,489
2
0
null
null
null
null
UTF-8
Java
false
false
11,230
java
/* * The MIT License (MIT) * * Copyright (c) 2020 mmmmmengli@gmail.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.imengli.appletServer.service; import com.imengli.appletServer.common.ResultStatus; import com.imengli.appletServer.dao.SysUserRepostory; import com.imengli.appletServer.dao.WechatUserRepostory; import com.imengli.appletServer.daomain.SysUserDO; import com.imengli.appletServer.daomain.WechatAuthDO; import com.imengli.appletServer.daomain.WechatUserDO; import com.imengli.appletServer.dto.ResultDTO; import com.imengli.appletServer.utils.PinyinUtil; import com.imengli.appletServer.utils.RedisUtil; import com.imengli.appletServer.utils.SnowflakeIdWorker; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @Service public class UserService { private final static Logger LOGGER = LoggerFactory.getLogger(UserService.class); @Autowired private RedisUtil redisUtil; @Resource private WechatUserRepostory wechatUserRepostory; @Resource private SysUserRepostory sysUserRepostory; @Autowired private SnowflakeIdWorker snowflakeIdWorker; public WechatAuthDO getWechatAuthEntity(String token) { WechatAuthDO wechatAuthDO = null; // 检验Token是否正常 if (redisUtil.containsWechat(token)) { // 获取Token对应的对象信息 wechatAuthDO = redisUtil.getWechat(token); } return wechatAuthDO; } public ResultDTO authUserInfo(String token, Boolean updateFlag) { WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { // 获取对应的用户信息 WechatUserDO wechatUserDOByOpenId = wechatUserRepostory.getUserEntityByOpenId(wechatAuthDO.getOpenId()); // 根据信息完善度返回 if (wechatUserDOByOpenId != null) { if (StringUtils.isBlank(wechatUserDOByOpenId.getUserId())) { // 需要完善 return new ResultDTO(ResultStatus.ERROR_UN_AUTHORIZED); } else { SysUserDO info = sysUserRepostory.getUserInfoByUserId(wechatUserDOByOpenId.getUserId()); if (updateFlag) { sysUserRepostory.update(SysUserDO.builder().id(info.getId()).lastLoginTime(LocalDateTime.now()).build()); } if (StringUtils.isAnyBlank(info.getAddress(), info.getUserName(), info.getPhoneNumber())) { return new ResultDTO(ResultStatus.ERROR_USERINFO, info); } return new ResultDTO(ResultStatus.SUCCESS_USERINFO, info); } } } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } @Transactional public ResultDTO setUserInfo(String token, String nickName, Integer gender, String city, String province, String country, String avatarUrl) { // 校验Token WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { // 获取对应的用户信息 Optional<WechatUserDO> wechatUserDOByOpenIdOptional = Optional.ofNullable(wechatUserRepostory.getUserEntityByOpenId(wechatAuthDO.getOpenId())); if (wechatUserDOByOpenIdOptional.isPresent()) { WechatUserDO wechatUserDOByOpenId = wechatUserDOByOpenIdOptional.get(); String userId = wechatUserDOByOpenId.getUserId(); if (StringUtils.isBlank(userId)) { // 生成用户ID String userID = snowflakeIdWorker.nextStringId(); LocalDateTime now = LocalDateTime.now(); SysUserDO sysUserDO = new SysUserDO(userID, nickName, avatarUrl, gender, country, province, city, now, now, 0); // 关联 wechatUserDOByOpenId.setUserId(userID); // 保存 wechatUserRepostory.updateUserEntity(wechatUserDOByOpenId); sysUserRepostory.save(sysUserDO); return new ResultDTO(ResultStatus.SUCCESS_USERINFO, sysUserDO); } else { return new ResultDTO(ResultStatus.SUCCESS_USERINFO, sysUserRepostory.getUserInfoByUserId(userId)); } } } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } public ResultDTO updateWechatUserInfo(String token, String nickName, Integer gender, String city, String province, String country, String avatarUrl, String userInfoId) { // 校验Token WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { // 如果没有异常,则更新用户信息 sysUserRepostory.update( SysUserDO.builder() .id(userInfoId) .avatarUrl(avatarUrl) .nickName(nickName) .gender(gender) .city(city) .province(province) .country(country) .updateTime(LocalDateTime.now()) .build()); return new ResultDTO(ResultStatus.SUCCESS, sysUserRepostory.getUserInfoByUserId(userInfoId)); } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } public ResultDTO updateUserInfo(String token, String address, String name, String phone, Boolean banner) { // 校验Token WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { WechatUserDO userEntityByOpenId = wechatUserRepostory.getUserEntityByOpenId(wechatAuthDO.getOpenId()); if (userEntityByOpenId != null) { // 更新 SysUserDO sysUserDO; if (StringUtils.isNoneBlank(address, name, phone)) { sysUserDO = SysUserDO.builder() .id(userEntityByOpenId.getUserId()) .userName(name) .userNameCode(PinyinUtil.ToFirstChar(name)) .phoneNumber(phone) .address(address) .updateTime(LocalDateTime.now()) .build(); } else { sysUserDO = SysUserDO.builder() .id(userEntityByOpenId.getUserId()) .updateTime(LocalDateTime.now()) .banner(banner) .build(); } sysUserRepostory.update(sysUserDO); return new ResultDTO(ResultStatus.SUCCESS_UPDATE_USERINFO); } } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } public ResultDTO getUserInfoBySearch(String token, String searchValue, Integer size) { // 校验Token WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { List<SysUserDO> userEntityList = sysUserRepostory.getUserInfoBySearch(searchValue, size); return new ResultDTO(ResultStatus.SUCCESS_SEARCH_USERINFO, userEntityList); } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } public ResultDTO userSubMsgAdd(String userId) { // 获取当前用户的次数 SysUserDO userInfoById = sysUserRepostory.getUserInfoByUserId(userId); // +1 SysUserDO build = SysUserDO.builder().id(userInfoById.getId()).subMsgNum(userInfoById.getSubMsgNum() + 1).build(); // 更新 sysUserRepostory.update(build); // 返回新的 userInfoById.setSubMsgNum(build.getSubMsgNum()); return new ResultDTO(ResultStatus.SUCCESS, userInfoById); } /** * 添加临时用户 * * @param token * @param userName * @param phoneNum * @param avatarUrl * @return */ public ResultDTO addTempUserByApplet(String token, String userName, String phoneNum, String avatarUrl) { // 校验Token WechatAuthDO wechatAuthDO = this.getWechatAuthEntity(token); // 判断是否异常 if (wechatAuthDO != null) { // 首先判断当前添加的测试用户是否已经存在 // 判断条件是名字是否存在或者手机号是否存在 if (sysUserRepostory.getUserInfoBySearch(userName, 1).size() <= 0 && sysUserRepostory.getUserInfoBySearch(phoneNum, 1).size() <= 0) { // 如果都不存在,则添加 sysUserRepostory.saveTempUser(SysUserDO.builder() .id(snowflakeIdWorker.nextStringId()) .userName(userName) .userNameCode(PinyinUtil.ToFirstChar(userName)) .phoneNumber(phoneNum) .avatarUrl(avatarUrl) .createTime(LocalDateTime.now()) .isTemp(Boolean.TRUE) .build()); return new ResultDTO(ResultStatus.SUCCESS); } else { return new ResultDTO(ResultStatus.EXISTED); } } return new ResultDTO(ResultStatus.ERROR_AUTH_TOKEN); } }
[ "dianxinweizi@163.com" ]
dianxinweizi@163.com
6e36af6e81f71e93dda942153c909f88c8816d69
6ee4da7cdebe25bd5bba932b8b29867e1259883d
/app/src/main/java/com/jotamarti/golocal/UseCases/Clients/ClientParser.java
cc2c8f44c0bd6d4d230c23487825039718e909b8
[]
no_license
TheDamProject/MovileApp
804c4c20924d1128727ec869d3a88e6302ee9490
c3aec01d18d1bbef1318453090b3a2196fd321d1
refs/heads/master
2023-05-05T05:17:30.597369
2021-05-30T09:45:47
2021-05-30T09:45:47
316,734,686
0
1
null
2022-05-12T13:46:34
2020-11-28T12:59:46
Java
UTF-8
Java
false
false
609
java
package com.jotamarti.golocal.UseCases.Clients; import com.jotamarti.golocal.Models.Client; import org.json.JSONException; import org.json.JSONObject; public class ClientParser { public static Client parseClientFromJsonObject(JSONObject jsonObject) throws JSONException { Client client = new Client(); String uid = jsonObject.getString("uid"); String nickName = jsonObject.getString("nick"); String url = jsonObject.getString("avatar"); client.setUserUid(uid); client.setNickName(nickName); client.setAvatar(url); return client; } }
[ "juanma887@gmail.com" ]
juanma887@gmail.com
8e11071117aaf044f65a10f45c365546e86e4cd3
b106b594d63a8e20fb2f9094a533c398393e9378
/src/test/java/com/orangehrm/practice/JdbcDemo.java
a1fbe8d910202e0ab9c18312d6be5364642d4856
[]
no_license
MahriAshyrova/OrangeHrmFramework
aff9121f14dd51eb5d831376ff0498afcbdc2d55
0bd4782a76ff885fefb44a34171ad5d76a59e330
refs/heads/master
2022-06-24T03:32:07.103951
2019-09-08T16:58:47
2019-09-08T16:58:47
192,842,078
0
0
null
2021-04-26T19:15:51
2019-06-20T03:27:26
HTML
UTF-8
Java
false
false
1,187
java
package com.orangehrm.practice; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.junit.Test; public class JdbcDemo { String dbUrl ="jdbc:oracle:thin:@syntaxdatabase.cdjflmucstpo.us-east-1.rds.amazonaws.com:1521:orcl"; String dbUsername="Syntax"; String dbPassword="syntax123"; @Test public void dbConnection() throws SQLException { // creating A CONNECTION Connection connection =DriverManager.getConnection(dbUrl, dbUsername, dbPassword); // create a statement Statement statement= connection.createStatement(); // exceute query and stores from database in ResultSet Object ResultSet resultSet =statement.executeQuery("select * from countries"); // get values from resultSet resultSet.next(); String columnData= resultSet.getString("Country_Name"); System.out.println(columnData); System.out.println("-----Printing values using loop-----"); while(resultSet.next()) { columnData=resultSet.getString("Country_Name"); System.out.println(columnData); } //close all db connection connection.close(); statement.close(); resultSet.close(); } }
[ "myahriturkmen@gmail.com" ]
myahriturkmen@gmail.com
e3aaec36275a69780a28269df8e0111813e33472
e7d0f8d0a4bf30073ffc306a50714b790a2ac55e
/src/main/java/com/example/demo/demo/thread/ThreadDemo3.java
e69f70199ae37722575b78907912752564300451
[]
no_license
lovepli/demo
c05730ad22b5848d3654d7a4a3a1aa1e0fcc7aca
3a847d2aed6da0162a754855e80fc6bd4d10343c
refs/heads/master
2022-12-23T22:55:24.700716
2019-12-02T11:40:31
2019-12-02T11:40:31
224,959,745
0
0
null
2020-10-13T17:51:28
2019-11-30T04:34:27
Java
UTF-8
Java
false
false
1,843
java
package com.example.demo.demo.thread; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author: lipan * @date: 2019-06-10 * @description: 练习: * join练习 小明设计了一个多线程程序,希望创建3个线程,每个线程先打印 * Hello, xxx! * 然后等待1秒,再打印: Goodbye, xxx! * * 这里我没有成功!!!!ß */ class HellThread extends Thread{ private String name; public HellThread(String name) { this.name = name; } @Override public void run() { System.out.println("Hello, " + name + "!"); } public String getname() { return name; } } public class ThreadDemo3 { public static void main(String[] args) throws Exception { List<Thread> threads = new ArrayList<>(); for (String name : Arrays.asList("Bob", "Alice", "Tom")) { threads.add(new HellThread(name)); } System.out.println("start"); for (Thread t : threads) { t.start(); t.join(); Thread.sleep(2000); } try { Thread.sleep(1000); System.out.println("(等待约1秒)"); } catch (InterruptedException e) { e.printStackTrace(); } // for (int i = 0; i < threads.size(); i++) { // String s=threads.get(i).getName(); // System.out.println(s); // } System.out.println("Goodbye, " +"Bob"+ "!"); System.out.println("Goodbye, " +"Alice"+ "!"); System.out.println("Goodbye, " +"Tom"+ "!"); System.out.println("end"); } // 小明期望的输出是: // START // Hello, Bob! // Hello, Alice! // Hello, Tom! // (等待约1秒) // Goodbye, Bob! // Goodbye, Alice! // Goodbye, Tom! // END }
[ "1171205514@qq.com" ]
1171205514@qq.com
e060bbfe84b73d4f397e2761ba131706de1c8e29
642bb69b1aca6cd5d206572ddc3f118f64be995a
/src/com/haxademic/demo/system/Demo_JavaFXAppLaunch.java
a3bfb40b0ba813727aa34e53cacddcecef8f1a1a
[ "MIT" ]
permissive
chrisfromwork/haxademic
25cdfd37a26ec897cf309ed96de4db8f68eeb991
125fbe694a084abf9b29efa9e321bc00ba627dfc
refs/heads/master
2020-06-26T17:04:05.716929
2019-07-27T22:21:04
2019-07-27T22:21:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
934
java
package com.haxademic.demo.system; import com.haxademic.core.app.PAppletHax; import com.haxademic.core.app.config.AppSettings; import com.haxademic.core.draw.context.PG; public class Demo_JavaFXAppLaunch extends PAppletHax { public static void main(String args[]) { PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); } protected void overridePropsFile() { int FRAMES = 360; p.appConfig.setProperty(AppSettings.LOOP_FRAMES, FRAMES); } // public void setupFirstFrame() { // new Thread() { // @Override // public void run() { // javafx.application.Application.launch(Demo_WebViewTestApp.class); // } // }.start(); // } public void drawApp() { p.background(0); PG.setCenterScreen(p); // if(Demo_WebViewTestApp.instance != null) { // p.background(0,255,0); // // WebViewApplicationTest.instance.printSomething(); // } } }
[ "cacheflowe@users.noreply.github.com" ]
cacheflowe@users.noreply.github.com
91737cd597900f3ef211752127f557fd5bea86e6
f0e36ac414f2e812ec4c90cd006a8b45d6749523
/src/com/zsm/example/Sum.java
6d90157f4a42e529f040d38fd533144aeba0385b
[]
no_license
hovljei/javalearn
fdbee332a25c89319bdf6b10a1518f4a5ee29b3f
cae3eace357c5d64a24eaed24fca05045e4a6e16
refs/heads/master
2016-09-05T23:31:45.611919
2013-03-24T17:01:52
2013-03-24T17:15:12
null
0
0
null
null
null
null
GB18030
Java
false
false
442
java
package com.zsm.example; class Sum{ public static void main(String[] args){ double sum=0; double fenZi=2.0, fenMu=1.0; //初始的分子 (fenZi)=2,分母(fenMu)=1 for(int i=1; i<=20; i++){ sum += fenZi / fenMu ; fenMu = fenZi; //下一项的分母 = 上一项的分子 fenZi += fenMu; //下一项的分子 = 上一项的分子加分母 } System.out.println("sum= " + sum); } }
[ "githup.lee@gmail.com" ]
githup.lee@gmail.com
49b55d4dca2eae9230cc7e14112b050fc0f1773c
74827bd4e7a0d0ac0de32cc6322f993f257ea088
/Pensione_Prog_BD/src/PensioneGrafica/CancAnimale.java
38fffb77a682199ba61ae171c2046e06f522bf52
[]
no_license
AngelaUrsi/PensioneAnimali
16f8dbe852f4c55b76bf67a20a2ae69a3547bfa3
845c67c0957dd49748daf8245fb0718284b9b365
refs/heads/master
2021-06-20T15:01:26.793176
2021-01-28T09:31:16
2021-01-28T09:31:16
157,995,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,771
java
package PensioneGrafica; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JButton; import javax.swing.JTextField; import fileDao.CancellazioneAnimale; public class CancAnimale implements ActionListener{ private JFrame frame; private JTextField textMC; private JTextField textCF; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { CancAnimale window = new CancAnimale(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public CancAnimale() { } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 136, 190); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.getContentPane().add(panel, BorderLayout.CENTER); JLabel lblMC = new JLabel("Microchip"); panel.add(lblMC); textMC = new JTextField(); panel.add(textMC); textMC.setColumns(10); JLabel lblCF = new JLabel("Codice Fiscale"); panel.add(lblCF); textCF = new JTextField(); panel.add(textCF); textCF.setColumns(10); JButton btnCancellaAnimale = new JButton("Cancella Animale"); btnCancellaAnimale.addActionListener(new CancellazioneAnimale(textMC, textCF)); panel.add(btnCancellaAnimale); this.frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { initialize(); } }
[ "angelaursi@virgilio.it" ]
angelaursi@virgilio.it
96371cef533c8d0f0c145b76eae8c36f542596e5
e88d288f1e438ab90d7202dcf719ac2859214ed2
/kzuo/src/main/java/com/example/kzuo/Application/application.java
ac72e7da8135d80b4701f56706955b7c2ae01a91
[]
no_license
shidongd/956
6044441e24328131419862a4c9aa6e2ad001f276
eb1c2b497b191e9f864e26f08c13ff926d15199b
refs/heads/master
2021-09-08T04:46:15.263889
2018-03-07T07:21:12
2018-03-07T07:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package com.example.kzuo.Application; import android.app.Application; import com.example.kao.DaoMaster; import com.example.kao.DaoSession; public class application extends Application { public static application application; private DaoSession daoSession; private static application application() { return application; } @Override public void onCreate() { super.onCreate(); application = this; DaoMaster.DevOpenHelper mast = new DaoMaster.DevOpenHelper(this, "stu.db"); DaoMaster daoMaster = new DaoMaster(mast.getWritableDatabase()); daoSession = daoMaster.newSession(); } public DaoSession getdaoSession() { return daoSession; } }
[ "614935053@qq.com" ]
614935053@qq.com
c2df770ca425e5877167a6d7e3e5d01e686a8051
261bb9f006737976aee730654f5052a7fc2ad5fd
/tkSystem/src/main/java/com/tkSystem/dao/mapper/TkApplyMapper.java
93c9371e99c4d43886bf9e6812c4938d3dd52282
[]
no_license
1emanresu/tkSystem
00d8aad9ec3e8965c5874e053b3814c9700a5ca0
35dc100d3da9eef13eaffc30118faefa0200f357
refs/heads/master
2020-03-11T01:52:41.046662
2018-09-14T12:52:54
2018-09-14T12:52:54
129,704,058
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.tkSystem.dao.mapper; import com.tkSystem.dao.entity.TkApply; public interface TkApplyMapper { int deleteByPrimaryKey(String tkApplyId); int insert(TkApply record); int insertSelective(TkApply record); TkApply selectByPrimaryKey(String tkApplyId); int updateByPrimaryKeySelective(TkApply record); int updateByPrimaryKey(TkApply record); }
[ "13549349203@163.com" ]
13549349203@163.com
71a37873bcfb3d864897ed95d9739cdc470a48ed
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/lucene-solr/2017/12/TimeRoutedAliasUpdateProcessorTest.java
f7f200f58ae6f8ef77bad00da33de97e07ce2ec5
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
12,254
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.solr.update.processor; import java.io.IOException; import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.function.UnaryOperator; import org.apache.lucene.util.IOUtils; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.request.ConfigSetAdminRequest; import org.apache.solr.client.solrj.request.V2Request; import org.apache.solr.client.solrj.response.FieldStatsInfo; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.UpdateResponse; import org.apache.solr.cloud.SolrCloudTestCase; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.cloud.Aliases; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.util.NamedList; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.response.SolrQueryResponse; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class TimeRoutedAliasUpdateProcessorTest extends SolrCloudTestCase { static final String configName = "timeConfig"; static final String alias = "myalias"; static final String timeField = "timestamp"; static final String intField = "integer_i"; static SolrClient solrClient; private int lastDocId = 0; private int numDocsDeletedOrFailed = 0; @BeforeClass public static void setupCluster() throws Exception { configureCluster(2).configure(); solrClient = getCloudSolrClient(cluster); } @AfterClass public static void finish() throws Exception { IOUtils.close(solrClient); } @Test public void test() throws Exception { // First create a config using REST API. To do this, we create a collection with the name of the eventual config. // We configure it, and ultimately delete it the collection, leaving a config with the same name behind. // Then when we create the "real" collections referencing this config. CollectionAdminRequest.createCollection(configName, 1, 1).process(solrClient); // manipulate the config... checkNoError(solrClient.request(new V2Request.Builder("/collections/" + configName + "/config") .withMethod(SolrRequest.METHOD.POST) .withPayload("{" + " 'set-user-property' : {'timePartitionAliasName':'" + alias + "'}," + // no data driven " 'set-user-property' : {'update.autoCreateFields':false}," + // no data driven " 'add-updateprocessor' : {" + " 'name':'tolerant', 'class':'solr.TolerantUpdateProcessorFactory'" + " }," + " 'add-updateprocessor' : {" + // for testing " 'name':'inc', 'class':'" + IncrementURPFactory.class.getName() + "'," + " 'fieldName':'" + intField + "'" + " }," + "}").build())); checkNoError(solrClient.request(new V2Request.Builder("/collections/" + configName + "/config/params") .withMethod(SolrRequest.METHOD.POST) .withPayload("{" + " 'set' : {" + " '_UPDATE' : {'processor':'inc,tolerant'}" + " }" + "}").build())); CollectionAdminRequest.deleteCollection(configName).process(solrClient); // start with one collection and an alias for it final String col23rd = alias + "_2017-10-23"; CollectionAdminRequest.createCollection(col23rd, configName, 1, 1) .withProperty(TimeRoutedAliasUpdateProcessor.TIME_PARTITION_ALIAS_NAME_CORE_PROP, alias) .process(solrClient); assertEquals("We only expect 2 configSets", Arrays.asList("_default", configName), new ConfigSetAdminRequest.List().process(solrClient).getConfigSets()); CollectionAdminRequest.createAlias(alias, col23rd).process(solrClient); //TODO use SOLR-11617 client API to set alias metadata final ZkStateReader zkStateReader = cluster.getSolrClient().getZkStateReader(); UnaryOperator<Aliases> op = a -> a.cloneWithCollectionAliasMetadata(alias, TimeRoutedAliasUpdateProcessor.ROUTER_FIELD_METADATA, timeField); zkStateReader.aliasesHolder.applyModificationAndExportToZk(op); // now we index a document solrClient.add(alias, newDoc(Instant.parse("2017-10-23T00:00:00Z"))); solrClient.commit(alias); //assertDocRoutedToCol(lastDocId, col23rd); assertInvariants(); // a document that is too old (throws exception... if we have a TolerantUpdateProcessor then we see it there) try { final UpdateResponse resp = solrClient.add(alias, newDoc(Instant.parse("2017-10-01T00:00:00Z"))); final Object errors = resp.getResponseHeader().get("errors"); assertTrue(errors != null && errors.toString().contains("couldn't be routed")); } catch (SolrException e) { assertTrue(e.getMessage().contains("couldn't be routed")); } numDocsDeletedOrFailed++; // add another collection, add to alias (soonest comes first) final String col24th = alias + "_2017-10-24"; CollectionAdminRequest.createCollection(col24th, configName, 2, 2) // more shards and replicas now .setMaxShardsPerNode(2) .withProperty("timePartitionAliasName", alias) .process(solrClient); CollectionAdminRequest.createAlias(alias, col24th + "," + col23rd).process(solrClient); // index 3 documents in a random fashion addDocsAndCommit( newDoc(Instant.parse("2017-10-23T00:00:00Z")), newDoc(Instant.parse("2017-10-24T01:00:00Z")), newDoc(Instant.parse("2017-10-24T02:00:00Z")) ); assertInvariants(); // assert that the IncrementURP has updated all '0' to '1' final SolrDocumentList checkIncResults = solrClient.query(alias, params("q", "NOT " + intField + ":1")).getResults(); assertEquals(checkIncResults.toString(), 0, checkIncResults.getNumFound()); //delete a random document id; ensure we don't find it int idToDelete = 1 + random().nextInt(lastDocId); if (idToDelete == 2) { // #2 didn't make it idToDelete++; } solrClient.deleteById(alias, Integer.toString(idToDelete)); solrClient.commit(alias); numDocsDeletedOrFailed++; assertInvariants(); } private void checkNoError(NamedList<Object> response) { Object errors = response.get("errorMessages"); assertNull("" + errors, errors); } /** Adds these documents and commits, returning when they are committed. * We randomly go about this in different ways. */ private void addDocsAndCommit(SolrInputDocument... solrInputDocuments) throws Exception { // we assume these are not old docs! // this is a list of the collections & the alias name. Use to pick randomly where to send. // (it doesn't matter where we send docs since the alias is honored at the URP level) List<String> collections = new ArrayList<>(); collections.add(alias); collections.addAll(new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias)); int commitWithin = random().nextBoolean() ? -1 : 500; // if -1, we commit explicitly instead int numDocsBefore = queryNumDocs(); if (random().nextBoolean()) { // send in separate requests for (SolrInputDocument solrInputDocument : solrInputDocuments) { String col = collections.get(random().nextInt(collections.size())); solrClient.add(col, solrInputDocument, commitWithin); } } else { // send in a batch. String col = collections.get(random().nextInt(collections.size())); solrClient.add(col, Arrays.asList(solrInputDocuments), commitWithin); } String col = collections.get(random().nextInt(collections.size())); if (commitWithin == -1) { solrClient.commit(col); } else { // check that it all got committed eventually int numDocs = queryNumDocs(); if (numDocs == numDocsBefore + solrInputDocuments.length) { System.err.println("Docs committed sooner than expected. Bug or slow test env?"); return; } // wait until it's committed, plus some play time for commit to become visible Thread.sleep(commitWithin + 200); numDocs = queryNumDocs(); assertEquals("not committed. Bug or a slow test?", numDocsBefore + solrInputDocuments.length, numDocs); } } private int queryNumDocs() throws SolrServerException, IOException { return (int) solrClient.query(alias, params("q", "*:*", "rows", "0")).getResults().getNumFound(); } private void assertInvariants() throws IOException, SolrServerException { final int expectNumFound = lastDocId - numDocsDeletedOrFailed; //lastDocId is effectively # generated docs final List<String> cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assert !cols.isEmpty(); int totalNumFound = 0; Instant colEndInstant = null; // exclusive end for (String col : cols) { final Instant colStartInstant = TimeRoutedAliasUpdateProcessor.parseInstantFromCollectionName(alias, col); //TODO do this in parallel threads final QueryResponse colStatsResp = solrClient.query(col, params( "q", "*:*", "rows", "0", "stats", "true", "stats.field", timeField)); long numFound = colStatsResp.getResults().getNumFound(); if (numFound > 0) { totalNumFound += numFound; final FieldStatsInfo timestampStats = colStatsResp.getFieldStatsInfo().get(timeField); assertTrue(colStartInstant.toEpochMilli() <= ((Date)timestampStats.getMin()).getTime()); if (colEndInstant != null) { assertTrue(colEndInstant.toEpochMilli() > ((Date)timestampStats.getMax()).getTime()); } } colEndInstant = colStartInstant; // next older segment will max out at our current start time } assertEquals(expectNumFound, totalNumFound); } private SolrInputDocument newDoc(Instant timestamp) { return sdoc("id", Integer.toString(++lastDocId), timeField, timestamp.toString(), intField, "0"); // always 0 } @Test public void testParse() { assertEquals(Instant.parse("2017-10-02T03:04:05Z"), TimeRoutedAliasUpdateProcessor.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03_04_05")); assertEquals(Instant.parse("2017-10-02T03:04:00Z"), TimeRoutedAliasUpdateProcessor.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03_04")); assertEquals(Instant.parse("2017-10-02T03:00:00Z"), TimeRoutedAliasUpdateProcessor.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03")); assertEquals(Instant.parse("2017-10-02T00:00:00Z"), TimeRoutedAliasUpdateProcessor.parseInstantFromCollectionName(alias, alias + "_2017-10-02")); } public static class IncrementURPFactory extends FieldMutatingUpdateProcessorFactory { @Override public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) { return FieldValueMutatingUpdateProcessor.valueMutator( getSelector(), next, (src) -> Integer.valueOf(src.toString()) + 1); } } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
f7f3ed1143491c108b1a1c643b38004b61f8ba54
56345887f87495c458a80373002159dbbbd7717f
/example/src/main/java/com/alibaba/otter/canal/example/db/MysqlLoadLauncher.java
b99361060bf849926c633a7a1fb30da9a73fd8d6
[ "Apache-2.0" ]
permissive
cainiao22/canal-bigdata
724199c61632e98b43797d4fd276abcba7e426fb
a88362535faeda5f846a8f147d341f8d22ffd2e4
refs/heads/master
2022-12-26T16:59:50.256698
2018-12-05T07:27:17
2018-12-05T07:27:17
214,317,447
1
0
Apache-2.0
2022-12-14T20:35:10
2019-10-11T01:30:07
Java
UTF-8
Java
false
false
1,289
java
package com.alibaba.otter.canal.example.db; import com.alibaba.otter.canal.example.db.mysql.MysqlClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MysqlLoadLauncher { private static final Logger logger = LoggerFactory.getLogger(MysqlLoadLauncher.class); public static void main(String[] args) { try { logger.info("## start the canal mysql client."); final MysqlClient client = ServiceLocator.getMysqlClient(); logger.info("## the canal consumer is running now ......"); client.start(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { logger.info("## stop the canal consumer"); client.stop(); } catch (Throwable e) { logger.warn("##something goes wrong when stopping canal consumer:\n{}", e); } finally { logger.info("## canal consumer is down."); } } }); } catch (Throwable e) { logger.error("## Something goes wrong when starting up the canal consumer:\n{}", e); System.exit(0); } } }
[ "yanpengfei@qding.me" ]
yanpengfei@qding.me
9c8ecb9cc92d2d30224d8a0e13bc769dcb861be0
24afaa2fe6c70acffb8aad4b5354ab9bfdd1a472
/app/src/main/java/com/ebs/ecount/parts_physical_inventory/equipment_inventory_activity.java
6e00968a949735f6682a81af878fc5f91512a818
[]
no_license
abdullaabdulla422/eCount
8511586c29a76b27d24ef3dcb13cc82014e0d010
94302ecf04015ef413812d42a8502d84e53b4a45
refs/heads/master
2022-07-03T19:04:15.232454
2019-05-16T11:01:38
2019-05-16T11:01:38
264,227,197
0
0
null
null
null
null
UTF-8
Java
false
false
440,291
java
package com.ebs.ecount.parts_physical_inventory; import android.Manifest; import android.animation.Animator; import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AutoCompleteTextView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.cognex.dataman.sdk.ConnectionState; import com.cognex.mobile.barcode.sdk.ReadResult; import com.cognex.mobile.barcode.sdk.ReadResults; import com.cognex.mobile.barcode.sdk.ReaderDevice; import com.cognex.mobile.barcode.sdk.ReaderDevice.OnConnectionCompletedListener; import com.cognex.mobile.barcode.sdk.ReaderDevice.ReaderDeviceListener; import com.ebs.ecount.R; import com.ebs.ecount.initial.Dashboard; import com.ebs.ecount.objects.GetAttachments; import com.ebs.ecount.objects.GetDealerBranch; import com.ebs.ecount.objects.GetEquipmentBranch; import com.ebs.ecount.objects.GetEquipmentList; import com.ebs.ecount.objects.GetEquipmentProcessid; import com.ebs.ecount.objects.LoginObject; import com.ebs.ecount.uidesigns.ProgressBar; import com.ebs.ecount.uidesigns.SimpleScannerActivity; import com.ebs.ecount.uidesigns.SweetAlertDialog; import com.ebs.ecount.utils.Sessiondata; import com.ebs.ecount.webutils.WebServiceConsumer; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by techunity on 21/11/16. */ public class equipment_inventory_activity extends AppCompatActivity implements OnConnectionCompletedListener, ReaderDeviceListener { private static final int ZBAR_CAMERA_PERMISSION = 1; private static final DeviceType[] deviceTypeValues = DeviceType.values(); public static ReaderDevice readerDevice; public static boolean isDevicePicked = false; public static boolean dialogAppeared = false; public static String selectedDevice = ""; public static boolean fragmentActive = false; Button back, btn_submit, filter_btn, filter_btn_1, refresh, btn_uncounted, btn_counted; ImageView process_id, equpiment_id, serial_scanner; Dialog mDialogattachlist = null; ListView equp_list; Dialog mDialoglist = null; String unit_ID; Dialog mDialognodata = null; Boolean sweetalrtsuccess = true; ValueAnimator mAnimator, mAnimator_1; ArrayList<GetEquipmentProcessid> equip_processid; ArrayList<GetAttachments> attachments_list; ArrayList<GetEquipmentList> equip_list; ArrayList<GetAttachments> attachment; GetEquipmentBranch equp_branch; GetEquipmentBranch equp_branch_chk; String uncountequp, update_equip, SetEquipmentDetails; String str_model, str_make, str_serial; LinearLayout filter_layout, filter_layout_1; ImageView filter_arrow, filter_arrow_1; int detach_pos; EditText equp_id, model, serial, make; Boolean make_model_TAG = false; Typeface header_face, txt_face; TextView txt_header; LoginObject loginObject = null; AutoCompleteTextView processid; AutoCompleteTextView description; String process_ids; String user_token, user, branch; String transfer_branch; String process_list = ""; String equipid_text = ""; String model_text = ""; String model_length_txt = ""; String serial_text = ""; int Session = 0; String make_text = ""; String process_id_text = ""; String description_text = ""; String sub_processid = ""; String usertoken, equipid; String DetachEquipment; String scan_processid; String scan_equip; String scan_model; String scan_make; String scan_serial; int scanne_value = 0; int msg_show = 0; // View footer; Boolean sweetalrt = true; Boolean sweetalrt_notmatch = true; Boolean sweetalrt_count = true; Boolean sweetalrt_new = true; Boolean sweetalrts1 = true, sweetalrts3 = true; Boolean sweetdetach = true; Boolean sweetbranch = true; Boolean sweetnobranch = true; Boolean autoCollapse = false; Boolean status_check = false; SweetAlertDialog sweetalt, dialogmsg, dialogdetach, dialogbranch, dialognobranch, alert_count, alert_chk, sweetalt_list, dialog_notmatch; ArrayList<String> selected_attach; // LinearLayout submit_layout; String equp_ids, models, makes, serials; String equpbranch, loginbranch; int call_setEquip_D = 0; int return_once = 0; AutoCompleteTextView branch_no; TextView txt_br; ImageView img_branch; ArrayList<GetDealerBranch> dealerbranch; ArrayList<GetDealerBranch> branchlist; Dialog Dialog; CustomAdapter_Branch adapter_branch; String branch_name = ""; Boolean Sweetalrt_list = true; SweetAlertDialog Sweetalt_list; int alert = 0; int scannedtype = 0; String uncount_equipid, uncount_branch; int ucount_processid; Drawable grey_drawable, blue_drawable; Boolean handleasync = true; private CustomAdapter adapter; private Class<?> mClss; private Context mContext; public static DeviceType deviceTypeFromInt(int i) { return deviceTypeValues[i]; } @SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_equp_inventory); header_face = Typeface.createFromAsset(getAssets(), "fonts/helr65w.ttf"); txt_face = Typeface.createFromAsset(getAssets(), "fonts/helr45w.ttf"); mContext = this; equip_list = new ArrayList<GetEquipmentList>(); txt_br = (TextView) findViewById(R.id.txt_branch); branch_no = (AutoCompleteTextView) findViewById(R.id.branch_no); img_branch = (ImageView) findViewById(R.id.branch_list); txt_br.setTypeface(header_face); branch_no.setEnabled(false); branch_no.setTypeface(txt_face); Log.d("GlobalVariables_Main ", "0_UnCounted" + " 1_Counted"); Log.d("GlobalVariables_Main ", "" + GlobalVariables.showerrormsg + " checkbtn_load " + GlobalVariables.checkbtn_load); img_branch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkInternetConenction()) { new AsyncGetDealerBranch().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); back = (Button) findViewById(R.id.back); refresh = (Button) findViewById(R.id.refresh); btn_counted = (Button) findViewById(R.id.counted); btn_uncounted = (Button) findViewById(R.id.uncounted); btn_submit = (Button) findViewById(R.id.btn_submit); // btn_handwrite = (Button) findViewById(R.id.hand_writeID); selected_attach = new ArrayList<>(); txt_header = (TextView) findViewById(R.id.txt_header); /*footer = findViewById(R.id.view);*/ process_id = (ImageView) findViewById(R.id.process_id); equpiment_id = (ImageView) findViewById(R.id.equpiment_id); equp_list = (ListView) findViewById(R.id.equp_list); serial_scanner = (ImageView) findViewById(R.id.serial_scanner); filter_arrow = (ImageView) findViewById(R.id.filter_arrow); filter_arrow_1 = (ImageView) findViewById(R.id.filter_arrow_1); filter_btn = (Button) findViewById(R.id.filter_btn); filter_btn_1 = (Button) findViewById(R.id.filter_btn_1); equp_id = (EditText) findViewById(R.id.equp_id); model = (EditText) findViewById(R.id.model); serial = (EditText) findViewById(R.id.serial_no); make = (EditText) findViewById(R.id.make); // submit_layout = (LinearLayout) findViewById(R.id.submit_layout); equp_id.setEnabled(true); model.setEnabled(true); serial.setEnabled(true); make.setEnabled(true); equpiment_id.setEnabled(true); serial_scanner.setEnabled(true); processid = (AutoCompleteTextView) findViewById(R.id.processId); description = (AutoCompleteTextView) findViewById(R.id.description); process_id.setTag(""); if (process_list.equals("")) { process_list = Sessiondata.getInstance().getProcess_list(); Log.d("getProcess_list", process_list); } final TextView txt_processid = (TextView) findViewById(R.id.txt_processid); TextView txt_equipmentid = (TextView) findViewById(R.id.txt_equipmentid); // TextView txt_model = (TextView) findViewById(R.id.txt_model); TextView txt_serialno = (TextView) findViewById(R.id.txt_serialno); TextView txt_make = (TextView) findViewById(R.id.txt_make); TextView text_description = (TextView) findViewById(R.id.text_description); txt_processid.setTypeface(header_face); text_description.setTypeface(header_face); // txt_model.setTypeface(header_face); txt_equipmentid.setTypeface(header_face); txt_serialno.setTypeface(header_face); txt_make.setTypeface(header_face); btn_submit.setTypeface(header_face); txt_header.setTypeface(header_face); filter_btn.setTypeface(header_face); filter_btn_1.setTypeface(header_face); back.setTypeface(txt_face); processid.setTypeface(txt_face); equp_id.setTypeface(txt_face); make.setTypeface(txt_face); model.setTypeface(txt_face); serial.setTypeface(txt_face); refresh.setTypeface(header_face); btn_counted.setTypeface(header_face); btn_uncounted.setTypeface(header_face); // btn_handwrite.setTypeface(header_face); grey_drawable = ContextCompat.getDrawable(mContext, R.drawable.round_grey_corner_label).mutate(); blue_drawable = ContextCompat.getDrawable(mContext, R.drawable.round_corner_label).mutate(); processid.setEnabled(true); btn_submit.setEnabled(true); // submit_layout.setEnabled(false); btn_submit.setVisibility(View.VISIBLE); // footer.setVisibility(View.GONE); /* submit_layout.setVisibility(View.GONE); */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } Bundle equpid = getIntent().getExtras(); if (equpid != null) { String equp_value = equpid.getString("value1"); if (Sessiondata.getInstance().getInventory_scanner().toString().equalsIgnoreCase("start")) { scannedtype = 2; handleasync = true; Log.d("OnReceive", "equp_id_scannedtype" + scannedtype); alert = 1; Sessiondata.getInstance().setUnitId(equp_value); } } Bundle bundleendbin = getIntent().getExtras(); if (bundleendbin != null) { String endbin = bundleendbin.getString("value2"); if (Sessiondata.getInstance().getInventory_scanner().toString().equalsIgnoreCase("end")) { scannedtype = 2; handleasync = true; Log.d("OnReceive", "serial_scannedtype" + scannedtype); Sessiondata.getInstance().setSerial(endbin); } } Bundle bundlemodel = getIntent().getExtras(); if (bundlemodel != null) { String model = bundlemodel.getString("value3"); if (Sessiondata.getInstance().getInventory_scanner().toString().equalsIgnoreCase("model")) { scannedtype = 2; handleasync = true; Log.d("OnReceive", "model_scannedtype" + scannedtype); Sessiondata.getInstance().setModel(model); } } Bundle bundlemake = getIntent().getExtras(); if (bundlemake != null) { String value4 = bundlemake.getString("value4"); if (Sessiondata.getInstance().getInventory_scanner().toString().equalsIgnoreCase("make")) { scannedtype = 2; handleasync = true; Log.d("OnReceive", "make_scannedtype" + scannedtype); String[] make_model = new String[0]; if (value4 != null && value4.length() != 0) { make_model = bundlemake.getString("value4").split("-"); } if (make_model != null && make_model.length > 0) { Log.d("make_model", "===" + make_model[0] + "-" + make_model[1]); Sessiondata.getInstance().setMake(make_model[0]); Sessiondata.getInstance().setModel(make_model[1]); Sessiondata.getInstance().setMake_model(make_model[0] + "-" + make_model[1]); } } } Sessiondata.getInstance().getWalkaroundgeneralimages().clear(); Sessiondata.getInstance().getAttachedFilesData().clear(); Sessiondata.getInstance().setEqup_scanner(0); Sessiondata.getInstance().setScanner_inventory(6); Sessiondata.getInstance().setInventory_scanner("start"); processid.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "processId_scannedtype" + scannedtype); Log.d("processId", "select"); return false; } }); equp_id.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "equp_id_scannedtype :" + scannedtype); alert = 0; Log.d("equp_id", "select"); Sessiondata.getInstance().setEqup_scanner(0); Sessiondata.getInstance().setScanner_inventory(6); Sessiondata.getInstance().setInventory_scanner("start"); return false; } }); model.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "model_scannedtype" + scannedtype); Log.d("model", "select"); Sessiondata.getInstance().setEqup_scanner(2); Sessiondata.getInstance().setScanner_inventory(8); Sessiondata.getInstance().setInventory_scanner("model"); return false; } }); make.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "make_scannedtype" + scannedtype); Log.d("make", "select"); Sessiondata.getInstance().setEqup_scanner(1); Sessiondata.getInstance().setScanner_inventory(9); Sessiondata.getInstance().setInventory_scanner("make"); return false; } }); serial.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "serial_scannedtype" + scannedtype); // Log.d("serial", "select"); // Sessiondata.getInstance().setEqup_scanner(3); // Sessiondata.getInstance().setScanner_inventory(7); // Sessiondata.getInstance().setInventory_scanner("end"); return false; } }); refresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { equp_id.setText(""); model.setText(""); make.setText(""); serial.setText(""); model_length_txt = ""; make_text = ""; equp_id.requestFocus(); handleasync = true; String branch = branch_no.getText().toString(); if (branch != null) { if (branch.isEmpty() || branch.equals("")) { process_list = ""; } } Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); Sessiondata.getInstance().setMake_model(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } } }); /* btn_handwrite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String handwrite_proc = split_string(process_list); if (handwrite_proc.equalsIgnoreCase("")) { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Please enter the PID") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } } });*/ btn_counted.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String equi_proc = split_string(process_list); if (equi_proc.toString().equalsIgnoreCase("")) { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Please enter the PID") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } else { if (checkInternetConenction()) { alert = 0; GlobalVariables.checkbtn_load = 1; process_ids = split_string(process_list); equipid_text = equp_id.getText().toString(); model_text = model.getText().toString(); make_text = make.getText().toString(); serial_text = serial.getText().toString(); equip_list = new ArrayList<GetEquipmentList>(); handleasync = true; new AsyncGetEquipmentListCounted().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }); btn_uncounted.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String equi_proc = split_string(process_list); if (equi_proc.toString().equalsIgnoreCase("")) { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Please enter the PID") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } else { if (checkInternetConenction()) { alert = 0; handleasync = true; GlobalVariables.checkbtn_load = 0; process_ids = split_string(process_list); equipid_text = equp_id.getText().toString(); model_text = model.getText().toString(); make_text = make.getText().toString(); serial_text = serial.getText().toString(); equip_list = new ArrayList<GetEquipmentList>(); new AsyncGetEquipmentListUnCounted().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }); btn_submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); if (process_ids.equalsIgnoreCase("")) { if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Please enter the PID") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setMake_model(scan_make); String[] make_model = scan_make.split("-"); if (make_model != null) { scan_make = make_model[0]; if (make_model.length > 1) { scan_model = make_model[1]; } } Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); sub_processid = split_string(process_list); int processId = Integer.parseInt(sub_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); } } }); equpiment_id.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { scanne_value = 1; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); String[] make_model = scan_make.split("-"); String temp_make = null; if (make_model != null && make_model.length != 0) { temp_make = make_model[0]; if (make_model.length > 1) scan_model = make_model[1]; } Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); Sessiondata.getInstance().setMake(temp_make); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake_model(scan_make); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setScanner_partreceipt(0); Sessiondata.getInstance().setScanner_partreceiving(0); Sessiondata.getInstance().setScanner_replace(0); Sessiondata.getInstance().setScanner_counting1(0); Sessiondata.getInstance().setScanner_counting2(0); Sessiondata.getInstance().setScanner_partnumber(0); Sessiondata.getInstance().setScanner_hwstartbin(0); Sessiondata.getInstance().setScanner_hwendbin(0); launchActivity(SimpleScannerActivity.class); } }); serial_scanner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { scannedtype = 1; handleasync = true; Log.d("OnTouch", "serial_scannedtype" + scannedtype); Log.d("serial", "select"); Sessiondata.getInstance().setEqup_scanner(3); Sessiondata.getInstance().setScanner_inventory(7); Sessiondata.getInstance().setInventory_scanner("end"); // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); // scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); String[] make_model = scan_make.split("-"); String temp_make = null; if (make_model != null && make_model.length != 0) { temp_make = make_model[0]; if (make_model.length > 1) scan_model = make_model[1]; } Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); Sessiondata.getInstance().setMake(temp_make); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setMake_model(scan_make); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setScanner_partreceipt(0); Sessiondata.getInstance().setScanner_partreceiving(0); Sessiondata.getInstance().setScanner_replace(0); Sessiondata.getInstance().setScanner_counting1(0); Sessiondata.getInstance().setScanner_counting2(0); Sessiondata.getInstance().setScanner_partnumber(0); Sessiondata.getInstance().setScanner_hwstartbin(0); Sessiondata.getInstance().setScanner_hwendbin(0); launchActivity(SimpleScannerActivity.class); } }); // if(!selectedDevice.equals("MX Scanner")){ equp_id.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(final Editable s) { // if (!selectedDevice.equals("MX Scanner")) { new Handler().postDelayed(new Runnable() { @Override public void run() { equipid_text = s.toString(); String ss = s.toString(); if (!ss.equals(ss.toUpperCase())) { ss = ss.toUpperCase(); equp_id.setText(ss); } equp_id.setSelection(equp_id.getText().length()); String equi_proc = split_string(process_list); if (equi_proc.toString().equalsIgnoreCase("")) { } else { if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 250); } // } }); model.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(final CharSequence s, int start, int before, int count) { new Handler().postDelayed(new Runnable() { @Override public void run() { model_text = s.toString(); String model_proc = split_string(process_list); if (model_proc.toString().equalsIgnoreCase("")) { } else { if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 750); } @Override public void afterTextChanged(Editable s) { String ss = s.toString(); if (!ss.equals(ss.toUpperCase())) { ss = ss.toUpperCase(); model.setText(ss); } model.setSelection(model.getText().length()); } }); serial.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(final CharSequence s, int start, int before, int count) { new Handler().postDelayed(new Runnable() { @Override public void run() { serial_text = s.toString(); String serial_proc = split_string(process_list); if (serial_proc.toString().equalsIgnoreCase("")) { } else { if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 750); } @Override public void afterTextChanged(Editable s) { String ss = s.toString(); if (!ss.equals(ss.toUpperCase())) { ss = ss.toUpperCase(); serial.setText(ss); } serial.setSelection(serial.getText().length()); } }); // make.setFilters(new InputFilter[]{new InputFilter.AllCaps()}); make.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(final CharSequence s, int start, int before, int count) { new Handler().postDelayed(new Runnable() { @Override public void run() { // make_text = s.toString(); String make_proc = split_string(process_list); String temp_make_text = s.toString(); if (make_proc.equalsIgnoreCase("")) { } else { if (!temp_make_text.contains("-")) { if (temp_make_text.length() == 3) { temp_make_text = temp_make_text + "-"; make.setText(temp_make_text); make.setSelection(make.getText().length()); } else { make_text = temp_make_text; } } if (temp_make_text.contains("-")) { String[] make_model = temp_make_text.split("-"); if (make_model != null && make_model.length != 0) { make_text = make_model[0]; if (make_model.length > 1) model_text = make_model[1]; if (model_text.length() == 12) { model_length_txt = make_text + "-" + model_text; Log.d("model_text", "Success"); } else if (model_text.length() >= 12) { make.setText(model_length_txt); } else if (model_text.length() <= 12) { model_length_txt = make.getText().toString(); } } } if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 750); } @Override public void afterTextChanged(Editable s) { // make.setText(make_text); String ss = s.toString(); if (!ss.equals(ss.toUpperCase())) { ss = ss.toUpperCase(); make.setText(ss); } make.setSelection(make.getText().length()); } }); processid.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(final Editable s) { new Handler().postDelayed(new Runnable() { @Override public void run() { process_id_text = s.toString(); String proce_proc = String.valueOf(split_string(process_list)); String[] s1 = proce_proc.split("-"); // process_ids = proce_proc; process_ids = s1[0].trim(); if (proce_proc.toString().isEmpty()) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equp_id.setText(""); model.setText(""); serial.setText(""); make.setText(""); Sessiondata.getInstance().setSub_process(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setUnitId(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } equip_list = new ArrayList<GetEquipmentList>(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 750); } }); equp_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @SuppressLint("LongLogTag") @Override public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { if (equip_list != null && equip_list.size() != 0) { detach_pos = position; Log.d("status_clk", "" + equip_list.get(position).getStatus().toString()); String equpstatuss = equip_list.get(position).getEqpstatus(); String status = equip_list.get(position).getStatus(); String Eqptblstatus = equip_list.get(position).getEqptblstatus(); String pid = split_string(process_list); Log.d("equpstatus_clk", "" + equpstatuss); equpbranch = equip_list.get(position).getBranch(); loginbranch = branch_no.getText().toString(); for (int ii = 0; ii < loginbranch.length(); ii++) { Character character = loginbranch.charAt(ii); if (character.toString().equals("-")) { loginbranch = loginbranch.substring(0, ii); Log.d("branch_trim", "" + loginbranch); break; } } Log.d("equpbranch_clk", "" + equpbranch); Log.d("loginbranch_clk", "" + loginbranch); // { if (equpstatuss.contains("Counted")) { final String equip = equip_list.get(position).getEquipid(); if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (sweetalrt_new) { sweetalrt_new = false; if (scannedtype == 2) { alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is Already Scanned!") .setCancelText("Ok") .setConfirmText("UnCount") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { uncount_equipid = equip_list.get(position).getEquipid(); uncount_branch = branch_no.getText().toString(); ucount_processid = Integer.parseInt(split_string(process_list)); new AsyncUnCountEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } else { alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Do you want to uncount this equipment " + equip + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { uncount_equipid = equip_list.get(position).getEquipid(); uncount_branch = branch_no.getText().toString(); ucount_processid = Integer.parseInt(split_string(process_list)); new AsyncUnCountEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (sweetalrt_new) { sweetalrt_new = false; if (scannedtype == 2) { alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is Already Scanned!") .setCancelText("Ok") .setConfirmText("UnCount") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { uncount_equipid = equip_list.get(position).getEquipid(); uncount_branch = branch_no.getText().toString(); ucount_processid = Integer.parseInt(split_string(process_list)); new AsyncUnCountEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } else { alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Do you want to uncount this equipment " + equip + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { uncount_equipid = equip_list.get(position).getEquipid(); uncount_branch = branch_no.getText().toString(); ucount_processid = Integer.parseInt(split_string(process_list)); new AsyncUnCountEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } } } else { int Scaned_Type = equip_list.get(position).getScannedtype(); Log.d("Scaned_Type", "" + equip_list.get(position).getScannedtype()); if (Scaned_Type == 2) { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is Already Scanned!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } else if (Scaned_Type == 1) { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is Already Entered!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } else { Log.d("status_clk", "" + equip_list.get(position).getStatus().toString()); String equpstatus = equip_list.get(position).getEqpstatus(); Log.d("equpstatus_clk", "" + equpstatus); equpbranch = equip_list.get(position).getBranch(); loginbranch = branch_no.getText().toString(); for (int ii = 0; ii < loginbranch.length(); ii++) { Character character = loginbranch.charAt(ii); if (character.toString().equals("-")) { loginbranch = loginbranch.substring(0, ii); Log.d("branch_trim", "" + loginbranch); break; } } Log.d("equpbranch_clk", "" + equpbranch); Log.d("loginbranch_clk", "" + loginbranch); if (equip_list.get(position).getStatus().toString().contains("AV") || equip_list.get(position).getStatus().toString().contains("av") || equip_list.get(position).getStatus().toString().contains("MA") || equip_list.get(position).getStatus().toString().contains("ma") || equip_list.get(position).getStatus().toString().contains("RE") || equip_list.get(position).getStatus().toString().contains("re")) { unit_ID = equip_list.get(position).getEquipid(); str_model = equip_list.get(position).getModel(); str_make = equip_list.get(position).getMfg(); str_serial = equip_list.get(position).getSerialno(); Log.d("unit_ID", "" + unit_ID); if (loginbranch.toString().equalsIgnoreCase(equpbranch)) { call_setEquip_D = 1; if (equpstatus.toString().contains("From Equip")) { if (sweetalrt_new) { sweetalrt_new = false; alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is not on PID, Would you like to add to PID and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } else if (equpstatus.contains("From Count")) { if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list ) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (checkInternetConenction()) { detach_pos = position; new AsyncGetAttachments_new().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (checkInternetConenction()) { detach_pos = position; new AsyncGetAttachments_new().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } else { call_setEquip_D = 0; if (equpstatus.toString().contains("From Equip")) { if (sweetbranch) { sweetbranch = false; dialogbranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment found in branch location " + equpbranch + ". Do you want to transfer to branch " + loginbranch + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; Sessiondata.getInstance().setTransfer_Equipment("T"); if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment_transfer().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogbranch.setCancelable(false); dialogbranch.show(); } } else if (equpstatus.toString().contains("From Count")) { if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (sweetbranch) { sweetbranch = false; dialogbranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment found in branch location " + equpbranch + ". Do you want to transfer to branch " + loginbranch + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; Sessiondata.getInstance().setTransfer_Equipment("T"); if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment_transfer().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogbranch.setCancelable(false); dialogbranch.show(); } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (sweetbranch) { sweetbranch = false; dialogbranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment found in branch location " + equpbranch + ". Do you want to transfer to branch " + loginbranch + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; Sessiondata.getInstance().setTransfer_Equipment("T"); if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment_transfer().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogbranch.setCancelable(false); dialogbranch.show(); } } } } Log.d("call_setEquip_D(AV,MA,RE)", "" + call_setEquip_D); } else { if (equip_list.get(position).getStatus().toString().contains("ON") || equip_list.get(position).getStatus().toString().contains("on")) { unit_ID = equip_list.get(position).getEquipid(); detach_pos = position; if (loginbranch.toString().equalsIgnoreCase(equpbranch)) { call_setEquip_D = 1; } else { call_setEquip_D = 0; } Log.d("call_setEquip_D(ON)", "" + call_setEquip_D); if (equpstatus.toString().contains("From Equip")) { if (sweetalrt_new) { sweetalrt_new = false; alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is not on PID, Would you like to add to PID and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } else if (equpstatus.toString().contains("From Count")) { if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is on Rent!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is on Rent!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } else if (equip_list.get(position).getStatus().toString().contains("SO") || equip_list.get(position).getStatus().toString().contains("so")) { unit_ID = equip_list.get(position).getEquipid(); detach_pos = position; call_setEquip_D = 1; if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Equipment is Sold! Do you want to count this Equipment# " + unit_ID + " ?")//Equipment is Sold. Do you want to count it? .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else if (equip_list.get(position).getStatus().toString().contains("DE") || equip_list.get(position).getStatus().toString().contains("de")) { if (loginbranch.toString().equalsIgnoreCase(equpbranch)) { call_setEquip_D = 1; } else { call_setEquip_D = 0; } Log.d("call_setEquip_D(DE)", "" + call_setEquip_D); unit_ID = equip_list.get(position).getEquipid(); detach_pos = position; if (equpstatus.toString().contains("From Equip")) { if (sweetalrt_new) { sweetalrt_new = false; alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is not on PID, Would you like to add to PID and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } else if (equpstatus.toString().contains("From Count")) { if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is on Demo!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is on Demo!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } else if (equip_list.get(position).getStatus().toString().contains("TR") || equip_list.get(position).getStatus().toString().contains("tr")) { if (loginbranch.toString().equalsIgnoreCase(equpbranch)) { call_setEquip_D = 1; } else { call_setEquip_D = 0; } Log.d("call_setEquip_D(TR)", "" + call_setEquip_D); unit_ID = equip_list.get(position).getEquipid(); detach_pos = position; if (equpstatus.toString().contains("From Equip")) { if (sweetalrt_new) { sweetalrt_new = false; alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is not on PID, Would you like to add to PID and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } else if (equpstatus.toString().contains("6")) { if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is in Transfer Status!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else if (equip_list.get(position).getStatus().toString().contains("PI") || equip_list.get(position).getStatus().toString().contains("pi")) { if (loginbranch.toString().equalsIgnoreCase(equpbranch)) { call_setEquip_D = 1; } else { call_setEquip_D = 0; } Log.d("call_setEquip_D(PI)", "" + call_setEquip_D); unit_ID = equip_list.get(position).getEquipid(); detach_pos = position; if (equpstatus.toString().contains("From Equip")) { if (sweetalrt_new) { sweetalrt_new = false; alert_chk = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Alert!") .setContentText("Equipment is not on PID, Would you like to add to PID and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_new = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_new = true; sDialog.dismiss(); } }); alert_chk.setCancelable(false); alert_chk.show(); } } else if (equpstatus.toString().contains("From Count")) { if (!Eqptblstatus.equals("") && !Eqptblstatus.contains(status)) { SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Status not match for this Process ID - " + process_list) .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.dismiss(); if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is in Pickup Status!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } }); sweetAlertDialog.setCancelable(false); sweetAlertDialog.show(); } else { if (sweetalrt) { sweetalrt = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Equipment is in Pickup Status!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt = true; sDialog.dismiss(); if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Info!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } } } } } } }); filter_layout = (LinearLayout) findViewById(R.id.filter_layout); filter_layout_1 = (LinearLayout) findViewById(R.id.filter_layout_1); ImageView img_back = (ImageView) findViewById(R.id.img_back); img_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ClearSession(); Intent myintent = new Intent(equipment_inventory_activity.this, Dashboard.class); startActivity(myintent); overridePendingTransition(R.anim.slide_left_to_right_enter, R.anim.slide_left_to_right_leave); } }); filter_layout.getViewTreeObserver().addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { filter_layout.getViewTreeObserver() .removeOnPreDrawListener(this); filter_layout.setVisibility(View.VISIBLE); final int widthSpec = View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED); final int heightSpec = View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); filter_layout.measure(widthSpec, heightSpec); mAnimator = slideAnimator(0, filter_layout.getMeasuredHeight()); return true; } }); filter_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (filter_layout.getVisibility() == View.VISIBLE) { collapse(); } else { expand(); } if (filter_arrow.getTag() != null && filter_arrow.getTag().toString().equals("filter_arrow")) { filter_arrow.setImageResource(R.drawable.down); filter_arrow.setTag("filter_down"); } else { filter_arrow.setImageResource(R.drawable.right); filter_arrow.setTag("filter_arrow"); } } }); filter_arrow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (filter_layout.getVisibility() == View.VISIBLE) { collapse(); } else { expand(); } if (filter_arrow.getTag() != null && filter_arrow.getTag().toString().equals("filter_arrow")) { filter_arrow.setImageResource(R.drawable.down); filter_arrow.setTag("filter_down"); } else { filter_arrow.setImageResource(R.drawable.right); filter_arrow.setTag("filter_arrow"); } } }); //Branch And ProcessId layout filter_layout_1.getViewTreeObserver().addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { filter_layout_1.getViewTreeObserver().removeOnPreDrawListener(this); filter_layout_1.setVisibility(View.VISIBLE); final int widthSpec = View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED); final int heightSpec = View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); filter_layout_1.measure(widthSpec, heightSpec); mAnimator_1 = slideAnimator_1(0, filter_layout_1.getMeasuredHeight()); return true; } }); filter_btn_1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (filter_layout_1.getVisibility() == View.VISIBLE) { collapse_1(); } else { expand_1(); } if (filter_arrow_1.getTag() != null && filter_arrow_1.getTag().toString().equals("filter_arrow")) { filter_arrow_1.setImageResource(R.drawable.down); filter_arrow_1.setTag("filter_down"); } else { filter_arrow_1.setImageResource(R.drawable.right); filter_arrow_1.setTag("filter_arrow"); } } }); filter_arrow_1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (filter_layout_1.getVisibility() == View.VISIBLE) { collapse_1(); } else { expand_1(); } if (filter_arrow_1.getTag() != null && filter_arrow_1.getTag().toString().equals("filter_arrow")) { filter_arrow_1.setImageResource(R.drawable.down); filter_arrow_1.setTag("filter_down"); } else { filter_arrow_1.setImageResource(R.drawable.right); filter_arrow_1.setTag("filter_arrow"); } } }); process_id.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String branch_names = branch_no.getText().toString(); if (!branch_names.isEmpty()) { if (checkInternetConenction()) { if (branch_name.isEmpty()) { branch_name = branch_no.getText().toString(); for (int ii = 0; ii < branch_name.length(); ii++) { Character character = branch_name.charAt(ii); if (character.toString().equals("-")) { branch_name = branch_name.substring(0, ii); Log.d("branch_trim", "" + branch_name); break; } } } handleasync = true; new AsyncGetEquipmentProcessid().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (Sweetalrt_list) { Sweetalrt_list = false; Sweetalt_list = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNINGMSG_TYPE) .setTitleText("Alert!") .setContentText("Please Choose the Branch before Select PID") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sweetalrt_list = true; sDialog.dismiss(); } }); Sweetalt_list.setCancelable(false); Sweetalt_list.show(); } } } }); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ClearSession(); Intent myintent = new Intent(equipment_inventory_activity.this, Dashboard.class); startActivity(myintent); overridePendingTransition(R.anim.slide_left_to_right_enter, R.anim.slide_left_to_right_leave); } }); } @Override protected void onStart() { super.onStart(); initDevice(); } @Override protected void onPause() { super.onPause(); if (readerDevice != null && readerDevice.getConnectionState() == ConnectionState.Connected) { readerDevice.disconnect(); } } private void initDevice() { equipment_inventory_activity.readerDevice = ReaderDevice.getMXDevice(mContext); readerDevice.startAvailabilityListening(); selectedDevice = "MX Scanner"; equipment_inventory_activity.readerDevice.setReaderDeviceListener(this); equipment_inventory_activity.readerDevice.enableImage(true); equipment_inventory_activity.readerDevice.connect(equipment_inventory_activity.this); } @Override public void onConnectionStateChanged(ReaderDevice reader) { if (reader.getConnectionState() == ConnectionState.Connected) { readerConnected(); } else if (reader.getConnectionState() == ConnectionState.Disconnected) { readerDisconnected(); } } @Override public void onReadResultReceived(ReaderDevice reader, ReadResults results) { if (results.getCount() > 0) { ReadResult result = results.getResultAt(0); if (result.isGoodRead()) { ReaderDevice.Symbology sym = result.getSymbology(); if (sym != null) { } else { } FinalResult(result.getReadString()); } else { } } } public void FinalResult(final String result) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { if (Sessiondata.getInstance().getScanner_inventory() == 6) { List<String> results = Arrays.asList(result.split(",")); if (results.size() == 1) { Sessiondata.getInstance().setUnitId(result); } else { Sessiondata.getInstance().setUnitId(results.get(Sessiondata.getInstance().getEqup_scanner())); } } else if (Sessiondata.getInstance().getScanner_inventory() == 7) { List<String> results = Arrays.asList(result.split(",")); if (results.size() == 1) { Sessiondata.getInstance().setSerial(result); } else { Log.d("Value_Postion", "" + Sessiondata.getInstance().getEqup_scanner()); Sessiondata.getInstance().setSerial(results.get(Sessiondata.getInstance().getEqup_scanner())); } } else if (Sessiondata.getInstance().getScanner_inventory() == 8) { List<String> results = Arrays.asList(result.split(",")); if (results.size() == 1) { Sessiondata.getInstance().setModel(result); } else { Log.d("Value_Postion", "" + Sessiondata.getInstance().getEqup_scanner()); Sessiondata.getInstance().setModel(results.get(Sessiondata.getInstance().getEqup_scanner())); } } else if (Sessiondata.getInstance().getScanner_inventory() == 9) { List<String> results = Arrays.asList(result.split(",")); if (results.size() == 1) { Sessiondata.getInstance().setMake(result); } else { Log.d("Value_Postion", "" + Sessiondata.getInstance().getEqup_scanner()); Sessiondata.getInstance().setMake(results.get(Sessiondata.getInstance().getEqup_scanner())); } } processid.setText(Sessiondata.getInstance().getSub_process()); equp_id.setText(Sessiondata.getInstance().getUnitId()); model.setText(Sessiondata.getInstance().getModel()); serial.setText(Sessiondata.getInstance().getSerial()); make.setText(Sessiondata.getInstance().getMake_model()); } }, 500); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(equp_id.getWindowToken(), 0); /* equp_id.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(final Editable s) { if (selectedDevice.equals("MX Scanner")) { new Handler().postDelayed(new Runnable() { @Override public void run() { equipid_text = s.toString(); String ss = s.toString(); if (!ss.equals(ss.toUpperCase())) { ss = ss.toUpperCase(); equp_id.setText(ss); } equp_id.setSelection(equp_id.getText().length()); String equi_proc = split_string(process_list); if (equi_proc.toString().equalsIgnoreCase("")) { } else { if (checkInternetConenction()) { equip_list = new ArrayList<GetEquipmentList>(); if (GlobalVariables.checkbtn_load == 0) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListUncountFilter().execute(); } } else { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = true; if (handleasync == true) { handleasync = false; new AsyncGetEquipmentListCountedFilter().execute(); } } } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } }, 250); } } });*/ } @Override public void onAvailabilityChanged(ReaderDevice reader) { if (reader.getAvailability() == ReaderDevice.Availability.AVAILABLE) { equipment_inventory_activity.readerDevice.connect(equipment_inventory_activity.this); } else { // DISCONNECTED USB DEVICE equipment_inventory_activity.readerDevice.connect(equipment_inventory_activity.this); equipment_inventory_activity.readerDevice.disconnect(); readerDisconnected(); } } @Override public void onConnectionCompleted(ReaderDevice reader, Throwable error) { if (error != null) { readerDisconnected(); } } private void readerDisconnected() { Log.d("cmb.SampleApp", "onDisconnected"); } private void readerConnected() { Log.d("cmb.SampleApp", "onConnected"); //example setSymbologyEnabled equipment_inventory_activity.readerDevice.setSymbologyEnabled(ReaderDevice.Symbology.C128, true, null); equipment_inventory_activity.readerDevice.setSymbologyEnabled(ReaderDevice.Symbology.DATAMATRIX, true, null); equipment_inventory_activity.readerDevice.setSymbologyEnabled(ReaderDevice.Symbology.UPC_EAN, true, null); equipment_inventory_activity.readerDevice.setSymbologyEnabled(ReaderDevice.Symbology.QR, true, null); //example sendCommand equipment_inventory_activity.readerDevice.getDataManSystem().sendCommand("SET SYMBOL.MICROPDF417 ON"); equipment_inventory_activity.readerDevice.getDataManSystem().sendCommand("SET IMAGE.SIZE 0"); } private void expand() { filter_layout.setVisibility(View.VISIBLE); mAnimator.start(); } private void expand_1() { filter_layout_1.setVisibility(View.VISIBLE); mAnimator_1.start(); } private void collapse() { int finalHeight = filter_layout.getHeight(); ValueAnimator mAnimator = slideAnimator(finalHeight, 0); mAnimator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator animator) { filter_layout.setVisibility(View.GONE); } @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); mAnimator.start(); } private void collapse_1() { int finalHeight = filter_layout_1.getHeight(); ValueAnimator mAnimator = slideAnimator_1(finalHeight, 0); mAnimator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator animator) { filter_layout_1.setVisibility(View.GONE); } @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); mAnimator.start(); } private ValueAnimator slideAnimator(int start, int end) { ValueAnimator animator = ValueAnimator.ofInt(start, end); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { int value = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = filter_layout .getLayoutParams(); layoutParams.height = value; filter_layout.setLayoutParams(layoutParams); } }); return animator; } private ValueAnimator slideAnimator_1(int start, int end) { ValueAnimator animator = ValueAnimator.ofInt(start, end); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { int value = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = filter_layout_1 .getLayoutParams(); layoutParams.height = value; filter_layout_1.setLayoutParams(layoutParams); } }); return animator; } public void launchActivity(Class<?> clss) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { mClss = clss; ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, ZBAR_CAMERA_PERMISSION); } else { Intent intent = new Intent(this, clss); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case ZBAR_CAMERA_PERMISSION: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (mClss != null) { Intent intent = new Intent(this, mClss); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); } } else { Toast.makeText(this, "Please grant camera permission to use the QR Scanner", Toast.LENGTH_SHORT).show(); } } } public void justifyListViewHeightBasedOnChildren(ListView listView) { ListAdapter adapter = listView.getAdapter(); if (adapter == null) { return; } int totalHeight = 0; for (int i = 0; i < adapter.getCount(); i++) { View listItem = adapter.getView(i, null, listView); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams par = listView.getLayoutParams(); par.height = totalHeight + (listView.getDividerHeight() * (adapter.getCount() - 1)); listView.setLayoutParams(par); listView.requestLayout(); } public void ClearSession() { Sessiondata.getInstance().setEqu_branch_name(""); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); Sessiondata.getInstance().setSub_process(""); Sessiondata.getInstance().setMake_model(""); Sessiondata.getInstance().setInventory_equip_id(0); Sessiondata.getInstance().setEqup_scanner(0); Sessiondata.getInstance().setInventory_scanner(""); GlobalVariables.showerrormsg = false; GlobalVariables.checkbtn_load = 0; handleasync = true; } @Override protected void onResume() { super.onResume(); handleasync = true; if (process_list.equals("")) { process_list = Sessiondata.getInstance().getProcess_list(); Log.d("getProcess_list", process_list); } if (Sessiondata.getInstance().getInventory_equip_id() == 1) { if (!Sessiondata.getInstance().getEqu_branch_name().isEmpty()) { branch_no.setText(Sessiondata.getInstance().getEqu_branch_name()); } if (!Sessiondata.getInstance().getSub_process().isEmpty()) { processid.setText(Sessiondata.getInstance().getSub_process()); } if (!Sessiondata.getInstance().getUnitId().isEmpty()) { // equp_id.setText(""); equp_id.setText(Sessiondata.getInstance().getUnitId()); } // if (!Sessiondata.getInstance().getModel().isEmpty()) { //// mode // .setText(Sessiondata.getInstance().getModel()); // } if (!Sessiondata.getInstance().getSerial().isEmpty()) { // serial.setText(""); serial.setText(Sessiondata.getInstance().getSerial()); } if (!Sessiondata.getInstance().getMake_model().isEmpty()) { // make.setText(""); Log.d("getMake_model_1", " " + Sessiondata.getInstance().getMake_model()); make.setText(Sessiondata.getInstance().getMake_model()); } Log.d("OnResume", " ProcessId " + Sessiondata.getInstance().getSub_process()); } } private boolean checkInternetConenction() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) { return true; } else { return false; } } public boolean isCameraAvailable() { PackageManager pm = getPackageManager(); return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA); } private void clearandload() { equp_id.setText(""); model.setText(""); make.setText(""); serial.setText(""); handleasync = true; Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); Sessiondata.getInstance().setMake_model(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } } @Override public void onBackPressed() { super.onBackPressed(); ClearSession(); Intent myintent = new Intent(equipment_inventory_activity.this, Dashboard.class); startActivity(myintent); overridePendingTransition(R.anim.slide_left_to_right_enter, R.anim.slide_left_to_right_leave); } public static enum DeviceType {MX_1000} public class CustomAdapter extends BaseAdapter { ArrayList<GetEquipmentList> result; private LayoutInflater inflater = null; public CustomAdapter(Context context, ArrayList<GetEquipmentList> list) { result = list; inflater = (LayoutInflater) context. getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public CustomAdapter() { } @Override public int getCount() { int size = 0; if (result != null) { size = result.size(); } return size; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @SuppressLint("LongLogTag") @Override public View getView(final int position, View convertView, ViewGroup parent) { final Holder holder = new Holder(); View rowView; rowView = inflater.inflate(R.layout.inventory_childrow, null); holder.unit_id = (TextView) rowView.findViewById(R.id.unit_id); holder.model = (TextView) rowView.findViewById(R.id.model_value); holder.make = (TextView) rowView.findViewById(R.id.make_value); holder.serial_no = (TextView) rowView.findViewById(R.id.serial_value); // holder.txt_unitid = (TextView) rowView.findViewById(R.id.txt_unitid); // holder.txt_make = (TextView) rowView.findViewById(R.id.txt_make); // holder.txt_model = (TextView) rowView.findViewById(R.id.txt_model); // holder.txt_serial = (TextView) rowView.findViewById(R.id.txt_serial); holder.desc_value = (TextView) rowView.findViewById(R.id.desc_value); holder.txt_branch_type_status = (TextView) rowView.findViewById(R.id.txt_branch_type_status); holder.unit_id.setTypeface(txt_face); holder.txt_branch_type_status.setTypeface(txt_face); holder.model.setTypeface(txt_face); holder.make.setTypeface(txt_face); holder.serial_no.setTypeface(txt_face); holder.desc_value.setTypeface(txt_face); // holder.txt_unitid.setTypeface(header_face); // holder.txt_make.setTypeface(header_face); // holder.txt_model.setTypeface(header_face); // holder.txt_serial.setTypeface(header_face); holder.unit_id.setText(result.get(position).getEquipid()); holder.model.setText(result.get(position).getModel()); holder.make.setText(result.get(position).getMfg()); holder.serial_no.setText(result.get(position).getSerialno()); holder.desc_value.setText(result.get(position).getDescription()); String subStat = ""; if (result.get(position).getSubstat() != null && result.get(position).getSubstat().length() != 0) { subStat = "-" + result.get(position).getSubstat(); } else { subStat = ""; } String str = ""; if (Sessiondata.getInstance().getCounted_Uncounted_status()) { // Log.d("getCounted_Uncounted_status", "Status"); str = result.get(position).getBranch() + "/" + result.get(position).getEqptype() + "/" + result.get(position).getStatus() + subStat; } else { // Log.d("getCounted_Uncounted_status", " :Eqptblstatus" ); str = result.get(position).getBranch() + "/" + result.get(position).getEqptype() + "/" + result.get(position).getEqptblstatus() + subStat; } //17893 holder.txt_branch_type_status.setText(str); handleasync = true; if (autoCollapse && result != null && result.size() != 0) { collapse_1(); autoCollapse = false; } return rowView; } public class Holder { TextView unit_id, model, make, serial_no, txt_unitid, txt_make, txt_model, txt_serial, desc_value, txt_branch_type_status; } } public class CustomAdapter_processid extends CustomAdapter { ArrayList<GetEquipmentProcessid> result; Context context; int[] imageId; private LayoutInflater inflater = null; public CustomAdapter_processid(Context context, ArrayList<GetEquipmentProcessid> list) { super(); result = list; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return result.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final Holder holder = new Holder(); View rowview_processid; rowview_processid = inflater.inflate(R.layout.activity_branch_childrow, null); holder.process_list = (TextView) rowview_processid.findViewById(R.id.process_list); holder.process_list.setText(String.valueOf(result.get(position).getProcessidAnd_Branch())); holder.process_list.setTypeface(header_face); handleasync = true; holder.process_list.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ // process_list = holder.process_list.getText().toString(); process_list = String.valueOf(result.get(position).getProcessid()); autoCollapse = true; processid.setText(holder.process_list.getText().toString()); processid.setTag(process_list); description.setText(result.get(position).getProcessdescription()); Sessiondata.getInstance().setProcess_list(process_list); // processid.setText(process_list); scannedtype = 1; Log.d("OnItemClick", "processId_scannedtype" + scannedtype); Sessiondata.getInstance().setSub_process(process_list); branch_name = branch_no.getText().toString(); branch_no.setText(branch_name); equp_id.setText(""); model.setText(""); make.setText(""); serial.setText(""); Sessiondata.getInstance().setEqu_branch_name(branch_name); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); for (int ii = 0; ii < branch_name.length(); ii++) { Character character = branch_name.charAt(ii); if (character.toString().equals("-")) { branch_name = branch_name.substring(0, ii); Log.d("branch_trim", "" + branch_name); break; } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } if (checkInternetConenction()) { GlobalVariables.checkbtn_load = 0; equip_list = new ArrayList<GetEquipmentList>(); new AsyncGetEquipmentList().execute(); mDialoglist.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); return rowview_processid; } public class Holder { TextView process_list; } } public class CustomAdapter_attach extends CustomAdapter { ArrayList<GetAttachments> result; private LayoutInflater inflater = null; public CustomAdapter_attach(Context context, ArrayList<GetAttachments> list) { super(); result = list; inflater = (LayoutInflater) context. getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return result.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final Holder holder = new Holder(); View rowview_attach; rowview_attach = inflater.inflate(R.layout.activity_attachlist_childrow, null); holder.attachment_list = (RelativeLayout) rowview_attach.findViewById(R.id.select_list); holder.attach_label = (TextView) rowview_attach.findViewById(R.id.attch_label); holder.equp_label = (TextView) rowview_attach.findViewById(R.id.equp_label); holder.attach_id = (TextView) rowview_attach.findViewById(R.id.attch_id); holder.equp_id = (TextView) rowview_attach.findViewById(R.id.equp_id); holder.attach_id.setText(String.valueOf(result.get(position).getAttachments())); holder.equp_id.setText(String.valueOf(result.get(position).getEquipid())); holder.attach_id.setTypeface(txt_face); holder.equp_id.setTypeface(txt_face); holder.equp_label.setTypeface(header_face); holder.attach_label.setTypeface(header_face); return rowview_attach; } public class Holder { TextView attach_label, attach_id, equp_label, equp_id; RelativeLayout attachment_list; } } private class AsyncDetachEquipment extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { usertoken = Sessiondata.getInstance().getLoginObject().getUsertoken(); DetachEquipment = WebServiceConsumer.getInstance().DetachEquipment(usertoken, equipid); } catch (SocketTimeoutException e) { DetachEquipment = null; } catch (Exception e) { DetachEquipment = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); ProgressBar.dismiss(); if (DetachEquipment != null) { if (DetachEquipment.toString().contains("Session")) { String Result = DetachEquipment; String replace = Result.replace("Error - ", ""); Session = 5; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } public class AsyncGetEquipmentProcessid extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); Log.d("branch_name", "" + branch_name); equip_processid = WebServiceConsumer.getInstance().GetEquipmentProcessidV1(user_token, branch_name); } catch (SocketTimeoutException e) { equip_processid = null; } catch (Exception e) { equip_processid = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); Sessiondata.getInstance().setGetEquipmentProcessids(equip_processid); CustomAdapter adapter_processid; if (equip_processid != null) { if (equip_processid.size() == 1) { if (equip_processid.get(0).getMessage().length() != 0) { ProgressBar.dismiss(); String Result = equip_processid.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_processid.get(0).getMessage().toString().contains("Session")) { Session = 1; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); if ((mDialoglist == null) || !mDialoglist.isShowing()) { mDialoglist = new Dialog(equipment_inventory_activity.this); mDialoglist.setCanceledOnTouchOutside(false); mDialoglist.setCancelable(false); mDialoglist.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialoglist.setContentView(R.layout.dialog_processid_search); TextView txt_header = (TextView) mDialoglist.findViewById(R.id.txt_header); TextView dialog_social_ok = (TextView) mDialoglist.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); txt_header.setText("Select ProcessId"); txt_header.setTypeface(header_face); ListView list = (ListView) mDialoglist.findViewById(R.id.list); equip_processid = new ArrayList<>(); equip_processid = Sessiondata.getInstance().getGetEquipmentProcessids(); TextView empty = (TextView) mDialoglist.findViewById(R.id.empty); empty.setTypeface(txt_face); if (equip_processid.size() == 0) { empty.setVisibility(View.VISIBLE); empty.setText("No PID"); list.setVisibility(View.GONE); } else { empty.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); adapter_processid = new CustomAdapter_processid(equipment_inventory_activity.this, equip_processid); list.setAdapter(adapter_processid); justifyListViewHeightBasedOnChildren(list); } mDialoglist.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialoglist.show(); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDialoglist.dismiss(); } }); } } } else { ProgressBar.dismiss(); if ((mDialoglist == null) || !mDialoglist.isShowing()) { mDialoglist = new Dialog(equipment_inventory_activity.this); mDialoglist.setCanceledOnTouchOutside(false); mDialoglist.setCancelable(false); mDialoglist.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialoglist.setContentView(R.layout.dialog_processid_search); TextView txt_header = (TextView) mDialoglist.findViewById(R.id.txt_header); TextView dialog_social_ok = (TextView) mDialoglist.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); txt_header.setText("Select ProcessId"); txt_header.setTypeface(header_face); ListView list = (ListView) mDialoglist.findViewById(R.id.list); equip_processid = new ArrayList<>(); equip_processid = Sessiondata.getInstance().getGetEquipmentProcessids(); TextView empty = (TextView) mDialoglist.findViewById(R.id.empty); empty.setTypeface(txt_face); if (equip_processid.size() == 0) { empty.setVisibility(View.VISIBLE); empty.setText("No PID"); list.setVisibility(View.GONE); } else { empty.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); adapter_processid = new CustomAdapter_processid(equipment_inventory_activity.this, equip_processid); list.setAdapter(adapter_processid); justifyListViewHeightBasedOnChildren(list); } mDialoglist.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialoglist.show(); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDialoglist.dismiss(); } }); } } } else { ProgressBar.dismiss(); if ((mDialoglist == null) || !mDialoglist.isShowing()) { mDialoglist = new Dialog(equipment_inventory_activity.this); mDialoglist.setCanceledOnTouchOutside(false); mDialoglist.setCancelable(false); mDialoglist.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialoglist.setContentView(R.layout.dialog_processid_search); TextView txt_header = (TextView) mDialoglist.findViewById(R.id.txt_header); TextView dialog_social_ok = (TextView) mDialoglist.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); txt_header.setText("Select ProcessId"); txt_header.setTypeface(header_face); ListView list = (ListView) mDialoglist.findViewById(R.id.list); equip_processid = new ArrayList<>(); equip_processid = Sessiondata.getInstance().getGetEquipmentProcessids(); TextView empty = (TextView) mDialoglist.findViewById(R.id.empty); empty.setTypeface(txt_face); if (equip_processid.size() == 0) { empty.setVisibility(View.VISIBLE); empty.setText("No PID"); list.setVisibility(View.GONE); } else { empty.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); adapter_processid = new CustomAdapter_processid(equipment_inventory_activity.this, equip_processid); list.setAdapter(adapter_processid); justifyListViewHeightBasedOnChildren(list); } mDialoglist.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialoglist.show(); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDialoglist.dismiss(); } }); } } } } public class AsyncGetEquipmentList extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); int process_ids_text = Integer.parseInt(split_string(process_list)); equip_list = WebServiceConsumer.getInstance().GetEquipmentListV4(user_token, process_ids_text, "", "", "", ""); Log.d("equip_list", equip_list + ""); } catch (SocketTimeoutException e) { equip_list = null; } catch (Exception e) { equip_list = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); Sessiondata.getInstance().setGetEquipmentLists(equip_list); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } if (equip_list != null) { equp_id.setEnabled(true); model.setEnabled(true); serial.setEnabled(true); make.setEnabled(true); equpiment_id.setEnabled(true); if (equip_list.size() == 1) { if (equip_list.get(0).getMessage().length() != 0) { String Result = equip_list.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_list.get(0).getMessage().toString().contains("Session")) { Session = 0; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { String eqstatus = equip_list.get(0).getEqpstatus(); Log.d("eqstatus_list_single1", "" + eqstatus); if (eqstatus.toString().contains("Counted")) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); new AsyncGetEquipmentListCountedFilter().execute(); } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } } else { equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); if (equip_list.size() == 0) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ ArrayList<GetEquipmentList> equimlist = new ArrayList<>(); for (int i = 0; i < equip_list.size(); i++) { String eqstatus = equip_list.get(i).getEqpstatus(); Log.d("eqstatus_list_many", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { equimlist.add(equip_list.get(i)); } } if (equimlist.size() == 0) { new AsyncGetEquipmentListCounted().execute(); } else { equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ } } } public class AsyncGetEquipmentListCountedFilter extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); int process_ids_text = Integer.parseInt(process_ids); equip_list = WebServiceConsumer.getInstance().GetEquipmentCountedList(user_token, process_ids_text, equipid_text, make_text, model_text, serial_text); } catch (SocketTimeoutException e) { equip_list = null; } catch (Exception e) { equip_list = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setGetEquipmentLists(equip_list); ProgressBar.dismiss(); String pid = processid.getText().toString(); Sessiondata.getInstance().setSub_process(pid); Log.d("GlobalVariables ", "CountFilter " + GlobalVariables.showerrormsg + " checkbtn_load " + GlobalVariables.checkbtn_load); if (equip_list != null) { if (equip_list.size() == 1) { handleasync = true; if (equip_list.get(0).getMessage().length() != 0) { String Result = equip_list.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_list.get(0).getMessage().toString().contains("Session")) { Session = 17; if (return_once == 0) { if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } if (return_once == 1) { return_once = 0; } } } else { GlobalVariables.checkbtn_load = 1; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(blue_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } else { btn_counted.setBackgroundDrawable(blue_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } //for (int i=0;i<equip_list.size();i++){ String eqstatus = equip_list.get(0).getEqpstatus(); Log.d("eqstatus_list_single2", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE); */ equip_list = new ArrayList<>(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); // footer.setVisibility(View.GONE);/**/ equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } } else { equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); if (equip_list.size() == 0) { if (GlobalVariables.showerrormsg == true) { if (checkInternetConenction()) { Log.d("CountFilter", "true"); GlobalVariables.showerrormsg = false; user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); process_ids = split_string(process_list); equipid_text = equp_id.getText().toString(); model_text = model.getText().toString(); make_text = make.getText().toString(); serial_text = serial.getText().toString(); new AsyncGetEquipmentListUncountFilter().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { handleasync = true; GlobalVariables.checkbtn_load = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } Log.d("CountFilter", "false"); btn_submit.setEnabled(true); // submit_layout.setEnabled(true); // submit_layout.setVisibility(View.VISIBLE); btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (!equipid_text.toString().isEmpty() && !make_text.toString().isEmpty() && !model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Does not exist, Do you want to add to Hand Writes?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && serial_text.toString().isEmpty()) { btn_submit.setEnabled(true); // submit_layout.setEnabled(true); // submit_layout.setVisibility(View.VISIBLE); btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { if (alert == 1) { if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Scanned equipment does not exist. Do you want to re-scan?") .setCancelText("No") .setConfirmText("Re-Scan") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; equp_id.setText(""); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setEqup_scanner(0); Sessiondata.getInstance().setScanner_inventory(6); Sessiondata.getInstance().setInventory_scanner("start"); scanne_value = 1; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setScanner_partreceipt(0); Sessiondata.getInstance().setScanner_partreceiving(0); Sessiondata.getInstance().setScanner_replace(0); Sessiondata.getInstance().setScanner_counting1(0); Sessiondata.getInstance().setScanner_counting2(0); Sessiondata.getInstance().setScanner_partnumber(0); Sessiondata.getInstance().setScanner_hwstartbin(0); Sessiondata.getInstance().setScanner_hwendbin(0); launchActivity(SimpleScannerActivity.class); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } else { if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Entered equipment does not exist. Would you like to re-enter?") .setCancelText("No") .setConfirmText("Re-Enter") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; equp_id.setText(""); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setTemp_unitId(""); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } } } else { handleasync = true; GlobalVariables.checkbtn_load = 1; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(blue_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } else { btn_counted.setBackgroundDrawable(blue_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ ArrayList<GetEquipmentList> equimlist = new ArrayList<>(); for (int i = 0; i < equip_list.size(); i++) { String eqstatus = equip_list.get(i).getEqpstatus(); Log.d("eqstatus_list_many", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { equimlist.add(equip_list.get(i)); } } if (equimlist.size() == 0) { new AsyncGetEquipmentListCounted().execute(); } else { equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } else { handleasync = true; } } } public class AsyncGetEquipmentListUncountFilter extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); int process_ids_text = Integer.parseInt(split_string(process_ids)); equip_list = WebServiceConsumer.getInstance().GetEquipmentListV4(user_token, process_ids_text, equipid_text, make_text, model_text, serial_text); Log.d("equip_list", equip_list + ""); } catch (SocketTimeoutException e) { equip_list = null; } catch (Exception e) { equip_list = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setGetEquipmentLists(equip_list); ProgressBar.dismiss(); String pid = processid.getText().toString(); Sessiondata.getInstance().setSub_process(pid); Log.d("GlobalVariables ", "UnCountFilter " + GlobalVariables.showerrormsg + " checkbtn_load " + GlobalVariables.checkbtn_load); if (equip_list != null) { if (equip_list.size() == 1) { if (equip_list.get(0).getMessage().length() != 0) { handleasync = true; String Result = equip_list.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_list.get(0).getMessage().toString().contains("Session")) { Session = 3; if (return_once == 0) { if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } if (return_once == 1) { return_once = 0; } } } else { handleasync = true; GlobalVariables.checkbtn_load = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } String eqstatus = equip_list.get(0).getEqpstatus(); Log.d("eqstatus_list_single3", "" + eqstatus); if (eqstatus.toString().contains("Counted")) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); new AsyncGetEquipmentListCountedFilter().execute(); } else { btn_submit.setEnabled(true); // submit_layout.setEnabled(false); // submit_layout.setVisibility(View.GONE); btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } } else { equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); if (equip_list.size() == 0) { if (GlobalVariables.showerrormsg == true) { if (checkInternetConenction()) { Log.d("UncountFilter", "true"); GlobalVariables.showerrormsg = false; user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); process_ids = split_string(process_list); equipid_text = equp_id.getText().toString(); model_text = model.getText().toString(); make_text = make.getText().toString(); serial_text = serial.getText().toString(); new AsyncGetEquipmentListCountedFilter().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { handleasync = true; GlobalVariables.checkbtn_load = 1; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(blue_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } else { btn_counted.setBackgroundDrawable(blue_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(getResources().getColor(R.color.white)); btn_uncounted.setTextColor(getResources().getColor(R.color.black)); } Log.d("UncountFilter", "false"); btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (!equipid_text.toString().isEmpty() && !make_text.toString().isEmpty() && !model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Does not exist, Do you want to add to Hand Writes?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && serial_text.toString().isEmpty()) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { if (alert == 1) { if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Scanned equipment does not exist. Do you want to re-scan?") .setCancelText("No") .setConfirmText("Re-Scan") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(equp_ids); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; equp_id.setText(""); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setEqup_scanner(0); Sessiondata.getInstance().setScanner_inventory(6); Sessiondata.getInstance().setInventory_scanner("start"); scanne_value = 1; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setScanner_partreceipt(0); Sessiondata.getInstance().setScanner_partreceiving(0); Sessiondata.getInstance().setScanner_replace(0); Sessiondata.getInstance().setScanner_counting1(0); Sessiondata.getInstance().setScanner_counting2(0); Sessiondata.getInstance().setScanner_partnumber(0); Sessiondata.getInstance().setScanner_hwstartbin(0); Sessiondata.getInstance().setScanner_hwendbin(0); launchActivity(SimpleScannerActivity.class); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } else { if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Entered equipment does not exist. Would you like to re-enter?") .setCancelText("No") .setConfirmText("Re-Enter") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; equp_id.setText(""); Sessiondata.getInstance().setUnitId(""); Sessiondata.getInstance().setTemp_unitId(""); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } } } else { handleasync = true; GlobalVariables.checkbtn_load = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ ArrayList<GetEquipmentList> equimlist = new ArrayList<>(); if (equip_list != null) { for (int i = 0; i < equip_list.size(); i++) { String eqstatus = equip_list.get(i).getEqpstatus(); Log.d("eqstatus_list_many", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { equimlist.add(equip_list.get(i)); } } } if (equimlist.size() == 0) { new AsyncGetEquipmentListCounted().execute(); } else { equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } else { handleasync = true; } } } public class AsyncGetEquipmentListCounted extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); int process_ids_text = Integer.parseInt(process_ids); equip_list = WebServiceConsumer.getInstance().GetEquipmentCountedList(user_token, process_ids_text, equipid_text, make_text, model_text, serial_text); } catch (SocketTimeoutException e) { equip_list = null; } catch (Exception e) { equip_list = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setGetEquipmentLists(equip_list); ProgressBar.dismiss(); String pid = processid.getText().toString(); Sessiondata.getInstance().setSub_process(pid); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(blue_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.WHITE); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(blue_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.WHITE); btn_uncounted.setTextColor(Color.BLACK); } if (equip_list != null) { if (equip_list.size() == 1) { if (equip_list.get(0).getMessage().length() != 0) { String Result = equip_list.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_list.get(0).getMessage().toString().contains("Session")) { Session = 15; if (return_once == 0) { if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } if (return_once == 1) { return_once = 0; } } } else { String eqstatus = equip_list.get(0).getEqpstatus(); Log.d("eqstatus_list_single4", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } } else { equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); if (equip_list.size() == 0) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (!equipid_text.toString().isEmpty() && !make_text.toString().isEmpty() && !model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Does not exist, Do you want to add to Hand Writes?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && serial_text.toString().isEmpty()) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ } else if (equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; scan_processid = split_string(process_list); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ ArrayList<GetEquipmentList> equimlist = new ArrayList<>(); for (int i = 0; i < equip_list.size(); i++) { String eqstatus = equip_list.get(i).getEqpstatus(); Log.d("eqstatus_list_many", "" + eqstatus); if (eqstatus.toString().contains("Counted")) { equimlist.add(equip_list.get(i)); } } equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } else { } } } public class AsyncGetEquipmentListUnCounted extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); int process_ids_text = Integer.parseInt(split_string(process_ids)); equip_list = WebServiceConsumer.getInstance().GetEquipmentListV4(user_token, process_ids_text, equipid_text, make_text, model_text, serial_text); Log.d("equip_list", equip_list + ""); } catch (SocketTimeoutException e) { equip_list = null; } catch (Exception e) { equip_list = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setGetEquipmentLists(equip_list); ProgressBar.dismiss(); String pid = processid.getText().toString(); Sessiondata.getInstance().setSub_process(pid); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(blue_drawable); btn_counted.setTextColor(getResources().getColor(R.color.black)); btn_uncounted.setTextColor(getResources().getColor(R.color.white)); } if (equip_list != null) { if (equip_list.size() == 1) { if (equip_list.get(0).getMessage().length() != 0) { String Result = equip_list.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (equip_list.get(0).getMessage().toString().contains("Session")) { Session = 16; if (return_once == 0) { if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } if (return_once == 1) { return_once = 0; } } } else { String eqstatus = equip_list.get(0).getEqpstatus(); Log.d("eqstatus_list_single5", "" + eqstatus); if (eqstatus.toString().contains("Counted")) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } } else { equip_list = new ArrayList<>(); equip_list = Sessiondata.getInstance().getGetEquipmentLists(); if (equip_list.size() == 0) { btn_submit.setEnabled(true); /*submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (!equipid_text.toString().isEmpty() && !make_text.toString().isEmpty() && !model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Does not exist, Do you want to add to Hand Writes?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { } else if (!equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && serial_text.toString().isEmpty()) { btn_submit.setEnabled(true); /* submit_layout.setEnabled(true); submit_layout.setVisibility(View.VISIBLE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.VISIBLE);*/ } else if (equipid_text.toString().isEmpty() && make_text.toString().isEmpty() && model_text.toString().isEmpty() && !serial_text.toString().isEmpty()) { if (Sessiondata.getInstance().getInventory_dialoghandle() == 0) { process_ids = split_string(process_list); equp_ids = equp_id.getText().toString(); models = model.getText().toString(); makes = make.getText().toString(); serials = serial.getText().toString(); sub_processid = split_string(process_list); if (sweetalrt_notmatch) { sweetalrt_notmatch = false; dialog_notmatch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment is not in PID, Do you want to add it and Count?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_notmatch = true; // scan_processid = split_string(process_list); scan_processid = processid.getText().toString(); scan_model = model.getText().toString(); scan_make = make.getText().toString(); scan_serial = serial.getText().toString(); scan_equip = equp_id.getText().toString(); Sessiondata.getInstance().setEqu_branch_name(branch_no.getText().toString()); Sessiondata.getInstance().setUnitId(scan_equip); Sessiondata.getInstance().setMake(scan_make); Sessiondata.getInstance().setModel(scan_model); Sessiondata.getInstance().setSerial(scan_serial); int processId = Integer.parseInt(split_string(scan_processid)); Sessiondata.getInstance().setSub_process(scan_processid); Sessiondata.getInstance().setProcessId(processId); Sessiondata.getInstance().setInventory_equip_id(1); Sessiondata.getInstance().setTemp_unitId(scan_equip); Sessiondata.getInstance().setTemp_make(scan_make); Sessiondata.getInstance().setTemp_model(scan_model); Sessiondata.getInstance().setTemp_serial(scan_serial); Intent intent = new Intent(equipment_inventory_activity.this, AttachImageActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_bottom_to_top_enter, R.anim.slide_bottom_to_top_leave); sDialog.dismiss(); } }); dialog_notmatch.setCancelable(false); dialog_notmatch.show(); } } if (Sessiondata.getInstance().getInventory_dialoghandle() == 1) { Sessiondata.getInstance().setInventory_dialoghandle(0); } } } else { btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); /*footer.setVisibility(View.GONE);*/ ArrayList<GetEquipmentList> equimlist = new ArrayList<>(); for (int i = 0; i < equip_list.size(); i++) { String eqstatus = equip_list.get(i).getEqpstatus(); Log.d("eqstatus_list_many", "" + eqstatus); if (!eqstatus.toString().contains("Counted")) { equimlist.add(equip_list.get(i)); } } if (equimlist.size() == 0) { new AsyncGetEquipmentListCounted().execute(); } else { equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } equip_list = equimlist; adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } } else { } } } public class AsyncGetAttachments_new extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); attachment = WebServiceConsumer.getInstance().attachmentsdetails(user_token, unit_ID); } catch (SocketTimeoutException e) { attachment = null; } catch (Exception e) { attachment = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setAttachment(attachment); if (attachment != null) { if (attachment.size() == 1) { if (attachment.get(0).getMessage().length() != 0) { ProgressBar.dismiss(); String Result = attachment.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (attachment.get(0).getMessage().toString().contains("Session")) { Session = 9; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); if (sweetdetach) { sweetdetach = false; dialogdetach = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("Yes") .setConfirmText("No") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment().execute(); sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogdetach.setCancelable(false); dialogdetach.show(); } } } else { ProgressBar.dismiss(); if (attachment.size() == 0) { if (sweetdetach) { sweetdetach = false; dialogdetach = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("Yes") .setConfirmText("No") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment().execute(); sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogdetach.setCancelable(false); dialogdetach.show(); } } else { if ((mDialogattachlist == null) || !mDialogattachlist.isShowing()) { mDialogattachlist = new Dialog(equipment_inventory_activity.this); mDialogattachlist.setCanceledOnTouchOutside(false); mDialogattachlist.setCancelable(false); mDialogattachlist.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialogattachlist.setContentView(R.layout.dialog_attch_list); TextView mDialogFreeCancelButton = (TextView) mDialogattachlist.findViewById(R.id.dialog_social_cancel); TextView mDialogFreeOKButton = (TextView) mDialogattachlist.findViewById(R.id.update); TextView txt_header = (TextView) mDialogattachlist.findViewById(R.id.txt_header); txt_header.setText("Attachments"); txt_header.setTypeface(header_face); mDialogFreeOKButton.setTypeface(header_face); mDialogFreeCancelButton.setTypeface(header_face); ListView list = (ListView) mDialogattachlist.findViewById(R.id.list); attachments_list = new ArrayList<>(); attachments_list = Sessiondata.getInstance().getAttachment(); CustomAdapter adapter_attach = new CustomAdapter_attach(equipment_inventory_activity.this, attachments_list); list.setAdapter(adapter_attach); mDialogFreeOKButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkInternetConenction()) { new AsyncUpdateEquipmentforAttach().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } mDialogattachlist.dismiss(); } }); mDialogFreeCancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDialogattachlist.dismiss(); } }); mDialogattachlist.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialogattachlist.show(); } } } } else { ProgressBar.dismiss(); if (sweetdetach) { sweetdetach = false; dialogdetach = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("Yes") .setConfirmText("No") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment().execute(); sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogdetach.setCancelable(false); dialogdetach.show(); } } } } public class AsyncGetAttachments extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); attachment = WebServiceConsumer.getInstance().attachmentsdetails(user_token, unit_ID); } catch (SocketTimeoutException e) { attachment = null; } catch (Exception e) { attachment = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setAttachment(attachment); if (attachment != null) { if (attachment.size() == 1) { if (attachment.get(0).getMessage().length() != 0) { ProgressBar.dismiss(); String Result = attachment.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (attachment.get(0).getMessage().toString().contains("Session")) { Session = 2; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); if (attachment.get(0).getAttachments().toString().length() == 0) { int process_ids = Integer.parseInt(split_string(process_list)); if (sweetalrts1) { sweetalrts1 = false; dialogmsg = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNING_TYPE) .setTitleText("Message!") .setContentText("Equipment not included in PID " + process_ids + ".Check for other branch!") .setCancelText("No,cancel") .setConfirmText("Yes,check it") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrts1 = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrts1 = true; if (checkInternetConenction()) { new AsyncGetEquipmentBranch().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogmsg.setCancelable(false); dialogmsg.show(); } } else { int process_ids = Integer.parseInt(split_string(process_list)); if (sweetdetach) { sweetdetach = false; dialogdetach = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("Yes") .setConfirmText("No") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { msg_show = 2; new AsyncUpdateEquipment().execute(); sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { sweetdetach = true; sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogdetach.setCancelable(false); dialogdetach.show(); } } } } else { ProgressBar.dismiss(); if (attachment.size() == 0) { int process_ids = Integer.parseInt(split_string(process_list)); if (sweetalrts3) { sweetalrts3 = false; dialogmsg = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNING_TYPE) .setTitleText("Message!") .setContentText("Equipment not included in PID " + process_ids + ".Check for other branch!") .setCancelText("No,cancel") .setConfirmText("Yes,check it") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrts3 = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { if (checkInternetConenction()) { sweetalrts3 = true; new AsyncGetEquipmentBranch().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogmsg.setCancelable(false); dialogmsg.show(); } } else { if ((mDialogattachlist == null) || !mDialogattachlist.isShowing()) { mDialogattachlist = new Dialog(equipment_inventory_activity.this); mDialogattachlist.setCanceledOnTouchOutside(false); mDialogattachlist.setCancelable(false); mDialogattachlist.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialogattachlist.setContentView(R.layout.dialog_attch_list); TextView mDialogFreeCancelButton = (TextView) mDialogattachlist.findViewById(R.id.dialog_social_cancel); TextView mDialogFreeOKButton = (TextView) mDialogattachlist.findViewById(R.id.update); TextView txt_header = (TextView) mDialogattachlist.findViewById(R.id.txt_header); txt_header.setText("Attachments"); txt_header.setTypeface(header_face); mDialogFreeOKButton.setTypeface(header_face); mDialogFreeCancelButton.setTypeface(header_face); ListView list = (ListView) mDialogattachlist.findViewById(R.id.list); attachments_list = new ArrayList<>(); attachments_list = Sessiondata.getInstance().getAttachment(); CustomAdapter adapter_attach = new CustomAdapter_attach(equipment_inventory_activity.this, attachments_list); list.setAdapter(adapter_attach); mDialogFreeOKButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkInternetConenction()) { new AsyncUpdateEquipmentforAttach().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } mDialogattachlist.dismiss(); } }); mDialogFreeCancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDialogattachlist.dismiss(); } }); mDialogattachlist.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialogattachlist.show(); } } } } else { ProgressBar.dismiss(); int process_ids = Integer.parseInt(split_string(process_list)); if (sweetalrts3) { sweetalrts3 = false; dialogmsg = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.WARNING_TYPE) .setTitleText("Message!") .setContentText("Equipment not included in PID " + process_ids + ".Check for other branch!") .setCancelText("No,cancel") .setConfirmText("Yes,check it") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrts3 = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrts3 = true; if (checkInternetConenction()) { new AsyncGetEquipmentBranch().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogmsg.setCancelable(false); dialogmsg.show(); } } } } public class AsyncGetEquipmentBranch_transfer extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); equp_branch = WebServiceConsumer.getInstance().equipmentBranch(user_token, unit_ID); } catch (SocketTimeoutException e) { equp_branch = null; } catch (Exception e) { equp_branch = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setBranch(equp_branch); if (equp_branch != null) { if (equp_branch.getMessage().length() != 0) { ProgressBar.dismiss(); String Result = equp_branch.getMessage(); String replace = Result.replace("Error - ", ""); if (equp_branch.getMessage().toString().contains("Session")) { Session = 10; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); String equp_branchs = equp_branch.getBranch(); String equp_branchs_login = branch_no.getText().toString(); Log.d("equp_branchs", "" + equp_branchs); Log.d("equp_branchs_login", "" + equp_branchs_login); for (int ii = 0; ii < equp_branchs_login.length(); ii++) { Character character = equp_branchs_login.charAt(ii); if (character.toString().equals("-")) { equp_branchs_login = equp_branchs_login.substring(0, ii); Log.d("branch_trim", "" + equp_branchs_login); break; } } if (!equp_branchs_login.toString().contains(equp_branchs)) { if (sweetbranch) { sweetbranch = false; dialogbranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment found in branch location " + equp_branchs + ". Do you want to transfer to branch " + loginbranch + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; Sessiondata.getInstance().setTransfer_Equipment("T"); if (checkInternetConenction()) { new AsyncSetEquipmentDetails_transfer().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogbranch.setCancelable(false); dialogbranch.show(); } } else { if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Equipment Available in Current Branch!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetalrt_count = true; sweetAlertDialog.dismiss(); if (checkInternetConenction()) { new AsyncSetEquipmentDetails_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } } } else { ProgressBar.dismiss(); if (sweetnobranch) { sweetnobranch = false; dialognobranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.ERROR_TYPE) .setTitleText("Error!") .setContentText("Branch not found!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetnobranch = true; sDialog.dismiss(); } }); dialognobranch.setCancelable(false); dialognobranch.show(); } } } } public class AsyncGetEquipmentBranch extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + user_token); equp_branch = WebServiceConsumer.getInstance().equipmentBranch(user_token, unit_ID); } catch (SocketTimeoutException e) { equp_branch = null; } catch (Exception e) { equp_branch = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Sessiondata.getInstance().setBranch(equp_branch); if (equp_branch != null) { if (equp_branch.getMessage().length() != 0) { ProgressBar.dismiss(); String Result = equp_branch.getMessage(); String replace = Result.replace("Error - ", ""); if (equp_branch.getMessage().toString().contains("Session")) { Session = 4; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); String equp_branchs = equp_branch.getBranch(); String equp_branchs_login = branch_no.getText().toString(); Log.d("equp_branchs", "" + equp_branchs); Log.d("equp_branchs_login", "" + equp_branchs_login); if (!equp_branchs_login.toString().contains(equp_branchs)) { if (sweetbranch) { sweetbranch = false; dialogbranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Message!") .setContentText("Equipment found in branch location " + equp_branchs + ". Do you want to transfer to branch " + loginbranch + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; sDialog.dismiss(); } }) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetbranch = true; Sessiondata.getInstance().setTransfer_Equipment("T"); if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); sDialog.dismiss(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }); dialogbranch.setCancelable(false); dialogbranch.show(); } } else { if (sweetalrt_count) { sweetalrt_count = false; alert_count = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.INFO_TYPE) .setTitleText("Equipment Available in Current Branch!") .setContentText("Do you want to count this Equipment# " + unit_ID + " ?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { Log.d("rLog", "Do you want to count this Equipment# " + unit_ID + " ?"); sweetalrt_count = true; sweetAlertDialog.dismiss(); msg_show = 3; if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } }) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrt_count = true; sDialog.dismiss(); } }); alert_count.setCancelable(false); alert_count.show(); } } } } else { ProgressBar.dismiss(); if (sweetnobranch) { sweetnobranch = false; dialognobranch = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.ERROR_TYPE) .setTitleText("Error!") .setContentText("Branch not found!") .setCancelText("Ok") .showCancelButton(false) .setConfirmClickListener(null) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetnobranch = true; sDialog.dismiss(); } }); dialognobranch.setCancelable(false); dialognobranch.show(); } } } } public class AsyncUpdateEquipment_transfer extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); branch = branch_no.getText().toString(); int processids = Integer.parseInt(process_ids.toString()); Log.d("branch_usertoken", "" + user_token); Log.d("scannedtype", "transfer" + scannedtype); update_equip = WebServiceConsumer.getInstance().UpdateEquipmentV3(user_token, unit_ID, processids, user, branch, scannedtype); } catch (SocketTimeoutException e) { update_equip = null; } catch (Exception e) { update_equip = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); if (update_equip != null) { if (update_equip.toString().contains("Session")) { String Result = update_equip; String replace = Result.replace("Error - ", ""); Session = 12; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (call_setEquip_D == 1) { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Counted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sessiondata.getInstance().setTransfer_Equipment(""); sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); if (equip_list.size() == 0) { Log.d("equip_list", " 0"); clearandload(); } else { Log.d("equip_list", " " + equip_list.size()); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (checkInternetConenction()) { new AsyncSetEquipmentDetails_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } else { if (call_setEquip_D == 1) { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Counted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sessiondata.getInstance().setTransfer_Equipment(""); sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (equip_list.size() == 0) { Log.d("equip_list", " 0"); clearandload(); } else { Log.d("equip_list", " " + equip_list.size()); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (checkInternetConenction()) { new AsyncSetEquipmentDetails_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } } public class AsyncUnCountEquipment extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); equp_branch_chk = Sessiondata.getInstance().getBranch(); Log.d("uncount_user_token", "" + user_token); Log.d("uncount_equipid", "" + uncount_equipid); Log.d("uncount_processid", "" + ucount_processid); Log.d("uncount_user", "" + user); Log.d("uncount_branch_name", "" + uncount_branch); uncountequp = WebServiceConsumer.getInstance().UncountEquipment(user_token, uncount_equipid, ucount_processid, user, uncount_branch); } catch (SocketTimeoutException e) { uncountequp = null; } catch (Exception e) { uncountequp = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); if (uncountequp != null) { if (uncountequp.toString().contains("Session")) { String Result = uncountequp; String replace = Result.replace("Error - ", ""); Session = 14; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment UnCounted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; if (equip_list.size() != 0) equip_list.remove(detach_pos); if (equip_list.size() != 0) { adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { clearandload(); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment UnCounted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); if (equip_list.size() != 0) { adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } else { clearandload(); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } public class AsyncUpdateEquipment extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { if (msg_show == 1 || msg_show == 2 || msg_show == 3) { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); branch = branch_no.getText().toString(); int processids = Integer.parseInt(process_ids.toString()); Log.d("branch_usertoken", "" + user_token); Log.d("scannedtype", "update" + scannedtype); Log.d("rLog", "scannedtype update " + scannedtype + " in " + msg_show + " Condition"); update_equip = WebServiceConsumer.getInstance().UpdateEquipmentV3(user_token, unit_ID, processids, user, branch, scannedtype); } else { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); int processids = Integer.parseInt(process_ids.toString()); equp_branch_chk = Sessiondata.getInstance().getBranch(); if (equp_branch_chk != null) { if (equp_branch_chk.getBranch() == null) { transfer_branch = branch_no.getText().toString(); } else { transfer_branch = Sessiondata.getInstance().getBranch().getBranch(); } } else { transfer_branch = branch_no.getText().toString(); } Log.d("branch_usertoken", "" + user_token); Log.d("branch_count_new", "" + transfer_branch); Log.d("scannedtype", "update" + scannedtype); Log.d("rLog", "scannedtype update " + scannedtype + " in else Condition"); update_equip = WebServiceConsumer.getInstance().UpdateEquipmentV3(user_token, unit_ID, processids, user, branch, scannedtype); } } catch (SocketTimeoutException e) { update_equip = null; } catch (Exception e) { update_equip = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); if (update_equip != null) { if (update_equip.toString().contains("Session")) { String Result = update_equip; String replace = Result.replace("Error - ", ""); Session = 6; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (call_setEquip_D == 1) { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Counted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sessiondata.getInstance().setTransfer_Equipment(""); sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (equip_list.size() == 0) { Log.d("equip_list", " 0"); clearandload(); } else { Log.d("equip_list", " " + equip_list.size()); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (checkInternetConenction()) { new AsyncSetEquipmentDetails().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } else { if (call_setEquip_D == 1) { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Counted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sessiondata.getInstance().setTransfer_Equipment(""); sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (equip_list.size() == 0) { Log.d("equip_list", " 0"); clearandload(); } else { Log.d("equip_list", " " + equip_list.size()); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (checkInternetConenction()) { new AsyncSetEquipmentDetails().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } } public class AsyncUpdateEquipmentforAttach extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); branch = branch_no.getText().toString(); int processids = Integer.parseInt(process_ids.toString()); Log.d("branch_usertoken", "" + user_token); Log.d("scannedtype", "_forattach" + scannedtype); for (int i = 0; i < attachments_list.size(); i++) { Log.d("equp_id", "" + attachments_list.get(i).getEquipid().toString()); String equp_id = attachments_list.get(i).getEquipid().toString(); update_equip = WebServiceConsumer.getInstance().UpdateEquipmentV3(user_token, equp_id, processids, user, branch, scannedtype); } } catch (SocketTimeoutException e) { update_equip = null; } catch (Exception e) { update_equip = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); selected_attach.clear(); if (update_equip != null) { if (update_equip.toString().contains("Session")) { String Result = update_equip; String replace = Result.replace("Error - ", ""); Session = 7; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (call_setEquip_D == 1) { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener(){ @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Counted!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Sessiondata.getInstance().setTransfer_Equipment(""); sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); if (equip_list.size() == 0) { Log.d("equip_list", " 0"); clearandload(); } else { Log.d("equip_list", " " + equip_list.size()); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); } sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } else { if (checkInternetConenction()) { new AsyncSetEquipmentDetails().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } else { } } } public class AsyncSetEquipmentDetails_transfer extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); branch = branch_no.getText().toString(); int processids = Integer.parseInt(process_ids.toString()); Log.d("branch_usertoken", "" + user_token); Log.d("scannedtype", "setEqup_transfer" + scannedtype); SetEquipmentDetails = WebServiceConsumer.getInstance().SetEquipmentDetailsV3(user_token, unit_ID, processids, user, branch, scannedtype); } catch (SocketTimeoutException e) { attachment = null; } catch (Exception e) { attachment = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); if (SetEquipmentDetails != null) { if (SetEquipmentDetails.toString().contains("Session")) { String Result = SetEquipmentDetails; String replace = Result.replace("Error - ", ""); Session = 11; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment transferred to Branch " + loginbranch + " and counted") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } else { } } } public class AsyncSetEquipmentDetails extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { user_token = Sessiondata.getInstance().getLoginObject().getUsertoken(); user = Sessiondata.getInstance().getLoginObject().getUsername(); branch = branch_no.getText().toString(); int processids = Integer.parseInt(process_ids.toString()); Log.d("branch_usertoken", "" + user_token); Log.d("scannedtype", "setEquip" + scannedtype); SetEquipmentDetails = WebServiceConsumer.getInstance().SetEquipmentDetailsV3(user_token, unit_ID, processids, user, branch, scannedtype); } catch (SocketTimeoutException e) { attachment = null; } catch (Exception e) { attachment = null; e.printStackTrace(); } return null; } protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ProgressBar.dismiss(); if (SetEquipmentDetails != null) { if (SetEquipmentDetails.toString().contains("Session")) { String Result = SetEquipmentDetails; String replace = Result.replace("Error - ", ""); Session = 8; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else { if (msg_show == 1) { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment Detached!") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } else { if (sweetalrtsuccess) { sweetalrtsuccess = false; sweetalt = new SweetAlertDialog(equipment_inventory_activity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success!") .setContentText("Equipment transferred to Branch " + loginbranch + " and counted") .setCancelText("Ok") .showCancelButton(false) .setCancelClickListener(null) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sweetalrtsuccess = true; msg_show = 0; equip_list.remove(detach_pos); adapter = new CustomAdapter(equipment_inventory_activity.this, equip_list); equp_list.setAdapter(adapter); sDialog.dismiss(); } }); sweetalt.setCancelable(false); sweetalt.show(); } } } } else { } } } public class AsyncGetDealerBranch extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { usertoken = Sessiondata.getInstance().getLoginObject().getUsertoken(); Log.d("branch_usertoken", "" + usertoken); dealerbranch = WebServiceConsumer.getInstance().GetBranchV2( usertoken, "E"); } catch (SocketTimeoutException e) { dealerbranch = null; } catch (Exception e) { dealerbranch = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); Sessiondata.getInstance().setDealerbranch(dealerbranch); if (dealerbranch != null) { if (dealerbranch.size() == 1) { if (dealerbranch.get(0).getMessage().length() != 0) { ProgressBar.dismiss(); String Result = dealerbranch.get(0).getMessage(); String replace = Result.replace("Error - ", ""); if (dealerbranch.get(0).getMessage().contains("Session")) { Session = 13; if (checkInternetConenction()) { new AsyncSessionLoginTask().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } else { ProgressBar.dismiss(); if (Dialog == null) { Dialog = new Dialog(equipment_inventory_activity.this); Dialog.setCanceledOnTouchOutside(false); Dialog.setCancelable(false); Dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Dialog.setContentView(R.layout.dialog_list_select); TextView txt_header = (TextView) Dialog.findViewById(R.id.txt_header); txt_header.setText("Select Branch"); txt_header.setTypeface(header_face); ListView list = (ListView) Dialog.findViewById(R.id.list); branchlist = new ArrayList<>(); branchlist = Sessiondata.getInstance().getDealerbranch(); adapter_branch = new CustomAdapter_Branch(equipment_inventory_activity.this, branchlist); list.setAdapter(adapter_branch); TextView dialog_social_ok = (TextView) Dialog.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Dialog.dismiss(); } }); Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } else if (!Dialog.isShowing()) { Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } } } else { ProgressBar.dismiss(); if (Dialog == null) { Dialog = new Dialog(equipment_inventory_activity.this); Dialog.setCanceledOnTouchOutside(false); Dialog.setCancelable(false); Dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Dialog.setContentView(R.layout.dialog_list_select); TextView txt_header = (TextView) Dialog.findViewById(R.id.txt_header); txt_header.setText("Select Branch"); txt_header.setTypeface(header_face); ListView list = (ListView) Dialog.findViewById(R.id.list); branchlist = new ArrayList<>(); branchlist = Sessiondata.getInstance().getDealerbranch(); adapter_branch = new CustomAdapter_Branch(equipment_inventory_activity.this, branchlist); list.setAdapter(adapter_branch); TextView dialog_social_ok = (TextView) Dialog.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Dialog.dismiss(); } }); Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } else if (!Dialog.isShowing()) { Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } } } else { ProgressBar.dismiss(); if (Dialog == null) { Dialog = new Dialog(equipment_inventory_activity.this); Dialog.setCanceledOnTouchOutside(false); Dialog.setCancelable(false); Dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Dialog.setContentView(R.layout.dialog_list_select); TextView txt_header = (TextView) Dialog.findViewById(R.id.txt_header); txt_header.setText("Select Branch"); txt_header.setTypeface(header_face); ListView list = (ListView) Dialog.findViewById(R.id.list); branchlist = new ArrayList<>(); branchlist = Sessiondata.getInstance().getDealerbranch(); adapter_branch = new CustomAdapter_Branch(equipment_inventory_activity.this, branchlist); list.setAdapter(adapter_branch); TextView dialog_social_ok = (TextView) Dialog.findViewById(R.id.dialog_social_ok); dialog_social_ok.setTypeface(header_face); dialog_social_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Dialog.dismiss(); } }); Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } else if (!Dialog.isShowing()) { Dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; Dialog.show(); } } } } public class CustomAdapter_Branch extends CustomAdapter { ArrayList<GetDealerBranch> result; ; private LayoutInflater inflater = null; public CustomAdapter_Branch(Context context, ArrayList<GetDealerBranch> list) { super(); result = list; inflater = (LayoutInflater) context. getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { if (result != null) return result.size(); else return 0; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final Holder holder = new Holder(); View rowview_processid; rowview_processid = inflater.inflate(R.layout.activity_branch_childrow, null); holder.process_list = (TextView) rowview_processid.findViewById(R.id.process_list); holder.process_list.setText(result.get(position).getBranch()); Log.d("branch", "" + result.get(position).getBranch()); holder.process_list.setTypeface(header_face); holder.process_list = (TextView) rowview_processid.findViewById(R.id.process_list); handleasync = true; holder.process_list.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { process_list = ""; btn_submit.setEnabled(true); /* submit_layout.setEnabled(false); submit_layout.setVisibility(View.GONE);*/ btn_submit.setVisibility(View.VISIBLE); // footer.setVisibility(View.GONE); String process_list = holder.process_list.getText().toString(); branch_no.setText(process_list); branch_name = branch_no.getText().toString(); processid.setText(""); equp_id.setText(""); model.setText(""); serial.setText(""); make.setText(""); branch_no.setText(branch_name); Sessiondata.getInstance().setEqu_branch_name(branch_name); Sessiondata.getInstance().setSub_process(""); Sessiondata.getInstance().setMake(""); Sessiondata.getInstance().setSerial(""); Sessiondata.getInstance().setModel(""); Sessiondata.getInstance().setUnitId(""); for (int ii = 0; ii < branch_name.length(); ii++) { Character character = branch_name.charAt(ii); if (character.toString().equals("-")) { branch_name = branch_name.substring(0, ii); Log.d("branch_trim", "" + branch_name); break; } } GlobalVariables.checkbtn_load = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { btn_counted.setBackground(grey_drawable); btn_uncounted.setBackground(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } else { btn_counted.setBackgroundDrawable(grey_drawable); btn_uncounted.setBackgroundDrawable(grey_drawable); btn_counted.setTextColor(Color.BLACK); btn_uncounted.setTextColor(Color.BLACK); } Dialog.dismiss(); } }); return rowview_processid; } public class Holder { TextView process_list; } } public class AsyncSessionLoginTask extends AsyncTask<Void, Void, Void> { protected void onPreExecute() { ProgressBar.showCommonProgressDialog(equipment_inventory_activity.this); } @Override protected Void doInBackground(Void... params) { try { loginObject = WebServiceConsumer.getInstance().authenticateUser( Sessiondata.getInstance().getTemp_username(), Sessiondata.getInstance().getTemp_password()); } catch (SocketTimeoutException e) { loginObject = null; } catch (Exception e) { loginObject = null; e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); if (loginObject != null) { if (loginObject.getUserid() == 0) { } else { Sessiondata.getInstance().setLoginObject(loginObject); } Log.d("New_Session_Usertoken", "" + Sessiondata.getInstance().getLoginObject().getUsertoken()); if (loginObject.getUserid() == 0) { ProgressBar.dismiss(); } else { ProgressBar.dismiss(); if (Session == 0) { if (checkInternetConenction()) { new AsyncGetEquipmentList().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 1) { if (checkInternetConenction()) { if (branch_name.isEmpty()) { branch_name = branch_no.getText().toString(); for (int ii = 0; ii < branch_name.length(); ii++) { Character character = branch_name.charAt(ii); if (character.toString().equals("-")) { branch_name = branch_name.substring(0, ii); Log.d("branch_trim", "" + branch_name); break; } } } new AsyncGetEquipmentProcessid().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 2) { if (checkInternetConenction()) { new AsyncGetAttachments().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 3) { if (checkInternetConenction()) { Log.d("UncountFilter_Session", "true"); GlobalVariables.checkbtn_load = 0; return_once = 1; GlobalVariables.showerrormsg = true; new AsyncGetEquipmentListUncountFilter().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 4) { if (checkInternetConenction()) { new AsyncGetEquipmentBranch().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 5) { if (checkInternetConenction()) { new AsyncDetachEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 6) { if (checkInternetConenction()) { new AsyncUpdateEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 7) { if (checkInternetConenction()) { new AsyncUpdateEquipmentforAttach().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 8) { if (checkInternetConenction()) { new AsyncSetEquipmentDetails().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 9) { if (checkInternetConenction()) { new AsyncGetAttachments_new().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 10) { if (checkInternetConenction()) { new AsyncGetEquipmentBranch_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 11) { if (checkInternetConenction()) { new AsyncSetEquipmentDetails_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 12) { if (checkInternetConenction()) { new AsyncUpdateEquipment_transfer().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 13) { if (checkInternetConenction()) { new AsyncGetDealerBranch().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 14) { if (checkInternetConenction()) { new AsyncUnCountEquipment().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 15) { if (checkInternetConenction()) { return_once = 1; new AsyncGetEquipmentListCounted().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 16) { if (checkInternetConenction()) { return_once = 1; new AsyncGetEquipmentListUnCounted().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } else if (Session == 17) { if (checkInternetConenction()) { Log.d("CountFilter_Session", "true"); GlobalVariables.checkbtn_load = 1; return_once = 1; GlobalVariables.showerrormsg = true; new AsyncGetEquipmentListCountedFilter().execute(); } else { Toast.makeText(equipment_inventory_activity.this, "No Internet Connection", Toast.LENGTH_LONG).show(); } } } } else { ProgressBar.dismiss(); if ((mDialognodata == null) || !mDialognodata.isShowing()) { mDialognodata = new Dialog(equipment_inventory_activity.this); mDialognodata.setCanceledOnTouchOutside(false); mDialognodata.setCancelable(false); mDialognodata.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialognodata.setContentView(R.layout.dialog_no_data); TextView mDialogFreeOKButton = (TextView) mDialognodata.findViewById(R.id.dialog_social_ok); TextView txt_dialog = (TextView) mDialognodata.findViewById(R.id.txt_dialog); TextView mDialogtxt_header = (TextView) mDialognodata.findViewById(R.id.txt_header); String Result = loginObject.getMessage().toString(); txt_dialog.setText(Result); txt_dialog.setTypeface(txt_face); mDialogtxt_header.setTypeface(header_face); mDialogFreeOKButton.setTypeface(header_face); final Dialog finalMDialog = mDialognodata; mDialogFreeOKButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); overridePendingTransition(R.anim.slide_left_to_right_enter, R.anim.slide_left_to_right_leave); finalMDialog.dismiss(); } }); mDialognodata.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_slide; mDialognodata.show(); } } } } public String split_string(String string) { String[] s = string.split("-"); Log.d("split_string", s[0]); return s[0]; } }
[ "parivendhan8@gmail.com" ]
parivendhan8@gmail.com
6fdb1bd4f18740154eda7370eeeaf26b4e742876
8ab6d0a25a68d2caa7517a6995724adc245c4341
/HTTP-ServerApp/src/HTTPServerLibrary.java
981bcb22955aa00fc049fb69a66c772b2cf7c965
[]
no_license
skanderbm123/445_A1
6caf5c7ca1e049b38ab9d2370562a57e69e45ba2
4fdfe99c026de812e54764c2bfeccf0e87a3a90c
refs/heads/master
2021-06-29T23:01:50.415988
2020-04-06T02:34:45
2020-04-06T02:34:45
237,322,044
0
2
null
2021-06-07T18:42:56
2020-01-30T22:57:03
Java
UTF-8
Java
false
false
9,347
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Scanner; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; public class HTTPServerLibrary { private static File file; private static int numberOfCharacters = 0; public static void main(String[] args) throws IOException { boolean flag = true; String userInput = ""; Scanner sc = new Scanner(System.in); int port = 80; ServerSocket server = null; Socket client = null; boolean verbose = false; String path=""; if((args.length)>1 && args[1].equals("help")){ System.out.println("-v Prints debugging messages."); System.out.println("-p Specifies the port number that the server will listen and serve at. Default is 8080. "); System.out.println("-d Specifies the directory that the server will use to read/write requested files. Default is the current directory when launching the application. "); System.out.println(); }else if(args[0].equals("httpfs")) { for(int i =0;i<args.length;i++){ if(args[i].equals("-p")){ port = Integer.parseInt(args[i+1]); System.out.println("New port is "+port); } if(args[i].equals("-v")){ verbose=true; } if(args[i].equals("-d")){ path = args[i+1]; } } while(flag){ // Creating server and client sockets try { server = new ServerSocket(port, 0, InetAddress.getLoopbackAddress()); client = server.accept(); if(verbose) { System.out.println("Initializing Server and Client sockets..."); } } catch(Exception e) { System.out.println(e.getMessage()); } //userInput = sc.nextLine(); if(userInput.equals("-q")) { flag = false; break; } Scanner in = new Scanner(new InputStreamReader(client.getInputStream())); if(verbose) { System.out.println("Reading data..."); } StringBuilder response = new StringBuilder(); String fileName = ""; String HttpVersion=""; String method=""; int counter = 0; if(in.hasNextLine()){ while(in.hasNextLine()){ String wtv = in.nextLine(); response.append(wtv+"\n"); if(counter == 0) { method = wtv.substring(0,4); fileName = wtv.substring(5, wtv.indexOf("HTTP")-1); HttpVersion = wtv.substring(wtv.indexOf("HTTP")); counter++; } if(wtv.equals("")) break; } String finalAnswer=""; if(!method.contains("GET")){ postOperation(response.toString(),HttpVersion,verbose,path); }else { if(fileName.length()==0) { System.out.print(response+"\n"); File folder = new File("../."); getAllFiles(folder,true," "); } else if(fileName.length()>1) { File folder = new File("../../."); getAllFiles(folder,false,fileName); if(file==null){ finalAnswer=HttpVersion + " 404 Not Found\n"; System.out.println(HttpVersion + " 404 Not Found"); System.out.println(response); finalAnswer=finalAnswer+response; }else if(!(file.canRead())){ finalAnswer=HttpVersion + " 403 Forbidden\n"; System.out.println(HttpVersion + " 403 Forbidden"); System.out.println(response); file=null; finalAnswer=finalAnswer+response; }else{ System.out.println(HttpVersion + " 200 OK"); finalAnswer=HttpVersion + " 200 OK\n"; } } OutputStream outputStream = client.getOutputStream(); if(file!=null){ System.out.print(response); String outputFile = readFile(file); System.out.print("Content-Length: "+numberOfCharacters+"\n"); System.out.println(outputFile); finalAnswer=finalAnswer+response.toString().trim()+"\nContent-Length: "+numberOfCharacters+"\n"+outputFile+"\r\n"; } outputStream.write(finalAnswer.getBytes()); numberOfCharacters=0; System.out.println(); System.out.println(); file = null; } if(verbose){ System.out.println("Server Socket and Client Socket terminated !"); } client.close(); server.close(); }} } } private static void postOperation(String response, String HttpVersion, boolean verbose, String pathString) throws IOException { String fileName = response.substring(6, response.indexOf("HTTP")-1); File file=null; //String data = response.substring(response.indexOf("\n",response.indexOf("Host:")),response.length()-1); String data = response; if(!(pathString.equals(""))){ File f = new File(pathString); f.mkdirs(); } try{ if(!(pathString.equals(""))) file = new File(pathString+"/"+fileName); else file = new File(fileName); if(verbose){ System.out.println("Writing into file for POST method..."); } if(file.createNewFile() || file.canWrite()){ System.out.println(HttpVersion + " 200 OK"); System.out.print("POST response:\n" + response); PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); pw.println(data); pw.close(); if(verbose){ System.out.println("Successfuly wrote into file!"); } }else{ System.out.println(HttpVersion + " 403 Forbidden"); System.out.print("POST response:\n" + response); if(verbose){ System.out.println("Forbidden to write into file"); } } }catch(FileNotFoundException e){ System.out.println("An error occured while creating the file " + fileName); e.printStackTrace(); } } private static void getAllFiles(File folder, boolean OnlyLook , String name) { if(OnlyLook) { File[] filesList = folder.listFiles(); for(File f : filesList){ if(f.isDirectory()) getAllFiles(f,OnlyLook,name); if(f.isFile()){ System.out.println(f.getName()); } } } if(!OnlyLook) { File[] filesList = folder.listFiles(); for(File f : filesList){ if(f.isDirectory()) getAllFiles(f,OnlyLook,name); if(f.isFile()){ if(name.equalsIgnoreCase(f.getName())) { file = new File(f.getPath()); } } } } } private static String readFile(File f){ String fileData=""; try { Scanner myReader = new Scanner(f); while(myReader.hasNextLine()){ fileData = fileData + myReader.nextLine(); fileData = fileData +"\n"; } myReader.close(); } catch (FileNotFoundException e) { System.out.println("An error occurred during the lecture of the file"); e.printStackTrace(); } numberOfCharacters=fileData.length()-1; return fileData; } }
[ "skander96@hotmail.com" ]
skander96@hotmail.com
26e2f88330e6b81929d9256dffad00e58b76cedb
d3530e3d155b5cf3d9e510fc12997f4588c36eb7
/ejercicios/src/ejemplolista/ListaNombres.java
f0c4ea13be8f0a728b803cc8d159ce22237851da
[]
no_license
erickgjs99/poo2020
01eafc4481029e28f070ea231f15930d3737431b
66c864fbfb7b2379cd80bb644b23bf0e13c4d183
refs/heads/master
2020-12-31T08:17:37.033462
2020-03-20T03:20:05
2020-03-20T03:20:05
238,947,454
1
0
null
null
null
null
UTF-8
Java
false
false
1,142
java
package ejemplolista; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ListaNombres { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); //Declaracion de variables List<String> nombres = new ArrayList<String>(); boolean verf = true; int opc; while (verf == true){ System.out.println("BIENVENIDO\n| 1 | Agregar un nuevo nombre\n| 2 | Presentar\n| 3 | Salir\n"); opc = entrada.nextInt(); entrada.nextLine(); if (opc == 1){ System.out.println("Ingrese el nombre por favor"); nombres.add(entrada.nextLine()); } if (opc == 2){ for (int i = 0; i < nombres.size(); i++){ System.out.println("-----------------------------------"); System.out.println("Nombres agragados\n"+ nombres.get(i)); } } if (opc == 3){ verf = false; } } System.out.println("FIN DEL PROGRAMA"); } }
[ "erickjs99lol@gmail.com" ]
erickjs99lol@gmail.com
6b5c275ad4a9a11a5a6d75204c4d885c43186117
ed82512b7dd203bf9769438ca8f0bd5ecc1c3d36
/app/src/main/java/com/example/samsungnormalannualproject/OnSwipeTouchListener.java
d239e79db8ff51f6670a4d229956995a06f00ba7
[]
no_license
hyper-hronoz/Samsung_normal_annual_project
a96da5e3dd3f4904c817ac73240cc7d4102b3020
c096ae83c75eab4fc470d6f87bbdd7edacd0c4e8
refs/heads/master
2023-05-14T20:54:32.048801
2021-06-07T15:37:40
2021-06-07T15:37:40
351,998,041
1
0
null
null
null
null
UTF-8
Java
false
false
1,550
java
package com.example.samsungnormalannualproject; import android.content.Context; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; public class OnSwipeTouchListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener(Context context) { gestureDetector = new GestureDetector(context, new GestureListener()); } public void onSwipeLeft() { } public void onSwipeRight() { } public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } private final class GestureListener extends GestureDetector.SimpleOnGestureListener { private static final int SWIPE_DISTANCE_THRESHOLD = 100; private static final int SWIPE_VELOCITY_THRESHOLD = 100; @Override public boolean onDown(MotionEvent e) { return true; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { float distanceX = e2.getX() - e1.getX(); float distanceY = e2.getY() - e1.getY(); if (Math.abs(distanceX) > Math.abs(distanceY) && Math.abs(distanceX) > SWIPE_DISTANCE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { if (distanceX > 0) onSwipeRight(); else onSwipeLeft(); return true; } return false; } } }
[ "vlad_moryakov_prog@mail.ru" ]
vlad_moryakov_prog@mail.ru
499d0814290f9ad77d43fd3c953ad6da9af55b6c
aae49c4e518bb8cb342044758c205a3e456f2729
/GeogebraiOS/javasources/org/geogebra/common/euclidian/draw/DrawImage.java
bc532368cbbe2d5e1068284469fdb127b8bf59b5
[]
no_license
kwangkim/GeogebraiOS
00919813240555d1f2da9831de4544f8c2d9776d
ca3b9801dd79a889da6cb2fdf24b761841fd3f05
refs/heads/master
2021-01-18T05:29:52.050694
2015-10-04T02:29:03
2015-10-04T02:29:03
45,118,575
4
2
null
2015-10-28T14:36:32
2015-10-28T14:36:31
null
UTF-8
Java
false
false
10,894
java
/* GeoGebra - Dynamic Mathematics for Everyone http://www.geogebra.org This file is part of GeoGebra. 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. */ /* * DrawPoint.java * * Created on 11. Oktober 2001, 23:59 */ package org.geogebra.common.euclidian.draw; import org.geogebra.common.awt.GPoint2D; import org.geogebra.common.awt.GRectangle; import org.geogebra.common.awt.MyImage; import org.geogebra.common.euclidian.Drawable; import org.geogebra.common.euclidian.EuclidianView; import org.geogebra.common.factories.AwtFactory; import org.geogebra.common.kernel.Kernel; import org.geogebra.common.kernel.geos.GeoElement; import org.geogebra.common.kernel.geos.GeoImage; import org.geogebra.common.kernel.geos.GeoPoint; /** * * @author Markus */ public final class DrawImage extends Drawable { private GeoImage geoImage; private boolean isVisible; private MyImage image; private boolean absoluteLocation; private org.geogebra.common.awt.GAlphaComposite alphaComp; private float alpha = -1; private boolean isInBackground = false; private org.geogebra.common.awt.GAffineTransform at, atInverse, tempAT; private boolean needsInterpolationRenderingHint; private int screenX, screenY; private org.geogebra.common.awt.GRectangle boundingBox; private org.geogebra.common.awt.GGeneralPath highlighting; /** * Creates new drawable image * * @param view * view * @param geoImage * image */ public DrawImage(EuclidianView view, GeoImage geoImage) { this.view = view; this.geoImage = geoImage; geo = geoImage; // temp at = AwtFactory.prototype.newAffineTransform(); tempAT = AwtFactory.prototype.newAffineTransform(); boundingBox = AwtFactory.prototype.newRectangle(); selStroke = AwtFactory.prototype.newMyBasicStroke(1.5f); update(); } @Override final public void update() { isVisible = geo.isEuclidianVisible(); if (!isVisible) return; if (geo.getAlphaValue() != alpha) { alpha = geo.getAlphaValue(); alphaComp = AwtFactory.prototype.newAlphaComposite( org.geogebra.common.awt.GAlphaComposite.SRC_OVER, alpha); } image = geoImage.getFillImage(); int width = image.getWidth(); int height = image.getHeight(); absoluteLocation = geoImage.isAbsoluteScreenLocActive(); // ABSOLUTE SCREEN POSITION if (absoluteLocation) { screenX = geoImage.getAbsoluteScreenLocX(); screenY = geoImage.getAbsoluteScreenLocY() - height; labelRectangle.setBounds(screenX, screenY, width, height); } // RELATIVE SCREEN POSITION else { GeoPoint A = geoImage.getCorner(0); GeoPoint B = geoImage.getCorner(1); GeoPoint D = geoImage.getCorner(2); double ax = 0; double ay = 0; if (A != null) { if (!A.isDefined() || A.isInfinite()) { isVisible = false; return; } ax = A.inhomX; ay = A.inhomY; } // set transform according to corners at.setTransform(view.getCoordTransform()); // last transform: real // world // -> screen at.translate(ax, ay); // translate to first corner A if (B == null) { // we only have corner A if (D == null) { // use original pixel width and heigt of image at.scale(view.getInvXscale(), -view.getInvXscale()); } // we have corners A and D else { if (!D.isDefined() || D.isInfinite()) { isVisible = false; return; } // rotate to coord system (-ADn, AD) double ADx = D.inhomX - ax; double ADy = D.inhomY - ay; tempAT.setTransform(ADy, -ADx, ADx, ADy, 0, 0); at.concatenate(tempAT); // scale height of image to 1 double yscale = 1.0 / height; at.scale(yscale, -yscale); } } else { if (!B.isDefined() || B.isInfinite()) { isVisible = false; return; } // we have corners A and B if (D == null) { // rotate to coord system (AB, ABn) double ABx = B.inhomX - ax; double ABy = B.inhomY - ay; tempAT.setTransform(ABx, ABy, -ABy, ABx, 0, 0); at.concatenate(tempAT); // scale width of image to 1 double xscale = 1.0 / width; at.scale(xscale, -xscale); } else { // we have corners A, B and D if (!D.isDefined() || D.isInfinite()) { isVisible = false; return; } // shear to coord system (AB, AD) double ABx = B.inhomX - ax; double ABy = B.inhomY - ay; double ADx = D.inhomX - ax; double ADy = D.inhomY - ay; tempAT.setTransform(ABx, ABy, ADx, ADy, 0, 0); at.concatenate(tempAT); // scale width and height of image to 1 at.scale(1.0 / width, -1.0 / height); } } // move image up so that A becomes lower left corner at.translate(0, -height); labelRectangle.setBounds(0, 0, width, height); // calculate bounding box for isInside boundingBox.setBounds(0, 0, width, height); org.geogebra.common.awt.GShape shape = at .createTransformedShape(boundingBox); boundingBox = shape.getBounds(); try { // for hit testing atInverse = at.createInverse(); } catch (Exception e) { isVisible = false; return; } // improve rendering for sheared and scaled images (translations // don't need this) // turns false if the image doen't want interpolation needsInterpolationRenderingHint = (geoImage.isInterpolate()) && !(Kernel.isEqual(at.getScaleX(), 1.0, Kernel.MAX_PRECISION) && Kernel.isEqual(at.getScaleY(), 1.0, Kernel.MAX_PRECISION) && Kernel.isEqual(at.getShearX(), 0.0, Kernel.MAX_PRECISION) && Kernel.isEqual( at.getShearY(), 0.0, Kernel.MAX_PRECISION)); } if (isInBackground != geoImage.isInBackground()) { isInBackground = !isInBackground; if (isInBackground) { view.addBackgroundImage(this); } else { view.removeBackgroundImage(this); view.updateBackgroundImage(); } } if (isInBackground) view.updateBackgroundImage(); } public boolean checkInBackground() { if (isInBackground != geoImage.isInBackground()) { update(); } else { setNeedsUpdate(true); } return isInBackground && geoImage.isInBackground(); } @Override final public void draw(org.geogebra.common.awt.GGraphics2D g3) { if (isVisible) { org.geogebra.common.awt.GComposite oldComp = g3.getComposite(); if (alpha >= 0f && alpha < 1f) { if (alphaComp == null) alphaComp = AwtFactory.prototype .newAlphaComposite( org.geogebra.common.awt.GAlphaComposite.SRC_OVER, alpha); g3.setComposite(alphaComp); } if (absoluteLocation) { g3.drawImage(image, null, screenX, screenY); if (!isInBackground && geo.doHighlighting()) { // draw rectangle around image g3.setStroke(selStroke); g3.setPaint(org.geogebra.common.awt.GColor.LIGHT_GRAY); g3.draw(labelRectangle); } } else { g3.saveTransform(); g3.transform(at); // improve rendering quality for transformed images Object oldInterpolationHint = g3 .setInterpolationHint(needsInterpolationRenderingHint); // g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g3.drawImage(image, 0, 0); g3.restoreTransform(); if (!isInBackground && geo.doHighlighting()) { // draw rectangle around image g3.setStroke(selStroke); g3.setPaint(org.geogebra.common.awt.GColor.LIGHT_GRAY); // changed to code below so that the line thicknesses aren't // transformed // g2.draw(labelRectangle); // draw parallelogram around edge drawHighlighting(at, g3); GPoint2D corner1 = AwtFactory.prototype.newPoint2D( labelRectangle.getMinX(), labelRectangle.getMinY()); GPoint2D corner2 = AwtFactory.prototype.newPoint2D( labelRectangle.getMinX(), labelRectangle.getMaxY()); GPoint2D corner3 = AwtFactory.prototype.newPoint2D( labelRectangle.getMaxX(), labelRectangle.getMaxY()); GPoint2D corner4 = AwtFactory.prototype.newPoint2D( labelRectangle.getMaxX(), labelRectangle.getMinY()); at.transform(corner1, corner1); at.transform(corner2, corner2); at.transform(corner3, corner3); at.transform(corner4, corner4); if (highlighting == null) highlighting = AwtFactory.prototype.newGeneralPath(); else highlighting.reset(); highlighting.moveTo((float) corner1.getX(), (float) corner1.getY()); highlighting.lineTo((float) corner2.getX(), (float) corner2.getY()); highlighting.lineTo((float) corner3.getX(), (float) corner3.getY()); highlighting.lineTo((float) corner4.getX(), (float) corner4.getY()); highlighting.lineTo((float) corner1.getX(), (float) corner1.getY()); g3.draw(highlighting); } // reset previous values g3.resetInterpolationHint(oldInterpolationHint); } g3.setComposite(oldComp); } } /** * Draws highligting (not implemented) * * @param at2 * transform * @param g2 * graphics */ private void drawHighlighting(org.geogebra.common.awt.GAffineTransform at2, org.geogebra.common.awt.GGraphics2D g2) { // TODO Auto-generated method stub } /** * Returns whether this is background image * * @return true for background images */ boolean isInBackground() { return geoImage.isInBackground(); } /** * was this object clicked at? (mouse pointer location (x,y) in screen * coords) */ @Override final public boolean hit(int x, int y, int hitThreshold) { if (!isVisible || geoImage.isInBackground()) return false; hitCoords[0] = x; hitCoords[1] = y; // convert screen to image coordinate system if (!geoImage.isAbsoluteScreenLocActive()) { atInverse.transform(hitCoords, 0, hitCoords, 0, 1); } return labelRectangle.contains(hitCoords[0], hitCoords[1]); } @Override public boolean intersectsRectangle(GRectangle rect) { if (!isVisible || geoImage.isInBackground()) return false; return rect.intersects(boundingBox); } private double[] hitCoords = new double[2]; @Override final public boolean isInside(org.geogebra.common.awt.GRectangle rect) { if (!isVisible || geoImage.isInBackground()) return false; return rect.contains(boundingBox); } /** * Returns the bounding box of this DrawPoint in screen coordinates. */ @Override final public org.geogebra.common.awt.GRectangle getBounds() { if (!geo.isDefined() || !geo.isEuclidianVisible()) { return null; } return boundingBox; } /** * Returns false */ @Override public boolean hitLabel(int x, int y) { return false; } @Override final public GeoElement getGeoElement() { return geo; } @Override final public void setGeoElement(GeoElement geo) { this.geo = geo; } }
[ "kuoyichun1102@gmail.com" ]
kuoyichun1102@gmail.com
b8eb87cdd430af92fc13dca83ce82ba746daaf5b
da4a4787cc61e3e209cac49fb09a66651ecc4880
/servletProject/src/com/webjjang/image/vo/ImageVO.java
01cd30fc51bfbeaaae240627f7c27a4092a59a54
[]
no_license
joypark0424/servletProject
a11351454741d0ca8a294c16815a018fe2f6b01d
5eecf3a032804376dbd3381f4218b678c3f5cfb2
refs/heads/master
2023-03-18T15:31:21.638674
2021-03-19T08:51:42
2021-03-19T08:51:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
package com.webjjang.image.vo; public class ImageVO { private Long no; private String title, content, name, id, writeDate, fileName; public Long getNo() { return no; } public void setNo(Long no) { this.no = no; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getWriteDate() { return writeDate; } public void setWriteDate(String writeDate) { this.writeDate = writeDate; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } @Override public String toString() { return "ImageVO [no=" + no + ", title=" + title + ", content=" + content + ", name=" + name + ", id=" + id + ", writeDate=" + writeDate + ", fileName=" + fileName + "]"; } }
[ "EZEN@DESKTOP-IPG2JCP" ]
EZEN@DESKTOP-IPG2JCP
da3b380581a4181a3adaa29d715d95414e628fc5
2cb930e8861ceade6620c06d24f15849a150ae9f
/base/src/main/java/com/steven/base/util/ProviderUtil.java
0d1280e312defb33177db5995192ae128b68e4af
[]
no_license
yummyship/SnowDream
216ee1e888220ee4d67f9d26a1a6d209bdeeff82
bf9d67867b320820ca4da3dc900f2c7d1e963404
refs/heads/master
2021-03-03T09:42:18.797717
2020-01-17T05:58:57
2020-01-17T05:58:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,624
java
package com.steven.base.util; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.provider.Settings; import androidx.core.app.NotificationManagerCompat; /** * @user steven * @createDate 2019/3/14 14:33 * @description 内容提供者工具类 */ public class ProviderUtil { public static final String SETTINGS_ACTION = "android.settings.APPLICATION_DETAILS_SETTINGS"; /** * 本地分享:分享文本 * * @param context * @param content */ public static void startLocalShareText(Context context, String content) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, content); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intent, "来自析梦的分享")); } /** * 本地分享:分享图片 * * @param context * @param content */ public static void startLocalShareUri(Context context, Uri content) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/jpeg"); intent.putExtra(Intent.EXTRA_STREAM, content); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intent, "来自析梦的分享")); } /** * 启动本地浏览器并传递url * * @param context * @param url */ public static void startChromeByUrl(Context context, String url) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse(url); intent.setData(content_url); context.startActivity(intent); } /** * 复制 * * @param context * @param content */ public static void copyManager(Context context, String content) { ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); manager.setPrimaryClip(ClipData.newHtmlText(null, content, null)); } /** * 检查通知是否打开 * * @param context * @return */ public static boolean checkNotification(Context context) { NotificationManagerCompat notification = NotificationManagerCompat.from(context); boolean isEnabled = notification.areNotificationsEnabled(); return isEnabled; } /** * 跳转到应用通知设置 * * @param context */ public static void goToSetNotification(Context context) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()); context.startActivity(intent); } else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra("app_package", context.getPackageName()); intent.putExtra("app_uid", context.getApplicationInfo().uid); context.startActivity(intent); } else if (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse("package:" + context.getPackageName())); context.startActivity(intent); } } /** * 跳转到应用详情页面 * * @param context */ public static void goToSystemSetNotification(Context context) { Intent localIntent = new Intent(); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (Build.VERSION.SDK_INT >= 9) { localIntent.setAction(SETTINGS_ACTION); localIntent.setData(Uri.fromParts("package", context.getPackageName(), null)); } else if (Build.VERSION.SDK_INT <= 8) { localIntent.setAction(Intent.ACTION_VIEW); localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); localIntent.putExtra("com.android.settings.ApplicationPkgName", context.getPackageName()); } context.startActivity(localIntent); } }
[ "15921327326@163.com" ]
15921327326@163.com
8191d46f9f9792595cc006c7da9546731a69e712
44cbd9499eb1973745954a8bb9b610fb104553cf
/app/src/main/java/org/loofer/weread/mvp/model/api/service/CommonService.java
1de5a71d8bf742099d8f093d9cfcc99bdd81279d
[ "Apache-2.0" ]
permissive
Loofer/WeRead
b4c8fa09cbe31f09a6aa66135a11a5c509c04fe3
1bfdb6bcfc39edeb29b208c3b040d63c6a5e153c
refs/heads/master
2021-01-11T11:07:09.107458
2017-04-06T02:53:42
2017-04-06T02:53:42
78,994,183
0
0
null
null
null
null
UTF-8
Java
false
false
2,602
java
package org.loofer.weread.mvp.model.api.service; import org.loofer.weread.mvp.model.entity.BaseJson; import org.loofer.weread.mvp.model.entity.Detail; import org.loofer.weread.mvp.model.entity.HomeItem; import org.loofer.weread.mvp.model.entity.Splash; import java.util.List; import retrofit2.http.GET; import retrofit2.http.Query; import rx.Observable; /** * 存放通用的一些API * Created by jess on 8/5/16 12:05 * contact with jess.yan.effort@gmail.com */ public interface CommonService { /** * <p>http://static.owspace.com/static/picture_list.txt?client=android&version=1.3.0&time=1467864021&device_id=866963027059338</p> * * @param client * @param version * @param time * @param deviceId * @return */ @GET("static/picture_list.txt") Observable<Splash> getSplash(@Query("client") String client, @Query("version") String version, @Query("time") Long time, @Query("device_id") String deviceId); /** * http://static.owspace.com/?c=api&a=getPost&post_id=292296&show_sdv=1 * <p>详情页</p> * * @param c * @param a * @param post_id * @param show_sdv * @return */ @GET("/") Observable<BaseJson<Detail>> getDetail(@Query("c") String c, @Query("a") String a, @Query("post_id") String post_id, @Query("show_sdv") int show_sdv); /** * <p>分类列表</p> * <p>http://static.owspace.com/?c=api&a=getList&p=1&model=1&page_id=0&create_time=0&client=android&version=1.3.0&time=1467867330&device_id=866963027059338&show_sdv=1</p> * * @param c * @param a * @param page * @param model(0:首页,1:文字,2:声音,3:影像,4:单向历) * @param pageId * @param time * @param deviceId * @param show_sdv * @return */ @GET("/") Observable<BaseJson<List<HomeItem>>> getList(@Query("c") String c, @Query("a") String a, @Query("p") int page, @Query("model") int model, @Query("page_id") String pageId, @Query("create_time") String createTime, @Query("client") String client, @Query("version") String version, @Query("time") long time, @Query("device_id") String deviceId, @Query("show_sdv") int show_sdv); /** * http://static.owspace.com/index.php?m=Home&c=Api&a=getLunar&client=android&device_id=866963027059338&version=866963027059338 * @return */ // @GET("index.php") // Observable<String> getRecommend(@Query("m") String m,@Query("c") String api,@Query("a") String a,@Query("client") String client,@Query("version") String version, @Query("device_id") String deviceId); }
[ "loofer.deng@bluepay.asia" ]
loofer.deng@bluepay.asia
fff6030dc7f6f7440e41446f992b26d6deb7066e
ad583ed989bad964055a7529ea25660d0d620268
/app/src/main/java/com/ufrbuild/mh4x0f/painelufrb/ui/activity/main/schedule/models/SemanaEnum.java
ed70712c0479f524b15cdd75f95e0bd953f29782
[ "Apache-2.0" ]
permissive
UFRBuild/Painel-Aulas-UFRB
1c92754694cd6e9d7791e9bffad6fc62723371b3
27c3a5b21584ab25ab90b5ceb98aa406005db310
refs/heads/dev
2022-12-25T12:04:38.632987
2022-12-12T23:16:25
2022-12-12T23:16:25
200,312,273
3
0
Apache-2.0
2022-12-12T23:16:26
2019-08-03T00:12:43
Java
UTF-8
Java
false
false
415
java
package com.ufrbuild.mh4x0f.painelufrb.ui.activity.main.schedule.models; public enum SemanaEnum { SEGUNDA(2), TERCA(3), QUARTA(4), QUINTA(5), SEXTA(6) , SABADO(7); private final int valor; SemanaEnum(int valorOpcao){ valor = valorOpcao; } public int getValor(){ return valor; } @Override public String toString() { return super.toString(); } }
[ "mh4root@gmail.com" ]
mh4root@gmail.com
4ccb346b085ea9e498f14038c55cfb0fe05ca875
fc562b4b16576c8fb9a8bc937898c455b383c761
/checkin.module/android/src/de/gmino/checkin/android/facebook/errorhandling/FacebookErrorListener.java
bc970980b4d9e47aa07f6d0c5cc91d7dcf2babc5
[]
no_license
lenaschimmel/meva
ed539adf1c93eb57c84baf067bbf45da1a6641b9
1a57ff0e37d394dc6047afc930587311775b2da7
refs/heads/master
2021-01-01T05:48:56.061455
2017-03-27T21:16:07
2017-03-27T21:16:07
22,265,270
2
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package de.gmino.checkin.android.facebook.errorhandling; import org.itemscript.core.values.JsonObject; import de.gmino.checkin.android.facebook.FacebookUtil; public class FacebookErrorListener { Throwable constructionContext; public FacebookErrorListener() { constructionContext = new Throwable(); } public void handleError(Throwable innerCause) { System.err.println("Error while communicatin with Facebook. Inner error:"); innerCause.printStackTrace(); System.err.println("Asynchronous call was made from:"); constructionContext.printStackTrace(); FacebookUtil.handleLoggedOutCondition(); } public void handleError(Throwable innerCause, Object state) { System.err.println("Error while communicatin with Facebook. Inner error:"); innerCause.printStackTrace(); System.err.println("State Object:"); System.err.println(state.toString()); System.err.println("Asynchronous call was made from:"); constructionContext.printStackTrace(); FacebookUtil.handleLoggedOutCondition(); } protected boolean checkResponse(JsonObject response) { if (response.containsKey("error")) { System.err.println("Error in response: " + response.toCompactJsonString()); int errorCode = response.getObject("error").getInt("code"); if (errorCode == 190) FacebookUtil.handleLoggedOutCondition(); return false; } return true; } }
[ "schimmel@gmino.de" ]
schimmel@gmino.de
d53b2105d7a5ac5b8f5ad2dd55fd961786bdb5dd
f8d00e97ba6045087f885e2675e73f5fa24e8601
/core/src/samples/java/org/easymock/samples/BasicClassMockTest.java
12cf3f8c1ab0a6b71c21ed6d2b2167a686e9d361
[ "Apache-2.0" ]
permissive
shadow000902/easymock
c2ae9f3bb3d959177c8619f543384c956ca46af0
5d2644988f13b9a254ebfd6193cb50626150a7e0
refs/heads/master
2021-01-13T11:00:28.890587
2016-12-21T04:46:20
2016-12-21T04:46:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,356
java
/** * Copyright 2001-2016 the original author or authors. * * 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.easymock.samples; import org.easymock.EasyMockSupport; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * Example of how to use {@code org.easymock.EasyMock} to mock a class * * @author Henri Tremblay */ public class BasicClassMockTest extends EasyMockSupport { /** * Our nice class that is allowed to print */ public static class Document { private final Printer printer; private String content; public Document(Printer printer) { this.printer = printer; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public void print() { printer.print(content); } } /** * The 3rd party class to mock. */ public static abstract class Printer { public abstract void print(String toPrint); } private Printer printer; private Document document; @Before public void setUp() { printer = mock(Printer.class); document = new Document(printer); } @After public void tearDown() { printer = null; document = null; } @Test public void testPrintContent() { printer.print("Hello world"); replayAll(); document.setContent("Hello world"); document.print(); verifyAll(); // make sure Printer.print was called } @Test public void testPrintEmptyContent() { printer.print(""); replayAll(); document.setContent(""); document.print(); verifyAll(); // make sure Printer.print was called } }
[ "henri.tremblay@gmail.com" ]
henri.tremblay@gmail.com
2bd1b9960913a89d3e20b4c357f94475bada2899
942ccfc960be91c186b8756ee70963ac84d190b2
/src/main/java/cn/com/fanyu/huanxin/api/impl/EasemobFile.java
529bd0ce213ebd0dd71c292e945cf7394516dd5f
[]
no_license
fengyiyangdeyi/fanyu
753c422b4b2457d3889bb6f4dc966ba28a3ac8d8
70e401dae37fa89e283b0ad0857ac54ecf398524
refs/heads/master
2021-08-08T01:47:53.228793
2017-11-09T10:08:50
2017-11-09T10:08:50
109,255,579
0
1
null
null
null
null
UTF-8
Java
false
false
1,406
java
package cn.com.fanyu.huanxin.api.impl; import cn.com.fanyu.huanxin.comm.EasemobAPI; import cn.com.fanyu.huanxin.api.FileAPI; import cn.com.fanyu.huanxin.comm.OrgInfo; import cn.com.fanyu.huanxin.comm.ResponseHandler; import cn.com.fanyu.huanxin.comm.TokenUtil; import io.swagger.client.ApiException; import io.swagger.client.api.UploadAndDownloadFilesApi; import java.io.File; public class EasemobFile implements FileAPI { private ResponseHandler responseHandler = new ResponseHandler(); private UploadAndDownloadFilesApi api = new UploadAndDownloadFilesApi(); @Override public Object uploadFile(final Object file) { return responseHandler.handle(new EasemobAPI() { @Override public Object invokeEasemobAPI() throws ApiException { return api.orgNameAppNameChatfilesPost(OrgInfo.ORG_NAME,OrgInfo.APP_NAME,TokenUtil.getAccessToken(),(File)file,true); } }); } @Override public Object downloadFile(final String fileUUID,final String shareSecret,final Boolean isThumbnail) { return responseHandler.handle(new EasemobAPI() { @Override public Object invokeEasemobAPI() throws ApiException { return api.orgNameAppNameChatfilesUuidGet(OrgInfo.ORG_NAME,OrgInfo.APP_NAME,TokenUtil.getAccessToken(),fileUUID,shareSecret,isThumbnail); } }); } }
[ "627319885@qq.com" ]
627319885@qq.com
22c3e3944f99559d9dcd1d1a3382f72471d8245f
81041a355741981eb9dbdaec2dcd25ac8bb82905
/src/main/java/com/botech/ywzx/netty/client/handler/TimeClientHandler.java
457a08c0bdd1017a4e4955efc5e36b150890f1fd
[]
no_license
luanxiaodong/test
b19cf925b3a6d92804f5add8bbd09eece5b95b7f
b9d23a840b82307467836071cd573e5a77e2bbb9
refs/heads/master
2021-01-12T07:15:48.764161
2016-12-20T05:46:15
2016-12-20T05:46:15
76,926,368
0
0
null
null
null
null
UTF-8
Java
false
false
1,290
java
package com.botech.ywzx.netty.client.handler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import java.util.logging.Logger; import com.botech.ywzx.netty.bean.BcPackageBuilder; import com.botech.ywzx.netty.client.client.NettyClient; import com.botech.ywzx.netty.client.service.ClientMsgHandleService; public class TimeClientHandler extends ChannelInboundHandlerAdapter{ private static final Logger logger = Logger.getLogger(TimeClientHandler.class.getName()); @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { ClientMsgHandleService.channel = ctx; } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { BcPackageBuilder.BcPackage pack = (BcPackageBuilder.BcPackage) msg; ClientMsgHandleService.doMsgForShunt(pack); ctx.fireChannelRead(msg); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { super.exceptionCaught(ctx, cause); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if(null!=ClientMsgHandleService.channel && !ClientMsgHandleService.channel.channel().isActive()){ NettyClient.getInstance().reConnect(); } } }
[ "lxd_l@163.com" ]
lxd_l@163.com
f10010753a2898fc9d1d19c6491f50f45d224013
88deb9c9049073ee22b8a20a686f3dd90b4b3ebf
/src/overriding/Ex04.java
fced0e3991e3420f1adec08b9a046dca783eb47c
[]
no_license
ladieslog/day16
fa4dcf8bbda68f2ad3d007ff18cb7416c8b0ebab
43e0656382c920ccc77780edfd17699a194e967f
refs/heads/master
2023-07-14T21:46:54.225904
2021-08-23T09:51:23
2021-08-23T09:51:23
398,989,490
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package overriding; class Parents{ public void familyName() { System.out.print("이 "); } public void name() { familyName(); System.out.println("순신"); } } class Daughter extends Parents{ public void name() { familyName(); System.out.println("국주"); } } class Son extends Parents{ public void name() { familyName(); System.out.println("기광"); } } public class Ex04 { public static void main(String[] args) { Parents p =new Parents(); p.name(); /* Daughter d =new Daughter(); d.name(); Son s=new Son(); s.name();*/ p =new Daughter(); p.name(); p=new Son(); p.name(); } }
[ "matia0529@gmail.com" ]
matia0529@gmail.com
d46ac41e5fa9ba0329ff91fb45ddf576ab1ecd6a
4abd603f82fdfa5f5503c212605f35979b77c406
/html/Programs/hw6-2-diff/r04631013-375-3/Diff.java
fc3f2bcf5c5de5d0ddb6d571bc972507c54155e0
[]
no_license
dn070017/1042-PDSA
b23070f51946c8ac708d3ab9f447ab8185bd2a34
5e7d7b1b2c9d751a93de9725316aa3b8f59652e6
refs/heads/master
2020-03-20T12:13:43.229042
2018-06-15T01:00:48
2018-06-15T01:00:48
137,424,305
0
0
null
null
null
null
UTF-8
Java
false
false
5,124
java
import java.util.Arrays; public class Player implements Comparable<Player> { private Card[] cards = new Card[5]; private String name; // DO NOT MODIFY THIS public Player(String name) { this.name = name; } // DO NOT MODIFY THIS public String getName() { return this.name; } // DO NOT MODIFY THIS public void setCards(Card[] cards) { this.cards = cards; } // TODO public int compareTo(Player that) { . //winner should be in the last Arrays.sort(this.cards); Arrays.sort(that.cards); int flower_a[] = new int[2]; flower_a[0] = 0; flower_a[1] = 0; for (int k = 0; k < 2; k++) { int my[] = new int[5]; Card[] see = new Card[5]; switch (k) { case 0: see = this.cards; break; case 1: see = that.cards; } for (int i = 0; i < 5; i++) { if (""J"".equals(see[i].getFace())) { my[i] = 11; } else if (""Q"".equals(see[i].getFace())) { my[i] = 12; } else if (""K"".equals(see[i].getFace())) { my[i] = 13; } else if (""A"".equals(see[i].getFace())) { my[i] = 14; } else { my[i] = Integer.parseInt(see[i].getFace()); } // System.out.printf(""%d\n "", my[i]); } int my_2[] = new int[5]; my_2[0] = my[4]; for (int i = 0; i < 4; i++) { my_2[i + 1] = my[i]; } int save_0 = 0; int save_1 = 0; // culmulate how many 1 and 0 for (int i = 0; i < 5; i++) { int temp = my_2[i] - my[i]; if (temp == 0) { save_0 = save_0 + 1; } else if (temp == -1) { save_1 = save_1 + 1; } } // System.out.printf(""%d\n "", save_0); // System.out.printf(""%d\n "", save_1); if (save_0 == 3) { flower_a[k] = 6; } else if (see[0].getSuit() == see[1].getSuit()) { if (see[1].getSuit() == see[2].getSuit()) { if (see[2].getSuit() == see[3].getSuit()) { if (see[3].getSuit() == see[4].getSuit()) { flower_a[k] = 5; } } } } else if (save_1 == 4) { flower_a[k] = 4; } else if (save_1 == 3) { if (""A"".equals(see[4].getFace())) { flower_a[k] = 4; } } else if (save_0 == 2) { if (see[0] == see[1] && see[1] == see[2]) { flower_a[k] = 2; } else if (see[2] == see[3] && see[3] == see[4]) { flower_a[k] = 2; } else if (see[1] == see[2] && see[2] == see[3]) { flower_a[k] = 2; } else { flower_a[k] = 3; } } else { flower_a[k] = 1; } // System.out.printf(""%d\n "", flower_a[k]); } int roo = 0; if (flower_a[0] > flower_a[1]) { return 1; } else if (flower_a[0] < flower_a[1]) { return -1; } else { if (flower_a[0] == 6) { if (this.cards[0] == this.cards[1] && this.cards[1] == this.cards[2]) { roo = this.cards[0].compareTo(that.cards[0]); } else { roo = this.cards[4].compareTo(that.cards[4]); } // return roo; } // ////////////////////// if (flower_a[0] == 5) { if (flower_a[1] == 5) { roo = 0; } } ////////////////////////////// if (flower_a[0] == 4) { roo = Card.SUIT_ORDER.compare(this.cards[4], that.cards[4]); // return roo; } /////////////////////////////////////////////////// if (flower_a[0] == 3) { roo = Card.SUIT_ORDER.compare(this.cards[3], that.cards[3]); // return roo; } //////////////////////////////////////////////// if (flower_a[0] == 2) { roo = Card.SUIT_ORDER.compare(this.cards[4], that.cards[4]); // return roo; } ///////////////////////////////////// if (flower_a[0] == 1) { roo = Card.SUIT_ORDER.compare(this.cards[4], that.cards[4]); // return roo; } } return roo; } }
[ "dn070017@gmail.com" ]
dn070017@gmail.com
e6ece82fea96c59443b12a7ebce83e100d7c0b31
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_c2df4106b55500a7ac1435aad9ac55931183334e/TableDataCopier/2_c2df4106b55500a7ac1435aad9ac55931183334e_TableDataCopier_t.java
9927b8f9ad5ef218bd2a62c32b510bbf72117b46
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
23,867
java
package com.googlecode.usc; import java.awt.Desktop; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Timer; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.util.StopWatch; class TableDataCopier extends JFrame { private static final long serialVersionUID = 5840057159492381296L; private Logger logger = LoggerFactory.getLogger(getClass()); private final String CONF_FILE_NAME = "config.properties"; private final long PER_SECOND = 1000; private int BATCH_SIZE = 100; private boolean IS_OPEN_LOG_FILE = false; private boolean IS_DELETE_ORIGINAL_DATA = true; private boolean ABORT_WHEN_ABNORMAL_INSERT = false; private long DELAY_TIME = 1000; private boolean STOP = false; private static final String SNAPSHOT_FLAG = "-SNAPSHOT"; private static final String LINE_FORMAT = "%04d"; private JButton btnCopy; private JTextField textField_0_0; private JTextField textField_0_1; private JTextField textField_1_0; private JTextField textField_1_1; private JTextField textField_2_0; private JTextField textField_2_1; private JTextField textField_3_0; private JTextField textField_3_1; private JTextField textField_4_0; private JTextArea results; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TableDataCopier frame = new TableDataCopier(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public TableDataCopier() { setResizable(false); setTitle("TableDataCopier-ShunLi(QQ:506817493)"); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getClassLoader().getResource("dataCopier.png"))); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth(); double height = Toolkit.getDefaultToolkit().getScreenSize().getHeight(); setBounds((int) ((width - 1024) / 2), (int) ((height - 648) / 4), 999, 609);// 128 // = // (1280-1024)/2 JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); JLabel label = new JLabel("TableDataCopier"); label.setFont(new Font("Microsoft YaHei", Font.PLAIN, 24)); Properties prop = Utils.loadPropertiesFile(this.getClass().getClassLoader().getResourceAsStream("build-info.properties")); String version = prop.getProperty("version", "1.0"); int snapshotIndex = version.lastIndexOf(SNAPSHOT_FLAG); if (snapshotIndex > 0) { version = version.substring(0, snapshotIndex); } JLabel lblv = new JLabel("ShunLi©V" + version); lblv.setEnabled(false); lblv.setFont(new Font("Microsoft YaHei", Font.PLAIN, 20)); lblv.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(new URI("http://blogjava.net/lishunli")); } catch (IOException e1) { e1.printStackTrace(); } catch (URISyntaxException e1) { e1.printStackTrace(); } } }); JPanel panel = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); panel.setFont(new Font("SimSun", Font.PLAIN, 12)); JPanel panel_1 = new JPanel(); FlowLayout flowLayout = (FlowLayout) panel_1.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); JLabel lblResults = new JLabel("Results"); lblResults.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); JPanel panel_2 = new JPanel(); FlowLayout flowLayout_5 = (FlowLayout) panel_2.getLayout(); flowLayout_5.setAlignment(FlowLayout.LEFT); JPanel panel_3 = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) panel_3.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); JPanel panel_4 = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) panel_4.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); JPanel panel_5 = new JPanel(); FlowLayout flowLayout_4 = (FlowLayout) panel_5.getLayout(); flowLayout_4.setAlignment(FlowLayout.LEFT); JLabel lblUsername = new JLabel("Username"); lblUsername.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); JLabel lblPassword = new JLabel("Password"); lblPassword.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); JLabel lblTable = new JLabel("Criteria"); lblTable.setHorizontalAlignment(SwingConstants.CENTER); lblTable.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); JLabel lblUrl = new JLabel("Url"); lblUrl.setHorizontalAlignment(SwingConstants.CENTER); lblUrl.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); JScrollPane scrollPane = new JScrollPane(); JLabel lblDriver = new JLabel("Driver "); lblDriver.setHorizontalAlignment(SwingConstants.CENTER); lblDriver.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); GroupLayout gl_contentPane = new GroupLayout(contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING).addGroup( gl_contentPane.createSequentialGroup().addContainerGap().addGroup( gl_contentPane.createParallelGroup(Alignment.TRAILING).addGroup(gl_contentPane.createSequentialGroup().addComponent(label).addGap(372)).addGroup(gl_contentPane.createSequentialGroup().addComponent(lblv).addGap(43)).addGroup( gl_contentPane.createSequentialGroup().addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addComponent(lblDriver).addComponent(lblUrl).addComponent(lblUsername).addComponent(lblPassword).addComponent(lblTable).addComponent(lblResults)).addGap(10).addGroup( gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup( gl_contentPane.createSequentialGroup().addGroup( gl_contentPane.createParallelGroup(Alignment.LEADING).addComponent(panel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE).addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE).addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE).addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE).addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE)).addGap(26)).addGroup( gl_contentPane.createSequentialGroup().addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 842, GroupLayout.PREFERRED_SIZE).addContainerGap())))))); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup( gl_contentPane.createSequentialGroup().addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addContainerGap().addComponent(label)).addGroup(gl_contentPane.createSequentialGroup().addGap(44).addComponent(lblv))).addGap(18).addComponent(panel, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addGroup( gl_contentPane.createParallelGroup(Alignment.TRAILING, false).addGroup( gl_contentPane.createSequentialGroup().addComponent(lblDriver, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE).addGap(1).addComponent(lblUrl, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addComponent(lblUsername, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)).addGroup( gl_contentPane.createSequentialGroup().addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGap(1).addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE).addGap(1).addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE))).addGap(1).addGroup( gl_contentPane.createParallelGroup(Alignment.LEADING).addComponent(lblPassword, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE).addComponent(panel_4, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)).addGap(10).addGroup( gl_contentPane.createParallelGroup(Alignment.TRAILING).addComponent(panel_5, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE).addComponent(lblTable, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup( gl_contentPane.createParallelGroup(Alignment.BASELINE).addComponent(lblResults).addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addContainerGap(103, Short.MAX_VALUE))); results = new JTextArea(); results.setLineWrap(true); results.setEditable(false); results.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); results.setRows(9); scrollPane.setViewportView(results); textField_4_0 = new JTextField(); textField_4_0.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); textField_4_0.setColumns(49); panel_5.add(textField_4_0); textField_3_0 = new JTextField(); textField_3_0.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_3_0.setColumns(25); panel_4.add(textField_3_0); JLabel label_4 = new JLabel(" "); label_4.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); panel_4.add(label_4); textField_3_1 = new JTextField(); textField_3_1.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_3_1.setColumns(25); panel_4.add(textField_3_1); textField_2_0 = new JTextField(); textField_2_0.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_2_0.setColumns(25); panel_3.add(textField_2_0); JLabel label_2 = new JLabel(" "); label_2.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); panel_3.add(label_2); textField_2_1 = new JTextField(); textField_2_1.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_2_1.setColumns(25); panel_3.add(textField_2_1); textField_1_0 = new JTextField(); textField_1_0.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_1_0.setColumns(25); panel_2.add(textField_1_0); JLabel label_1 = new JLabel(" "); label_1.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); panel_2.add(label_1); textField_1_1 = new JTextField(); textField_1_1.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_1_1.setColumns(25); panel_2.add(textField_1_1); textField_0_0 = new JTextField(); textField_0_0.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); panel_1.add(textField_0_0); textField_0_0.setColumns(25); JLabel label_3 = new JLabel(" "); label_3.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); panel_1.add(label_3); textField_0_1 = new JTextField(); textField_0_1.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); textField_0_1.setColumns(25); panel_1.add(textField_0_1); List<JTextField> fields = Arrays.asList(textField_0_0, textField_0_1, textField_1_0, textField_1_1, textField_2_0, textField_2_1, textField_3_0, textField_3_1, textField_4_0); initData(fields); addCanCopyDataListener(fields); JLabel lblFrom = new JLabel(" From======="); lblFrom.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); panel.add(lblFrom); btnCopy = new JButton("Copy"); panel.add(btnCopy); btnCopy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { STOP = false; new Thread() { public void run() { while (!STOP) { buttonActionPerformed(); } } }.start(); } }); btnCopy.setToolTipText("copy table's data from one database to another database(same table schema)"); btnCopy.setFont(new Font("Microsoft YaHei", Font.PLAIN, 16)); canCopyData(fields); JLabel lblTo = new JLabel("=======>To"); lblTo.setFont(new Font("Microsoft YaHei", Font.PLAIN, 18)); panel.add(lblTo); contentPane.setLayout(gl_contentPane); } // Copy private void buttonActionPerformed() { copy(); } @SuppressWarnings("unchecked") private void copy() { // clear results.setText(""); String criteria = textField_4_0.getText(); String tableName = null, deleteSql = null, countSql = null, selectSql = null; int indexOf = criteria.toUpperCase().lastIndexOf("FROM"); if (indexOf < 0) { // not find "FROM" word. case insensitive tableName = criteria.trim().split("\\s", 2)[0]; deleteSql = "Delete FROM " + tableName; countSql = "SELECT COUNT(1) FROM " + tableName; selectSql = "SELECT * FROM " + criteria; } else {// find "FROM" word tableName = criteria.substring(indexOf + 4).trim().split("\\s", 2)[0]; deleteSql = "Delete FROM " + tableName; countSql = "SELECT COUNT(1) FROM " + tableName; selectSql = criteria; } int updateNums = 0; boolean hasException = false; Timer timer = new Timer(); StopWatch stopWatch = new StopWatch(); try { // From DriverManagerDataSource dataSourceFrom = new DriverManagerDataSource(); dataSourceFrom.setDriverClassName(textField_0_0.getText()); dataSourceFrom.setUrl(textField_1_0.getText()); dataSourceFrom.setUsername(textField_2_0.getText()); dataSourceFrom.setPassword(textField_3_0.getText()); // To DriverManagerDataSource dataSourceTo = new DriverManagerDataSource(); dataSourceTo.setDriverClassName(textField_0_1.getText()); dataSourceTo.setUrl(textField_1_1.getText()); dataSourceTo.setUsername(textField_2_1.getText()); dataSourceTo.setPassword(textField_3_1.getText()); SimpleJdbcTemplate jdbcTemplateFrom = new SimpleJdbcTemplate(dataSourceFrom); SimpleJdbcTemplate jdbcTemplateTo = new SimpleJdbcTemplate(dataSourceTo); HashMap<String, Object> paramMap = new HashMap<String, Object>(); if (IS_DELETE_ORIGINAL_DATA) { // clear temp table first showResults("Delete Table "); timer.schedule(new PrintTimerTask(), 0, PER_SECOND); logger.info("Successfully delete sql is {}", deleteSql); stopWatch.start("batch delete"); logger.info("Delete {} records", jdbcTemplateTo.update(deleteSql, paramMap)); stopWatch.stop(); showResults("\nSelect Table "); } // start count updateNums = jdbcTemplateTo.queryForInt(countSql); // select all if (!IS_DELETE_ORIGINAL_DATA) { showResults("Select Table "); timer.schedule(new PrintTimerTask(), 0, PER_SECOND); } logger.info("Select sql is {}", selectSql); stopWatch.start("batch select"); List<Map<String, Object>> selectList = jdbcTemplateFrom.queryForList(selectSql, paramMap); int size = selectList.size(); logger.info("Successfully select {} records", size); for (int i = 0; i < size; i++) { logger.info("{} : {}", String.format(LINE_FORMAT, i + 1), selectList.get(i).toString()); } stopWatch.stop(); String egiOgInsertSql = null; showResults("\nInsert Table "); stopWatch.start("batch insert"); for (int i = 0; i * BATCH_SIZE < size; i++) { if (i == 0) { egiOgInsertSql = Utils.buildInsertSql(selectList.get(0).keySet(), tableName); logger.info("Insert sql is {}", egiOgInsertSql); } int fromIndex = i * BATCH_SIZE; int toIndex = size - fromIndex > BATCH_SIZE ? fromIndex + BATCH_SIZE : size; // String msg = "batch insert from " + String.format("%04d", // fromIndex) + " to " + String.format("%04d", toIndex); // showResultsln(msg); List<Map<String, Object>> subEgiList = selectList.subList(fromIndex, toIndex); try { // batch insert jdbcTemplateTo.batchUpdate(egiOgInsertSql, subEgiList.toArray(new Map[0])); } catch (Exception e) { hasException = true; exceptionHandler(e); if (ABORT_WHEN_ABNORMAL_INSERT) { break; } } } stopWatch.stop(); // end count updateNums = jdbcTemplateTo.queryForInt(countSql) - updateNums; showResults("\n----------------------Result----------------------\n"); for (StopWatch.TaskInfo taskInfo : stopWatch.getTaskInfo()) { showResults(taskInfo.getTaskName() + ",escaped time " + taskInfo.getTimeMillis() + " ms\n"); } showResults("batch all escaped time " + stopWatch.getTotalTimeSeconds() + " s"); } catch (Exception e) { hasException = true; exceptionHandler(e); } finally { timer.cancel(); if (stopWatch.isRunning()) { stopWatch.stop(); } STOP = true; logger.info("Successfully insert {} records", updateNums); if (IS_OPEN_LOG_FILE || hasException) { Timer timer2 = new Timer(); timer2.schedule(new OpenLogTask(), DELAY_TIME); } } } private void initData(List<JTextField> fields) { // first get outside, second get inside Properties config = Utils.loadPropertiesFile(System.getProperty("user.dir") + "\\" + CONF_FILE_NAME, this.getClass().getClassLoader().getResourceAsStream(CONF_FILE_NAME)); List<String> props = Arrays.asList("fromDbDriver", "toDbDriver", "fromDbUrl", "toDbUrl", "fromDbUsername", "toDbUsername", "fromDbPassword", "toDbPassword", "criteria"); logger.info("Init data from configruation"); for (int i = 0; i < fields.size(); i++) { String key = props.get(i); String value = config.getProperty(key); logger.info("{} is {} ", key, value); fields.get(i).setText(value); } IS_OPEN_LOG_FILE = Utils.parseString2Boolean(config.getProperty("openLogFile"), false); DELAY_TIME = Utils.parseString2Long(config.getProperty("delayTime"), PER_SECOND); IS_DELETE_ORIGINAL_DATA = Utils.parseString2Boolean(config.getProperty("deleteOriginalData"), true); ABORT_WHEN_ABNORMAL_INSERT = Utils.parseString2Boolean(config.getProperty("abort"), false); } private void addCanCopyDataListener(final List<JTextField> fields) { for (JTextField jtextField : fields) { jtextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { canCopyData(fields); } }); } } /** * can copy data? */ private void canCopyData(List<JTextField> fields) { btnCopy.setEnabled(validateAllFiledToBeFilled(fields)); } private boolean validateAllFiledToBeFilled(List<JTextField> fields) { for (JTextField obj : fields) { if (Utils.isBlank(obj.getText())) { return false; } } return true; } private void showResults(String info) { results.setText(results.getText() + info); // logger.info(info); } private void exceptionHandler(Exception e) { String message = e.getMessage(); logger.error(message); logger.info("Please see log file or contact me(QQ.506817493).Thanks."); if (Utils.isBlank(results.getText())) { results.setText("[ERROR] " + message); } else { results.setText(results.getText() + "\n[ERROR] " + message + "\nplease see log file or contact me(QQ.506817493).Thanks. "); } } private class PrintTimerTask extends java.util.TimerTask { @Override public void run() { showResults("· "); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
557bdfadf3130d05a1d39d520de3e8893b4882cd
95c49f466673952b465e19a5ee3ae6eff76bee00
/src/main/java/com/airbnb/lottie/p134f/GammaEvaluator.java
d35413e884c81e5c053128ccc5791072076994ae
[]
no_license
Phantoms007/zhihuAPK
58889c399ae56b16a9160a5f48b807e02c87797e
dcdbd103436a187f9c8b4be8f71bdf7813b6d201
refs/heads/main
2023-01-24T01:34:18.716323
2020-11-25T17:14:55
2020-11-25T17:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,352
java
package com.airbnb.lottie.p134f; /* renamed from: com.airbnb.lottie.f.b */ /* compiled from: GammaEvaluator */ public class GammaEvaluator { /* renamed from: a */ private static float m5634a(float f) { return f <= 0.0031308f ? f * 12.92f : (float) ((Math.pow((double) f, 0.4166666567325592d) * 1.0549999475479126d) - 0.054999999701976776d); } /* renamed from: b */ private static float m5636b(float f) { return f <= 0.04045f ? f / 12.92f : (float) Math.pow((double) ((f + 0.055f) / 1.055f), 2.4000000953674316d); } /* renamed from: a */ public static int m5635a(float f, int i, int i2) { float f2 = ((float) ((i >> 24) & 255)) / 255.0f; float b = m5636b(((float) ((i >> 16) & 255)) / 255.0f); float b2 = m5636b(((float) ((i >> 8) & 255)) / 255.0f); float b3 = m5636b(((float) (i & 255)) / 255.0f); float b4 = m5636b(((float) ((i2 >> 16) & 255)) / 255.0f); float b5 = m5636b(((float) ((i2 >> 8) & 255)) / 255.0f); float b6 = b3 + (f * (m5636b(((float) (i2 & 255)) / 255.0f) - b3)); return (Math.round(m5634a(b + ((b4 - b) * f)) * 255.0f) << 16) | (Math.round((f2 + (((((float) ((i2 >> 24) & 255)) / 255.0f) - f2) * f)) * 255.0f) << 24) | (Math.round(m5634a(b2 + ((b5 - b2) * f)) * 255.0f) << 8) | Math.round(m5634a(b6) * 255.0f); } }
[ "seasonpplp@qq.com" ]
seasonpplp@qq.com
f934bb78afb34bbf56870bb8d18308b03dc1012b
068dcc21015b89fc6bf33527203a3a4ad8a62882
/oauth2/src/main/java/com/lambdaschool/oauth2/services/UseremailServiceImpl.java
bde2c25ceca3fe93b8291c57f980f0cd76f5b747
[ "MIT" ]
permissive
jeffreywhitaker/java-oauth2
1911da0064874812f0b9b7a5cd97428bbe3fc35b
a0f09dd2802c4b483a36b5e65d5e325c38adbf0e
refs/heads/master
2020-08-10T01:44:38.706679
2019-10-09T01:11:25
2019-10-09T01:11:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,882
java
package com.lambdaschool.oauth2.services; import com.lambdaschool.oauth2.models.Useremail; import com.lambdaschool.oauth2.repository.UseremailRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import javax.persistence.EntityNotFoundException; import java.util.ArrayList; import java.util.List; @Service(value = "useremailService") public class UseremailServiceImpl implements UseremailService { @Autowired private UseremailRepository useremailrepos; @Override public List<Useremail> findAll() { List<Useremail> list = new ArrayList<>(); useremailrepos.findAll() .iterator() .forEachRemaining(list::add); return list; } @Override public Useremail findUseremailById(long id) { return useremailrepos.findById(id) .orElseThrow(() -> new EntityNotFoundException("Useremail with id " + id + " Not Found!")); } @Override public List<Useremail> findByUserName(String username, boolean isAdmin) { Authentication authentication = SecurityContextHolder.getContext() .getAuthentication(); if (username.equalsIgnoreCase(authentication.getName()) || isAdmin) { return useremailrepos.findAllByUser_Username(username); } else { throw new EntityNotFoundException(authentication.getName() + " not authorized to make change"); } } @Override public void delete(long id, boolean isAdmin) { if (useremailrepos.findById(id) .isPresent()) { Authentication authentication = SecurityContextHolder.getContext() .getAuthentication(); if (useremailrepos.findById(id) .get() .getUser() .getUsername() .equalsIgnoreCase(authentication.getName()) || isAdmin) { useremailrepos.deleteById(id); } else { throw new EntityNotFoundException(authentication.getName() + " not authorized to make change"); } } else { throw new EntityNotFoundException("Useremail with id " + id + " Not Found!"); } } @Override public Useremail update(long useremailid, String emailaddress, boolean isAdmin) { Authentication authentication = SecurityContextHolder.getContext() .getAuthentication(); if (useremailrepos.findById(useremailid) .isPresent()) { if (useremailrepos.findById(useremailid) .get() .getUser() .getUsername() .equalsIgnoreCase(authentication.getName()) || isAdmin) { Useremail useremail = findUseremailById(useremailid); useremail.setUseremail(emailaddress); return useremailrepos.save(useremail); } else { throw new EntityNotFoundException(authentication.getName() + " not authorized to make change"); } } else { throw new EntityNotFoundException("Useremail with id " + useremailid + " Not Found!"); } } }
[ "jrmmba@outlook.com" ]
jrmmba@outlook.com
ca95f5ddc1fc35e07c3e1a13495e7f998cc594d0
2ba30ff60b31576decccb83f33bda63c376e9a47
/springweb/src/main/java/com/test/spring/web/CommonController.java
3a5765daafd6935056fe6f9fb283bf87c497d905
[]
no_license
kenti-lan/framework
74fc09afee70a0545a47c1c9213fbeb8ff8c4380
88cd8f7b20e93bc06bcb4158a2c50b322a86a030
refs/heads/master
2021-01-15T14:23:19.437876
2017-03-29T07:12:14
2017-03-29T07:12:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
869
java
package com.test.spring.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.test.spring.base.BaseController; @Controller public class CommonController extends BaseController { @RequestMapping(value = "/") public String entry() { return "redirect:/login"; } @RequestMapping(value = "/login", method=RequestMethod.GET) public String login() { return "login"; } @RequestMapping(value = "/logout", method=RequestMethod.GET) public String logout() { return "redirect:/j_spring_security_logout"; } @RequestMapping(value = "/main") public String index() { return "main"; } @RequestMapping(value = "/forbidden", method=RequestMethod.GET) public String forbidden() { return "/commom/forbidden"; } }
[ "809707651@qq.com" ]
809707651@qq.com
c31555f84dab7fc756f0c58c68f57f4233253bf2
0c1dd34ce45672277bedbb8caf3c51ebe0fc17ee
/src/main/java/com/tounga/predictice/dto/OrganizationDTO.java
5660159aa43d1ee90b743afea46025a68ed82c09
[]
no_license
ftounga/predictice
f8e5833b0acd324e3dd06dcb02fd73a53615f8cf
dcef14df52112034f431be3c84c7687c66a4e98e
refs/heads/master
2020-03-17T22:14:18.095690
2018-05-23T00:18:34
2018-05-23T00:18:34
133,995,190
0
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package com.tounga.predictice.dto; import java.util.List; import javax.validation.constraints.NotBlank; public class OrganizationDTO { private int organizationId; @NotBlank private String name; @NotBlank private String billingContact; @NotBlank private String description; private List<UserDTO> users; private PlanDTO plan; private CreditCardDTO creditCard; public int getOrganizationId() { return organizationId; } public void setOrganizationId(int organizationId) { this.organizationId = organizationId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBillingContact() { return billingContact; } public void setBillingContact(String billingContact) { this.billingContact = billingContact; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List<UserDTO> getUsers() { return users; } public void setUsers(List<UserDTO> users) { this.users = users; } public PlanDTO getPlan() { return plan; } public void setPlan(PlanDTO plan) { this.plan = plan; } public CreditCardDTO getCreditCard() { return creditCard; } public void setCreditCard(CreditCardDTO creditCard) { this.creditCard = creditCard; } }
[ "ntounga@gmail.com" ]
ntounga@gmail.com
040ae295a562f015fb3b7e568954c5fd684015f5
ddb5c9118a84aa79d0d02aada22ebde50f3634a4
/carManager/src/cn/lk/filter/nonLogFilter.java
075fb364e0f5d11b3312bdfc383999d0d5fcddff
[]
no_license
shadowamy/java_web
d7df23915e5afbd7d4c9d45f400296de8b502f77
04162a4500954381d5eb4b8a70f4007b4266e372
refs/heads/master
2020-05-04T20:20:22.525473
2019-06-11T12:52:15
2019-06-11T12:52:15
179,433,816
2
0
null
null
null
null
GB18030
Java
false
false
3,475
java
package cn.lk.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import cn.lvb.bao.adminUser; import cn.lvb.bao.userData; /** * Servlet Filter implementation class nonLogFilter */ public class nonLogFilter implements Filter { /** * Default constructor. */ public nonLogFilter() { // TODO Auto-generated constructor stub } /** * @see Filter#destroy() */ public void destroy() { // TODO Auto-generated method stub } /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub // place your code here // pass the request along the filter chain //chain.doFilter(request, response); HttpServletRequest servletRequest = (HttpServletRequest) request; HttpServletResponse servletResponse = (HttpServletResponse) response; HttpSession session = servletRequest.getSession(); // 获得用户请求的URI String path = servletRequest.getRequestURI(); userData user = (userData)session.getAttribute("user"); adminUser adm = (adminUser)session.getAttribute("adminuser"); // 登陆页面无需过滤 if(path.indexOf("/carManager/Login/login.jsp") > -1) { chain.doFilter(servletRequest, servletResponse); return; } // 注册页面无需过滤 if(path.indexOf("/carManager/Login/register.jsp") > -1) { chain.doFilter(servletRequest, servletResponse); return; } if(path.indexOf("/carManager/Action/addVio.jsp") > -1) { if(adm == null) { servletResponse.sendRedirect("/carManager/Login/login.jsp"); } else { chain.doFilter(servletRequest, servletResponse); } return; } if(path.indexOf("/carManager/Action/updateVio.jsp") > -1) { if(adm == null) { servletResponse.sendRedirect("/carManager/Login/login.jsp"); } else { chain.doFilter(servletRequest, servletResponse); } return; } if(path.indexOf("/carManager/Main/content/adminVio.jsp") > -1) { if(adm == null) { servletResponse.sendRedirect("/carManager/Login/login.jsp"); } else { chain.doFilter(servletRequest, servletResponse); } return; } if (user == null&&adm == null) { // 跳转到登陆页面 servletResponse.sendRedirect("/carManager/Login/login.jsp"); } else { // 已经登陆,继续此次请求 chain.doFilter(request, response); } } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { // TODO Auto-generated method stub } }
[ "547822367@qq.com" ]
547822367@qq.com
f7c5d818f60422906a7205eae7ddd716108a6ace
faa0488c5b7ad25656032026a1a92da0b75a5d7c
/APPDISPATCH_DXD/FUENTES_APP/View/src/pe/com/nextel/service/RequestManualService.java
6d511982341c7d97616d734c1f3820ee0c30bcb5
[]
no_license
gfcaceres/BafiAppDispatch
1d8ecf1f59d1bdc9d8e423fdecdd65c3e44deded
3285777278f9ac930308a894116b792f31ba9c61
refs/heads/master
2021-02-04T07:51:39.122213
2020-03-10T00:40:19
2020-03-10T00:40:19
243,640,166
0
0
null
null
null
null
UTF-8
Java
false
false
5,191
java
package pe.com.nextel.service; import java.util.HashMap; import java.util.List; import javax.naming.Context; import javax.rmi.PortableRemoteObject; import org.apache.log4j.Logger; import pe.com.nextel.bean.DominioBean; import pe.com.nextel.bean.RequestManualBean; import pe.com.nextel.bean.StockBean; import pe.com.nextel.ejb.SEJBRequestManualRemote; import pe.com.nextel.ejb.SEJBRequestManualRemoteHome; import pe.com.nextel.util.MiUtil; public class RequestManualService extends GenericService{ protected static Logger logger = Logger.getLogger(RequestManualService.class); public RequestManualService(){} public static SEJBRequestManualRemote getSEJBRequestManualRemote() { try { final Context context = MiUtil.getInitialContext(); final SEJBRequestManualRemoteHome remoteHome = (SEJBRequestManualRemoteHome) PortableRemoteObject.narrow(context.lookup("SEJBRequestManualDispatch"), SEJBRequestManualRemoteHome.class); return remoteHome.create(); } catch (Exception ex) { System.out.println("Exception : [RequestManualService][SEJBRequestManualRemote][" + ex.getMessage() + "]"); return null; } } public HashMap getModalityList() { HashMap mapaModalidad = null; try { mapaModalidad = getSEJBRequestManualRemote().getModalityList(); }catch(Throwable t){ manageCatch(mapaModalidad, t); } return mapaModalidad; } public HashMap getEstadoList() { HashMap mapaEstado = null; try { mapaEstado = getSEJBRequestManualRemote().getEstadoList(); }catch(Throwable t){ manageCatch(mapaEstado, t); } return mapaEstado; } public HashMap getAccesoriosList() { HashMap mapaAccesorios = null; try { mapaAccesorios = getSEJBRequestManualRemote().getAccesoriosList(); }catch(Throwable t){ manageCatch(mapaAccesorios, t); } return mapaAccesorios; } public HashMap getTipoDocumentoList() { HashMap mapaTipoDocumento = null; try { mapaTipoDocumento = getSEJBRequestManualRemote().getTipoDocumentoList(); }catch(Throwable t){ manageCatch(mapaTipoDocumento, t); } return mapaTipoDocumento; } public HashMap getSolucionNegocioList() { HashMap mapaSolucionNegocio = null; try { mapaSolucionNegocio = getSEJBRequestManualRemote().getSolucionNegocioList(); }catch(Throwable t){ manageCatch(mapaSolucionNegocio, t); } return mapaSolucionNegocio; } public HashMap getLineaProductoListByIdsolucion(DominioBean solucionNegocio) { HashMap mapaLineaProducto = null; try { mapaLineaProducto = getSEJBRequestManualRemote().getLineaProductoListByIdsolucion(solucionNegocio); }catch(Throwable t){ manageCatch(mapaLineaProducto, t); } return mapaLineaProducto; } public HashMap getProductoListByLineaproductoid(DominioBean dominioBean) { HashMap mapaProducto = null; try { mapaProducto = getSEJBRequestManualRemote().getProductoListByLineaproductoid(dominioBean); }catch(Throwable t){ manageCatch(mapaProducto, t); } return mapaProducto; } public HashMap getMotivosListByUserLogin(String userLogin){ HashMap mapaUsuario = null; try { mapaUsuario = getSEJBRequestManualRemote().getMotivosListByUserLogin(userLogin); }catch(Throwable t){ manageCatch(mapaUsuario, t); } return mapaUsuario; } public HashMap saveRequestManual(RequestManualBean requestManualBean, List listaDetailRequestManual ){ HashMap mapaDatos = null; try { mapaDatos = getSEJBRequestManualRemote().saveRequestManual(requestManualBean,listaDetailRequestManual); }catch(Throwable t){ manageCatch(mapaDatos, t); } return mapaDatos; } public HashMap getRepuestosList(DominioBean solucionNegocio) { HashMap mapaDatos = null; try { mapaDatos = getSEJBRequestManualRemote().getRepuestosList(solucionNegocio); }catch(Throwable t){ manageCatch(mapaDatos, t); } return mapaDatos; } public HashMap getListaEstadoSolicitud() { HashMap mapaDatos = null; try { mapaDatos = getSEJBRequestManualRemote().getListaEstadoSolicitud(); }catch(Throwable t){ manageCatch(mapaDatos, t); } return mapaDatos; } public StockBean validarStock(StockBean stockBean) { StockBean stock = null; HashMap mapaDatos = null; try { stock = getSEJBRequestManualRemote().validarStock(stockBean); }catch(Throwable t){ manageCatch(mapaDatos, t); } return stock; } public HashMap obtenerFlagValidarProductosAndAccesorio(int lineaProducto){ HashMap mapaDatos = null; try { mapaDatos = getSEJBRequestManualRemote().obtenerFlagValidarProductosAndAccesorio(lineaProducto); }catch(Throwable t){ manageCatch(mapaDatos, t); } return mapaDatos; } }
[ "gianfranco.caceres@gmail.com" ]
gianfranco.caceres@gmail.com
57e440f82dff06881a5a033b1330beddadaa2373
7391db0830da43b8c1447a7a43d76b07edd77c80
/src/main/java/com/datdeveloper/randomspawn2/commands/ResetSpawnCommand.java
4e1b49b07b4972cbe8400ad37ef3fb497ef257ed
[ "MIT" ]
permissive
FlashiFlasche/random-spawn-2
44c59111c8e9ccf6eb79cda699f69fbb78035ddc
310f41b724e1dd6e45731cbd2f567c6a1bf09d6f
refs/heads/master
2023-08-16T07:28:15.935053
2021-09-15T00:44:54
2021-09-15T00:44:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,672
java
package com.datdeveloper.randomspawn2.commands; import com.datdeveloper.randomspawn2.RandomConfig; import com.datdeveloper.randomspawn2.Util; import com.demmodders.datmoddingapi.util.DemConstants; import com.demmodders.datmoddingapi.util.DemStringUtils; import com.demmodders.datmoddingapi.util.Permissions; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.FMLCommonHandler; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; public class ResetSpawnCommand extends CommandBase { @Override public String getName() { return "randomspawnreset"; } @Override public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { if (args.length == 1){ return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); } return super.getTabCompletions(server, sender, args, targetPos); } @Override public String getUsage(ICommandSender sender) { return (RandomConfig.saveSpawn ? DemConstants.TextColour.COMMAND + "/spawnreset [player] - " + DemConstants.TextColour.INFO + " Reset your spawn/the spawn of the given player in your dimension to a new random location" : DemConstants.TextColour.INFO + "The server has disabled saving spawn, this will do nothing"); } @Override public int getRequiredPermissionLevel() { return 0; } @Override public List<String> getAliases() { ArrayList<String> aliases = new ArrayList<>(); aliases.add("spawnreset"); return aliases; } @Override public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return true; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { // Ensure its either being called by a player, or on a player if (!(sender instanceof EntityPlayerMP) && args.length != 1) { sender.sendMessage(new TextComponentString(DemConstants.TextColour.ERROR + "As the server, you can only reset the spawn of specific players, use: /spawnreset <player>")); return; } // If called by a player make sure they have permission if (sender instanceof EntityPlayerMP) { if (!Permissions.checkPermission(sender, "datrandomteleport.rspawn.spawnreset", getRequiredPermissionLevel()) || (!Permissions.checkPermission(sender, "datrandomteleport.rspawn.spawnresetother", getRequiredPermissionLevel()) && args.length > 0)) { sender.sendMessage(new TextComponentString(DemConstants.TextColour.ERROR + "You don't have permission to do that")); return; } } // Catch if has been called when saving spawn is disabled, as it means this command won't actually do anything if (!RandomConfig.saveSpawn) { sender.sendMessage(new TextComponentString(DemConstants.TextColour.ERROR + "The server has disabled saving spawn points, this will do nothing")); return; } // Work out who the target is EntityPlayerMP target; if (args.length != 0) { target = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUsername(args[0]); } else { target = (EntityPlayerMP) sender; } if (null == target) { sender.sendMessage(new TextComponentString(DemConstants.TextColour.ERROR + "Unable to find that player")); return; } int dimension = ((EntityPlayerMP) sender).dimension; if (Util.getValidSpawnDimension(target, dimension) != dimension) { sender.sendMessage(new TextComponentString(DemConstants.TextColour.ERROR + "That player can't respawn in this dimension")); return; } if(args.length != 0) sender.sendMessage(new TextComponentString(DemConstants.TextColour.INFO + "Resetting " + DemStringUtils.makePossessive(args[0]) + " spawn")); else sender.sendMessage(new TextComponentString(DemConstants.TextColour.INFO + "Resetting your spawn")); Util.randomiseSpawnPoint(target, dimension); } }
[ "jtljac2@gmail.com" ]
jtljac2@gmail.com
596868dd3b4b3055ed3f27ddc5c3599b39624e5b
eb2c22492d4740a3eb455f2a898f6b3bc8235809
/jnnsBank/kyc-service/src/main/java/com/ideatech/ams/kyc/service/SuperviseServiceImpl.java
193bbe40545f33aa74544bad36da179fda0a5248
[]
no_license
deepexpert-gaohz/sa-d
72a2d0cbfe95252d2a62f6247e7732c883049459
2d14275071b3d562447d24bd44d3a53f5a96fb71
refs/heads/master
2023-03-10T08:39:15.544657
2021-02-24T02:17:58
2021-02-24T02:17:58
341,395,351
1
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package com.ideatech.ams.kyc.service; import com.ideatech.ams.kyc.dao.SuperviseDao; import com.ideatech.ams.kyc.dto.SuperviseDto; import com.ideatech.ams.kyc.entity.Supervise; import com.ideatech.common.util.BeanCopierUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; @Service @Transactional public class SuperviseServiceImpl implements SuperviseService { @Autowired private SuperviseDao superviseDao; @Override public void insertBatch(Long saicInfoId, List<SuperviseDto> superviseList) { Supervise supervise = null; int size = superviseList.size(); if(size == 0){ return; } //设置主键 for (SuperviseDto superviseDto: superviseList) { supervise = new Supervise(); BeanCopierUtils.copyProperties(superviseDto, supervise); // supervise.setId(Calendar.getInstance().getTimeInMillis()); supervise.setSaicinfoId(saicInfoId); superviseDao.save(supervise); } } }
[ "807661486@qq.com" ]
807661486@qq.com
7ceb029e8bf8b0a7aed8fb1590e62bc4ae6b31e6
22c8a2d93c2c74ffcb3729f3fe9b3c614884d138
/by.epam.unit03.main/src/by/epam/unit03/main/Task04.java
b7ec31e6ad3b929d453e2522e69acd86c108fd7b
[]
no_license
vlad-zankevich/Unit03Zankevich
2ba6e789a3be528942bfa3dd93b41e5ab2bed9f4
ea06535a44bf1209a31797cb506f6b4638d8830d
refs/heads/main
2023-05-03T07:02:05.842512
2021-05-24T07:40:40
2021-05-24T07:40:40
369,154,103
0
1
null
2021-05-29T10:04:52
2021-05-20T09:32:47
Java
UTF-8
Java
false
false
651
java
package by.epam.unit03.main; public class Task04 { public static void main(String[] args) { //Make a table of the values of the y = 5 - x2/2 function on the segment [-5, 5] in increments of 0.5 double x = -5; double y; System.out.println("-------------------------"); System.out.printf("|%8s\t|%8s\t|\n", "x", "y"); System.out.println("-------------------------"); while(x <= 5) { y = 5 - (Math.pow(x, 2)) / 2; System.out.printf("|\t%4.1f\t|\t%4.3f\t|\n", x, y); x = x + 0.5; } System.out.println("-------------------------"); } }
[ "vlad.zankevich@gmail.com" ]
vlad.zankevich@gmail.com
f765d12ca1ca7a2d1d5b5366a234532554e7562c
5c69c9003d29e4feb825fcd6921da9b626506b1d
/app/src/main/java/com/example/arsalankhan/imagesliderdemo/MyPagerAdapter.java
9e959a361bdf182612e47b1ba1887703e91b4a84
[]
no_license
arsalan1212/ImageSliderDemo
7c8817d7c988965643d9fab42b3244ee7eece81f
a05dd7ba12843849cc936e1e68f869f29495992f
refs/heads/master
2021-01-01T19:08:16.327505
2017-07-27T08:49:32
2017-07-27T08:49:32
98,514,493
0
0
null
null
null
null
UTF-8
Java
false
false
1,393
java
package com.example.arsalankhan.imagesliderdemo; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; /** * Created by Arsalan khan on 7/27/2017. */ public class MyPagerAdapter extends PagerAdapter { int images[]={R.drawable.image1,R.drawable.image2,R.drawable.image3,R.drawable.image4}; Context context; public MyPagerAdapter(Context context){ this.context=context; } @Override public int getCount() { return images.length; } @Override public boolean isViewFromObject(View view, Object object) { return view==(LinearLayout)object; } @Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater= (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); View view=inflater.inflate(R.layout.single_image,container,false); ImageView imageView=view.findViewById(R.id.imageView); imageView.setImageResource(images[position]); container.addView(view); return view; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((LinearLayout)object); } }
[ "arsalan.ak777@gmail.com" ]
arsalan.ak777@gmail.com
2047c2ab36ba728f5b333ce64b330c93617d4aa8
121d01fe40db720d6bba5c9cc60bc6ed9e3d8a9f
/app/src/main/java/com/example/iii_user/ming07/page2Activity.java
ebed6ae9081e46048e4549865f90679482439d6f
[]
no_license
Shine92/Android-ming07
19c80a684f232ee437e1a1ccb6f9b39f337ebe29
da03fcc0bc70b52ed2931ce38d9a5fae513e25c0
refs/heads/master
2021-01-18T02:02:27.133461
2016-05-27T00:58:01
2016-05-27T00:58:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
package com.example.iii_user.ming07; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; public class page2Activity extends AppCompatActivity { private TextView mesg; private int Lottery; public page2Activity(){ Log.i("ming", "page2Activity()"); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_page2); Log.i("ming", "page2Activity():onCreate()"); mesg = (TextView)findViewById(R.id.page2_mesg); Intent it = getIntent(); String username = it.getStringExtra("username"); Boolean sound = it.getBooleanExtra("sound", true); Integer level = it.getIntExtra("level", 1); Lottery = (int) (Math.random()*49+1); mesg.setText("username: "+username+"\n" +"sound: "+(sound?"on":"off")+"\n" +"level: "+level+"\n"+"Lottery"+Lottery+"\n"); } public void back1(View view){ finish(); } public void back2(View view){ Intent it = new Intent(this,MainActivity.class); startActivity(it); } @Override public void finish() { Intent it = new Intent(); setResult(Lottery); super.finish(); } }
[ "msn8971@gmail.com" ]
msn8971@gmail.com
555f42a4a8253409ed5cbc177d77ad443c65d0b4
adca054993b9eab782006bd75c30292f534b3b91
/netty.protobuf.client/src/main/java/netty/protobuf/client/Client.java
435fc97c26a68b9f43b62e6a3cb92ac5592eae8b
[]
no_license
scottzzq/netty.protobuf.example
087591e9c2232c9e08e2391002a1d8f0cf3108a1
f8c9d8148fb8f7ee56adec956b6d0ed01e182895
refs/heads/master
2016-09-13T10:11:39.679350
2016-04-23T16:38:11
2016-04-23T16:38:11
56,924,750
0
0
null
null
null
null
UTF-8
Java
false
false
1,677
java
package netty.protobuf.client; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.LengthFieldBasedFrameDecoder; import io.netty.handler.codec.LengthFieldPrepender; import netty.protobuf.codec.NettyMessageDecoder; import netty.protobuf.codec.NettyMessageEncoder; public class Client { public void connect(String host, int port) throws Exception { EventLoopGroup workerGroup = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(workerGroup); b.channel(NioSocketChannel.class); b.option(ChannelOption.SO_KEEPALIVE, true); b.handler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { // decoder ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(1024 * 1024, 0, 4, 0, 4)); ch.pipeline().addLast("decoder", new NettyMessageDecoder()); // encoder ch.pipeline().addLast("headerEncoder", new LengthFieldPrepender(4)); ch.pipeline().addLast("encoder", new NettyMessageEncoder()); // user handler ch.pipeline().addLast("user handler in", new ClientHandlerInEntry()); ch.pipeline().addLast("user handler out", new ClientHandlerOutEntry()); } }); ChannelFuture f = b.connect(host, port).sync(); f.channel().closeFuture().sync(); } finally { workerGroup.shutdownGracefully(); } } }
[ "zhai-303458@163.com" ]
zhai-303458@163.com
bc6b074678cd8f62b0384496b34d0e518b2a3b04
d08be282c2408e033e16e44642d9464dde698dc6
/Stacks/SortStack.java
cd7e04a306d0d03aecd71e14da65bc25e0419d80
[]
no_license
PaviRaghav/Algorithms
84b35595585bc67200db34983000374c10f901be
3309f885e893fab683fca31b94bfe93b2a8ff2f4
refs/heads/master
2021-01-19T21:20:21.398891
2018-09-17T19:47:25
2018-09-17T19:47:25
88,516,342
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package Algorithms; import Implementation.*; /** * This class is to sort a stack * * @author pavithraraghavan * */ public class SortStack { public Stack_LL seqSort(Stack_LL stk) { Stack_LL rstk = new Stack_LL(); try { while (!stk.isEmpty()) { int tmp = stk.pop(); while (!rstk.isEmpty() && rstk.top() > tmp) stk.push(rstk.pop()); rstk.push(tmp); } } catch (Exception e) { System.out.println(e); } return rstk; } }
[ "pavithra.raghavanms@gmail.com" ]
pavithra.raghavanms@gmail.com
43a1ac108b516c4beccb026829497b165bd82c0a
31d45303febe51da406a5438c35c8ce35d93be5a
/src/exception/persistence/BIRT_QueryNotFoundException.java
02b313995c4813283157c75a19483999fb239295
[]
no_license
zekuny/SeleniumTestApplication
afcb501c77ddf112a64921a732e4dc2f993fd7e7
826a4beddece2c9252a225b59a127c1153bce15e
refs/heads/master
2021-01-10T00:57:29.781554
2015-12-19T21:57:22
2015-12-19T21:57:22
48,298,499
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package exception.persistence; import exception.BIRT_Exception; public class BIRT_QueryNotFoundException extends BIRT_Exception { private static final long serialVersionUID = 1L; public BIRT_QueryNotFoundException(String strDisplayableMessage) { super(strDisplayableMessage); } }
[ "zekuny@live.unc.edu" ]
zekuny@live.unc.edu
31cc57a46082e1eded773546747f97c6acadc17a
1326ae15996748206d9014e979484ba45f47b858
/src/main/java/th/co/nxp/framework/common/persistence/repository/CommonJpaCrudRepository.java
07f8840c3772bde79506527e1111ce76d77efb2f
[]
no_license
ryangek/spring-boot
aa75c3fb6d37d884557f95ce695eb71855e6e223
83fbf1b935104bb4149af7b051529f510f78e64d
refs/heads/master
2022-07-14T20:46:16.497773
2019-08-16T07:32:32
2019-08-16T07:32:32
202,680,779
0
0
null
2022-06-29T17:34:47
2019-08-16T07:32:03
Java
UTF-8
Java
false
false
1,016
java
package th.co.nxp.framework.common.persistence.repository; import java.io.Serializable; import java.util.List; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.NoRepositoryBean; import th.co.nxp.framework.common.constant.CommonConstants.FLAG; import th.co.nxp.framework.common.persistence.entity.BaseEntity; /* * @Author: Taechapon Himarat (Su) * @Create: Jul 20, 2018 */ @NoRepositoryBean public interface CommonJpaCrudRepository<T extends BaseEntity, ID extends Serializable> extends CrudRepository<T, ID> { /** * Returns all instances of the type. * * @return all entities */ @Query("select e from #{#entityName} e where e.isDeleted = '" + FLAG.N_FLAG + "'") List<T> findAll(); /** * Returns the number of entities available. * * @return the number of entities */ @Query("select count(1) from #{#entityName} e where e.isDeleted = '" + FLAG.N_FLAG + "'") long count(); }
[ "arthit.kanjai@nxp.com" ]
arthit.kanjai@nxp.com