dagger.android.AndroidInjection Java Examples
The following examples show how to use
dagger.android.AndroidInjection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BootCompletedBroadcast.java From adamant-android with GNU General Public License v3.0 | 7 votes |
@Override public void onReceive(Context context, Intent intent) { AndroidInjection.inject(this, context); if (intent == null || intent.getAction() == null) { return; } switch (intent.getAction()) { case Intent.ACTION_LOCKED_BOOT_COMPLETED: case Intent.ACTION_BOOT_COMPLETED: PushNotificationServiceFacade currentFacade = switchPushNotificationServiceInteractor.getCurrentFacade(); boolean isCurrentLocalService = currentFacade != null && SupportedPushNotificationFacadeType.LOCAL_SERVICE.equals(currentFacade.getFacadeType()); if (isCurrentLocalService) { Intent i = new Intent(context, AdamantLocalMessagingService.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { context.startForegroundService(i); } else { context.startService(i); } } break; } }
Example #2
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #3
Source File: LiveDataRowsActivity.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_livedata_rows); if (ContextCompat.checkSelfPermission(LiveDataRowsActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // If the permission is not authorized in the first time. A new permission access // request will be created. if (ActivityCompat.shouldShowRequestPermissionRationale(LiveDataRowsActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { ActivityCompat.requestPermissions(LiveDataRowsActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_PERMISSION); } else { ActivityCompat.requestPermissions(LiveDataRowsActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_PERMISSION); } } }
Example #4
Source File: TokenDetailActivity.java From alpha-wallet-android with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_token_detail); viewModel = ViewModelProviders.of(this, tokenFunctionViewModelFactory) .get(TokenFunctionViewModel.class); if (getIntent() != null && getIntent().getExtras() != null) { asset = getIntent().getExtras().getParcelable("asset"); token = getIntent().getExtras().getParcelable("token"); initViews(); toolbar(); setTitle(token.getFullName()); setupPage(); } else { finish(); } }
Example #5
Source File: TokenFunctionActivity.java From alpha-wallet-android with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_script_view); viewModel = ViewModelProviders.of(this, tokenFunctionViewModelFactory) .get(TokenFunctionViewModel.class); viewModel.insufficientFunds().observe(this, this::errorInsufficientFunds); viewModel.invalidAddress().observe(this, this::errorInvalidAddress); viewModel.tokenUpdate().observe(this, this::onTokenUpdate); viewModel.walletUpdate().observe(this, this::onWalletUpdate); SystemView systemView = findViewById(R.id.system_view); systemView.hide(); functionBar = findViewById(R.id.layoutButtons); initViews(getIntent().getParcelableExtra(TICKET)); toolbar(); setTitle(getString(R.string.token_function)); viewModel.startGasPriceUpdate(token.tokenInfo.chainId); }
Example #6
Source File: SelectNetworkActivity.java From alpha-wallet-android with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); toolbar(); setTitle(getString(R.string.select_active_networks)); viewModel = ViewModelProviders.of(this, viewModelFactory) .get(SelectNetworkViewModel.class); if (getIntent() != null) { singleItem = getIntent().getBooleanExtra(C.EXTRA_SINGLE_ITEM, false); selectedChainId = getIntent().getStringExtra(C.EXTRA_CHAIN_ID); } if (selectedChainId == null || selectedChainId.isEmpty()) { selectedChainId = viewModel.getFilterNetworkList(); } recyclerView = findViewById(R.id.list); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new ListDivider(this)); }
Example #7
Source File: AppInjector.java From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static void handleActivity(final Activity activity) { if (activity instanceof Injectable || activity instanceof HasAndroidInjector) { AndroidInjection.inject(activity); } if (activity instanceof AppCompatActivity) { ((AppCompatActivity) activity).getSupportFragmentManager().registerFragmentLifecycleCallbacks( new FragmentManager.FragmentLifecycleCallbacks() { @Override public void onFragmentCreated(@NonNull final FragmentManager fm, @NonNull final Fragment f, final Bundle savedInstanceState) { if (f instanceof Injectable) { AndroidSupportInjection.inject(f); } } }, true); } }
Example #8
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #9
Source File: MainScreen.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); appBar.setOnNavigationItemSelectedListener(menuItem -> { switch (menuItem.getItemId()){ case R.id.navigation_chats: { presenter.onSelectedChatsScreen(); return true; } case R.id.navigation_wallet: { presenter.onSelectedWalletScreen(); return true; } case R.id.navigation_settings: { presenter.onSelectedSettingsScreen(); return true; } } return false; }); }
Example #10
Source File: ImportWalletActivity.java From trust-wallet-android-source with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_import_wallet); toolbar(); pages.add(KEYSTORE_FORM_INDEX, new Pair<>(getString(R.string.tab_keystore), ImportKeystoreFragment.create())); pages.add(PRIVATE_KEY_FORM_INDEX, new Pair<>(getString(R.string.tab_private_key), ImportPrivateKeyFragment.create())); ViewPager viewPager = findViewById(R.id.viewPager); viewPager.setAdapter(new TabPagerAdapter(getSupportFragmentManager(), pages)); TabLayout tabLayout = findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); importWalletViewModel = ViewModelProviders.of(this, importWalletViewModelFactory) .get(ImportWalletViewModel.class); importWalletViewModel.progress().observe(this, this::onProgress); importWalletViewModel.error().observe(this, this::onError); importWalletViewModel.wallet().observe(this, this::onWallet); }
Example #11
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockSummaryFragment.setViewModel(viewModel); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); viewModel.loadSaved(savedInstanceState); }
Example #12
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #13
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #14
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockSummaryFragment.setViewModel(viewModel); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); }
Example #15
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #16
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #17
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #18
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #19
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #20
Source File: SplashScreen.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); Context applicationContext = getApplicationContext(); WeakReference<SplashScreen> thisReference = new WeakReference<>(this); if (settings.isKeyPairMustBeStored() && !settings.getAccountPassphrase().isEmpty()) { Bundle bundle = new Bundle(); bundle.putSerializable(PinCodeView.ARG_MODE, PinCodeView.MODE.ACCESS_TO_APP); goToScreen(PincodeScreen.class, applicationContext, thisReference, bundle); } else { // Resetting the settings is necessary to switch from the version without pincode support, // otherwise the "Save authorization" checkbox in the settings window will be incorrect. settings.setKeyPairMustBeStored(false); settings.setAccountPassphrase(""); goToScreen(LoginScreen.class, applicationContext, thisReference, null); return; } setContentView(R.layout.activity_splash_screen); }
Example #21
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #22
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #23
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; }
Example #24
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #25
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #26
Source File: AddNewStockActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_add_new_stock); addNewStockFragment = new AddNewStockFragment(); addNewStockFragment.setViewModel(viewModel); setTitle("Add New Item"); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, addNewStockFragment) .commit(); viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #27
Source File: StockPortfolioListViewActivity.java From Building-Professional-Android-Applications with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); // getMainComponent().inject(this); super.onCreate(savedInstanceState); setContentView(R.layout.portfolio_activity_stock_list); stockSummaryFragment = new StockSummaryFragment(); stockPortfolioListFragment = new StockPortfolioListFragment(); stockPortfolioListFragment.setViewModel(viewModel); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_container_1, stockSummaryFragment) .replace(R.id.fragment_container_2, stockPortfolioListFragment) .commit(); ; viewModel.loadSaved(savedInstanceState); viewModel.bind(this); }
Example #28
Source File: AppInjector.java From mcumgr-android with Apache License 2.0 | 6 votes |
private static void handleActivity(@NonNull final Activity activity) { if (activity instanceof Injectable || activity instanceof HasAndroidInjector) { AndroidInjection.inject(activity); } if (activity instanceof FragmentActivity) { ((AppCompatActivity) activity).getSupportFragmentManager() .registerFragmentLifecycleCallbacks( new FragmentManager.FragmentLifecycleCallbacks() { @Override public void onFragmentPreCreated(@NonNull final FragmentManager fm, @NonNull final Fragment f, final Bundle savedInstanceState) { if (f instanceof Injectable) { AndroidSupportInjection.inject(f); } } }, true); } }
Example #29
Source File: TransferDetailsScreen.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { loadArgs(); AndroidInjection.inject(this); super.onCreate(savedInstanceState); if (savedInstanceState == null) { presenter.initParams(transferId, currencyAbbr); } ButterKnife.bind(this); initTitle(); id.setText(transferId); explorerGroup.setOnClickListener(v -> presenter.showExplorerClicked()); explorerTextView.setPaintFlags(explorerTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); chatGroup.setOnClickListener(v -> presenter.chatClicked()); chatTextView.setPaintFlags(explorerTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); amountGroup.setOnClickListener(v -> presenter.amountGroupClicked()); statusGroup.setOnClickListener(v -> presenter.statusGroupClicked()); dateGroup.setOnClickListener(v -> presenter.dateGroupClicked()); confirmationsGroup.setOnClickListener(v -> presenter.confirmationsClicked()); feeGroup.setOnClickListener(v -> presenter.feeGroupClicked()); fromGroup.setOnClickListener(v -> presenter.fromGroupClicked()); toGroup.setOnClickListener(v -> presenter.toGroupClicked()); idGroup.setOnClickListener(v -> presenter.idGroupClicked()); }
Example #30
Source File: NodesListScreen.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); setTitle(R.string.activity_nodes_list_title); LinearLayoutManager layoutManager = new LinearLayoutManager(this); nodeListView.setLayoutManager(layoutManager); Drawable drawable = ContextCompat.getDrawable(nodeListView.getContext(), R.drawable.line_divider); if (drawable != null) { IgnoreLastDividerItemDecorator dividerItemDecoration = new IgnoreLastDividerItemDecorator(drawable); nodeListView.addItemDecoration(dividerItemDecoration); } nodeListView.setAdapter(nodeAdapter); newNodeAddressView.setOnFocusChangeListener( (edittextView, isFocused) -> { if (!isFocused){ hideKeyboard(); } }); resetButtonView.setPaintFlags(resetButtonView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); }