use of com.owncloud.android.datamodel.ExternalLinksProvider in project android by nextcloud.
the class DrawerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mIsAccountChooserActive = savedInstanceState.getBoolean(KEY_IS_ACCOUNT_CHOOSER_ACTIVE, false);
mCheckedMenuItem = savedInstanceState.getInt(KEY_CHECKED_MENU_ITEM, Menu.NONE);
}
mCurrentAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.nav_drawer_header_avatar_radius);
mOtherAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.nav_drawer_header_avatar_other_accounts_radius);
mMenuAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.nav_drawer_menu_avatar_radius);
externalLinksProvider = new ExternalLinksProvider(getContentResolver());
arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
}
use of com.owncloud.android.datamodel.ExternalLinksProvider in project android by nextcloud.
the class Preferences method loadExternalSettingLinks.
private void loadExternalSettingLinks(PreferenceCategory preferenceCategory) {
if (getBaseContext().getResources().getBoolean(R.bool.show_external_links)) {
ExternalLinksProvider externalLinksProvider = new ExternalLinksProvider(getContentResolver());
for (final ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.SETTINGS)) {
// only add if it does not exist, in case activity is re-used
if (findPreference(link.id.toString()) == null) {
Preference p = new Preference(this);
p.setTitle(link.name);
p.setKey(link.id.toString());
p.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent externalWebViewIntent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, link.name);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, link.url);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, link.id);
startActivity(externalWebViewIntent);
return true;
}
});
preferenceCategory.addPreference(p);
}
}
}
}
Aggregations