a.alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/status_bar_notification_shelf.xml 其中的moretext是所折叠的通知的数量,不可直接在com.android.systemui.statusbar.phone.NotificationIconContainer中做修改 b.alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/keyguard/KeyguardStatusView.java alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/keyguard/KeyguardStatusView.java 修改mAlarmStatusView.setVisibility(View.VISIBLE);VISIBLE为GONE 以下修改仅在锁屏及状态栏添加am/pm alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/keyguard/KeyguardStatusView.java alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java 在alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable-hdpi/添加要替换的图片,修改后发现图标模糊
修改
<com.android.keyguard.AlphaOptimizedLinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/moretext"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_gravity="center"
android:clickable="false"
android:visibility="gone"
android:text="+1"
android:gravity="center"
android:background="@drawable/keyguard_overflow_number_background" />
<com.android.systemui.statusbar.phone.NotificationIconContainer
android:id="@+id/content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:paddingEnd="@dimen/shelf_icon_container_padding"
android:gravity="center_vertical" />
com.android.keyguard.AlphaOptimizedLinearLayout>
添加所定义的控件:moretext = (TextView)findViewById(R.id.moretext);
在方法public void updateAppearance()的mShelfIcons.setSpeedBumpIndex(mAmbientState.getSpeedBumpIndex())之前添加:if((int)numViewsInShelf > 0){
moretext.setVisibility(VISIBLE);
}else{
moretext.setVisibility(GONE);
}
moretext.setText("+"+((int)numViewsInShelf)+"");
c. alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml此处:
// 该值是显示最大展开通知条数
<integer name="keyguard_max_notification_count">2</integer>
2.锁屏时钟
a.修改日期显示格式
中private static final class Patterns 中的dateViewSkel值dateViewSkel = res.getString(hasAlarm
? R.string.abbrev_wday_month_day_no_year_alarm
: R.string.abbrev_wday_month_day_no_year);
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res-keyguard/layout/keyguard_status_area.xml
android:letterSpacing="0.05" --日期显示的间距
b.修改时钟与状态栏的距离
int y = getClockY() - mKeyguardStatusHeight / 2; --修改y即可
c.去除日期中所带的闹铃
private void refresh()注释refreshAlarmStatus(null);void refreshAlarmStatus(AlarmManager.AlarmClockInfo nextAlarm)
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res-keyguard/layout/keyguard_status_view.xml进行布局调整d.时间设置为12小时制,界面没有AM和PM显示
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res-keyguard/values/dimens.xml添加:<item name="ampm_font_size_scale" type="fraction">40%item>
<item name="reduced_clock_font_size_scale" type="fraction">65%item>
首先:导包 import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.RelativeSizeSpan;
import java.text.DateFormatSymbols;
import android.text.style.TypefaceSpan;
import android.graphics.Typeface;
import android.text.style.StyleSpan;
其次:在public void refreshTime() 方法中修改mClockView.setFormat12Hour(Patterns.clockView12)为
mClockView.setFormat12Hour(get12ModeFormat(mContext, true /* showAmPm */));
private void refresh()中将
if (!clockView12Skel.contains("a")) {
clockView12 = clockView12.replaceAll("a", "").trim();
}屏蔽
自定义方法:
/**
* @param context - context used to get time format string resource
* @param showAmPm - include the am/pm string if true
* @return format string for 12 hours mode time
*/
public static CharSequence get12ModeFormat(Context context, boolean showAmPm) {
String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), "hma");
if (!showAmPm) {
pattern = pattern.replaceAll("a", "").trim();
}
// Replace spaces with "Hair Space"
pattern = pattern.replaceAll(" ", "\u200A");
// Build a spannable so that the am/pm will be formatted
int amPmPos = pattern.indexOf('a');
if (amPmPos == -1) {
return pattern;
}
final Resources resources = context.getResources();
final float amPmProportion = resources.getFraction(R.fraction.ampm_font_size_scale, 1, 1);
final Spannable sp = new SpannableString(pattern);
sp.setSpan(new RelativeSizeSpan(amPmProportion), amPmPos, amPmPos + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(new StyleSpan(Typeface.NORMAL), amPmPos, amPmPos + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(new TypefaceSpan("sans-serif"), amPmPos, amPmPos + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// Make the font smaller for locales with long am/pm strings.
if (isAmPmStringLong()) {
final float proportion = resources.getFraction(
R.fraction.reduced_clock_font_size_scale, 1, 1);
sp.setSpan(new RelativeSizeSpan(proportion), 0, pattern.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return sp;
}
/**
* Returns {@code true} if the am / pm strings for the current locale are long and a reduced
* text size should be used for displaying the digital clock.
*/
public static boolean isAmPmStringLong() {
final String[] amPmStrings = new DateFormatSymbols().getAmPmStrings();
for (String amPmString : amPmStrings) {
// Dots are small, so don't count them.
final int amPmStringLength = amPmString.replace(".", "").length();
if (amPmStringLength > 3) {
return true;
}
}
return false;
}
将mAmPmStyle = mStatusBarExt.getClockAmPmStyle(a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_GONE))修改为
mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_SMALL);
3.修改通知的setting小图标
进而修改为在alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/添加要替换的svg图片,并删除对应的png图片,
同时修改:
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.javapublic NotificationMenuItem(Context context, String s, GutsContent content, int iconResId):
//将iv.setColorFilter(tint);注释掉,否则会出现图片显示异常的问题