use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class ManageReposActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
((FDroidApp) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.repo_list_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final ListView repoList = (ListView) findViewById(R.id.list);
repoAdapter = RepoAdapter.create(this, null, CursorAdapterCompat.FLAG_AUTO_REQUERY);
repoAdapter.setEnabledListener(this);
repoList.setAdapter(repoAdapter);
repoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Repo repo = new Repo((Cursor) repoList.getItemAtPosition(position));
editRepo(repo);
}
});
}
use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.
the class RepoDetailsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
((FDroidApp) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.repodetails);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
repoView = findViewById(R.id.repoView);
repoId = getIntent().getLongExtra(ARG_REPO_ID, 0);
final String[] projection = { RepoTable.Cols.NAME, RepoTable.Cols.ADDRESS, RepoTable.Cols.FINGERPRINT, RepoTable.Cols.MIRRORS, RepoTable.Cols.USER_MIRRORS };
repo = RepoProvider.Helper.findById(this, repoId, projection);
TextView inputUrl = (TextView) findViewById(R.id.input_repo_url);
inputUrl.setText(repo.address);
if (repo.address.startsWith("content://")) {
// no need to show a QR Code, it is not shareable
return;
}
Uri uri = Uri.parse(repo.address);
uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build();
String qrUriString = uri.toString();
new QrGenAsyncTask(this, R.id.qr_code).execute(qrUriString);
}
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.applyTheme(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);
if (Build.VERSION.SDK_INT >= 11) {
// 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) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_list);
searchInput = (EditText) findViewById(R.id.search);
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 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
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);
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_last_updated_black);
} else {
sortImage.setImageResource(R.drawable.ic_last_updated_white);
}
sortImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (sortClauseSelected.equalsIgnoreCase(SortClause.LAST_UPDATED)) {
sortClauseSelected = SortClause.NAME;
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_az_black);
} else {
sortImage.setImageResource(R.drawable.ic_az_white);
}
} else {
sortClauseSelected = SortClause.LAST_UPDATED;
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_last_updated_black);
} else {
sortImage.setImageResource(R.drawable.ic_last_updated_white);
}
}
getSupportLoaderManager().restartLoader(0, null, AppListActivity.this);
appView.scrollToPosition(0);
}
});
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("");
}
});
appAdapter = new AppListAdapter(this);
appView = (RecyclerView) findViewById(R.id.app_list);
appView.setHasFixedSize(true);
appView.setLayoutManager(new LinearLayoutManager(this));
appView.setAdapter(appAdapter);
appView.addOnScrollListener(new RecyclerView.OnScrollListener() {
private final ImageLoader imageLoader = ImageLoader.getInstance();
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch(newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
imageLoader.pause();
break;
case RecyclerView.SCROLL_STATE_IDLE:
imageLoader.resume();
break;
}
super.onScrollStateChanged(recyclerView, newState);
}
});
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) getApplication()).applyTheme(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);
}
updatesBadge = new BadgeItem().hide(false);
bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
bottomNavigation.setTabSelectedListener(this).setBarBackgroundColor(getBottomNavigationBackgroundColorResId()).setInActiveColor(R.color.bottom_nav_items).setActiveColor(android.R.color.white).setMode(BottomNavigationBar.MODE_FIXED).addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps)).addItem(new BottomNavigationItem(R.drawable.ic_categories, R.string.main_menu__categories)).addItem(new BottomNavigationItem(R.drawable.ic_nearby, R.string.main_menu__swap_nearby)).addItem(new BottomNavigationItem(R.drawable.ic_updates, R.string.updates).setBadgeItem(updatesBadge)).addItem(new BottomNavigationItem(R.drawable.ic_settings, R.string.menu_settings)).initialise();
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);
if (savedInstanceState != null) {
selectedMenuId = savedInstanceState.getInt(STATE_SELECTED_MENU_ID, R.id.whats_new);
}
setSelectedMenuInNav();
initialRepoUpdateIfRequired();
Intent intent = getIntent();
handleSearchOrAppViewIntent(intent);
}
Aggregations