fixed day time setting, added wallpaper setting button, other fixes
This commit is contained in:
parent
2c51ab0cc6
commit
15da663864
@ -541,14 +541,23 @@ void TAndroidApplication::InnerInit()
|
||||
Renderer->SetMatrixHeight(800);
|
||||
}
|
||||
|
||||
Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 400.f);
|
||||
Renderer->SetPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 400.f);
|
||||
|
||||
GetConsole() << "Inner init end!\n";
|
||||
|
||||
m2.unlock();
|
||||
}
|
||||
|
||||
void TAndroidApplication::InnerReinitGLResources()
|
||||
{
|
||||
if (Renderer->GetScreenWidth() < Renderer->GetScreenHeight())
|
||||
{
|
||||
Renderer->SetMatrixWidth(480);
|
||||
Renderer->SetMatrixHeight(800);
|
||||
}
|
||||
|
||||
Renderer->SetPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 400.f);
|
||||
}
|
||||
|
||||
void TAndroidApplication::InnerDeinit()
|
||||
{
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
|
||||
//#ifdef TARGET_WIN32
|
||||
//#define NOMINMAX 1
|
||||
//#include <Windows.h>
|
||||
//#undef NOMINMAX
|
||||
#endif
|
||||
|
||||
//#ifdef TARGET_WIN32
|
||||
//#define NOMINMAX 1
|
||||
//#include <Windows.h>
|
||||
//#undef NOMINMAX
|
||||
//#endif
|
||||
|
||||
#include "boost/shared_ptr.hpp"
|
||||
@ -62,6 +62,7 @@ public:
|
||||
TAndroidApplication();
|
||||
|
||||
virtual void InnerInit();
|
||||
void InnerReinitGLResources() override;
|
||||
|
||||
virtual void InnerDeinit();
|
||||
|
||||
|
@ -19,6 +19,7 @@ apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "fishrungames.mountainwallpaper"
|
||||
|
@ -49,7 +49,8 @@
|
||||
|
||||
<activity
|
||||
android:name=".WallpaperPreferences"
|
||||
android:launchMode="singleTop">
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.AppCompat">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
@ -24,6 +24,9 @@ import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import android.view.SurfaceHolder
|
||||
import fishrungames.salmonengineandroid.EngineWrapper
|
||||
import android.content.SharedPreferences
|
||||
|
||||
|
||||
|
||||
class MountainWallpaper : GLWallpaperService(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
@ -54,6 +57,10 @@ class MountainWallpaper : GLWallpaperService(), SharedPreferences.OnSharedPrefer
|
||||
apkFilePath = appInfo!!.sourceDir
|
||||
|
||||
EngineWrapper.SetupApkFilePath(apkFilePath)
|
||||
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
JniWrapper.SetTimeOfDayPref(Integer.parseInt(prefs.getString("Timeofday", "0")!!))
|
||||
JniWrapper.SetSnowPref(prefs.getBoolean("Snow", false))
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
|
@ -18,11 +18,28 @@ package fishrungames.mountainwallpaper
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.FragmentActivity
|
||||
import android.app.WallpaperManager
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.content.Intent
|
||||
import android.content.ComponentName
|
||||
|
||||
class WallpaperPreferences : FragmentActivity()
|
||||
{
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.pref_activity)
|
||||
val buttonSetWallpaper = findViewById<View>(R.id.button_setWallpaper) as Button
|
||||
|
||||
buttonSetWallpaper.setOnClickListener(object : View.OnClickListener{
|
||||
override fun onClick(arg0: View) {
|
||||
|
||||
val component = ComponentName(packageName, "$packageName.MountainWallpaper")
|
||||
intent = Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
|
||||
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, component)
|
||||
startActivity(intent)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="fill_parent"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_margin="20dp">
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon">
|
||||
</ImageView>
|
||||
android:src="@drawable/icon" />
|
||||
|
||||
<fragment
|
||||
class="fishrungames.mountainwallpaper.WallpaperPreferenceFragment"
|
||||
android:id="@+id/preferences"
|
||||
android:layout_width="fill_parent"
|
||||
class="fishrungames.mountainwallpaper.WallpaperPreferenceFragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true">
|
||||
</fragment>
|
||||
android:background="#ff0000" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_setWallpaper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/button_set_wallpaper_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/feedback"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/feedback" />
|
||||
|
||||
</LinearLayout>
|
@ -18,6 +18,14 @@
|
||||
<item>Ночь</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="timeofday_value">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<string name="text_feedback">Feedback</string>
|
||||
<string name="button_set_wallpaper_text">Установить обои</string>
|
||||
</resources>
|
||||
|
||||
|
@ -40,5 +40,6 @@
|
||||
</string-array>
|
||||
|
||||
<string name="text_feedback">Feedback</string>
|
||||
<string name="button_set_wallpaper_text">Set Wallpaper</string>
|
||||
</resources>
|
||||
|
||||
|
@ -6,10 +6,12 @@
|
||||
android:key="Timeofday" android:summary="@string/p_stimeofday"
|
||||
android:title="@string/p_timeofday" android:entries="@array/timeofday_id"
|
||||
android:entryValues="@array/timeofday_value" android:defaultValue="0"
|
||||
android:background="#00ff00"
|
||||
/>
|
||||
<CheckBoxPreference android:summaryOn="@string/p_snow_on"
|
||||
android:key="Snow" android:title="@string/p_snow"
|
||||
android:summaryOff="@string/p_snow_off" android:defaultValue="false"
|
||||
android:background="#0000ff"
|
||||
/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user