/** * @param activity * @param repo */ public CommentPreviewPagerAdapter(AppCompatActivity activity, Repository repo) { super(activity); this.context = activity.getApplicationContext(); this.repo = repo; }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { selectedListPosition = savedInstanceState.getInt("listPosition", 0); searchQuery = savedInstanceState.getString(SearchManager.QUERY); } else { selectedListPosition = 0; Bundle bundle = getArguments(); if (bundle != null) { searchQuery = bundle.getString(SearchManager.QUERY); } } recyclerViewAdapter = new RecordingRecyclerViewAdapter(isDualPane, this, htspVersion); recyclerView.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext())); recyclerView.addItemDecoration(new DividerItemDecoration(activity.getApplicationContext(), LinearLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(recyclerViewAdapter); viewModel = ViewModelProviders.of(activity).get(RecordingViewModel.class); recyclerView.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); }
public void showAndroidUsbDeviceInfo(String device) { if (isSmallScreen()) { final Intent i = new Intent(activity.getApplicationContext(), UsbInfoActivity.class); i.putExtra(UsbInfoActivity.EXTRA_DATA_ANDROID, device); startActivity(i); } else { final Fragment fragment = FragmentFactory.getFragment(device); stackFragment(fragment); } }
public void showLinuxUsbDeviceInfo(SysBusUsbDevice device) { if (isSmallScreen()) { final Intent i = new Intent(activity.getApplicationContext(), UsbInfoActivity.class); i.putExtra(UsbInfoActivity.EXTRA_DATA_LINUX, device); startActivity(i); } else { final Fragment fragment = FragmentFactory.getFragment(device); stackFragment(fragment); } }
public static void startMaybe(AppCompatActivity caller, Intent unlockIntent) { if(!BuildConfig.DEBUG || !Settings.getBoolean("use_lockscreen", false)) return; if(RxDroid.isLocked()) { if(unlockIntent == null) { unlockIntent = caller.getIntent(); if(unlockIntent == null) throw new IllegalStateException("Intent is null in argument and calling activity"); } final Intent intent = new Intent(caller.getApplicationContext(), LockscreenActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(EXTRA_UNLOCK_INTENT, unlockIntent); caller.startActivity(intent); caller.finish(); } }
/** * Initializes activity-specific stuff. */ public static void onCreateActivity(AppCompatActivity activity, int flags) { onCreate(activity.getApplicationContext(), flags); // XXX for now... flags |= NO_LOCKSCREEN | NO_VISIBILITY_REGISTRY; if((flags & NO_THEME) == 0) activity.setTheme(Theme.get()); activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); if(BuildConfig.DEBUG) { final String lang = Settings.getString(Keys.LANGUAGE); if(lang != null && lang.length() != 0) { final Resources res = activity.getResources(); final Configuration cfg = res.getConfiguration(); if(!lang.equals(cfg.locale.getLanguage())) { cfg.locale = new Locale(lang); res.updateConfiguration(cfg, res.getDisplayMetrics()); Log.i(TAG, "Setting language to '" + lang + "'"); } else Log.d(TAG, "Language '" + lang + "' already set"); } } SystemEventReceiver.registerOnSystemTimeChangeListener(activity); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { // !!! Make some modifications Toast.makeText(getApplicationContext(), "Hello World!", Toast.LENGTH_SHORT).show(); final AppCompatDelegate delegate = getDelegate(); delegate.installViewFactory(); delegate.onCreate(savedInstanceState); if (delegate.applyDayNight() && mThemeId != 0) { // If DayNight has been applied, we need to re-apply the theme for // the changes to take effect. On API 23+, we should bypass // setTheme(), which will no-op if the theme ID is identical to the // current theme ID. if (Build.VERSION.SDK_INT >= 23) { onApplyThemeResource(getTheme(), mThemeId, false); } else { setTheme(mThemeId); } } super.onCreate(savedInstanceState); }
recyclerView.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext())); recyclerView.addItemDecoration(new DividerItemDecoration(activity.getApplicationContext(), LinearLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(recyclerViewAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext())); recyclerView.addItemDecoration(new DividerItemDecoration(activity.getApplicationContext(), LinearLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(recyclerViewAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext())); recyclerView.addItemDecoration(new DividerItemDecoration(activity.getApplicationContext(), LinearLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(recyclerViewAdapter);
public void applyNightModel(AppCompatActivity activity){ invokeResources(activity); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); activity.getDelegate().applyDayNight(); applyNewModel(); PersistenceUtils.setNightModel(activity.getApplicationContext(), true); ModelChangeManager.getInstance().notifyChange(true); }
recyclerView.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext())); recyclerView.addItemDecoration(new DividerItemDecoration(activity.getApplicationContext(), LinearLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(recyclerViewAdapter);
public void applyDayModel(AppCompatActivity activity) { invokeResources(activity); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); activity.getDelegate().applyDayNight(); applyNewModel(); PersistenceUtils.setNightModel(activity.getApplicationContext(), false); ModelChangeManager.getInstance().notifyChange(false); }