Search in sources :

Example 86 with UP

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);
}
Also used : Preference(android.support.v7.preference.Preference) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 87 with UP

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);
        }
    }
}
Also used : EditText(android.widget.EditText) ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) MotionEvent(android.view.MotionEvent)

Example 88 with UP

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));
}
Also used : TurnLaneAdapter(com.mapbox.services.android.navigation.ui.v5.instruction.turnlane.TurnLaneAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 89 with UP

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()));
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) InstructionListAdapter(com.mapbox.services.android.navigation.ui.v5.summary.list.InstructionListAdapter) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 90 with UP

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);
    }
}
Also used : LogPreference(dev.ukanth.ufirewall.log.LogPreference) Context(android.content.Context) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) ApplicationInfo(android.content.pm.ApplicationInfo) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) PackageManager(android.content.pm.PackageManager) Button(android.widget.Button) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) ImageView(android.widget.ImageView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

View (android.view.View)135 RecyclerView (android.support.v7.widget.RecyclerView)97 TextView (android.widget.TextView)69 Toolbar (android.support.v7.widget.Toolbar)51 ActionBar (android.support.v7.app.ActionBar)49 Intent (android.content.Intent)44 ImageView (android.widget.ImageView)41 AdapterView (android.widget.AdapterView)33 ArrayList (java.util.ArrayList)30 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)29 DialogInterface (android.content.DialogInterface)25 AlertDialog (android.support.v7.app.AlertDialog)25 ListView (android.widget.ListView)25 Bundle (android.os.Bundle)22 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)22 SharedPreferences (android.content.SharedPreferences)21 Preference (android.support.v7.preference.Preference)20 GridLayoutManager (android.support.v7.widget.GridLayoutManager)19 SuppressLint (android.annotation.SuppressLint)16 Point (android.graphics.Point)16