mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2025-03-20 09:29:19 -09:00
added a splash screen, updated to android 2.2
This commit is contained in:
parent
01e331ca6a
commit
f3e9f66eea
8 changed files with 100 additions and 3 deletions
|
@ -17,7 +17,7 @@ using MonoStockPortfolio.Framework;
|
|||
|
||||
namespace MonoStockPortfolio.Activites.MainScreen
|
||||
{
|
||||
[Activity(Label = "Stock Portfolio", MainLauncher = true, Icon = "@drawable/icon", Name = "monostockportfolio.activites.mainscreen.MainActivity")]
|
||||
[Activity(Label = "Stock Portfolio", MainLauncher = false, Icon = "@drawable/icon", Name = "monostockportfolio.activites.mainscreen.MainActivity")]
|
||||
public class MainActivity : Activity, IMainView
|
||||
{
|
||||
[LazyView(Resource.Id.btnAddPortfolio)] protected Button AddPortfolioButton;
|
||||
|
|
62
MonoStockPortfolio/Activites/SplashActivity.java
Normal file
62
MonoStockPortfolio/Activites/SplashActivity.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
//Note: this file have its Build Action property set to AndroidJavaSource in the Solution Explorer
|
||||
package com.monostockportfolio;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.WindowManager;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public class SplashActivity extends Activity {
|
||||
|
||||
protected int _splashTime = 3000;
|
||||
Handler handler;
|
||||
SplashScreenRunner runner;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
//Ensure we use the full screen area
|
||||
//Note that specifying the Theme.Translucent.NoTitleBar.Fullscreen (or even Theme.Wallpaper.NoTitleBar.Fullscreen) style
|
||||
//for the activity in the Android manifest is easier than these two calls
|
||||
//requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
|
||||
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
// Have the system blur any windows behind this one.
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
|
||||
//Inflate the UI
|
||||
setContentView(R.layout.splashscreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
handler = new Handler();
|
||||
runner = new SplashScreenRunner();
|
||||
handler.postDelayed(runner, _splashTime);
|
||||
}
|
||||
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
//Exit splash screen on touch
|
||||
if (event.getAction() == MotionEvent.ACTION_UP)
|
||||
{
|
||||
//Cancel the delayed invocation of main screen and instead do it immediately
|
||||
handler.removeCallbacks(runner);
|
||||
handler.post(runner);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class SplashScreenRunner implements Runnable {
|
||||
public void run() {
|
||||
Intent i = new Intent();
|
||||
//Params: package name (as per AndroindManifest.xml) and lower-case-namespace-qualified
|
||||
//activity class (or name as per the obj\Debug\android\AndroidManifest.xml)
|
||||
i.setClassName("com.monostockportfolio", "monostockportfolio.activites.mainscreen.MainActivity");
|
||||
startActivity(i);
|
||||
SplashActivity.this.finish();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
<AndroidSupportedAbis>armeabi</AndroidSupportedAbis>
|
||||
<AndroidApplication>true</AndroidApplication>
|
||||
<AndroidStoreUncompressedFileExtensions />
|
||||
<TargetFrameworkVersion>v2.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v2.2</TargetFrameworkVersion>
|
||||
<MandroidI18n />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
@ -99,6 +99,7 @@
|
|||
<AndroidResource Include="Resources\layout\config.axml">
|
||||
<SubType>AndroidResource</SubType>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\layout\SplashScreen.axml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\main.axml">
|
||||
|
@ -134,6 +135,7 @@
|
|||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidJavaSource Include="Activites\SplashActivity.java" />
|
||||
<Content Include="Properties\AndroidManifest.xml" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_menu_preferences.png" />
|
||||
<AndroidResource Include="Resources\drawable-ldpi\ic_menu_preferences.png" />
|
||||
|
@ -144,6 +146,7 @@
|
|||
<AndroidResource Include="Resources\drawable-hdpi\ic_menu_info_details.png" />
|
||||
<AndroidResource Include="Resources\drawable-ldpi\ic_menu_info_details.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_menu_info_details.png" />
|
||||
<AndroidResource Include="Resources\Drawable\Splash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_menu_refresh.png" />
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.monostockportfolio" android:versionCode="2" android:versionName="1.0.1">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.monostockportfolio" android:versionCode="3" android:versionName="1.1.0" android:installLocation="preferExternal">
|
||||
<application android:label="Stock Portfolio" android:icon="@drawable/icon">
|
||||
<!-- Register the Java splash screen activity and set it to be full screen with no title bar & translucent -->
|
||||
<activity android:label="Stock Portfolio" android:name="com.monostockportfolio.SplashActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
|
||||
<!-- Set this Java activity as the main activity to be launched -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
|
BIN
MonoStockPortfolio/Resources/Drawable/Splash.png
Normal file
BIN
MonoStockPortfolio/Resources/Drawable/Splash.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 164 KiB |
|
@ -41,6 +41,9 @@ namespace MonoStockPortfolio
|
|||
// aapt resource value: 0x7f020004
|
||||
public const int icon = 2130837508;
|
||||
|
||||
// aapt resource value: 0x7f020005
|
||||
public const int Splash = 2130837509;
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
|
@ -108,6 +111,9 @@ namespace MonoStockPortfolio
|
|||
// aapt resource value: 0x7f030004
|
||||
public const int portfolio = 2130903044;
|
||||
|
||||
// aapt resource value: 0x7f030005
|
||||
public const int SplashScreen = 2130903045;
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
|
|
9
MonoStockPortfolio/Resources/layout/SplashScreen.axml
Normal file
9
MonoStockPortfolio/Resources/layout/SplashScreen.axml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<ImageView android:src="@drawable/splash"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
9
README
9
README
|
@ -29,3 +29,12 @@ domain anyway.
|
|||
To get stock quotes, I'm using a Yahoo API coupled with the FileHelpers library
|
||||
(since the Yahoo API outputs a CSV)
|
||||
|
||||
Credits
|
||||
-------
|
||||
All images licensed under creative commons.
|
||||
Penny image (assorted icons):
|
||||
From the US Mint, via Wikimedia user "Sniff"
|
||||
http://commons.wikimedia.org/wiki/File:United_States_penny,_obverse,_2002.png
|
||||
NYSE image (splash):
|
||||
Taken by "Helico" on Flickr
|
||||
http://www.flickr.com/photos/helico/422215562/
|
||||
|
|
Loading…
Add table
Reference in a new issue