Off:
介词
prep.
1.(
表示方向
)
从„
,
通向
,
偏离
,
从„离开
He fell off the ladder.
他从梯子上掉下来。
The kitchen's off the dining room.
厨房通向餐厅。
We are going off the subject.
我们正偏离正题。
He was off his seat.
他离开他的位子。
2.(
表示比较
)
低于
,
不及
They are selling the bikes off the market price.
他们按低于市价卖出自
行车。
3.(
表示否定
)
不想,戒除
He is off tea.
他不想喝茶。
She's off work with a bad cold.
她因患重感冒而不上班。
Off:
副词
adv.
1.
离开
They drove off.
他们开车离开了。
2.
脱落
He's had his beard shaved off.
他已经把胡子剃掉了。
3.
未连接;不工作
The radio is off.
录音机是关着的。
4.
光
,
完
His money was off yesterday.
昨天他的钱用完了。
5.
休息
off可用作介词使用,表示离开、从、隔着...、偏离...等;用作副词,表示休息、离开、切断、取消等;用作形容词,表示远的,休假的,腐坏的。”
如何在sim cards的preferences sim中添加一个OFF项,来实现和SystemUi中下拉中的data connection相同的功能(关闭当前卡的数据连接)?在SimDialogActivity.java中修改:
1、setDefaultDataSubId(content,subid)方法中
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context)
//modify by dino for Bug #168346 begin
//miscExt.setDefaultDataEnable(context, subId)
//simExt.setDataState(subId)
//subscriptionManager.setDefaultDataSubId(subId)
//simExt.setDataStateEnable(subId)
获取得到telephonyManager对象
TelephonyManager telephonyManager = TelephonyManager.from(context)
获取当前卡的数据连接的布尔值(如果选中卡1或者卡2为true否则false)
boolean enableBefore = telephonyManager.getDataEnabled()
获取默认数据连接卡号
int preSubId = subscriptionManager.getDefaultDataSubId()
Log.d(TAG, "setDefaultDataSubId flag: " + enableBefore + ", subId: "+ subId + ", preSubId: " + preSubId)
Log.d(TAG, "setDefaultDataSubId subscriptionManager.isValidSubscriptionId(subId) : " + subscriptionManager.isValidSubscriptionId(subId))
判断卡数是否为正数(isValidSubscriptionId如果卡的数量大于-1返回true)
if (subscriptionManager.isValidSubscriptionId(subId)) {
设置默认的(选中的)数据连接
subscriptionManager.setDefaultDataSubId(subId)
判断当前卡数是否唯一相等(一张卡两个值必定相等,两张卡需判断当前默认和preSubId是否相等)
if (subId != preSubId){
if (enableBefore) {
设置当前卡开启数据连接
telephonyManager.setDataEnabled(subId, true)
设置切换前的卡的数据关闭连接
telephonyManager.setDataEnabled(preSubId, false)
}
} else {
若subid==preSubId直接设置开启数据连接
telephonyManager.setDataEnabled(subId, true)
}
}
2、添加一个方法setDataConnectionOff(context,subId)和1很类似不同就在if条件位置。
private static void setDataConnectionOff(final Context context, final int subId) {
ISettingsMiscExt miscExt = UtilsExt.getMiscPlugin(context)
ISimManagementExt simExt = UtilsExt.getSimManagmentExtPlugin(context)
if (TelecomManager.from(context).isInCall()) {
String textErr =
context.getResources().getString(R.string.default_data_switch_err_msg1)
textErr = miscExt.customizeSimDisplayString(textErr, subId)
Toast.makeText(context, textErr, Toast.LENGTH_SHORT).show()
return
}
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context)
TelephonyManager telephonyManager = TelephonyManager.from(context)
boolean enableBefore = telephonyManager.getDataEnabled()
//int preSubId = subscriptionManager.getDefaultDataSubId()
Log.d(TAG, "setDataConnectionOff flag: " + enableBefore + ", subId: "+ subId)
if (subscriptionManager.isValidSubscriptionId(subId)) {
subscriptionManager.setDefaultDataSubId(subId)
因为这是一个单独的dialog而不是卡,所以不许要判断subId和preSubId,直接关闭当前卡的网络就好
if (enableBefore) {
telephonyManager.setDataEnabled(subId, false)
}
}
3、在CreateDialog()中
在点击cellular data选择使用那张卡作为数据连接,当点击OFF时获取为空。所以需要添加判空条件,并关闭数据连接。
public void onClick(DialogInterface dialog, int value) {
final SubscriptionInfo sir
switch (id) {
case DATA_PICK:
sir = subInfoList.get(value)
if (null == sir){
setDataConnectionOff(context, subscriptionManager.getDefaultDataSubId())
} else if (!mExt.switchDefaultDataSub(context, sir.getSubscriptionId())) {
setDefaultDataSubId(context, sir.getSubscriptionId())
}
break
case CALLS_PICK:
4、CreateDialog.java
在点击Cellular data是d出dialog中添加一条OFF点击item
ArrayList<SubscriptionInfo>callsSubInfoList = new ArrayList<SubscriptionInfo>()
ArrayList<SubscriptionInfo>smsSubInfoList = new ArrayList<SubscriptionInfo>()
if (id == CALLS_PICK) {
final TelecomManager telecomManager = TelecomManager.from(context)
final Iterator<PhoneAccountHandle>phoneAccounts =
telecomManager.getCallCapablePhoneAccounts().listIterator()
if (telecomManager.getCallCapablePhoneAccounts().size() >1) {
list.add(getResources().getString(R.string.sim_calls_ask_first_prefs_title))
callsSubInfoList.add(null)
}
while (phoneAccounts.hasNext()) {
final PhoneAccount phoneAccount =
telecomManager.getPhoneAccount(phoneAccounts.next())
list.add((String)phoneAccount.getLabel())
if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) &&
TextUtils.isDigitsOnly(phoneAccount.getAccountHandle().getId())) {
final String phoneAccountId = phoneAccount.getAccountHandle().getId()
final SubscriptionInfo sir = Utils.findRecordBySubId(context,
Integer.parseInt(phoneAccountId))
callsSubInfoList.add(sir)
} else {
callsSubInfoList.add(null)
}
}
mExt.customizeListArray(list)
mExt.customizeSubscriptionInfoArray(callsSubInfoList)
} else if (id == SMS_PICK) {
initSmsData(list, subInfoList, selectableSubInfoLength, smsSubInfoList)
} else {
for (int i = 0i <selectableSubInfoLength++i) {
final SubscriptionInfo sir = subInfoList.get(i)
CharSequence displayName = sir.getDisplayName()
if (displayName == null) {
displayName = ""
}
list.add(displayName.toString())
}
if (selectableSubInfoLength >0) {
list.add(“OFF”)
subInfoList.add(null)
}
}
1.day
off
休息日的意思
take
a
day
off
休息一天
休息两天
是
take
two
days
off.
take可用have
代替
如果这样的话
提问就应该是
how
many
days
do
you
take
off?
你的疑问句里面少个take
或者
have
2
这是一个only至于句首的部分倒装句
only在句首倒装的情况。例如:
Only
in
this
way,
can
you
learn
English
well.
只有这样,你才能学好英语。
Only
after
being
asked
three
times
did
he
come
to
the
meeting.
叫了三次,他才来参加会议。
如果句子为主从复合句,则主句倒装,从句不倒装。例如:
Only
when
he
is
seriously
ill
does
he
ever
stay
in
bed.
病得狠重时,他才卧床休息。
倒装句之部分倒装
部分倒装是指将谓语的一部分如助动词或情态倒装至主语之前。如果句子的谓语没有助动词或情态动词,则需添加助动词do,
does或did,并将其置于主语之前。
当然部分倒装句的情况还有很多
例如句首为否定或半否定的词语,如no,
not,
never,
seldom,
little,
hardly,
at
no
time,
in
no
way,
not
until…
等等
例如Never
have
I
seen
such
a
performance.
从未见过如此糟糕的表演。
Nowhere
will
you
find
the
answer
to
this
question.
无论如何你不会找到这个问题的答案的。
Not
until
the
child
fell
asleep
did
the
mother
leave
the
room.
母亲一直到孩子入睡后离开房间。
当Not
until引出主从复合句,主句倒装,从句不倒装。注意:
如否定词不在句首不倒装。例如:
I
have
never
seen
such
a
performance.
The
mother
didn't
leave
the
room
until
the
child
fell
asleep.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)