Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile-Cn-Ko-En
Commits
f496a915
Commit
f496a915
authored
May 15, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove chat room
parent
0b010d98
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
357 additions
and
1329 deletions
+357
-1329
LICENSE
LICENSE
+339
-0
README.md
README.md
+2
-0
build.gradle
build.gradle
+1
-0
mobile/build.gradle
mobile/build.gradle
+3
-3
mobile/src/main/res/layout/activity_splash.xml
mobile/src/main/res/layout/activity_splash.xml
+0
-23
mobile/src/main/res/layout/item_chat.xml
mobile/src/main/res/layout/item_chat.xml
+0
-51
mobile/src/main/res/layout/item_chat_me.xml
mobile/src/main/res/layout/item_chat_me.xml
+0
-51
mobile/src/main/res/layout/main.xml
mobile/src/main/res/layout/main.xml
+0
-75
mobile/src/main/res/menu/nav_mycard_menu.xml
mobile/src/main/res/menu/nav_mycard_menu.xml
+2
-2
mobile/src/main/res/values-ko/strings.xml
mobile/src/main/res/values-ko/strings.xml
+2
-0
mobile/src/mycard/AndroidManifest.xml
mobile/src/mycard/AndroidManifest.xml
+2
-2
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
...src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
+3
-3
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
...rd/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
+3
-3
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatApplication.java
...cn/garymb/ygomobile/ui/online/mcchat/ChatApplication.java
+0
-22
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatListener.java
...va/cn/garymb/ygomobile/ui/online/mcchat/ChatListener.java
+0
-11
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
...ava/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
+0
-84
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
.../cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
+0
-142
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
.../cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
+0
-167
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/adapter/ChatAdapter.java
...arymb/ygomobile/ui/online/mcchat/adapter/ChatAdapter.java
+0
-139
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/management/ServiceManagement.java
...mobile/ui/online/mcchat/management/ServiceManagement.java
+0
-197
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/management/UserManagement.java
...ygomobile/ui/online/mcchat/management/UserManagement.java
+0
-36
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/ImageUtil.java
.../cn/garymb/ygomobile/ui/online/mcchat/util/ImageUtil.java
+0
-23
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/TaxiConnectionListener.java
...omobile/ui/online/mcchat/util/TaxiConnectionListener.java
+0
-140
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/Util.java
.../java/cn/garymb/ygomobile/ui/online/mcchat/util/Util.java
+0
-31
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/view/YuanImage.java
.../cn/garymb/ygomobile/ui/online/mcchat/view/YuanImage.java
+0
-124
No files found.
LICENSE
0 → 100644
View file @
f496a915
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
README.md
View file @
f496a915
# License
GPL
# YGOMobile
Android编译环境
---------------------
...
...
build.gradle
View file @
f496a915
...
...
@@ -21,6 +21,7 @@ ext {
allprojects
{
repositories
{
jcenter
()
google
()
maven
{
url
"https://jitpack.io"
}
}
}
...
...
mobile/build.gradle
View file @
f496a915
...
...
@@ -79,7 +79,7 @@ dependencies {
implementation
'com.tubb.smrv:swipemenu-recyclerview:5.4.0'
//
mycardImplementation
(
name:
'xwalk_core_library-22.52.561.4'
,
ext:
'aar'
)
implementation
'org.igniterealtime.smack:smack-android-extensions:4.2.0'
/*
implementation 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.2.0'
implementation 'org.igniterealtime.smack:smack-android:4.2.0'
implementation 'org.igniterealtime.smack:smack-core:4.2.0'
...
...
@@ -87,7 +87,7 @@ dependencies {
implementation 'org.igniterealtime.smack:smack-im:4.2.0'
implementation 'org.igniterealtime.smack:smack-resolver-minidns:4.2.0'
implementation 'org.igniterealtime.smack:smack-sasl-provided:4.2.0'
implementation
'xpp3:xpp3:1.1.4c'
//
implementation 'xpp3:xpp3:1.1.4c'
implementation 'org.jxmpp:jxmpp-core:0.5.0'
implementation 'org.jxmpp:jxmpp-jid:0.5.0'
implementation 'org.jxmpp:jxmpp-util-cache:0.5.0'
...
...
@@ -97,7 +97,7 @@ dependencies {
implementation 'de.measite.minidns:minidns-dnssec:0.2.4'
implementation 'de.measite.minidns:minidns-iterative-resolver:0.2.4'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
*/
//
implementation
'com.nightonke:boommenu:2.1.0'
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
...
...
mobile/src/main/res/layout/activity_splash.xml
deleted
100644 → 0
View file @
0b010d98
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"horizontal"
android:gravity=
"center"
android:id=
"@+id/sp_li"
>
<ProgressBar
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:id=
"@+id/sp_jz"
/>
<TextView
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"登录中,请稍等"
android:textSize=
"18sp"
android:id=
"@+id/sp_tv"
/>
</LinearLayout>
mobile/src/main/res/layout/item_chat.xml
deleted
100644 → 0
View file @
0b010d98
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#00000000"
>
<com.mcchat.feihua.view.YuanImage
android:layout_height=
"35dp"
android:layout_width=
"35dp"
android:id=
"@+id/ic_avatar"
android:scaleType=
"centerCrop"
android:layout_marginTop=
"5dp"
android:layout_marginLeft=
"10dp"
/>
<LinearLayout
android:layout_alignTop=
"@id/ic_avatar"
android:layout_toRightOf=
"@id/ic_avatar"
android:descendantFocusability=
"blocksDescendants"
android:padding=
"8dp"
android:background=
"@drawable/chat_message_background"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:id=
"@+id/ic_dialog"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"5dp"
android:layout_marginLeft=
"10dp"
>
<TextView
android:id=
"@+id/ic_name"
android:text=
"name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingBottom=
"4dp"
android:textSize=
"13sp"
android:textColor=
"#B8630C"
android:textStyle=
"bold"
/>
<TextView
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"message"
android:textColor=
"#000000"
android:id=
"@+id/ic_message"
android:textSize=
"16sp"
/>
</LinearLayout>
</RelativeLayout>
mobile/src/main/res/layout/item_chat_me.xml
deleted
100644 → 0
View file @
0b010d98
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#00000000"
>
<com.mcchat.feihua.view.YuanImage
android:id=
"@+id/icm_avatar"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_alignParentRight=
"true"
android:layout_marginRight=
"10dp"
android:layout_marginTop=
"5dp"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:id=
"@+id/icm_dialog"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignTop=
"@id/icm_avatar"
android:layout_marginBottom=
"5dp"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_toLeftOf=
"@id/icm_avatar"
android:background=
"@drawable/chat_message_me_background"
android:descendantFocusability=
"blocksDescendants"
android:orientation=
"vertical"
android:padding=
"8dp"
>
<TextView
android:id=
"@+id/icm_name"
android:layout_width=
"0px"
android:layout_height=
"0px"
android:paddingBottom=
"4dp"
android:text=
"name"
android:textColor=
"#B8630C"
android:textSize=
"13sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/icm_message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"message"
android:textColor=
"#000000"
android:textSize=
"16sp"
/>
</LinearLayout>
</RelativeLayout>
mobile/src/main/res/layout/main.xml
deleted
100644 → 0
View file @
0b010d98
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:background=
"@color/background"
android:gravity=
"center"
>
<RelativeLayout
android:background=
"@color/colorMain"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
>
<TextView
android:textColor=
"@color/white"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"@string/app_name"
android:layout_margin=
"10dp"
android:textSize=
"20sp"
android:id=
"@+id/main_title"
/>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/main_rec"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"1000"
/>
<LinearLayout
android:gravity=
"center"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"horizontal"
android:padding=
"7dp"
android:id=
"@+id/main_bottom_bar"
>
<EditText
android:background=
"@drawable/chat_edittext_background"
android:padding=
"7dp"
android:id=
"@+id/main_send_message"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:textSize=
"15sp"
android:layout_weight=
"10"
android:maxEms=
"3"
/>
<LinearLayout
android:layout_marginLeft=
"7dp"
android:layout_width=
"0dp"
android:layout_height=
"33dp"
android:gravity=
"center"
android:layout_weight=
"2"
android:orientation=
"vertical"
>
<ImageButton
android:background=
"@drawable/chat_message_background"
android:src=
"@drawable/ic_send_black_24dp"
android:id=
"@+id/main_send"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:text=
"@string/send"
android:gravity=
"center"
android:textSize=
"12sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
mobile/src/main/res/menu/nav_mycard_menu.xml
View file @
f496a915
...
...
@@ -5,10 +5,10 @@
android:icon=
"@drawable/ic_home"
android:title=
"@string/mc_home"
/>
<item
<
!--
item
android:id="@+id/action_chat"
android:icon="?android:attr/textSelectHandleLeft"
android:title=
"@string/mc_chat"
/>
android:title="@string/mc_chat" /
--
>
<item
android:id=
"@+id/action_bbs"
android:icon=
"@drawable/ic_forum"
...
...
mobile/src/main/res/values-ko/strings.xml
View file @
f496a915
...
...
@@ -179,6 +179,8 @@
<string
name=
"mycard"
>
MYcard
</string>
<string
name=
"arena"
>
듀얼리스트db
</string>
<string
name=
"mc_home"
>
홈화면
</string>
<string
name=
"mc_chat"
>
채팅
</string>
<string
name=
"send"
>
보내기
</string>
<string
name=
"bbs"
>
커뮤니티
</string>
<string
name=
"settings_pref_settings_only_game"
>
앱 실행시 YGOCORE 바로 실행(설정하지마십시오)
</string>
<string
name=
"only_game_tip"
>
앱의 초기화를 위해 설정을 초기화 해야합니다.
</string>
...
...
mobile/src/mycard/AndroidManifest.xml
View file @
f496a915
...
...
@@ -10,12 +10,12 @@
android:launchMode=
"singleTop"
android:theme=
"@style/AppTheme.Mycard"
android:windowSoftInputMode=
"stateAlwaysHidden|adjustResize"
/>
<activity
<
!--
activity
android:name="cn.garymb.ygomobile.ui.online.mcchat.McchatActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:label="@string/app_name"/>
<activity
android:name=
"cn.garymb.ygomobile.ui.online.mcchat.SplashActivity"
/>
android:name="cn.garymb.ygomobile.ui.online.mcchat.SplashActivity"/
--
>
</application>
</manifest>
\ No newline at end of file
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
View file @
f496a915
...
...
@@ -26,7 +26,7 @@ import cn.garymb.ygomobile.AppsSettings;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.plus.DefWebViewClient
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.UserManagement
;
//
import cn.garymb.ygomobile.ui.online.mcchat.management.UserManagement;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
...
...
@@ -78,8 +78,8 @@ public class MyCard {
mUser
.
avatar_url
=
info
.
getQueryParameter
(
"avatar_url"
);
mUser
.
admin
=
info
.
getBooleanQueryParameter
(
"admin"
,
false
);
mUser
.
moderator
=
info
.
getBooleanQueryParameter
(
"moderator"
,
false
);
UserManagement
.
setUserName
(
mUser
.
username
);
UserManagement
.
setUserPassword
(
mUser
.
external_id
+
""
);
//
UserManagement.setUserName(mUser.username);
//
UserManagement.setUserPassword(mUser.external_id+"");
mUser
.
login
=
true
;
if
(
getMyCardListener
()
!=
null
)
{
getMyCardListener
().
onLogin
(
mUser
.
name
,
mUser
.
avatar_url
,
null
);
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
View file @
f496a915
...
...
@@ -31,7 +31,7 @@ import cn.garymb.ygomobile.lite.BuildConfig;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.online.mcchat.SplashActivity
;
//
import cn.garymb.ygomobile.ui.online.mcchat.SplashActivity;
public
class
MyCardActivity
extends
BaseActivity
implements
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
...
...
@@ -168,9 +168,9 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
case
R
.
id
.
action_bbs
:
mWebViewPlus
.
loadUrl
(
mMyCard
.
getBBSUrl
());
break
;
case
R
.
id
.
action_chat
:
/*
case R.id.action_chat:
startActivity(new Intent(MyCardActivity.this,SplashActivity.class));
break
;
break;
*/
default
:
return
false
;
}
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatApplication.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
android.app.*
;
import
android.content.*
;
public
class
ChatApplication
extends
Application
{
private
static
Context
context
;
@Override
public
void
onCreate
()
{
// TODO: Implement this method
super
.
onCreate
();
context
=
getApplicationContext
();
}
public
static
Context
getContext
(){
return
context
;
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatListener.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
org.jivesoftware.smack.packet.*
;
public
interface
ChatListener
{
void
addMessage
(
Message
message
);
void
removeMessage
(
Message
message
);
void
reLogin
(
boolean
state
);
void
reJoin
(
boolean
state
);
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
org.jivesoftware.smack.packet.Message
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
public
class
ChatMessage
{
private
String
name
;
//private String time;
private
String
message
;
private
String
avatar
;
public
void
setAvatar
(
String
avatar
)
{
this
.
avatar
=
avatar
;
}
public
String
getAvatar
()
{
return
avatar
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
this
.
avatar
=
getAvatarUrl
(
name
);
}
public
String
getName
()
{
return
name
;
}
/*
public void setTime(String time)
{
this.time = time;
}
public String getTime()
{
return time;
}
*/
public
static
ChatMessage
toChatMessage
(
Message
message
){
if
(
message
.
getBody
()!=
null
)
{
String
xs
=
message
.
toXML
().
toString
();
int
cc
=
xs
.
indexOf
(
"stamp='"
);
if
(
cc
!=-
1
){
String
ss
=
xs
.
substring
(
cc
+
7
,
xs
.
indexOf
(
"'"
,
cc
+
7
));
}
else
{
}
String
names
=
message
.
getFrom
().
toString
();
String
name
=
names
.
substring
(
names
.
indexOf
(
ServiceManagement
.
GROUP_ADDRESS
)+
ServiceManagement
.
GROUP_ADDRESS
.
length
()+
1
,
names
.
length
());
ChatMessage
cm
=
new
ChatMessage
();
cm
.
setName
(
name
);
//cm.setTime(ss);
cm
.
setMessage
(
message
.
getBody
());
return
cm
;
}
return
null
;
}
public
String
getAvatarUrl
(
String
userName
){
return
"https://api.moecube.com/accounts/users/"
+
userName
+
".png"
;
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
android.app.*
;
import
android.os.*
;
import
android.util.*
;
import
org.jivesoftware.smack.packet.Message
;
import
android.widget.*
;
import
android.support.v7.widget.*
;
import
android.view.View.*
;
import
android.view.*
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.online.mcchat.adapter.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
public
class
McchatActivity
extends
Activity
implements
ChatListener
{
@Override
public
void
reLogin
(
boolean
state
)
{
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
if
(
state
){
main_title
.
setText
(
"登录成功"
);
}
else
{
main_title
.
setText
(
"连接断开,重新登录中……"
);
}
// TODO: Implement this method
}
@Override
public
void
reJoin
(
boolean
state
)
{
if
(
state
){
main_bottom_bar
.
setVisibility
(
View
.
VISIBLE
);
main_title
.
setText
(
getResources
().
getString
(
R
.
string
.
app_name
));
}
else
{
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
main_title
.
setText
(
"重新加入聊天室中……"
);
}
// TODO: Implement this method
}
@Override
public
void
addMessage
(
Message
message
)
{
cadp
.
sx
();
main_rec
.
smoothScrollToPosition
(
su
.
getData
().
size
()-
1
);
// TODO: Implement this method
}
@Override
public
void
removeMessage
(
Message
message
)
{
// TODO: Implement this method
}
private
EditText
main_send_message
;
private
ImageButton
main_send
;
private
RecyclerView
main_rec
;
private
TextView
main_title
;
private
LinearLayout
main_bottom_bar
;
private
ChatAdapter
cadp
;
private
ServiceManagement
su
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main
);
initView
();
}
private
void
initView
()
{
main_rec
=(
RecyclerView
)
findViewById
(
R
.
id
.
main_rec
);
main_send
=(
ImageButton
)
findViewById
(
R
.
id
.
main_send
);
main_send_message
=(
EditText
)
findViewById
(
R
.
id
.
main_send_message
);
main_title
=(
TextView
)
findViewById
(
R
.
id
.
main_title
);
main_bottom_bar
=(
LinearLayout
)
findViewById
(
R
.
id
.
main_bottom_bar
);
su
=
ServiceManagement
.
getDx
();
cadp
=
new
ChatAdapter
(
this
,
su
.
getData
());
su
.
addListener
(
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
McchatActivity
.
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
linearLayoutManager
.
setStackFromEnd
(
true
);
//关键 设置此项,当软键盘弹出时,布局会自动顶上去,在结合AndroidManifest.xml设置属性
main_rec
.
setLayoutManager
(
linearLayoutManager
);
main_rec
.
setAdapter
(
cadp
);
initListener
();
// TODO: Implement this method
}
private
void
initListener
()
{
main_send
.
setOnClickListener
(
new
OnClickListener
(){
@Override
public
void
onClick
(
View
p1
)
{
String
message
=
main_send_message
.
getText
().
toString
().
trim
();
if
(
message
.
equals
(
""
)){
Util
.
show
(
"发送内容不能为空"
);
}
else
{
try
{
su
.
sendMessage
(
message
);
main_send_message
.
setText
(
""
);
}
catch
(
Exception
e
){
Util
.
show
(
"发送失败"
);
Log
.
e
(
"错误"
,
"错误为"
+
e
);
}
}
// TODO: Implement this method
}
});
// TODO: Implement this method
}
@Override
protected
void
onDestroy
()
{
// TODO: Implement this method
super
.
onDestroy
();
su
.
disClass
();
UserManagement
.
setUserName
(
null
);
UserManagement
.
setUserPassword
(
null
);
finish
();
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
android.app.*
;
import
android.os.*
;
import
android.content.*
;
import
android.util.*
;
import
android.widget.*
;
import
android.view.*
;
import
android.view.View.*
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.online.MyCardActivity
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
public
class
SplashActivity
extends
Activity
{
ServiceManagement
su
;
ProgressBar
sp_jz
;
TextView
sp_tv
;
LinearLayout
sp_li
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO: Implement this method
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_splash
);
initView
();
/*String name=getIntent().getStringExtra("name");
String password=getIntent().getStringExtra("password");
UserManagement.setUserName(name);
UserManagement.setUserPassword(password);*/
//UserManagement.setUserName("废话多");
//UserManagement.setUserPassword("19709");
/*
SharedPreferences lastModified = getSharedPreferences("MyCardUser", Context.MODE_PRIVATE);
UserManagement.setUserName(lastModified.getString("name",null));
UserManagement.setUserPassword(lastModified.getString("id",null));
*/
su
=
ServiceManagement
.
getDx
();
join
();
}
private
void
join
()
{
if
(!
su
.
isListener
())
{
new
Thread
(
new
Runnable
(){
@Override
public
void
run
()
{
if
(!
su
.
isConnected
()){
han
.
sendEmptyMessage
(
4
);
login
();
}
if
(
su
.
isConnected
()){
han
.
sendEmptyMessage
(
3
);
try
{
su
.
joinChat
();
han
.
sendEmptyMessage
(
1
);
}
catch
(
Exception
e
)
{
han
.
sendEmptyMessage
(
2
);
}
}
// TODO: Implement this method
}
}).
start
();
}
else
{
han
.
sendEmptyMessage
(
1
);
}
// TODO: Implement this method
}
private
void
initView
()
{
sp_jz
=
findViewById
(
R
.
id
.
sp_jz
);
sp_tv
=
findViewById
(
R
.
id
.
sp_tv
);
sp_li
=
findViewById
(
R
.
id
.
sp_li
);
sp_li
.
setOnClickListener
(
new
OnClickListener
(){
@Override
public
void
onClick
(
View
p1
)
{
join
();
// TODO: Implement this method
}
});
// TODO: Implement this method
}
private
void
login
()
{
String
name
=
UserManagement
.
getUserName
();
String
password
=
UserManagement
.
getUserPassword
();
if
(
name
!=
null
&&
password
!=
null
)
{
try
{
su
.
login
(
name
,
password
);
}
catch
(
Exception
e
){
Log
.
e
(
"登录失败"
,
"登录失败"
+
e
);
Message
me
=
new
Message
();
me
.
obj
=
e
;
me
.
what
=
0
;
han
.
sendMessage
(
me
);
}
}
else
{
han
.
sendEmptyMessage
(
5
);
}
// TODO: Implement this method
}
Handler
han
=
new
Handler
(){
@Override
public
void
handleMessage
(
Message
msg
)
{
// TODO: Implement this method
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
){
case
0
:
su
.
setIsConnected
(
false
);
sp_jz
.
setVisibility
(
View
.
GONE
);
sp_tv
.
setText
(
"登录失败,点击重新登录"
);
Util
.
show
(
"登录失败,原因为"
+
msg
.
obj
);
break
;
case
1
:
startActivity
(
new
Intent
(
SplashActivity
.
this
,
McchatActivity
.
class
));
finish
();
break
;
case
2
:
su
.
setIsListener
(
false
);
sp_jz
.
setVisibility
(
View
.
GONE
);
sp_tv
.
setText
(
"加入聊天室失败,点击重新加入"
);
break
;
case
3
:
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
sp_tv
.
setText
(
"正在加入聊天室,请稍等"
);
break
;
case
4
:
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
sp_tv
.
setText
(
"登录中,请稍等"
);
break
;
case
5
:
/*sp_jz.setVisibility(View.GONE);
sp_tv.setText("用户名或密码为空");*/
startActivity
(
new
Intent
(
SplashActivity
.
this
,
MyCardActivity
.
class
));
finish
();
break
;
}
}
};
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/adapter/ChatAdapter.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.adapter
;
import
android.content.*
;
import
android.support.v7.widget.*
;
import
android.view.*
;
import
android.widget.*
;
import
android.view.View.*
;
import
java.util.*
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.online.mcchat.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
import
android.app.*
;
public
class
ChatAdapter
extends
RecyclerView
.
Adapter
<
ChatAdapter
.
ViewHolder
>
{
private
List
<
ChatMessage
>
data
;
private
Context
context
;
private
static
final
int
CHAT
=
0
;
private
static
final
int
CHAT_ME
=
1
;
@Override
public
ChatAdapter
.
ViewHolder
onCreateViewHolder
(
ViewGroup
p1
,
int
p2
)
{
View
v
=
null
;
switch
(
p2
)
{
case
CHAT:
v
=
LayoutInflater
.
from
(
p1
.
getContext
()).
inflate
(
R
.
layout
.
item_chat
,
p1
,
false
);
break
;
case
CHAT_ME:
v
=
LayoutInflater
.
from
(
p1
.
getContext
()).
inflate
(
R
.
layout
.
item_chat_me
,
p1
,
false
);
break
;
}
ViewHolder
viewHolder
=
new
ViewHolder
(
v
,
p2
);
// TODO: Implement this method
return
viewHolder
;
}
@Override
public
int
getItemViewType
(
int
position
)
{
if
(
data
.
get
(
position
).
getName
().
equals
(
UserManagement
.
getUserName
()))
{
return
CHAT_ME
;
}
else
{
return
CHAT
;
}
}
@Override
public
void
onBindViewHolder
(
ChatAdapter
.
ViewHolder
vh
,
int
position
)
{
final
ChatMessage
cm
=
data
.
get
(
position
);
vh
.
ic_name
.
setText
(
cm
.
getName
());
//vh.ic_time.setText(cm.getTime());
vh
.
ic_message
.
setText
(
cm
.
getMessage
());
ImageUtil
.
tuxian
(
context
,
cm
.
getAvatar
(),
vh
.
ic_avatar
);
if
(
position
!=
0
)
{
if
(
cm
.
getName
().
equals
(
data
.
get
(
position
-
1
).
getName
()))
{
vh
.
ic_name
.
setVisibility
(
View
.
GONE
);
vh
.
ic_avatar
.
setVisibility
(
View
.
INVISIBLE
);
}
else
{
vh
.
ic_name
.
setVisibility
(
View
.
VISIBLE
);
vh
.
ic_avatar
.
setVisibility
(
View
.
VISIBLE
);
}
}
else
{
vh
.
ic_name
.
setVisibility
(
View
.
VISIBLE
);
vh
.
ic_avatar
.
setVisibility
(
View
.
VISIBLE
);
}
vh
.
ic_dialog
.
setOnLongClickListener
(
new
OnLongClickListener
()
{
@Override
public
boolean
onLongClick
(
View
p1
)
{
Util
.
fzMessage
(
cm
.
getMessage
());
Util
.
show
(
"已复制到剪贴板"
);
// TODO: Implement this method
return
true
;
}
});
vh
.
vh
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
p1
)
{
Util
.
closeKeyboard
((
Activity
)
context
);
// TODO: Implement this method
}
});
// TODO: Implement this method
}
@Override
public
int
getItemCount
()
{
// TODO: Implement this method
return
data
.
size
();
}
public
ChatAdapter
(
Context
context
,
List
<
ChatMessage
>
data
)
{
this
.
context
=
context
;
this
.
data
=
data
;
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
TextView
ic_name
,
ic_message
;
ImageView
ic_avatar
;
LinearLayout
ic_dialog
;
View
vh
;
public
ViewHolder
(
View
v
,
int
position
)
{
super
(
v
);
vh
=
v
;
if
(
position
==
CHAT
)
{
ic_dialog
=
(
LinearLayout
)
v
.
findViewById
(
R
.
id
.
ic_dialog
);
ic_name
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
ic_name
);
ic_avatar
=
(
ImageView
)
v
.
findViewById
(
R
.
id
.
ic_avatar
);
ic_message
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
ic_message
);
}
else
{
ic_name
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
icm_name
);
ic_avatar
=
(
ImageView
)
v
.
findViewById
(
R
.
id
.
icm_avatar
);
ic_message
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
icm_message
);
ic_dialog
=
(
LinearLayout
)
v
.
findViewById
(
R
.
id
.
icm_dialog
);
}
}
}
public
void
sx
()
{
notifyDataSetChanged
();
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/management/ServiceManagement.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.management
;
import
android.util.*
;
import
java.util.*
;
import
java.io.*
;
import
org.jivesoftware.smack.*
;
import
org.jivesoftware.smack.packet.*
;
import
org.jivesoftware.smack.tcp.*
;
import
org.jivesoftware.smackx.muc.*
;
import
org.jxmpp.jid.impl.*
;
import
org.jxmpp.jid.parts.*
;
import
org.jxmpp.stringprep.*
;
import
android.os.Handler
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.*
;
public
class
ServiceManagement
{
public
static
final
String
GROUP_ADDRESS
=
"ygopro_china_north@conference.mycard.moe"
;
private
static
ServiceManagement
su
=
new
ServiceManagement
();
private
XMPPTCPConnection
con
;
private
MultiUserChat
muc
;
private
boolean
isConnected
=
false
;
private
boolean
isListener
=
false
;
private
List
<
ChatMessage
>
data
=
new
ArrayList
<
ChatMessage
>();
private
List
<
ChatListener
>
cl
=
new
ArrayList
<
ChatListener
>();
private
ServiceManagement
(){
}
public
void
addListener
(
ChatListener
c
){
cl
.
add
(
c
);
}
public
List
<
ChatMessage
>
getData
()
{
return
data
;
}
public
void
setIsListener
(
boolean
isListener
)
{
this
.
isListener
=
isListener
;
}
public
boolean
isListener
()
{
return
isListener
;
}
public
void
setIsConnected
(
boolean
isConnected
)
{
this
.
isConnected
=
isConnected
;
}
public
boolean
isConnected
()
{
return
isConnected
;
}
public
XMPPTCPConnection
getCon
()
{
return
con
;
}
private
XMPPTCPConnection
getConnextion
(
String
name
,
String
password
)
throws
XmppStringprepException
{
XMPPTCPConnectionConfiguration
config
=
XMPPTCPConnectionConfiguration
.
builder
()
.
setUsernameAndPassword
(
name
,
password
)
.
setXmppDomain
(
"mycard.moe"
)
.
setKeystoreType
(
null
)
.
setSecurityMode
(
ConnectionConfiguration
.
SecurityMode
.
disabled
)
.
build
();
con
=
new
XMPPTCPConnection
(
config
);
return
con
;
}
public
boolean
login
(
String
name
,
String
password
)
throws
IOException
,
SmackException
,
XMPPException
,
InterruptedException
{
XMPPTCPConnection
con
=
getConnextion
(
name
,
password
);
con
.
connect
();
if
(
con
.
isConnected
()){
con
.
login
();
con
.
addConnectionListener
(
new
TaxiConnectionListener
());
setIsConnected
(
true
);
return
true
;
}
setIsConnected
(
false
);
return
false
;
}
public
void
sendMessage
(
String
message
)
throws
SmackException
.
NotConnectedException
,
InterruptedException
{
muc
.
sendMessage
(
message
);
}
public
void
joinChat
()
throws
SmackException
.
NoResponseException
,
XMPPException
.
XMPPErrorException
,
MultiUserChatException
.
NotAMucServiceException
,
SmackException
.
NotConnectedException
,
XmppStringprepException
,
MultiUserChatException
.
MucAlreadyJoinedException
,
InterruptedException
{
if
(!
isListener
){
MultiUserChatManager
multiUserChatManager
=
MultiUserChatManager
.
getInstanceFor
(
getCon
());
muc
=
multiUserChatManager
.
getMultiUserChat
(
JidCreate
.
entityBareFrom
(
GROUP_ADDRESS
));
muc
.
createOrJoin
(
Resourcepart
.
from
(
UserManagement
.
getUserName
()));
data
.
clear
();
muc
.
addMessageListener
(
new
MessageListener
()
{
@Override
public
void
processMessage
(
Message
message
)
{
Log
.
e
(
"接收消息"
,
"接收"
+
message
);
ChatMessage
cm
=
ChatMessage
.
toChatMessage
(
message
);
if
(
cm
!=
null
){
data
.
add
(
cm
);
han
.
sendEmptyMessage
(
0
);
}
}
});
setIsListener
(
true
);
}
}
Handler
han
=
new
Handler
(){
@Override
public
void
handleMessage
(
android
.
os
.
Message
msg
)
{
// TODO: Implement this method
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
){
case
0
:
for
(
ChatListener
c:
cl
){
if
(
c
!=
null
){
c
.
addMessage
((
Message
)
msg
.
obj
);
}
else
{
cl
.
remove
(
c
);
}
}
break
;
case
1
:
for
(
ChatListener
c:
cl
){
if
(
c
!=
null
){
c
.
reLogin
((
boolean
)
msg
.
obj
);
}
else
{
cl
.
remove
(
c
);
}
}
break
;
case
2
:
for
(
ChatListener
c:
cl
){
if
(
c
!=
null
){
c
.
reJoin
((
boolean
)
msg
.
obj
);
}
else
{
cl
.
remove
(
c
);
}
}
break
;
}
}
};
public
void
setreLogin
(
boolean
state
){
android
.
os
.
Message
me
=
new
android
.
os
.
Message
();
me
.
what
=
1
;
me
.
obj
=
state
;
han
.
sendMessage
(
me
);
}
public
void
setreJoin
(
boolean
state
){
android
.
os
.
Message
me
=
new
android
.
os
.
Message
();
me
.
what
=
2
;
me
.
obj
=
state
;
han
.
sendMessage
(
me
);
}
public
static
ServiceManagement
getDx
(){
return
su
;
}
public
void
disSerVice
(){
con
.
disconnect
();
setIsConnected
(
false
);
}
public
void
disClass
(){
disSerVice
();
setIsConnected
(
false
);
setIsListener
(
false
);
data
.
clear
();
cl
.
clear
();
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/management/UserManagement.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.management
;
public
class
UserManagement
{
private
static
UserManagement
um
=
new
UserManagement
();
private
static
String
userName
,
userPassword
;
private
UserManagement
(){
}
public
static
String
getUserName
(){
return
userName
;
}
public
static
String
getUserPassword
(){
return
userPassword
;
}
public
static
void
setUserName
(
String
name
){
userName
=
name
;
}
public
static
void
setUserPassword
(
String
password
){
userPassword
=
password
;
}
public
static
UserManagement
getDx
(){
return
um
;
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/ImageUtil.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.util
;
import
android.widget.*
;
import
com.bumptech.glide.*
;
import
android.net.*
;
import
android.content.*
;
import
com.bumptech.glide.load.engine.*
;
import
cn.garymb.ygomobile.lite.R
;
public
class
ImageUtil
{
public
static
void
tuxian
(
Context
context
,
String
url
,
final
ImageView
im
){
if
(
url
!=
null
){
Glide
.
with
(
context
)
.
load
(
Uri
.
parse
(
url
))
.
asBitmap
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
SOURCE
)
.
placeholder
(
R
.
drawable
.
avatar
)
.
into
(
im
);
}
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/TaxiConnectionListener.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.util
;
/**
* 连接监听类
*
*
*/
import
android.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.*
;
import
java.util.*
;
//import org.apache.commons.codec.net.*;
import
org.jivesoftware.smack.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
import
java.io.*
;
import
org.jivesoftware.smack.SmackException.*
;
import
org.jivesoftware.smack.XMPPException.*
;
import
org.jivesoftware.smackx.muc.MultiUserChatException.*
;
import
org.jxmpp.stringprep.*
;
import
android.os.*
;
public
class
TaxiConnectionListener
implements
ConnectionListener
{
@Override
public
void
connected
(
XMPPConnection
p1
)
{
Log
.
e
(
"TaxiConnectionListener"
,
"开始连接"
);
//连接
// TODO: Implement this method
}
@Override
public
void
authenticated
(
XMPPConnection
p1
,
boolean
p2
)
{
Log
.
e
(
"TaxiConnectionListener"
,
"通过身份验证"
);
//通过身份验证
// TODO: Implement this method
}
@Override
public
void
reconnectionSuccessful
()
{
//重新连接成功
Log
.
e
(
"TaxiConnectionListener"
,
"重连成功"
);
// TODO: Implement this method
}
@Override
public
void
reconnectingIn
(
int
p1
)
{
//正在重连
Log
.
e
(
"TaxiConnectionListener"
,
"正在重连"
+
p1
);
// TODO: Implement this method
}
@Override
public
void
reconnectionFailed
(
Exception
p1
)
{
//重新连接失败
Log
.
e
(
"重连失败"
,
"失败"
+
p1
);
// TODO: Implement this method
}
private
Timer
tExit
;
private
String
username
;
private
String
password
;
private
int
logintime
=
2000
;
private
ServiceManagement
sm
=
ServiceManagement
.
getDx
();
@Override
public
void
connectionClosed
()
{
//正常关闭连接
Log
.
e
(
"TaxiConnectionListener"
,
"连接关闭"
);
// 重连服务器
//tExit = new Timer();
//tExit.schedule(new timetask(), logintime);
}
@Override
public
void
connectionClosedOnError
(
Exception
e
)
{
//非正常关闭连接
Log
.
e
(
"TaxiConnectionListener"
,
"连接关闭异常"
+
e
);
sm
.
setIsListener
(
false
);
// 重连服务器
tExit
=
new
Timer
();
tExit
.
schedule
(
new
timetask
(),
logintime
);
}
class
timetask
extends
TimerTask
{
@Override
public
void
run
()
{
username
=
UserManagement
.
getUserName
();
password
=
UserManagement
.
getUserPassword
();
if
(
username
!=
null
&&
password
!=
null
)
{
sm
.
setreLogin
(
false
);
Log
.
e
(
"TaxiConnectionListener"
,
"尝试登录"
);
// 连接服务器
try
{
if
(
sm
.
login
(
username
,
password
))
{
sm
.
setreLogin
(
true
);
Log
.
e
(
"TaxiConnectionListener"
,
"登录成功"
);
tExit
.
schedule
(
new
timeJoin
(),
logintime
);
}
else
{
Log
.
e
(
"TaxiConnectionListener"
,
"重新登录"
);
tExit
.
schedule
(
new
timetask
(),
logintime
);
}
}
catch
(
Exception
e
){
tExit
.
schedule
(
new
timetask
(),
logintime
);
}
}
}
class
timeJoin
extends
TimerTask
{
@Override
public
void
run
()
{
sm
.
setreJoin
(
false
);
Log
.
e
(
"TaxiConnectionListener"
,
"尝试加入房间"
);
try
{
sm
.
joinChat
();
sm
.
setreJoin
(
true
);
Log
.
e
(
"TaxiConnectionListener"
,
"加入房间成功"
);
}
catch
(
Exception
e
){
Log
.
e
(
"TaxiConnectionListener"
,
"重新加入房间"
);
tExit
.
schedule
(
new
timeJoin
(),
logintime
);
}
// TODO: Implement this method
}
}
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/util/Util.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.util
;
import
android.app.*
;
import
android.content.*
;
import
android.view.inputmethod.*
;
import
android.widget.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.*
;
public
class
Util
{
//提示
public
static
void
show
(
String
message
){
Toast
.
makeText
(
ChatApplication
.
getContext
(),
message
,
Toast
.
LENGTH_SHORT
).
show
();
}
//关闭输入法
public
static
void
closeKeyboard
(
Activity
activity
){
InputMethodManager
inputMethodManager
=
(
InputMethodManager
)
activity
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
inputMethodManager
.
hideSoftInputFromWindow
((
activity
).
getCurrentFocus
().
getWindowToken
()
,
InputMethodManager
.
HIDE_NOT_ALWAYS
);
}
//复制字符串到剪贴板
public
static
void
fzMessage
(
String
message
){
ClipboardManager
cmb
=
(
ClipboardManager
)
ChatApplication
.
getContext
().
getSystemService
(
ChatApplication
.
getContext
().
CLIPBOARD_SERVICE
);
cmb
.
setText
(
message
);
//复制命令
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/view/YuanImage.java
deleted
100644 → 0
View file @
0b010d98
package
cn.garymb.ygomobile.ui.online.mcchat.view
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap.Config
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.PorterDuff.Mode
;
import
android.graphics.PorterDuffXfermode
;
import
android.graphics.Rect
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.NinePatchDrawable
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.widget.ImageView
;
/*
* 圆形ImageView
*/
public
class
YuanImage
extends
android
.
support
.
v7
.
widget
.
AppCompatImageView
{
private
Context
mContext
;
// 控件默认长、宽
private
int
defaultWidth
=
0
;
private
int
defaultHeight
=
0
;
public
YuanImage
(
Context
context
)
{
super
(
context
);
mContext
=
context
;
}
public
YuanImage
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
mContext
=
context
;
}
public
YuanImage
(
Context
context
,
AttributeSet
attrs
,
int
defStyle
)
{
super
(
context
,
attrs
,
defStyle
);
mContext
=
context
;
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
Drawable
drawable
=
getDrawable
()
;
if
(
drawable
==
null
)
{
return
;
}
if
(
getWidth
()
==
0
||
getHeight
()
==
0
)
{
return
;
}
this
.
measure
(
0
,
0
);
if
(
drawable
.
getClass
()
==
NinePatchDrawable
.
class
)
return
;
Bitmap
b
=
((
BitmapDrawable
)
drawable
).
getBitmap
();
Bitmap
bitmap
=
b
.
copy
(
Bitmap
.
Config
.
ARGB_8888
,
true
);
if
(
defaultWidth
==
0
)
{
defaultWidth
=
getWidth
();
}
if
(
defaultHeight
==
0
)
{
defaultHeight
=
getHeight
();
}
int
radius
=
(
defaultWidth
<
defaultHeight
?
defaultWidth
:
defaultHeight
)
/
2
;
Bitmap
roundBitmap
=
getCroppedRoundBitmap
(
bitmap
,
radius
);
canvas
.
drawBitmap
(
roundBitmap
,
defaultWidth
/
2
-
radius
,
defaultHeight
/
2
-
radius
,
null
);
}
/**
* 获取裁剪后的圆形图片
* @param radius 半径
*/
public
Bitmap
getCroppedRoundBitmap
(
Bitmap
bmp
,
int
radius
)
{
Bitmap
scaledSrcBmp
;
int
diameter
=
radius
*
2
;
// 为了防止宽高不相等,造成圆形图片变形,因此截取长方形中处于中间位置最大的正方形图片
int
bmpWidth
=
bmp
.
getWidth
();
int
bmpHeight
=
bmp
.
getHeight
();
int
squareWidth
=
0
,
squareHeight
=
0
;
int
x
=
0
,
y
=
0
;
Bitmap
squareBitmap
;
if
(
bmpHeight
>
bmpWidth
)
{
// 高大于宽
squareWidth
=
squareHeight
=
bmpWidth
;
x
=
0
;
y
=
(
bmpHeight
-
bmpWidth
)
/
2
;
// 截取正方形图片
squareBitmap
=
Bitmap
.
createBitmap
(
bmp
,
x
,
y
,
squareWidth
,
squareHeight
);
}
else
if
(
bmpHeight
<
bmpWidth
)
{
// 宽大于高
squareWidth
=
squareHeight
=
bmpHeight
;
x
=
(
bmpWidth
-
bmpHeight
)
/
2
;
y
=
0
;
squareBitmap
=
Bitmap
.
createBitmap
(
bmp
,
x
,
y
,
squareWidth
,
squareHeight
);
}
else
{
squareBitmap
=
bmp
;
}
if
(
squareBitmap
.
getWidth
()
!=
diameter
||
squareBitmap
.
getHeight
()
!=
diameter
)
{
scaledSrcBmp
=
Bitmap
.
createScaledBitmap
(
squareBitmap
,
diameter
,
diameter
,
true
);
}
else
{
scaledSrcBmp
=
squareBitmap
;
}
Bitmap
output
=
Bitmap
.
createBitmap
(
scaledSrcBmp
.
getWidth
(),
scaledSrcBmp
.
getHeight
(),
Config
.
ARGB_8888
);
Canvas
canvas
=
new
Canvas
(
output
);
Paint
paint
=
new
Paint
();
Rect
rect
=
new
Rect
(
0
,
0
,
scaledSrcBmp
.
getWidth
(),
scaledSrcBmp
.
getHeight
());
paint
.
setAntiAlias
(
true
);
paint
.
setFilterBitmap
(
true
);
paint
.
setDither
(
true
);
canvas
.
drawARGB
(
0
,
0
,
0
,
0
);
canvas
.
drawCircle
(
scaledSrcBmp
.
getWidth
()
/
2
,
scaledSrcBmp
.
getHeight
()
/
2
,
scaledSrcBmp
.
getWidth
()
/
2
,
paint
);
paint
.
setXfermode
(
new
PorterDuffXfermode
(
Mode
.
SRC_IN
));
canvas
.
drawBitmap
(
scaledSrcBmp
,
rect
,
rect
,
paint
);
bmp
=
null
;
squareBitmap
=
null
;
scaledSrcBmp
=
null
;
return
output
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment