use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishesFragment method onEnterSelectionMode.
public void onEnterSelectionMode() {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
activity.startSupportActionMode(this);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class Lbryio method newInstall.
public static void newInstall(Context context) {
String appVersion = "";
if (context != null) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
appVersion = info.versionName;
} catch (PackageManager.NameNotFoundException ex) {
}
}
Map<String, String> options = new HashMap<>();
if (context instanceof MainActivity) {
String firebaseToken = ((MainActivity) context).getFirebaseMessagingToken();
if (!Helper.isNullOrEmpty(firebaseToken)) {
options.put("firebase_token", firebaseToken);
}
}
options.put("app_version", appVersion);
options.put("app_id", Lbry.INSTALLATION_ID);
options.put("node_id", "");
options.put("operating_system", "android");
options.put("platform", String.format("Android %s (API %d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
options.put("domain", "odysee.com");
try {
JSONObject response = (JSONObject) parseResponse(call("install", "new", options, Helper.METHOD_POST, context));
} catch (LbryioRequestException | LbryioResponseException | ClassCastException ex) {
// pass
Log.e(TAG, String.format("install/new failed: %s", ex.getMessage()), ex);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFragment method loadGalleryItems.
private void loadGalleryItems() {
Context context = getContext();
Helper.setViewVisibility(noVideosLoaded, View.GONE);
LoadGalleryItemsTask task = new LoadGalleryItemsTask(loading, context, new LoadGalleryItemsTask.LoadGalleryHandler() {
@Override
public void onItemLoaded(GalleryItem item) {
if (context != null) {
if (adapter == null) {
adapter = new GalleryGridAdapter(Arrays.asList(item), context);
adapter.setListener(new GalleryGridAdapter.GalleryItemClickListener() {
@Override
public void onGalleryItemClicked(GalleryItem item) {
Context context = getContext();
if (context instanceof MainActivity) {
Map<String, Object> params = new HashMap<>();
params.put("galleryItem", item);
params.put("suggestedUrl", getSuggestedPublishUrl());
// ((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
}
}
});
} else {
adapter.addItem(item);
}
if (galleryGrid.getAdapter() == null) {
galleryGrid.setAdapter(adapter);
}
Helper.setViewVisibility(loading, adapter == null || adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
}
}
@Override
public void onAllItemsLoaded(List<GalleryItem> items) {
if (context != null) {
if (adapter == null) {
adapter = new GalleryGridAdapter(items, context);
} else {
adapter.addItems(items);
}
if (galleryGrid.getAdapter() == null) {
galleryGrid.setAdapter(adapter);
}
}
checkNoVideosLoaded();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFragment method launchFilePicker.
private void launchFilePicker() {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity.startingFilePickerActivity = true;
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("*/*");
((MainActivity) context).startActivityForResult(Intent.createChooser(intent, getString(R.string.upload_file)), MainActivity.REQUEST_FILE_PICKER);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFragment method takePhoto.
private void takePhoto() {
Context context = getContext();
if (context instanceof MainActivity) {
takePhotoPending = false;
((MainActivity) context).requestTakePhoto();
}
}
Aggregations