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->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";
|
GetConsole() << "Inner init end!\n";
|
||||||
|
|
||||||
m2.unlock();
|
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()
|
void TAndroidApplication::InnerDeinit()
|
||||||
{
|
{
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
TAndroidApplication();
|
TAndroidApplication();
|
||||||
|
|
||||||
virtual void InnerInit();
|
virtual void InnerInit();
|
||||||
|
void InnerReinitGLResources() override;
|
||||||
|
|
||||||
virtual void InnerDeinit();
|
virtual void InnerDeinit();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ apply plugin: 'kotlin-android'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
|
buildToolsVersion "28.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "fishrungames.mountainwallpaper"
|
applicationId "fishrungames.mountainwallpaper"
|
||||||
|
@ -49,7 +49,8 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".WallpaperPreferences"
|
android:name=".WallpaperPreferences"
|
||||||
android:launchMode="singleTop">
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/Theme.AppCompat">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
@ -24,6 +24,9 @@ import android.view.GestureDetector
|
|||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.SurfaceHolder
|
import android.view.SurfaceHolder
|
||||||
import fishrungames.salmonengineandroid.EngineWrapper
|
import fishrungames.salmonengineandroid.EngineWrapper
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MountainWallpaper : GLWallpaperService(), SharedPreferences.OnSharedPreferenceChangeListener {
|
class MountainWallpaper : GLWallpaperService(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@ -54,6 +57,10 @@ class MountainWallpaper : GLWallpaperService(), SharedPreferences.OnSharedPrefer
|
|||||||
apkFilePath = appInfo!!.sourceDir
|
apkFilePath = appInfo!!.sourceDir
|
||||||
|
|
||||||
EngineWrapper.SetupApkFilePath(apkFilePath)
|
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 {
|
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||||
|
@ -18,11 +18,28 @@ package fishrungames.mountainwallpaper
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.app.FragmentActivity
|
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()
|
class WallpaperPreferences : FragmentActivity()
|
||||||
{
|
{
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.pref_activity)
|
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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_margin="20dp">
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/icon">
|
android:src="@drawable/icon" />
|
||||||
</ImageView>
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
class="fishrungames.mountainwallpaper.WallpaperPreferenceFragment"
|
|
||||||
android:id="@+id/preferences"
|
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_height="wrap_content"
|
||||||
android:layout_alignParentStart="true">
|
android:background="#ff0000" />
|
||||||
</fragment>
|
|
||||||
|
<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
|
<TextView
|
||||||
android:text="@string/feedback"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
</TextView>
|
android:text="@string/feedback" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -18,6 +18,14 @@
|
|||||||
<item>Ночь</item>
|
<item>Ночь</item>
|
||||||
</string-array>
|
</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="text_feedback">Feedback</string>
|
||||||
|
<string name="button_set_wallpaper_text">Установить обои</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@ -40,5 +40,6 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string name="text_feedback">Feedback</string>
|
<string name="text_feedback">Feedback</string>
|
||||||
|
<string name="button_set_wallpaper_text">Set Wallpaper</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
android:key="Timeofday" android:summary="@string/p_stimeofday"
|
android:key="Timeofday" android:summary="@string/p_stimeofday"
|
||||||
android:title="@string/p_timeofday" android:entries="@array/timeofday_id"
|
android:title="@string/p_timeofday" android:entries="@array/timeofday_id"
|
||||||
android:entryValues="@array/timeofday_value" android:defaultValue="0"
|
android:entryValues="@array/timeofday_value" android:defaultValue="0"
|
||||||
|
android:background="#00ff00"
|
||||||
/>
|
/>
|
||||||
<CheckBoxPreference android:summaryOn="@string/p_snow_on"
|
<CheckBoxPreference android:summaryOn="@string/p_snow_on"
|
||||||
android:key="Snow" android:title="@string/p_snow"
|
android:key="Snow" android:title="@string/p_snow"
|
||||||
android:summaryOff="@string/p_snow_off" android:defaultValue="false"
|
android:summaryOff="@string/p_snow_off" android:defaultValue="false"
|
||||||
|
android:background="#0000ff"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user