use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class AppDetailsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
FDroidApp fdroidApp = (FDroidApp) getApplication();
fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.app_details2);
MaterialToolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// clear title
getSupportActionBar().setDisplayShowTitleEnabled(false);
supportPostponeEnterTransition();
String packageName = getPackageNameFromIntent(getIntent());
if (!resetCurrentApp(packageName)) {
finish();
return;
}
bluetoothAdapter = getBluetoothAdapter();
localBroadcastManager = LocalBroadcastManager.getInstance(this);
recyclerView = (RecyclerView) findViewById(R.id.rvDetails);
adapter = new AppDetailsRecyclerViewAdapter(this, app, this);
LinearLayoutManager lm = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
lm.setStackFromEnd(false);
// Has to be invoked after AppDetailsRecyclerViewAdapter is created.
refreshStatus();
recyclerView.setLayoutManager(lm);
recyclerView.setAdapter(adapter);
recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
supportStartPostponedEnterTransition();
return true;
}
});
// Load the feature graphic, if present
final FeatureImage featureImage = (FeatureImage) findViewById(R.id.feature_graphic);
RequestOptions displayImageOptions = new RequestOptions();
String featureGraphicUrl = app.getFeatureGraphicUrl(this);
featureImage.loadImageAndDisplay(displayImageOptions, featureGraphicUrl, app.getIconUrl(this));
}
use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class ScreenShotsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
FDroidApp fdroidApp = (FDroidApp) getApplication();
fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screenshots);
String packageName = getIntent().getStringExtra(EXTRA_PACKAGE_NAME);
int startPosition = getIntent().getIntExtra(EXTRA_START_POSITION, 0);
App app = AppProvider.Helper.findHighestPriorityMetadata(getContentResolver(), packageName);
String[] screenshots = app.getAllScreenshots(this);
ViewPager viewPager = (ViewPager) findViewById(R.id.screenshot_view_pager);
ScreenShotPagerAdapter adapter = new ScreenShotPagerAdapter(getSupportFragmentManager(), screenshots);
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(startPosition);
// display some nice animation while swiping
viewPager.setPageTransformer(true, new DepthPageTransformer());
}
use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class AppListActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
FDroidApp fdroidApp = (FDroidApp) getApplication();
fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_list);
keyboardStateMonitor = new Utils.KeyboardStateMonitor(findViewById(R.id.app_list_root));
savedSearchSettings = getSavedSearchSettings(this);
searchTerms = savedSearchSettings.getString(SEARCH_TERMS_KEY, null);
sortClauseSelected = savedSearchSettings.getString(SORT_CLAUSE_KEY, SortClause.LAST_UPDATED);
searchInput = (EditText) findViewById(R.id.search);
searchInput.setText(searchTerms);
searchInput.addTextChangedListener(new CategoryTextWatcher(this, searchInput, this));
searchInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// Hide the keyboard (http://stackoverflow.com/a/1109108 (when pressing search)
InputMethodManager inputManager = ContextCompat.getSystemService(AppListActivity.this, InputMethodManager.class);
inputManager.hideSoftInputFromWindow(searchInput.getWindowToken(), 0);
// Change focus from the search input to the app list.
appView.requestFocus();
return true;
}
return false;
}
});
sortImage = (ImageView) findViewById(R.id.sort);
final Drawable lastUpdated = DrawableCompat.wrap(ContextCompat.getDrawable(this, R.drawable.ic_last_updated)).mutate();
final Drawable words = DrawableCompat.wrap(ContextCompat.getDrawable(AppListActivity.this, R.drawable.ic_sort)).mutate();
sortImage.setImageDrawable(SortClause.WORDS.equals(sortClauseSelected) ? words : lastUpdated);
sortImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
switch(sortClauseSelected) {
case SortClause.WORDS:
sortClauseSelected = SortClause.LAST_UPDATED;
DrawableCompat.setTint(lastUpdated, FDroidApp.isAppThemeLight() ? Color.BLACK : Color.WHITE);
sortImage.setImageDrawable(lastUpdated);
break;
case SortClause.LAST_UPDATED:
sortClauseSelected = SortClause.WORDS;
DrawableCompat.setTint(words, FDroidApp.isAppThemeLight() ? Color.BLACK : Color.WHITE);
sortImage.setImageDrawable(words);
break;
}
putSavedSearchSettings(getApplicationContext(), SORT_CLAUSE_KEY, sortClauseSelected);
getSupportLoaderManager().restartLoader(0, null, AppListActivity.this);
appView.scrollToPosition(0);
}
});
hiddenAppNotice = findViewById(R.id.hiddenAppNotice);
hiddenAppNotice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.putExtra(MainActivity.EXTRA_VIEW_SETTINGS, true);
getApplicationContext().startActivity(intent);
}
});
emptyState = (TextView) findViewById(R.id.empty_state);
View backButton = findViewById(R.id.back);
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
View clearButton = findViewById(R.id.clear);
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchInput.setText("");
searchInput.requestFocus();
if (!keyboardStateMonitor.isKeyboardVisible()) {
InputMethodManager inputMethodManager = ContextCompat.getSystemService(AppListActivity.this, InputMethodManager.class);
inputMethodManager.toggleSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
}
});
appAdapter = new AppListAdapter(this);
appView = (RecyclerView) findViewById(R.id.app_list);
appView.setHasFixedSize(true);
appView.setLayoutManager(new LinearLayoutManager(this));
appView.setAdapter(appAdapter);
parseIntentForSearchQuery();
}
use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class MainActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
FDroidApp fdroidApp = (FDroidApp) getApplication();
fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adapter = new MainViewAdapter(this);
pager = (RecyclerView) findViewById(R.id.main_view_pager);
pager.setHasFixedSize(true);
pager.setLayoutManager(new NonScrollingHorizontalLayoutManager(this));
pager.setAdapter(adapter);
// reverting back to the "Latest" screen again, in completely non-deterministic ways.
if (Build.VERSION.SDK_INT <= 15) {
pager.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
}
bottomNavigation = (BottomNavigationView) findViewById(R.id.bottom_navigation);
bottomNavigation.setOnNavigationItemSelectedListener(item -> {
pager.scrollToPosition(item.getOrder());
if (item.getItemId() == R.id.nearby) {
NearbyViewBinder.updateUsbOtg(MainActivity.this);
}
return true;
});
updatesBadge = bottomNavigation.getOrCreateBadge(R.id.updates);
updatesBadge.setVisible(false);
IntentFilter updateableAppsFilter = new IntentFilter(AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED);
updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED);
updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED);
LocalBroadcastManager.getInstance(this).registerReceiver(onUpdateableAppsChanged, updateableAppsFilter);
initialRepoUpdateIfRequired();
Intent intent = getIntent();
handleSearchOrAppViewIntent(intent);
}
use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class PanicPreferencesActivity method onCreate.
@Override
public void onCreate(Bundle bundle) {
FDroidApp fdroidApp = (FDroidApp) getApplication();
fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
super.onCreate(bundle);
setContentView(R.layout.activity_panic_settings);
MaterialToolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Aggregations