Some Updates
This commit is contained in:
@@ -22,9 +22,145 @@ freely, subject to the following restrictions:
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
/*
|
||||
* A sample wrapper class that just calls SDLActivity
|
||||
*/
|
||||
|
||||
public class MainActivity extends SDLActivity { }
|
||||
public class MainActivity extends SDLActivity
|
||||
{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
/*setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
|
||||
instance = this;
|
||||
// fullscreen mode
|
||||
/*requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if(Globals.InhibitSuspend)
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
*/
|
||||
Log.i("SDL", "libSDL: Creating startup screen");
|
||||
/* _layout = new LinearLayout(this);
|
||||
_layout.setOrientation(LinearLayout.VERTICAL);
|
||||
_layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
_layout2 = new LinearLayout(this);
|
||||
_layout2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
final Semaphore loadedLibraries = new Semaphore(0);
|
||||
*/
|
||||
/*if( Globals.StartupMenuButtonTimeout > 0 )
|
||||
{
|
||||
_btn = new Button(this);
|
||||
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
_btn.setText(getResources().getString(R.string.device_change_cfg));
|
||||
class onClickListener implements View.OnClickListener
|
||||
{
|
||||
public MainActivity p;
|
||||
onClickListener( MainActivity _p ) { p = _p; }
|
||||
public void onClick(View v)
|
||||
{
|
||||
setUpStatusLabel();
|
||||
Log.i("SDL", "libSDL: User clicked change phone config button");
|
||||
loadedLibraries.acquireUninterruptibly();
|
||||
SettingsMenu.showConfig(p, false);
|
||||
}
|
||||
};
|
||||
_btn.setOnClickListener(new onClickListener(this));
|
||||
|
||||
_layout2.addView(_btn);
|
||||
}*/
|
||||
|
||||
/* _layout.addView(_layout2);
|
||||
|
||||
ImageView img = new ImageView(this);
|
||||
|
||||
img.setScaleType(ImageView.ScaleType.FIT_CENTER ); // FIT_XY
|
||||
try
|
||||
{
|
||||
img.setImageDrawable(Drawable.createFromStream(getAssets().open("logo.png"), "logo.png"));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
img.setImageResource(R.drawable.publisherlogo);
|
||||
}
|
||||
img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
_layout.addView(img);
|
||||
|
||||
_videoLayout = new FrameLayout(this);
|
||||
_videoLayout.addView(_layout);
|
||||
|
||||
_ad = new Advertisement(this);
|
||||
if( _ad.getView() != null )
|
||||
{
|
||||
_videoLayout.addView(_ad.getView());
|
||||
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT));
|
||||
}
|
||||
|
||||
setContentView(_videoLayout);
|
||||
|
||||
class Callback implements Runnable
|
||||
{
|
||||
MainActivity p;
|
||||
Callback( MainActivity _p ) { p = _p; }
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch( InterruptedException e ) {};
|
||||
|
||||
if(p.mAudioThread == null)
|
||||
{
|
||||
Log.i("SDL", "libSDL: Loading libraries");
|
||||
p.LoadLibraries();
|
||||
p.mAudioThread = new AudioThread(p);
|
||||
Log.i("SDL", "libSDL: Loading settings");
|
||||
final Semaphore loaded = new Semaphore(0);
|
||||
class Callback2 implements Runnable
|
||||
{
|
||||
public MainActivity Parent;
|
||||
public void run()
|
||||
{
|
||||
Settings.Load(Parent);
|
||||
loaded.release();
|
||||
loadedLibraries.release();
|
||||
}
|
||||
}
|
||||
Callback2 cb = new Callback2();
|
||||
cb.Parent = p;
|
||||
p.runOnUiThread(cb);
|
||||
loaded.acquireUninterruptibly();
|
||||
if(!Globals.CompatibilityHacksStaticInit)
|
||||
p.LoadApplicationLibrary(p);
|
||||
}
|
||||
|
||||
if( !Settings.settingsChanged )
|
||||
{
|
||||
if( Globals.StartupMenuButtonTimeout > 0 )
|
||||
{
|
||||
Log.i("SDL", "libSDL: " + String.valueOf(Globals.StartupMenuButtonTimeout) + "-msec timeout in startup screen");
|
||||
try {
|
||||
Thread.sleep(Globals.StartupMenuButtonTimeout);
|
||||
} catch( InterruptedException e ) {};
|
||||
}
|
||||
if( Settings.settingsChanged )
|
||||
return;
|
||||
Log.i("SDL", "libSDL: Timeout reached in startup screen, process with downloader");
|
||||
p.startDownloader();
|
||||
}
|
||||
}
|
||||
};
|
||||
(new Thread(new Callback(this))).start();*/
|
||||
}
|
||||
|
||||
public static MainActivity instance = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user