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
97c88374
Commit
97c88374
authored
Dec 19, 2018
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复有悬浮窗权限,无通知权限时不提示的bug
新增卡组分享(卡组截图,储存路径ygocore/deckShare)
parent
2450c6bc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
22 deletions
+91
-22
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+7
-0
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
...java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+41
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+15
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+2
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/BitmapUtil.java
...e/src/main/java/cn/garymb/ygomobile/utils/BitmapUtil.java
+14
-0
mobile/src/main/res/layout/activity_deck_cards.xml
mobile/src/main/res/layout/activity_deck_cards.xml
+1
-1
mobile/src/main/res/menu/deck_menu.xml
mobile/src/main/res/menu/deck_menu.xml
+9
-2
No files found.
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
97c88374
...
...
@@ -350,6 +350,13 @@ public class AppsSettings {
return
new
File
(
getResourcePath
(),
Constants
.
MOBILE_LOG
).
getAbsolutePath
();
}
/***
* 卡组分享图片文件夹
*/
public
String
getDeckSharePath
()
{
return
new
File
(
getResourcePath
(),
Constants
.
MOBILE_DECK_SHARE
).
getAbsolutePath
();
}
/***
* 当前数据库文件夹
*/
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
97c88374
...
...
@@ -67,6 +67,7 @@ public interface Constants {
String
CORE_SINGLE_PATH
=
"single"
;
String
CORE_IMAGE_PATH
=
"pics"
;
String
MOBILE_LOG
=
"log"
;
String
MOBILE_DECK_SHARE
=
"deckShare"
;
String
CORE_EXPANSIONS_IMAGE_PATH
=
"expansions/pics"
;
String
CORE_IMAGE_FIELD_PATH
=
"field"
;
String
CORE_SCRIPT_PATH
=
"script"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
View file @
97c88374
...
...
@@ -29,7 +29,7 @@ import ocgcore.data.Card;
public
abstract
class
BaseCardsAcitivity
extends
BaseActivity
implements
CardLoader
.
CallBack
{
protected
DrawerLayout
mDrawerlayout
;
pr
ivate
RecyclerView
mListView
;
pr
otected
RecyclerView
mListView
;
protected
CardSearcher
mCardSelector
;
protected
CardListAdapter
mCardListAdapater
;
protected
CardLoader
mCardLoader
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
97c88374
...
...
@@ -3,10 +3,16 @@ package cn.garymb.ygomobile.ui.cards;
import
android.content.ClipData
;
import
android.content.ClipboardManager
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.util.LruCache
;
import
android.support.v7.widget.AppCompatSpinner
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerViewItemListener
;
...
...
@@ -57,6 +63,7 @@ import cn.garymb.ygomobile.ui.plus.AOnGestureListener;
import
cn.garymb.ygomobile.ui.plus.DefaultOnBoomListener
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.BitmapUtil
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.ShareUtil
;
import
ocgcore.DataManager
;
...
...
@@ -575,6 +582,9 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
case
R
.
id
.
action_card_list
:
showResult
(
true
);
break
;
case
R
.
id
.
action_share_deck
:
shareDeck
();
break
;
case
R
.
id
.
action_save
:
if
(
mYdkFile
==
null
)
{
inputDeckName
(
null
);
...
...
@@ -655,13 +665,38 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
}
private
void
shareDeck
()
{
// 开启绘图缓存
mRecyclerView
.
setDrawingCacheEnabled
(
true
);
//这个方法可调可不调,因为在getDrawingCache()里会自动判断有没有缓存有没有准备好,
//如果没有,会自动调用buildDrawingCache()
mRecyclerView
.
buildDrawingCache
();
//获取绘图缓存 这里直接创建了一个新的bitmap
//因为我们在最后需要释放缓存资源,会释放掉缓存中创建的bitmap对象
Bitmap
bitmap
=
BitmapUtil
.
drawBg4Bitmap
(
Color
.
parseColor
(
"#e6f3fd"
),
Bitmap
.
createBitmap
(
mRecyclerView
.
getDrawingCache
(),
0
,
0
,
mRecyclerView
.
getMeasuredWidth
(),
mRecyclerView
.
getMeasuredHeight
()));
//清理绘图缓存,释放资源
mRecyclerView
.
destroyDrawingCache
();
// shotRecyclerView(mRecyclerView)
Deck
deck
=
mDeckAdapater
.
toDeck
(
mYdkFile
);
String
label
=
TextUtils
.
isEmpty
(
deck
.
getName
())
?
getString
(
R
.
string
.
share_deck
)
:
deck
.
getName
();
final
String
uriString
=
deck
.
toAppUri
().
toString
();
final
String
httpUri
=
deck
.
toHttpUri
().
toString
();
shareUrl
(
uriString
,
label
);
String
deckName
=
deck
.
getName
();
int
end
=
deckName
.
lastIndexOf
(
"."
);
if
(
end
!=-
1
){
deckName
=
deckName
.
substring
(
0
,
end
);
}
String
savePath
=
new
File
(
AppsSettings
.
get
().
getDeckSharePath
(),
deckName
+
".jpg"
).
getAbsolutePath
();
BitmapUtil
.
saveBitmap
(
bitmap
,
savePath
,
50
);
ShareUtil
.
shareImage
(
DeckManagerActivityImpl
.
this
,
"卡组分享"
,
savePath
,
null
);
// String label = TextUtils.isEmpty(deck.getName()) ? getString(R.string.share_deck) : deck.getName();
// final String uriString = deck.toAppUri().toString();
// final String httpUri = deck.toHttpUri().toString();
// shareUrl(uriString, label);
}
private
void
shareUrl
(
String
uri
,
String
label
)
{
String
url
=
getString
(
R
.
string
.
deck_share_head
)
+
" "
+
uri
;
ShareUtil
.
shareText
(
this
,
getString
(
R
.
string
.
share_deck
),
url
,
null
);
...
...
@@ -861,7 +896,8 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
private
void
initBoomMenuButton
(
BoomMenuButton
menu
)
{
final
SparseArray
<
Integer
>
mMenuIds
=
new
SparseArray
<>();
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_card_search
,
R
.
string
.
deck_list
,
R
.
drawable
.
listicon
);
// addMenuButton(mMenuIds, menu, R.id.action_card_search, R.string.deck_list, R.drawable.listicon);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_share_deck
,
R
.
string
.
share_deck
,
R
.
drawable
.
listicon
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_save
,
R
.
string
.
save_deck
,
R
.
drawable
.
save
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_clear_deck
,
R
.
string
.
clear_deck
,
R
.
drawable
.
clear_deck
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
97c88374
...
...
@@ -130,8 +130,11 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
checkPgyerUpdateSilent
(
getContext
(),
false
,
false
,
false
);
//ServiceDuelAssistant
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
PermissionUtil
.
isNotificationPermission
(
this
)==
null
)
DialogPlus
dialogPlus
=
PermissionUtil
.
isNotificationPermission
(
this
);
if
(
dialogPlus
==
null
)
this
.
startForegroundService
(
new
Intent
(
this
,
ServiceDuelAssistant
.
class
));
else
dialogPlus
.
show
();
}
else
{
startService
(
new
Intent
(
this
,
ServiceDuelAssistant
.
class
));
}
...
...
@@ -147,7 +150,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
@Override
public
void
onNotchInformation
(
boolean
isNotch
,
int
notchHeight
,
int
phoneType
)
{
try
{
FileLogUtil
.
writeAndTime
(
"检查刘海"
+
isNotch
+
" "
+
notchHeight
);
FileLogUtil
.
writeAndTime
(
"检查刘海"
+
isNotch
+
" "
+
notchHeight
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
97c88374
...
...
@@ -275,7 +275,8 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
Constants
.
CORE_REPLAY_PATH
,
Constants
.
FONT_DIRECTORY
,
Constants
.
CORE_IMAGE_PATH
,
Constants
.
MOBILE_LOG
Constants
.
MOBILE_LOG
,
Constants
.
MOBILE_DECK_SHARE
};
File
dirFile
=
null
;
for
(
String
dir
:
dirs
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/BitmapUtil.java
View file @
97c88374
...
...
@@ -5,6 +5,8 @@ import android.content.res.AssetManager;
import
android.content.res.Resources
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.util.DisplayMetrics
;
...
...
@@ -210,4 +212,16 @@ public class BitmapUtil {
view
.
measure
(
widthSpec
,
heightSpec
);
view
.
layout
(
0
,
0
,
w
,
h
);
}
public
static
Bitmap
drawBg4Bitmap
(
int
color
,
Bitmap
orginBitmap
)
{
Paint
paint
=
new
Paint
();
paint
.
setColor
(
color
);
Bitmap
bitmap
=
Bitmap
.
createBitmap
(
orginBitmap
.
getWidth
(),
orginBitmap
.
getHeight
(),
orginBitmap
.
getConfig
());
Canvas
canvas
=
new
Canvas
(
bitmap
);
canvas
.
drawRect
(
0
,
0
,
orginBitmap
.
getWidth
(),
orginBitmap
.
getHeight
(),
paint
);
canvas
.
drawBitmap
(
orginBitmap
,
0
,
0
,
paint
);
return
bitmap
;
}
}
mobile/src/main/res/layout/activity_deck_cards.xml
View file @
97c88374
...
...
@@ -128,7 +128,7 @@
android:divider=
"@android:color/transparent"
android:dividerHeight=
"4dp"
android:padding=
"2dp"
android:scrollbars=
"none"
/>
android:scrollbars=
"none"
/>
</LinearLayout>
<LinearLayout
...
...
mobile/src/main/res/menu/deck_menu.xml
View file @
97c88374
...
...
@@ -6,11 +6,18 @@
android:icon=
"@drawable/search"
android:title=
"@string/search"
app:showAsAction=
"always"
/>
<item
android:id=
"@+id/action_
card_list
"
android:id=
"@+id/action_
share_deck
"
android:icon=
"@drawable/listicon"
android:title=
"@string/
card_result
"
android:title=
"@string/
share_deck
"
app:showAsAction=
"always"
/>
<!--<item-->
<!--android:id="@+id/action_card_list"-->
<!--android:icon="@drawable/listicon"-->
<!--android:title="@string/card_result"-->
<!--app:showAsAction="always"/>-->
<!--<item
android:id="@+id/action_refresh"
android:icon="@drawable/ic_refresh"
...
...
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