編輯:關於Android編程
今天給大家分享下關於修改MTK平台下系統首次開機的默認屏幕背光亮度,系統語言默認英語情況下修改日期格式,修改拍照屬性,具體修改的地方不清楚或者沒人告知的
話,請參照之前幾篇博客的方法分享,現在直接進入主題
首先我們來修改第一次開機的屏幕亮度
①修改首次開機的系統默認屏幕背光亮度,我是在該java下修改的------(把注釋的地方都去掉,因為注釋的地方都是修改了的)
packages\apps\Settings\src\com.mediatek.settings\RestoreRotationReceiver.java
// private SharedPreferences mSharedPreferences; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.v("RestoreRotationReceiver_IPO", action); // mSharedPreferences = context.getSharedPreferences("walpad_first_run",Context.MODE_PRIVATE); if (action.equals(Intent.ACTION_BOOT_COMPLETED) || action.equals("android.intent.action.ACTION_BOOT_IPO")) { sRestoreRetore = Settings.System.getInt(context .getContentResolver(), Settings.System.ACCELEROMETER_ROTATION_RESTORE, 0) != 0; // Engineer-Jsp add Unknown sources and Usb debugging default true if (android.os.SystemProperties.isWalPadVersion() && !isFirstRunSettings(context)) { // reboot first default unkonwn sources check Settings.Global.putInt(context.getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS,1); // reboot first default usb debugging check Settings.Global.putInt(context.getContentResolver(),Settings.Global.ADB_ENABLED, 1); // save first reboot falgs boolean // mSharedPreferences.edit().putString("isfirstrun", String.valueOf(true)).commit(); // firstrun defaulr birghtness value for 100% // setWalpadCFirstRunDefaultBrightness(context); } if (sRestoreRetore) { Settings.System.putInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1); Settings.System.putInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION_RESTORE, 0); } } } /** * ***- MTK-6582-8382© -*** * isFirstRunSettings(Context context) * walpad c firstrun need default false * Engineer-Jsp add * */ public boolean isFirstRunSettings(Context context){ if (TextUtils.isEmpty(mSharedPreferences.getString("isfirstrun", ""))) { mSharedPreferences.edit() .putString("isfirstrun", String.valueOf(false)) .commit(); } return Boolean.valueOf(mSharedPreferences.getString("isfirstrun", "")); } /** * ***- MTK-6582-8382© -*** * setWalpadCFirstRunDefaultBrightness(Context context) * walpad c firstrun need default settings brightness value for 100% * Engineer-Jsp add * */ public void setWalpadCFirstRunDefaultBrightness(Context context){ try{ Uri uri = Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS); Settings.System.putInt(context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 255); context.getContentResolver().notifyChange(uri, null); } catch (Exception localException){ localException.printStackTrace(); } }
我在系統代碼裡自己添加的,前面幾篇博客也有提到,這裡就不細說了,首次開機的記錄,因為我們只需要第一次開機設置100%的屏幕亮度
②日期格式修改
packages\apps\Settings\src\com\android\settings\DateTimeSettings.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.date_time_prefs); initUI(); /// M: get plug in and move roaming time setting into date and time settings @{ mExt = UtilsExt.getDateTimeSettingsPlugin(getActivity()); mExt.customizePreferenceScreen(getActivity(), getPreferenceScreen()); /// @} }
private void initUI() { boolean autoTimeEnabled = getAutoState(Settings.Global.AUTO_TIME); boolean autoTimeZoneEnabled = getAutoState(Settings.Global.AUTO_TIME_ZONE); ///M: MTK use ListPreference instead of google CheckboxPerference ...... String [] dateFormats = getResources().getStringArray(R.array.date_format_values); String [] formattedDates = new String[dateFormats.length]; String currentFormat = getDateFormat(); // Initialize if DATE_FORMAT is not set in the system settings // This can happen after a factory reset (or data wipe) if (currentFormat == null) { currentFormat = ""; } // Prevents duplicated values on date format selector. mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 31, 13, 0, 0); for (int i = 0; i < formattedDates.length; i++) { String formatted = DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]) .format(mDummyDate.getTime()); if (dateFormats[i].length() == 0) { formattedDates[i] = getResources(). getString(R.string.normal_date_format, formatted); } else { formattedDates[i] = formatted; } } mDateFormat.setEntries(formattedDates); mDateFormat.setEntryValues(R.array.date_format_values); mDateFormat.setValue(currentFormat); ...... }
private String getDateFormat() { return Settings.System.getString(getContentResolver(), Settings.System.DATE_FORMAT); }
initUI:
private void initUI() { boolean autoTimeEnabled = getAutoState(Settings.Global.AUTO_TIME); boolean autoTimeZoneEnabled = getAutoState(Settings.Global.AUTO_TIME_ZONE); ///M: MTK use ListPreference instead of google CheckboxPerference ...... String [] dateFormats = getResources().getStringArray(R.array.date_format_values); String [] formattedDates = new String[dateFormats.length]; String currentFormat = getDateFormat(dateFormats[2]); // Initialize if DATE_FORMAT is not set in the system settings // This can happen after a factory reset (or data wipe) if (currentFormat == null) { currentFormat = ""; } // Prevents duplicated values on date format selector. mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 31, 13, 0, 0); for (int i = 0; i < formattedDates.length; i++) { String formatted = DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]) .format(mDummyDate.getTime()); if (dateFormats[i].length() == 0) { formattedDates[i] = getResources(). getString(R.string.normal_date_format, formatted); } else { formattedDates[i] = formatted; } } mDateFormat.setEntries(formattedDates); mDateFormat.setEntryValues(R.array.date_format_values); mDateFormat.setValue(currentFormat); ...... }
private String getDateFormat(String format) { // Engineer-Jsp add walpad c default date format if(android.os.SystemProperties.isWalPadVersion()){ Settings.System.putString(getContentResolver(), Settings.System.DATE_FORMAT, format); } return Settings.System.getString(getContentResolver(), Settings.System.DATE_FORMAT); }
R.array.date_format_values:
<string-array name="date_format_values" translatable="false"> <!--{cke_protected}{C}%3C!%2D%2D%20The%20blank%20item%20means%20to%20use%20whatever%20the%20locale%20calls%20for.%20%2D%2D%3E--> <item></item> <item>MM-dd-yyyy</item> <item>dd-MM-yyyy</item> <item>yyyy-MM-dd</item> <item>EE-MMM-d-yyyy</item> <item>EE-d-MMM-yyyy</item> <item>yyyy-MMM-d-EE</item> </string-array>
③picture makeer model ,修改 buildinfo.sh 文件,model\product 屬性
修改之前:
修改之後:
第③是編譯之後的效果圖,前面兩個的效果圖就沒有貼出來了
頁面拖動到最後一頁 再向下滑動回復到 第一頁,第一頁向前滑動回到 最後一頁同時,底部紅色小圓點隨著頁面的滑動距離比例隨時改變位置布局:<?xml versi
今天無意中發現一個圓形進度,想想自己實現一個,如下圖:基本思路是這樣的:1.首先繪制一個實心圓2.繪制一個白色實心的正方形,遮住實心圓3.在圓的中心動態繪制當前進度的百分
本人比較懶,不說廢話,直接貼代碼,代碼後附有完整項目package test.com.opengles5_3;import android.opengl.GLES20;i
概述作為一個android開發者,在開發應用時,隨著業務規模發展到一定程度,不斷地加入新功能、添加新的類庫,代碼在急劇的膨脹,相應的apk包的大小也急劇增加,