Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若苗瞬
年会抽奖
提交
f989abc5
年会抽奖
项目概览
若苗瞬
/
年会抽奖
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
年会抽奖
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f989abc5
编写于
11月 20, 2021
作者:
若苗瞬
😶
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upd: for rad11, but still can't open txt file.
上级
43d02079
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
676 addition
and
256 deletion
+676
-256
AndroidManifest.template.xml
AndroidManifest.template.xml
+30
-26
README.md
README.md
+6
-6
Unit1.fmx
Unit1.fmx
+7
-8
Unit1.pas
Unit1.pas
+103
-63
pro_Lottery.deployproj
pro_Lottery.deployproj
+274
-84
pro_Lottery.dproj
pro_Lottery.dproj
+253
-69
pro_Lottery.dproj.local
pro_Lottery.dproj.local
+3
-0
未找到文件。
AndroidManifest.template.xml
浏览文件 @
f989abc5
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"%package%"
android:versionCode=
"%versionCode%"
android:versionName=
"%versionName%"
android:installLocation=
"%installLocation%"
>
package=
"%package%"
android:versionCode=
"%versionCode%"
android:versionName=
"%versionName%"
android:installLocation=
"%installLocation%"
>
<uses-sdk
android:minSdkVersion=
"%minSdkVersion%"
android:targetSdkVersion=
"%targetSdkVersion%"
/>
<
%uses-permission%>
<uses-feature
android:glEsVersion=
"0x00020000"
android:required=
"True"
/>
<application
android:persistent=
"%persistent%"
android:restoreAnyVersion=
"%restoreAnyVersion%"
android:label=
"%label%"
android:debuggable=
"%debuggable%"
<
%uses-permission%>
<uses-feature
android:glEsVersion=
"0x00020000"
android:required=
"true"
/>
<queries>
<
%queries-child-elements%>
</queries>
<application
android:persistent=
"%persistent%"
android:restoreAnyVersion=
"%restoreAnyVersion%"
android:label=
"%label%"
android:debuggable=
"%debuggable%"
android:largeHeap=
"%largeHeap%"
android:icon=
"%icon%"
android:theme=
"%theme%"
android:hardwareAccelerated=
"%hardwareAccelerated%"
android:resizeableActivity=
"false"
android:requestLegacyExternalStorage=
"true"
>
<
%provider%>
<
%application-meta-data%>
<
%uses-libraries%>
<
%services%>
<
%provider%>
<
%application-meta-data%>
<
%uses-libraries%>
<
%services%>
<!-- Our activity is a subclass of the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity
android:name=
"com.embarcadero.firemonkey.FMXNativeActivity"
android:label=
"%activityLabel%"
android:configChanges=
"orientation|keyboard|keyboardHidden|screenSize"
android:launchMode=
"singleTask"
>
<activity
android:name=
"com.embarcadero.firemonkey.FMXNativeActivity"
android:label=
"%activityLabel%"
android:configChanges=
"orientation|keyboard|keyboardHidden|screenSize"
android:launchMode=
"singleTask"
>
<!-- Tell NativeActivity the name of our .so -->
<meta-data
android:name=
"android.app.lib_name"
android:value=
"%libNameValue%"
/>
<intent-filter>
<meta-data
android:name=
"android.app.lib_name"
android:value=
"%libNameValue%"
/>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
<
%activity%>
<
%receivers%>
<
%activity%>
<
%receivers%>
</application>
</manifest>
<!-- END_INCLUDE(manifest) -->
README.md
浏览文件 @
f989abc5
# AC Lottery
##
##
介绍
## 介绍
奥诚科技年会抽奖程序(功能非常简单)。
##
##
软件架构
## 软件架构
Windows & Android
##
##
安装教程
## 安装教程
1.
Windows下直接运行exe程序。
2.
安卓下安装APK并运行。
##
##
使用说明
## 使用说明
1.
打开程序。
2.
按钮1)选择抽奖名单(安卓下预设在/storage/emulated/0/抽奖名单.txt)
3.
按钮2)选择背景音乐(安卓下固定在/storage/emulated/0/背景音乐.mp3)
...
...
@@ -19,14 +19,14 @@ Windows & Android
5.
抽中的人不会参与下一次抽奖,但在预览界面仍会被随机显示和选中。
6.
无奖项设置等其它功能,适合小型抽奖。
##
##
参与贡献
## 参与贡献
1.
Fork 本仓库
2.
新建 Feat_xxx 分支
3.
提交代码
4.
新建 Pull Request
##
##
MISC
## MISC
2.
博客
[
DDRFAN
](
https://blog.csdn.net/ddrfan
)
3.
你可以
[
https://gitee.com/explore
](
https://gitee.com/explore
)
这个地址来了解 Gitee 上的优秀开源项目
...
...
Unit1.fmx
浏览文件 @
f989abc5
...
...
@@ -2,7 +2,7 @@ object Form5: TForm5
Left = 0
Top = 0
Caption = #22885#35802#31185#25216#26032#26149#22823#25277#22870
ClientHeight = 59
1
ClientHeight = 59
2
ClientWidth = 1000
Position = ScreenCenter
Quality = HighPerformance
...
...
@@ -41697,7 +41697,7 @@ object Form5: TForm5
HitTest = False
Opacity = 0.400000005960464500
Size.Width = 1000.000000000000000000
Size.Height = 59
1
.000000000000000000
Size.Height = 59
2
.000000000000000000
Size.PlatformDefault = False
WrapMode = Stretch
end
...
...
@@ -81783,7 +81783,7 @@ object Form5: TForm5
end
object Panel1: TPanel
Align = Bottom
Position.Y = 54
1
.000000000000000000
Position.Y = 54
2
.000000000000000000
Size.Width = 1000.000000000000000000
Size.Height = 50.000000000000000000
Size.PlatformDefault = False
...
...
@@ -81822,7 +81822,6 @@ object Form5: TForm5
Touch.InteractiveGestures = [LongTap, DoubleTap]
Align = Left
TabOrder = 0
Text = '/storage/emulated/0/'#25277#22870#21517#21333'.txt'
Position.Y = 9.000000000000000000
Size.Width = 353.000000000000000000
Size.Height = 32.000000000000000000
...
...
@@ -81932,7 +81931,7 @@ object Form5: TForm5
Enabled = False
Hint = #25277#22870#21517#21333
Size.Width = 200.000000000000000000
Size.Height = 54
1
.000000000000000000
Size.Height = 54
2
.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'listboxstyle'
TabOrder = 5
...
...
@@ -81950,7 +81949,7 @@ object Form5: TForm5
DefaultItemStyles.GroupHeaderStyle = 'listboxgroupheader'
DefaultItemStyles.GroupFooterStyle = ''
Viewport.Width = 200.000000000000000000
Viewport.Height = 54
1
.000000000000000000
Viewport.Height = 54
2
.000000000000000000
object ListBoxItem1: TListBoxItem
IsSelected = True
ItemData.Bitmap.PNG = {
...
...
@@ -82063,14 +82062,14 @@ object Form5: TForm5
HitTest = False
Position.X = 922.000000000000000000
Size.Width = 78.000000000000000000
Size.Height = 54
1
.000000000000000000
Size.Height = 54
2
.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'memostyle'
TabOrder = 3
ParentShowHint = False
ShowHint = True
Viewport.Width = 68.000000000000000000
Viewport.Height = 53
1
.000000000000000000
Viewport.Height = 53
2
.000000000000000000
end
object opd_names: TOpenDialog
DefaultExt = '*.txt'
Unit1.pas
浏览文件 @
f989abc5
...
...
@@ -5,21 +5,14 @@ interface
uses
System
.
SysUtils
,
System
.
Types
,
System
.
UITypes
,
System
.
Classes
,
System
.
Variants
,
System
.
Permissions
,
{$IFDEF ANDROID}
FMX
.
Platform
.
Android
,
Androidapi
.
JNI
.
Net
,
FMX
.
Platform
,
Androidapi
.
JNI
.
GraphicsContentViewText
,
Androidapi
.
JNI
.
JavaTypes
,
Androidapi
.
JNIBridge
,
Androidapi
.
Helpers
,
Androidapi
.
JNI
.
Telephony
,
FMX
.
PhoneDialer
,
Androidapi
.
JNI
.
Os
,
{$ENDIF}
FMX
.
Types
,
FMX
.
Controls
,
FMX
.
Forms
,
FMX
.
Graphics
,
FMX
.
Dialogs
,
FMX
.
Controls
.
Presentation
,
FMX
.
StdCtrls
,
FMX
.
ListView
.
Types
,
FMX
.
ListView
.
Appearances
,
FMX
.
ListView
.
Adapters
.
Base
,
FMX
.
ListView
,
FMX
.
ScrollBox
,
FMX
.
Memo
,
FMX
.
DialogService
,
FMX
.
Layouts
,
FMX
.
ListBox
,
FMX
.
ScrollBox
,
FMX
.
Memo
,
FMX
.
Layouts
,
FMX
.
ListBox
,
System
.
ImageList
,
FMX
.
ImgList
,
FMX
.
Ani
,
FMX
.
Objects
,
FMX
.
Effects
,
FMX
.
Memo
.
Types
,
FMX
.
Edit
,
FMX
.
Media
;
FMX
.
Memo
.
Types
,
FMX
.
Edit
,
FMX
.
Media
,
FMX
.
MediaLibrary
.
Actions
,
FMX
.
Filter
.
Effects
,
FMX
.
Filter
;
type
TForm5
=
class
(
TForm
)
...
...
@@ -55,7 +48,14 @@ type
private
tmpi
:
Integer
;
musicName
:
String
;
FPermissionReadExternalStorage
,
FPermissionWriteExternalStorage
:
string
;
procedure
DisplayRationale
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
APostRationaleProc
:
TProc
);
procedure
LoadListPermissionRequestResult
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
AGrantResults
:
TClassicPermissionStatusDynArray
);
procedure
LoadSongPermissionRequestResult
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
AGrantResults
:
TClassicPermissionStatusDynArray
);
public
constructor
Create
(
AOwner
:
TComponent
);
override
;
destructor
Destroy
;
override
;
procedure
LoadList
();
end
;
...
...
@@ -64,19 +64,66 @@ var
implementation
uses
{$IFDEF ANDROID}
Androidapi
.
Helpers
,
Androidapi
.
JNI
.
JavaTypes
,
Androidapi
.
JNI
.
Os
,
{$ENDIF}
FMX
.
DialogService
;
{$R *.fmx}
constructor
TForm5
.
Create
(
AOwner
:
TComponent
);
begin
inherited
Create
(
AOwner
);
{$IFDEF ANDROID}
FPermissionReadExternalStorage
:=
JStringToString
(
TJManifest_permission
.
JavaClass
.
READ_EXTERNAL_STORAGE
);
FPermissionWriteExternalStorage
:=
JStringToString
(
TJManifest_permission
.
JavaClass
.
WRITE_EXTERNAL_STORAGE
);
{$ENDIF}
end
;
destructor
TForm5
.
Destroy
;
begin
inherited
Destroy
;
end
;
// Optional rationale display routine to display permission requirement rationale to the user
procedure
TForm5
.
DisplayRationale
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
APostRationaleProc
:
TProc
);
var
I
:
Integer
;
RationaleMsg
:
string
;
begin
for
I
:=
0
to
High
(
APermissions
)
do
begin
if
APermissions
[
I
]
=
FPermissionWriteExternalStorage
then
RationaleMsg
:=
RationaleMsg
+
'The app needs to save files to your device'
+
SLineBreak
else
if
APermissions
[
I
]
=
FPermissionReadExternalStorage
then
RationaleMsg
:=
RationaleMsg
+
'The app needs to load files from your device'
+
SLineBreak
;
end
;
// Show an explanation to the user *asynchronously* - don't block this thread waiting for the user's response!
// After the user sees the explanation, invoke the post-rationale routine to request the permissions
TDialogService
.
ShowMessage
(
RationaleMsg
,
procedure
(
const
AResult
:
TModalResult
)
begin
APostRationaleProc
;
end
)
end
;
procedure
TForm5
.
LoadList
();
var
i
:
Integer
;
aFStream
:
TFileStream
;
begin
if
FileExists
(
edit1
.
Text
.
Trim
)
then
if
FileExists
(
Edit1
.
Text
)
then
begin
FloatAnimation3
.
Enabled
:=
false
;
lbl_winner
.
Visible
:=
false
;
aFStream
:=
TFileStream
.
Create
(
Edit1
.
Text
,
fmOpenRead
);
mem_names
.
Lines
.
Clear
;
mem_names
.
Lines
.
LoadFrom
File
(
edit1
.
Text
.
Tri
m
,
TEncoding
.
UTF8
);
mem_names
.
Lines
.
LoadFrom
Stream
(
aFStrea
m
,
TEncoding
.
UTF8
);
mem_names
.
Text
:=
mem_names
.
Text
.
Trim
;
FreeAndNil
(
aFStream
);
lsb_names
.
Items
.
Clear
;
mem_winners
.
Lines
.
Clear
;
GlowEffect1
.
Enabled
:=
false
;
...
...
@@ -95,42 +142,7 @@ begin
end
;
procedure
TForm5
.
FormCreate
(
Sender
:
TObject
);
{$IFDEF ANDROID}
var
FPermissionReadExternalStorage
,
FPermissionWriteExternalStorage
:
String
;
{$ENDIF}
begin
{$IFDEF ANDROID}
//FPermissionCamera := JStringToString(TJManifest_permission.JavaClass.CAMERA);
FPermissionReadExternalStorage
:=
JStringToString
(
TJManifest_permission
.
JavaClass
.
READ_EXTERNAL_STORAGE
);
FPermissionWriteExternalStorage
:=
JStringToString
(
TJManifest_permission
.
JavaClass
.
WRITE_EXTERNAL_STORAGE
);
PermissionsService
.
RequestPermissions
([
FPermissionReadExternalStorage
,
FPermissionWriteExternalStorage
],
procedure
(
const
APermissions
:
TArray
<
string
>;
const
AGrantResults
:
TArray
<
TPermissionStatus
>)
var
i
:
Integer
;
allok
:
Boolean
;
begin
allok
:=
true
;
for
i
:=
0
to
Length
(
AGrantResults
)-
1
do
begin
if
(
AGrantResults
[
i
]
<>
TPermissionStatus
.
Granted
)
then
begin
allok
:=
false
;
break
;
end
end
;
if
allok
then
begin
TDialogService
.
ShowMessage
(
'STORAGE permission granted, OK.'
);
end
else
begin
TDialogService
.
ShowMessage
(
'STORAGE permission not granted !!!'
);
end
;
end
);
{$ENDIF}
mem_names
.
Lines
.
Clear
;
mem_winners
.
Lines
.
Clear
;
...
...
@@ -139,7 +151,8 @@ begin
GlowEffect1
.
Enabled
:=
false
;
ShadowEffect1
.
Enabled
:=
false
;
FloatAnimation3
.
Enabled
:=
false
;
musicName
:=
'/storage/emulated/0/背景音乐.mp3'
;
musicName
:=
'/storage/emulated/0/ACMusic.mp3'
;
Edit1
.
Text
:=
'/storage/emulated/0/ACList.txt'
;
end
;
procedure
TForm5
.
spb_goClick
(
Sender
:
TObject
);
...
...
@@ -211,24 +224,12 @@ end;
procedure
TForm5
.
spb_loadmusicClick
(
Sender
:
TObject
);
begin
if
opd_music
.
Execute
then
begin
musicName
:=
opd_music
.
FileName
;
end
;
if
FileExists
(
musicName
)
then
begin
MediaPlayer1
.
Stop
;
MediaPlayer1
.
FileName
:=
musicName
;
end
;
PermissionsService
.
RequestPermissions
([
FPermissionReadExternalStorage
,
FPermissionWriteExternalStorage
],
LoadSongPermissionRequestResult
,
DisplayRationale
);
end
;
procedure
TForm5
.
spb_loadnameClick
(
Sender
:
TObject
);
begin
if
opd_names
.
Execute
then
begin
edit1
.
Text
:=
opd_names
.
FileName
;
end
;
LoadList
();
PermissionsService
.
RequestPermissions
([
FPermissionReadExternalStorage
,
FPermissionWriteExternalStorage
],
LoadListPermissionRequestResult
,
DisplayRationale
);
end
;
procedure
TForm5
.
Timer1Timer
(
Sender
:
TObject
);
...
...
@@ -240,4 +241,43 @@ begin
Application
.
ProcessMessages
;
end
;
procedure
TForm5
.
LoadListPermissionRequestResult
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
AGrantResults
:
TClassicPermissionStatusDynArray
);
begin
// 2 permissions involved: READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE
if
(
Length
(
AGrantResults
)
=
2
)
and
(
AGrantResults
[
0
]
=
TPermissionStatus
.
Granted
)
and
(
AGrantResults
[
1
]
=
TPermissionStatus
.
Granted
)
then
begin
if
opd_names
.
Execute
then
begin
Edit1
.
Text
:=
opd_names
.
FileName
;
end
;
LoadList
();
end
else
TDialogService
.
ShowMessage
(
'Cannot load list, the required permissions are not granted'
);
end
;
procedure
TForm5
.
LoadSongPermissionRequestResult
(
Sender
:
TObject
;
const
APermissions
:
TClassicStringDynArray
;
const
AGrantResults
:
TClassicPermissionStatusDynArray
);
begin
// 2 permissions involved: READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE
if
(
Length
(
AGrantResults
)
=
2
)
and
(
AGrantResults
[
0
]
=
TPermissionStatus
.
Granted
)
and
(
AGrantResults
[
1
]
=
TPermissionStatus
.
Granted
)
then
begin
if
opd_music
.
Execute
then
begin
musicName
:=
opd_music
.
FileName
;
end
;
if
FileExists
(
musicName
)
then
begin
MediaPlayer1
.
Stop
;
MediaPlayer1
.
FileName
:=
musicName
;
MediaPlayer1
.
Play
;
end
;
end
else
TDialogService
.
ShowMessage
(
'Cannot load song, the required permissions are not granted'
);
end
;
end
.
pro_Lottery.deployproj
浏览文件 @
f989abc5
此差异已折叠。
点击以展开。
pro_Lottery.dproj
浏览文件 @
f989abc5
此差异已折叠。
点击以展开。
pro_Lottery.dproj.local
浏览文件 @
f989abc5
...
...
@@ -5,4 +5,7 @@
<Transaction>
1899-12-30 00:00:00.000.439,=C:\Users\Shion\Documents\Embarcadero\Studio\Projects\Unit1.pas
</Transaction>
<Transaction>
1899-12-30 00:00:00.000.173,=C:\Users\Shion\Documents\Embarcadero\Studio\Projects\Lottery\Unit1.pas
</Transaction>
</Transactions>
<ActiveMobileDevice>
<NoProfile
Android64=
""
/>
</ActiveMobileDevice>
</BorlandProject>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录