タブレットが文鎮化してしまったのでAndroid開発はこれで終了
誠に悔やまれます
@@ -7,7 +7,6 @@ | ||
7 | 7 | Unit2 in 'Unit2.pas' {Form2}, |
8 | 8 | Unit3 in 'Unit3.pas' {Form3}, |
9 | 9 | Unit4 in 'Unit4.pas'; |
10 | - | |
11 | 10 | {$R *.res} |
12 | 11 | |
13 | 12 | begin |
@@ -46,11 +46,13 @@ | ||
46 | 46 | procedure Action4Execute(Sender: TObject); |
47 | 47 | procedure Action6Execute(Sender: TObject); |
48 | 48 | procedure Action5Execute(Sender: TObject); |
49 | + procedure TrackBar2Change(Sender: TObject); | |
49 | 50 | private |
50 | 51 | { private 宣言 } |
51 | 52 | public |
52 | 53 | { public 宣言 } |
53 | 54 | th: TThread; |
55 | + procedure PlayMusic(Number: integer); | |
54 | 56 | end; |
55 | 57 | |
56 | 58 | var |
@@ -122,14 +124,16 @@ | ||
122 | 124 | MediaPlayer1.Stop; |
123 | 125 | Action4.Text := 'Play'; |
124 | 126 | end |
125 | - else | |
127 | + else if ListView1.ItemCount > 0 then | |
126 | 128 | begin |
127 | - if (ListView1.ItemCount > 0) and (ListView1.ItemIndex = -1) then | |
129 | + if ListView1.ItemIndex = -1 then | |
130 | + PlayMusic(0) | |
131 | + else | |
128 | 132 | begin |
129 | - ListView1.ItemIndex := 0; | |
130 | - MediaPlayer1.FileName := ListView1.Items[0].Detail; | |
133 | + MediaPlayer1.FileName := ListView1.Items[ListView1.ItemIndex].Detail; | |
131 | 134 | TrackBar2.Max := MediaPlayer1.Duration; |
132 | - TrackBar2.Value := 0; | |
135 | + MediaPlayer1.CurrentTime := Trunc(TrackBar2.Value); | |
136 | + MediaPlayer1.Play; | |
133 | 137 | end; |
134 | 138 | MediaPlayer1.Play; |
135 | 139 | Action4.Text := 'Stop'; |
@@ -138,16 +142,28 @@ | ||
138 | 142 | |
139 | 143 | procedure TForm1.Action5Execute(Sender: TObject); |
140 | 144 | begin |
141 | - MediaPlayer1.CurrentTime := MediaPlayer1.CurrentTime - | |
142 | - MediaTimeScale div 1000; | |
143 | - TrackBar2.Value := MediaPlayer1.CurrentTime; | |
145 | + if MediaPlayer1.CurrentTime < MediaTimeScale div 10000 then | |
146 | + if ListView1.ItemCount > 0 then | |
147 | + PlayMusic(ListView1.ItemIndex - 1) | |
148 | + else | |
149 | + begin | |
150 | + MediaPlayer1.Stop; | |
151 | + MediaPlayer1.CurrentTime := 0; | |
152 | + TrackBar2.Value := 0; | |
153 | + Action4.Text := 'Play'; | |
154 | + end; | |
144 | 155 | end; |
145 | 156 | |
146 | 157 | procedure TForm1.Action6Execute(Sender: TObject); |
158 | +var | |
159 | + i: integer; | |
147 | 160 | begin |
148 | - MediaPlayer1.CurrentTime := MediaPlayer1.CurrentTime + | |
149 | - MediaTimeScale div 1000; | |
150 | - TrackBar2.Value := MediaPlayer1.CurrentTime; | |
161 | + if ListView1.ItemIndex < ListView1.ItemCount - 1 then | |
162 | + begin | |
163 | + i := ListView1.ItemIndex + 1; | |
164 | + ListView1.ItemIndex := i; | |
165 | + PlayMusic(i); | |
166 | + end; | |
151 | 167 | end; |
152 | 168 | |
153 | 169 | procedure TForm1.FormDestroy(Sender: TObject); |
@@ -185,13 +201,20 @@ | ||
185 | 201 | Action1Execute(Sender); |
186 | 202 | Exit; |
187 | 203 | end; |
188 | - Volume := TrackBar1.Value; | |
189 | - TrackBar2.Max := Duration; | |
190 | - TrackBar2.Value := 0; | |
191 | - Play; | |
204 | + PlayMusic(ListView1.ItemIndex); | |
192 | 205 | end; |
193 | 206 | end; |
194 | 207 | |
208 | +procedure TForm1.PlayMusic(Number: integer); | |
209 | +begin | |
210 | + ListView1.ItemIndex := Number; | |
211 | + MediaPlayer1.FileName := ListView1.Items[Number].Detail; | |
212 | + TrackBar2.Max := MediaPlayer1.Duration; | |
213 | + TrackBar2.Value := 0; | |
214 | + Action4.Text := 'Stop'; | |
215 | + MediaPlayer1.Play; | |
216 | +end; | |
217 | + | |
195 | 218 | procedure TForm1.SpeedButton1Click(Sender: TObject); |
196 | 219 | begin |
197 | 220 | Form2.Show; |
@@ -210,7 +233,7 @@ | ||
210 | 233 | begin |
211 | 234 | Stop; |
212 | 235 | Clear; |
213 | - FileName := ListView1.Items.Item[ListView1.ItemIndex].Detail; | |
236 | + FileName := ListView1.Items[ListView1.ItemIndex].Detail; | |
214 | 237 | Volume := TrackBar1.Value; |
215 | 238 | Play; |
216 | 239 | end; |
@@ -225,4 +248,11 @@ | ||
225 | 248 | MediaPlayer1.Volume := TrackBar1.Value; |
226 | 249 | end; |
227 | 250 | |
251 | +procedure TForm1.TrackBar2Change(Sender: TObject); | |
252 | +begin | |
253 | + if (TrackBar2.Value < MediaPlayer1.CurrentTime) or | |
254 | + (TrackBar2.Value > MediaPlayer1.CurrentTime + MediaTimeScale div 800) then | |
255 | + MediaPlayer1.CurrentTime := Trunc(TrackBar2.Value); | |
256 | +end; | |
257 | + | |
228 | 258 | end. |
@@ -5,8 +5,8 @@ | ||
5 | 5 | <FrameworkType>FMX</FrameworkType> |
6 | 6 | <MainSource>gtp1000.dpr</MainSource> |
7 | 7 | <Base>True</Base> |
8 | - <Config Condition="'$(Config)'==''">Release</Config> | |
9 | - <Platform Condition="'$(Platform)'==''">Android</Platform> | |
8 | + <Config Condition="'$(Config)'==''">Debug</Config> | |
9 | + <Platform Condition="'$(Platform)'==''">Win32</Platform> | |
10 | 10 | <TargetedPlatforms>95</TargetedPlatforms> |
11 | 11 | <AppType>Application</AppType> |
12 | 12 | </PropertyGroup> |
@@ -248,7 +248,9 @@ | ||
248 | 248 | <Form>Form3</Form> |
249 | 249 | <FormType>fmx</FormType> |
250 | 250 | </DCCReference> |
251 | - <DCCReference Include="Unit4.pas"/> | |
251 | + <DCCReference Include="Unit4.pas"> | |
252 | + <Form>$R *.res</Form> | |
253 | + </DCCReference> | |
252 | 254 | <BuildConfiguration Include="Release"> |
253 | 255 | <Key>Cfg_2</Key> |
254 | 256 | <CfgParent>Base</CfgParent> |
@@ -294,9 +296,9 @@ | ||
294 | 296 | <Overwrite>true</Overwrite> |
295 | 297 | </Platform> |
296 | 298 | </DeployFile> |
297 | - <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png" Configuration="Release" Class="Android_SplashImage470"> | |
299 | + <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png" Configuration="Release" Class="Android_LauncherIcon72"> | |
298 | 300 | <Platform Name="Android"> |
299 | - <RemoteName>splash_image.png</RemoteName> | |
301 | + <RemoteName>ic_launcher.png</RemoteName> | |
300 | 302 | <Overwrite>true</Overwrite> |
301 | 303 | </Platform> |
302 | 304 | </DeployFile> |
@@ -517,9 +519,9 @@ | ||
517 | 519 | <Overwrite>true</Overwrite> |
518 | 520 | </Platform> |
519 | 521 | </DeployFile> |
520 | - <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png" Configuration="Release" Class="Android_LauncherIcon72"> | |
522 | + <DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png" Configuration="Release" Class="Android_SplashImage470"> | |
521 | 523 | <Platform Name="Android"> |
522 | - <RemoteName>ic_launcher.png</RemoteName> | |
524 | + <RemoteName>splash_image.png</RemoteName> | |
523 | 525 | <Overwrite>true</Overwrite> |
524 | 526 | </Platform> |
525 | 527 | </DeployFile> |
@@ -861,7 +863,7 @@ | ||
861 | 863 | <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/> |
862 | 864 | </Deployment> |
863 | 865 | <Platforms> |
864 | - <Platform value="Android" ActiveMobileDevice="333495355FDD00EC">True</Platform> | |
866 | + <Platform value="Android" ActiveMobileDevice="AVD_for_Galaxy_Nexus_by_Google">True</Platform> | |
865 | 867 | <Platform value="iOSDevice">True</Platform> |
866 | 868 | <Platform value="iOSSimulator" ActiveMobileDevice="iPhone">True</Platform> |
867 | 869 | <Platform value="OSX32">True</Platform> |