Skip to content

Commit 268c028

Browse files
committed
强制切回夜间模式背景图
1 parent 1d0cefa commit 268c028

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

res/drawable/test_portrait.jpg

-6.42 KB
Binary file not shown.

src/com/dreamteam/app/ui/Main.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.content.Context;
88
import android.content.Intent;
99
import android.content.IntentFilter;
10-
import android.content.SharedPreferences;
1110
import android.content.SharedPreferences.Editor;
1211
import android.database.Cursor;
1312
import android.database.sqlite.SQLiteDatabase;
@@ -282,24 +281,22 @@ public void onClick(View v)
282281

283282
private void switchMode()
284283
{
285-
SharedPreferences prefs = AppContext.getPrefrences(this);
286284
Editor editor = AppContext.getPrefrences(this).edit();
287285
//切回日间模式
288286
if(isNight)
289287
{
290288
isNight = false;
291289
bgLayout.setBackgroundResource(R.drawable.home_bg_default);
292290
switchModeBtn.setImageResource(R.drawable.composer_sun);
293-
Toast.makeText(Main.this, "已切回日间模式", Toast.LENGTH_SHORT).show();
291+
Toast.makeText(Main.this, R.string.switch2Day, Toast.LENGTH_SHORT).show();
294292
}
295293
else
296294
{
297295
//切回夜间模式
298296
isNight = true;
299-
bgLayout.setBackgroundResource(
300-
prefs.getInt("home_bg_id", R.drawable.home_bg_night));
297+
bgLayout.setBackgroundResource(R.drawable.home_bg_night);
301298
switchModeBtn.setImageResource(R.drawable.composer_moon);
302-
Toast.makeText(Main.this, "夜间模式已启用", Toast.LENGTH_SHORT).show();
299+
Toast.makeText(Main.this, R.string.switch2Day, Toast.LENGTH_SHORT).show();
303300
}
304301
editor.putBoolean("day_night_mode", isNight);
305302
editor.commit();
@@ -334,7 +331,7 @@ private void login()
334331
{
335332
if(UMInfoAgent.isLogin(this))
336333
{
337-
Toast.makeText(this, "你已登陆!", Toast.LENGTH_SHORT).show();
334+
Toast.makeText(this, R.string.loggedon, Toast.LENGTH_SHORT).show();
338335
return;
339336
}
340337
new LoginDialog().show(getSupportFragmentManager(), tag);
@@ -479,7 +476,7 @@ private void inSectionEdit()
479476
{
480477
gridAdapters.get(i).changeDelBtnState(isVisble);
481478
}
482-
Toast.makeText(this, "按下返回键退出编辑模式", Toast.LENGTH_SHORT).show();
479+
Toast.makeText(this, R.string.exitEdit, Toast.LENGTH_SHORT).show();
483480
}
484481

485482
//退出编辑模式
@@ -621,7 +618,7 @@ protected void onPostExecute(ItemListEntity result)
621618
}
622619
else
623620
{
624-
Toast.makeText(Main.this, "网络异常!", Toast.LENGTH_SHORT).show();
621+
Toast.makeText(Main.this, R.string.networkexception, Toast.LENGTH_SHORT).show();
625622
}
626623
}
627624

@@ -661,7 +658,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event)
661658
finish();
662659
return true;
663660
}
664-
Toast.makeText(this, "再按下退出程序", Toast.LENGTH_SHORT).show();
661+
Toast.makeText(this, R.string.twice2Exit, Toast.LENGTH_SHORT).show();
665662
exit = true;
666663
Log.d(tag, "after toast");
667664
}

0 commit comments

Comments
 (0)