use of android.support.v7.widget.helper.ItemTouchHelper.UP in project platform_packages_apps_Settings by BlissRoms.
the class MobileNetworkPreferenceControllerTest method serviceStateChange_shouldUpdatePrefSummary.
@Test
public void serviceStateChange_shouldUpdatePrefSummary() {
final String testCarrierName = "test";
final Preference mPreference = mock(Preference.class);
mController = spy(new MobileNetworkPreferenceController(mContext));
mLifecycle.addObserver(mController);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(true).when(mController).isAvailable();
// Display pref and go through lifecycle to set up listener.
mController.displayPreference(mScreen);
mLifecycle.onResume();
verify(mController).onResume();
verify(mTelephonyManager).listen(mController.mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
// Trigger listener update
when(mTelephonyManager.getNetworkOperatorName()).thenReturn(testCarrierName);
mController.mPhoneStateListener.onServiceStateChanged(null);
// Carrier name should be set.
verify(mPreference).setSummary(testCarrierName);
}
use of android.support.v7.widget.helper.ItemTouchHelper.UP in project SeniorProject by 5731075221-PM.
the class NoteAddFragment method setupUI.
public void setupUI(View view) {
// Set up touch listener for non-text box views to hide keyboard.
if (!(view instanceof EditText)) {
view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
hideSoftKeyboard(NoteAddFragment.this);
return false;
}
});
}
// If a layout container, iterate over children and seed recursion.
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
View innerView = ((ViewGroup) view).getChildAt(i);
setupUI(innerView);
}
}
}
use of android.support.v7.widget.helper.ItemTouchHelper.UP in project mapbox-navigation-android by mapbox.
the class InstructionView method initTurnLaneRecyclerView.
/**
* Sets up the {@link RecyclerView} that is used to display the turn lanes.
*/
private void initTurnLaneRecyclerView() {
turnLaneAdapter = new TurnLaneAdapter();
rvTurnLanes.setAdapter(turnLaneAdapter);
rvTurnLanes.setHasFixedSize(true);
rvTurnLanes.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
}
use of android.support.v7.widget.helper.ItemTouchHelper.UP in project mapbox-navigation-android by mapbox.
the class InstructionView method initDirectionsRecyclerView.
/**
* Sets up the {@link RecyclerView} that is used to display the list of instructions.
*/
private void initDirectionsRecyclerView() {
instructionListAdapter = new InstructionListAdapter();
rvInstructions.setAdapter(instructionListAdapter);
rvInstructions.setHasFixedSize(true);
rvInstructions.setItemAnimator(new DefaultItemAnimator());
rvInstructions.setLayoutManager(new LinearLayoutManager(getContext()));
}
use of android.support.v7.widget.helper.ItemTouchHelper.UP in project afwall by ukanth.
the class AppDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.traffic_detail_title));
setContentView(R.layout.app_detail);
int appid = getIntent().getIntExtra("appid", -1);
String packageName = getIntent().getStringExtra("package");
try {
CheckBox logOption = (CheckBox) findViewById(R.id.notification_p);
LogPreference logPreference = SQLite.select().from(LogPreference.class).where(LogPreference_Table.uid.eq(appid)).querySingle();
if (logPreference != null) {
logOption.setChecked(logPreference.isDisable());
}
logOption.setOnCheckedChangeListener((buttonView, isChecked) -> {
// only use when triggered by user
if (buttonView.isPressed()) {
// write the logic here
G.updateLogNotification(appid, isChecked);
}
});
} catch (Exception e) {
}
Toolbar toolbar = (Toolbar) findViewById(R.id.app_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final Context ctx = getApplicationContext();
ImageView image = (ImageView) findViewById(R.id.app_icon);
TextView textView = (TextView) findViewById(R.id.app_title);
TextView textView2 = (TextView) findViewById(R.id.app_package);
TextView up = (TextView) findViewById(R.id.up);
TextView down = (TextView) findViewById(R.id.down);
/**/
final PackageManager packageManager = getApplicationContext().getPackageManager();
final String[] packageNameList = ctx.getPackageManager().getPackagesForUid(appid);
final String pName = packageName;
Button button = findViewById(R.id.app_settings);
button.setOnClickListener(v -> Api.showInstalledAppDetails(getApplicationContext(), pName));
ApplicationInfo applicationInfo;
try {
if (!packageName.startsWith("dev.afwall.special.")) {
applicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
if (applicationInfo != null) {
image.setImageDrawable(applicationInfo.loadIcon(packageManager));
String name = packageManager.getApplicationLabel(applicationInfo).toString();
textView.setText(name);
setTotalBytesManual(down, up, applicationInfo.uid);
}
} else {
image.setImageDrawable(getApplicationContext().getResources().getDrawable(R.drawable.ic_android_white_24dp));
if (appid >= 0) {
textView.setText(Api.getSpecialDescription(getApplicationContext(), packageName.replace("dev.afwall.special.", "")));
} else {
textView.setText(Api.getSpecialDescriptionSystem(getApplicationContext(), packageName.replace("dev.afwall.special.", "")));
}
down.setText(" : " + humanReadableByteCount(0, false));
up.setText(" : " + humanReadableByteCount(0, false));
button.setEnabled(false);
}
if (packageNameList != null && packageNameList.length > 1) {
textView2.setText(Arrays.toString(packageNameList));
button.setEnabled(false);
} else {
textView2.setText(packageName);
}
} catch (final NameNotFoundException e) {
down.setText(" : " + humanReadableByteCount(0, false));
up.setText(" : " + humanReadableByteCount(0, false));
button.setEnabled(false);
}
}
Aggregations