Search in sources :

Example 31 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project UltimateAndroid by cymcsg.

the class SlideScaleInOutRightItemAnimator method animateAddImpl.

protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    ViewCompat.animate(view).scaleX(mOriginalScaleX).scaleY(mOriginalScaleY).translationX(0).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationCancel(View view) {
            ViewCompat.setTranslationX(view, 0);
            ViewCompat.setScaleX(view, mOriginalScaleX);
            ViewCompat.setScaleY(view, mOriginalScaleY);
        }

        @Override
        public void onAnimationEnd(View view) {
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
    mAddAnimations.add(holder);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 32 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project AntennaPod by AntennaPod.

the class PlaybackService method setupNotification.

/**
     * Prepares notification and starts the service in the foreground.
     */
private void setupNotification(final PlaybackServiceMediaPlayer.PSMPInfo info) {
    final PendingIntent pIntent = PendingIntent.getActivity(this, 0, PlaybackService.getPlayerActivityIntent(this), PendingIntent.FLAG_UPDATE_CURRENT);
    if (notificationSetupThread != null) {
        notificationSetupThread.interrupt();
    }
    Runnable notificationSetupTask = new Runnable() {

        Bitmap icon = null;

        @Override
        public void run() {
            Log.d(TAG, "Starting background work");
            if (android.os.Build.VERSION.SDK_INT >= 11) {
                if (info.playable != null) {
                    int iconSize = getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
                    try {
                        icon = Glide.with(PlaybackService.this).load(info.playable.getImageLocation()).asBitmap().diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).centerCrop().into(iconSize, iconSize).get();
                    } catch (Throwable tr) {
                        Log.e(TAG, "Error loading the media icon for the notification", tr);
                    }
                }
            }
            if (icon == null) {
                icon = BitmapFactory.decodeResource(getApplicationContext().getResources(), ClientConfig.playbackServiceCallbacks.getNotificationIconResource(getApplicationContext()));
            }
            if (mediaPlayer == null) {
                return;
            }
            PlayerStatus playerStatus = mediaPlayer.getPlayerStatus();
            final int smallIcon = ClientConfig.playbackServiceCallbacks.getNotificationIconResource(getApplicationContext());
            if (!Thread.currentThread().isInterrupted() && started && info.playable != null) {
                String contentText = info.playable.getEpisodeTitle();
                String contentTitle = info.playable.getFeedTitle();
                Notification notification;
                // Builder is v7, even if some not overwritten methods return its parent's v4 interface
                NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(PlaybackService.this).setContentTitle(contentTitle).setContentText(contentText).setOngoing(false).setContentIntent(pIntent).setLargeIcon(icon).setSmallIcon(smallIcon).setWhen(// we don't need the time
                0).setPriority(// set notification priority
                UserPreferences.getNotifyPriority());
                IntList compactActionList = new IntList();
                // we start and 0 and then increment by 1 for each call to addAction
                int numActions = 0;
                if (isCasting) {
                    Intent stopCastingIntent = new Intent(PlaybackService.this, PlaybackService.class);
                    stopCastingIntent.putExtra(EXTRA_CAST_DISCONNECT, true);
                    PendingIntent stopCastingPendingIntent = PendingIntent.getService(PlaybackService.this, numActions, stopCastingIntent, PendingIntent.FLAG_UPDATE_CURRENT);
                    notificationBuilder.addAction(R.drawable.ic_media_cast_disconnect, getString(R.string.cast_disconnect_label), stopCastingPendingIntent);
                    numActions++;
                }
                // always let them rewind
                PendingIntent rewindButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_REWIND, numActions);
                notificationBuilder.addAction(android.R.drawable.ic_media_rew, getString(R.string.rewind_label), rewindButtonPendingIntent);
                if (UserPreferences.showRewindOnCompactNotification()) {
                    compactActionList.add(numActions);
                }
                numActions++;
                if (playerStatus == PlayerStatus.PLAYING) {
                    PendingIntent pauseButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_PAUSE, numActions);
                    //pause action
                    notificationBuilder.addAction(//pause action
                    android.R.drawable.ic_media_pause, getString(R.string.pause_label), pauseButtonPendingIntent);
                    compactActionList.add(numActions++);
                } else {
                    PendingIntent playButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_PLAY, numActions);
                    //play action
                    notificationBuilder.addAction(//play action
                    android.R.drawable.ic_media_play, getString(R.string.play_label), playButtonPendingIntent);
                    compactActionList.add(numActions++);
                }
                // ff follows play, then we have skip (if it's present)
                PendingIntent ffButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, numActions);
                notificationBuilder.addAction(android.R.drawable.ic_media_ff, getString(R.string.fast_forward_label), ffButtonPendingIntent);
                if (UserPreferences.showFastForwardOnCompactNotification()) {
                    compactActionList.add(numActions);
                }
                numActions++;
                if (UserPreferences.isFollowQueue()) {
                    PendingIntent skipButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_NEXT, numActions);
                    notificationBuilder.addAction(android.R.drawable.ic_media_next, getString(R.string.skip_episode_label), skipButtonPendingIntent);
                    if (UserPreferences.showSkipOnCompactNotification()) {
                        compactActionList.add(numActions);
                    }
                    numActions++;
                }
                PendingIntent stopButtonPendingIntent = getPendingIntentForMediaAction(KeyEvent.KEYCODE_MEDIA_STOP, numActions);
                notificationBuilder.setStyle(new android.support.v7.app.NotificationCompat.MediaStyle().setMediaSession(mediaSession.getSessionToken()).setShowActionsInCompactView(compactActionList.toArray()).setShowCancelButton(true).setCancelButtonIntent(stopButtonPendingIntent)).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).setColor(NotificationCompat.COLOR_DEFAULT);
                notification = notificationBuilder.build();
                if (playerStatus == PlayerStatus.PLAYING || playerStatus == PlayerStatus.PREPARING || playerStatus == PlayerStatus.SEEKING || isCasting) {
                    startForeground(NOTIFICATION_ID, notification);
                } else {
                    stopForeground(false);
                    NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
                    mNotificationManager.notify(NOTIFICATION_ID, notification);
                }
                Log.d(TAG, "Notification set up");
            }
        }
    };
    notificationSetupThread = new Thread(notificationSetupTask);
    notificationSetupThread.start();
}
Also used : NotificationManager(android.app.NotificationManager) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) Notification(android.app.Notification) IntList(de.danoeh.antennapod.core.util.IntList) Bitmap(android.graphics.Bitmap) NotificationCompat(android.support.v7.app.NotificationCompat) PendingIntent(android.app.PendingIntent)

Example 33 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project AntennaPod by AntennaPod.

the class PreferenceController method onCreate.

public void onCreate() {
    final Activity activity = ui.getActivity();
    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        // disable expanded notification option on unsupported android versions
        ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setEnabled(false);
        ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setOnPreferenceClickListener(preference -> {
            Toast toast = Toast.makeText(activity, R.string.pref_expand_notify_unsupport_toast, Toast.LENGTH_SHORT);
            toast.show();
            return true;
        });
    }
    ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setOnPreferenceClickListener(preference -> {
        FlattrUtils.revokeAccessToken(activity);
        checkItemVisibility();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_ABOUT).setOnPreferenceClickListener(preference -> {
        activity.startActivity(new Intent(activity, AboutActivity.class));
        return true;
    });
    ui.findPreference(PreferenceController.STATISTICS).setOnPreferenceClickListener(preference -> {
        activity.startActivity(new Intent(activity, StatisticsActivity.class));
        return true;
    });
    ui.findPreference(PreferenceController.PREF_OPML_EXPORT).setOnPreferenceClickListener(preference -> export(new OpmlWriter()));
    ui.findPreference(PreferenceController.PREF_HTML_EXPORT).setOnPreferenceClickListener(preference -> export(new HtmlWriter()));
    ui.findPreference(PreferenceController.PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(preference -> {
        if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
            showChooseDataFolderDialog();
        } else {
            int readPermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
            int writePermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (readPermission == PackageManager.PERMISSION_GRANTED && writePermission == PackageManager.PERMISSION_GRANTED) {
                openDirectoryChooser();
            } else {
                requestPermission();
            }
        }
        return true;
    });
    ui.findPreference(PreferenceController.PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(preference -> {
        if (Build.VERSION.SDK_INT >= 19) {
            showChooseDataFolderDialog();
        } else {
            Intent intent = new Intent(activity, DirectoryChooserActivity.class);
            activity.startActivityForResult(intent, DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED);
        }
        return true;
    });
    ui.findPreference(UserPreferences.PREF_THEME).setOnPreferenceChangeListener((preference, newValue) -> {
        Intent i = new Intent(activity, MainActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.finish();
        activity.startActivity(i);
        return true;
    });
    ui.findPreference(UserPreferences.PREF_HIDDEN_DRAWER_ITEMS).setOnPreferenceClickListener(preference -> {
        showDrawerPreferencesDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_COMPACT_NOTIFICATION_BUTTONS).setOnPreferenceClickListener(preference -> {
        showNotificationButtonsDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_UPDATE_INTERVAL).setOnPreferenceClickListener(preference -> {
        showUpdateIntervalTimePreferencesDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL).setOnPreferenceChangeListener((preference, newValue) -> {
        if (newValue instanceof Boolean) {
            boolean enabled = (Boolean) newValue;
            ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setEnabled(enabled);
            ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_ON_BATTERY).setEnabled(enabled);
            ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setEnabled(enabled);
            setSelectedNetworksEnabled(enabled && UserPreferences.isEnableAutodownloadWifiFilter());
        }
        return true;
    });
    ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setOnPreferenceChangeListener((preference, newValue) -> {
        if (newValue instanceof Boolean) {
            setSelectedNetworksEnabled((Boolean) newValue);
            return true;
        } else {
            return false;
        }
    });
    ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            try {
                int value = Integer.parseInt((String) o);
                if (1 <= value && value <= 50) {
                    setParallelDownloadsText(value);
                    return true;
                }
            } catch (NumberFormatException e) {
                return false;
            }
        }
        return false;
    });
    // validate and set correct value: number of downloads between 1 and 50 (inclusive)
    final EditText ev = ((EditTextPreference) ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS)).getEditText();
    ev.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.length() > 0) {
                try {
                    int value = Integer.parseInt(s.toString());
                    if (value <= 0) {
                        ev.setText("1");
                    } else if (value > 50) {
                        ev.setText("50");
                    }
                } catch (NumberFormatException e) {
                    ev.setText("6");
                }
                ev.setSelection(ev.getText().length());
            }
        }
    });
    ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            setEpisodeCacheSizeText(UserPreferences.readEpisodeCacheSize((String) o));
        }
        return true;
    });
    ui.findPreference(PreferenceController.PREF_PLAYBACK_SPEED_LAUNCHER).setOnPreferenceClickListener(preference -> {
        VariableSpeedDialog.showDialog(activity);
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_SETLOGIN_INFORMATION).setOnPreferenceClickListener(preference -> {
        AuthenticationDialog dialog = new AuthenticationDialog(activity, R.string.pref_gpodnet_setlogin_information_title, false, false, GpodnetPreferences.getUsername(), null) {

            @Override
            protected void onConfirmed(String username, String password, boolean saveUsernamePassword) {
                GpodnetPreferences.setPassword(password);
            }
        };
        dialog.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_SYNC).setOnPreferenceClickListener(preference -> {
        GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext());
        Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, Toast.LENGTH_SHORT);
        toast.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_FORCE_FULL_SYNC).setOnPreferenceClickListener(preference -> {
        GpodnetPreferences.setLastSubscriptionSyncTimestamp(0L);
        GpodnetPreferences.setLastEpisodeActionsSyncTimestamp(0L);
        GpodnetPreferences.setLastSyncAttempt(false, 0);
        updateLastGpodnetSyncReport(false, 0);
        GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext());
        Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, Toast.LENGTH_SHORT);
        toast.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_LOGOUT).setOnPreferenceClickListener(preference -> {
        GpodnetPreferences.logout();
        Toast toast = Toast.makeText(activity, R.string.pref_gpodnet_logout_toast, Toast.LENGTH_SHORT);
        toast.show();
        updateGpodnetPreferenceScreen();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_HOSTNAME).setOnPreferenceClickListener(preference -> {
        GpodnetSetHostnameDialog.createDialog(activity).setOnDismissListener(dialog -> updateGpodnetPreferenceScreen());
        return true;
    });
    ui.findPreference(PreferenceController.PREF_AUTO_FLATTR_PREFS).setOnPreferenceClickListener(preference -> {
        AutoFlattrPreferenceDialog.newAutoFlattrPreferenceDialog(activity, new AutoFlattrPreferenceDialog.AutoFlattrPreferenceDialogInterface() {

            @Override
            public void onCancelled() {
            }

            @Override
            public void onConfirmed(boolean autoFlattrEnabled, float autoFlattrValue) {
                UserPreferences.setAutoFlattrSettings(autoFlattrEnabled, autoFlattrValue);
                checkItemVisibility();
            }
        });
        return true;
    });
    ui.findPreference(UserPreferences.PREF_IMAGE_CACHE_SIZE).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            int newValue = Integer.parseInt((String) o) * 1024 * 1024;
            if (newValue != UserPreferences.getImageCacheSize()) {
                AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity());
                dialog.setTitle(android.R.string.dialog_alert_title);
                dialog.setMessage(R.string.pref_restart_required);
                dialog.setPositiveButton(android.R.string.ok, null);
                dialog.show();
            }
            return true;
        }
        return false;
    });
    ui.findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> {
        ProxyDialog dialog = new ProxyDialog(ui.getActivity());
        dialog.createDialog().show();
        return true;
    });
    ui.findPreference(PREF_KNOWN_ISSUES).setOnPreferenceClickListener(preference -> {
        openInBrowser("https://github.com/AntennaPod/AntennaPod/labels/bug");
        return true;
    });
    ui.findPreference(PREF_FAQ).setOnPreferenceClickListener(preference -> {
        openInBrowser("http://antennapod.org/faq.html");
        return true;
    });
    ui.findPreference(PREF_SEND_CRASH_REPORT).setOnPreferenceClickListener(preference -> {
        Intent emailIntent = new Intent(Intent.ACTION_SEND);
        emailIntent.setType("text/plain");
        emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "Martin.Fietz@gmail.com" });
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "AntennaPod Crash Report");
        emailIntent.putExtra(Intent.EXTRA_TEXT, "Please describe what you were doing when the app crashed");
        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(CrashReportWriter.getFile()));
        String intentTitle = ui.getActivity().getString(R.string.send_email);
        ui.getActivity().startActivity(Intent.createChooser(emailIntent, intentTitle));
        return true;
    });
    PreferenceControllerFlavorHelper.setupFlavoredUI(ui);
    buildEpisodeCleanupPreference();
    buildSmartMarkAsPlayedPreference();
    buildAutodownloadSelectedNetworsPreference();
    setSelectedNetworksEnabled(UserPreferences.isEnableAutodownloadWifiFilter());
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ProxyDialog(de.danoeh.antennapod.dialog.ProxyDialog) AutoFlattrPreferenceDialog(de.danoeh.antennapod.dialog.AutoFlattrPreferenceDialog) HtmlWriter(de.danoeh.antennapod.core.export.html.HtmlWriter) MainActivity(de.danoeh.antennapod.activity.MainActivity) AboutActivity(de.danoeh.antennapod.activity.AboutActivity) StatisticsActivity(de.danoeh.antennapod.activity.StatisticsActivity) PreferenceActivity(de.danoeh.antennapod.activity.PreferenceActivity) DirectoryChooserActivity(de.danoeh.antennapod.activity.DirectoryChooserActivity) Activity(android.app.Activity) StatisticsActivity(de.danoeh.antennapod.activity.StatisticsActivity) Toast(android.widget.Toast) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EditText(android.widget.EditText) AuthenticationDialog(de.danoeh.antennapod.dialog.AuthenticationDialog) Intent(android.content.Intent) EditTextPreference(android.preference.EditTextPreference) SuppressLint(android.annotation.SuppressLint) AboutActivity(de.danoeh.antennapod.activity.AboutActivity) OpmlWriter(de.danoeh.antennapod.core.export.opml.OpmlWriter)

Example 34 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project kdeconnect-android by KDE.

the class MaterialActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavigationView = (NavigationView) findViewById(R.id.navigation_drawer);
    View mDrawerHeader = mNavigationView.getHeaderView(0);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
    mDrawerLayout, /* DrawerLayout object */
    R.string.open, /* "open drawer" description */
    R.string.close);
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    actionBar.setDisplayHomeAsUpEnabled(true);
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerToggle.syncState();
    String deviceName = DeviceHelper.getDeviceName(this);
    TextView nameView = (TextView) mDrawerHeader.findViewById(R.id.device_name);
    nameView.setText(deviceName);
    View.OnClickListener renameListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            renameDevice();
        }
    };
    mDrawerHeader.findViewById(R.id.kdeconnect_label).setOnClickListener(renameListener);
    mDrawerHeader.findViewById(R.id.device_name).setOnClickListener(renameListener);
    mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {

        @Override
        public boolean onNavigationItemSelected(MenuItem menuItem) {
            String deviceId = mMapMenuToDeviceId.get(menuItem);
            onDeviceSelected(deviceId);
            mDrawerLayout.closeDrawer(mNavigationView);
            return true;
        }
    });
    preferences = getSharedPreferences(STATE_SELECTED_DEVICE, Context.MODE_PRIVATE);
    String savedDevice;
    String pairStatus = "";
    if (getIntent().hasExtra("forceOverview")) {
        Log.i("MaterialActivity", "Requested to start main overview");
        savedDevice = null;
    } else if (getIntent().hasExtra("deviceId")) {
        Log.i("MaterialActivity", "Loading selected device from parameter");
        savedDevice = getIntent().getStringExtra("deviceId");
        if (getIntent().hasExtra(PAIR_REQUEST_STATUS)) {
            pairStatus = getIntent().getStringExtra(PAIR_REQUEST_STATUS);
        }
    } else if (savedInstanceState != null) {
        Log.i("MaterialActivity", "Loading selected device from saved activity state");
        savedDevice = savedInstanceState.getString(STATE_SELECTED_DEVICE);
    } else {
        Log.i("MaterialActivity", "Loading selected device from persistent storage");
        savedDevice = preferences.getString(STATE_SELECTED_DEVICE, null);
    }
    //if pairStatus is not empty, then the decision has been made...
    if (!pairStatus.equals("")) {
        Log.i("MaterialActivity", "pair status is " + pairStatus);
        onNewDeviceSelected(savedDevice, pairStatus);
    }
    onDeviceSelected(savedDevice);
}
Also used : NavigationView(android.support.design.widget.NavigationView) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) TextView(android.widget.TextView) MenuItem(android.view.MenuItem) NavigationView(android.support.design.widget.NavigationView) View(android.view.View) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 35 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project leo-app by LCA311.

the class WrapperQRActivity method onCreate.

/*    private ZXingScannerView scV;
    public static Button scan;
    private final int MY_PERMISSIONS_REQUEST_USE_CAMERA = 0;
    private boolean runningScan; */
@Override
protected void onCreate(Bundle savedInstanceState) {
    /*   super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wrapper_qr); */
    //---- START TOOLBAR ---- //
    Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar);
    //        runningScan = false;
    setSupportActionBar(myToolbar);
    //If it's stupid, but it works it's not stupid
    getSupportActionBar().setTitle(Html.fromHtml("<font color=\"#ffffff\">" + getString(R.string.toolbar_title) + "</font>"));
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    //---- ENDE TOOLBAR ---- //
    //---- START TABS ---- //
    mViewPager = (ViewPager) findViewById(R.id.pager);
    FragmentPagerAdapter adapt = new FragmentPagerAdapter(getSupportFragmentManager()) {

        @Override
        public Fragment getItem(int position) {
            if (position == 0)
                //QRActivity ist ein Fragment trotz des Namens
                return new QRActivity();
            else
                //ScanActivity ist ein Fragment trotz des Namens
                return new ScanActivity();
        }

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            if (position == 0)
                return getString(R.string.toolbar_qr);
            else
                return getString(R.string.toolbar_scan);
        }
    };
    mViewPager.setAdapter(adapt);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout);
    tabLayout.setupWithViewPager(mViewPager);
//---- ENDE TABS ---- //
/*        sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
        sqlh = new SQLiteHandler(getApplicationContext());

        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                scan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        scan();
                    }
                });
            }
        }, 100); */
}
Also used : FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter) TabLayout(android.support.design.widget.TabLayout) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

View (android.view.View)367 RecyclerView (android.support.v7.widget.RecyclerView)271 TextView (android.widget.TextView)175 Intent (android.content.Intent)109 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)84 Toolbar (android.support.v7.widget.Toolbar)77 TextWatcher (android.text.TextWatcher)77 Editable (android.text.Editable)76 ImageView (android.widget.ImageView)76 ArrayList (java.util.ArrayList)68 Bundle (android.os.Bundle)48 DialogInterface (android.content.DialogInterface)47 AlertDialog (android.support.v7.app.AlertDialog)47 AdapterView (android.widget.AdapterView)46 EditText (android.widget.EditText)42 SuppressLint (android.annotation.SuppressLint)39 Button (android.widget.Button)39 ActionBar (android.support.v7.app.ActionBar)34 List (java.util.List)34 ViewPropertyAnimatorCompat (android.support.v4.view.ViewPropertyAnimatorCompat)33