Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
Commits
72ab238a
Commit
72ab238a
authored
Aug 22, 2019
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断安卓版本
parent
225ea61b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/PreferenceFragmentPlus.java
...arymb/ygomobile/ui/preference/PreferenceFragmentPlus.java
+9
-3
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/PreferenceFragmentPlus.java
View file @
72ab238a
...
@@ -31,6 +31,7 @@ import static cn.garymb.ygomobile.Constants.REQUEST_CHOOSE_IMG;
...
@@ -31,6 +31,7 @@ import static cn.garymb.ygomobile.Constants.REQUEST_CHOOSE_IMG;
public
abstract
class
PreferenceFragmentPlus
extends
BasePreferenceFragment
{
public
abstract
class
PreferenceFragmentPlus
extends
BasePreferenceFragment
{
private
Preference
curPreference
;
private
Preference
curPreference
;
private
CurImageInfo
mCurImageInfo
;
private
CurImageInfo
mCurImageInfo
;
private
Uri
saveimgUri
;
protected
void
onChooseFileOk
(
Preference
preference
,
String
file
)
{
protected
void
onChooseFileOk
(
Preference
preference
,
String
file
)
{
onPreferenceChange
(
preference
,
file
);
onPreferenceChange
(
preference
,
file
);
...
@@ -121,8 +122,13 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
...
@@ -121,8 +122,13 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
}
}
Log
.
i
(
"我是srcfile"
,
srcfile
+
""
);
Log
.
i
(
"我是srcfile"
,
srcfile
+
""
);
File
file
=
new
File
(
info
.
mOutFile
);
File
file
=
new
File
(
info
.
mOutFile
);
Uri
saveimgUri
=
FileProvider
.
getUriForFile
(
getContext
(),
BuildConfig
.
APPLICATION_ID
+
".fallenstardust"
,
file
);
Intent
intent
=
new
Intent
(
"com.android.camera.action.CROP"
);
Intent
intent
=
new
Intent
(
"com.android.camera.action.CROP"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
|
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
);
saveimgUri
=
FileProvider
.
getUriForFile
(
getContext
(),
BuildConfig
.
APPLICATION_ID
+
".fallenstardust"
,
file
);
}
else
{
saveimgUri
=
Uri
.
fromFile
(
file
);
}
intent
.
setDataAndType
(
srcfile
,
"image/*"
);
intent
.
setDataAndType
(
srcfile
,
"image/*"
);
// 下面这个crop=true是设置在开启的Intent中设置显示的VIEW可裁剪
// 下面这个crop=true是设置在开启的Intent中设置显示的VIEW可裁剪
intent
.
putExtra
(
"crop"
,
"true"
);
intent
.
putExtra
(
"crop"
,
"true"
);
...
@@ -137,11 +143,11 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
...
@@ -137,11 +143,11 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
intent
.
putExtra
(
"return-data"
,
false
);
intent
.
putExtra
(
"return-data"
,
false
);
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
saveimgUri
);
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
saveimgUri
);
intent
.
putExtra
(
"outputFormat"
,
info
.
mJpeg
?
Bitmap
.
CompressFormat
.
JPEG
.
toString
()
:
Bitmap
.
CompressFormat
.
PNG
.
toString
());
intent
.
putExtra
(
"outputFormat"
,
info
.
mJpeg
?
Bitmap
.
CompressFormat
.
JPEG
.
toString
()
:
Bitmap
.
CompressFormat
.
PNG
.
toString
());
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
|
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
);
try
{
try
{
startActivityForResult
(
Intent
.
createChooser
(
intent
,
info
.
mCurTitle
),
Constants
.
REQUEST_CUT_IMG
);
startActivityForResult
(
Intent
.
createChooser
(
intent
,
info
.
mCurTitle
),
Constants
.
REQUEST_CUT_IMG
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
i
(
"我是e"
,
e
+
""
);
Log
.
i
(
"我是e"
,
e
+
""
);
Toast
.
makeText
(
getActivity
(),
R
.
string
.
no_find_image_cutor
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
no_find_image_cutor
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
...
...
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