mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Last fixes
This commit is contained in:
@ -101,7 +101,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!BuildConfig.full_instances) {
|
if (!BuildConfig.full_instances) {
|
||||||
binding.loginUid.setOnFocusChangeListener((v, hasFocus) -> {
|
binding.loginUid.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
|
@ -83,20 +83,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public static int PICK_INSTANCE = 5641;
|
public static int PICK_INSTANCE = 5641;
|
||||||
public static int PICK_INSTANCE_SURF = 5642;
|
public static int PICK_INSTANCE_SURF = 5642;
|
||||||
|
public static UserMe userMe;
|
||||||
final FragmentManager fm = getSupportFragmentManager();
|
final FragmentManager fm = getSupportFragmentManager();
|
||||||
Fragment active;
|
Fragment active;
|
||||||
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||||
private DisplayOverviewFragment overviewFragment;
|
private DisplayOverviewFragment overviewFragment;
|
||||||
public static UserMe userMe;
|
|
||||||
|
|
||||||
public enum TypeOfConnection{
|
|
||||||
UNKNOWN,
|
|
||||||
NORMAL,
|
|
||||||
SURFING
|
|
||||||
}
|
|
||||||
|
|
||||||
private TypeOfConnection typeOfConnection;
|
|
||||||
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
DisplayVideosFragment displayVideosFragment = null;
|
DisplayVideosFragment displayVideosFragment = null;
|
||||||
@ -130,7 +121,66 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private TypeOfConnection typeOfConnection;
|
||||||
|
|
||||||
|
@SuppressLint("ApplySharedPref")
|
||||||
|
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
||||||
|
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
|
||||||
|
alt_bld.setTitle(R.string.instance_choice);
|
||||||
|
String instance = Helper.getLiveInstance(activity);
|
||||||
|
final EditText input = new EditText(activity);
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
input.setLayoutParams(lp);
|
||||||
|
alt_bld.setView(input);
|
||||||
|
input.setText(instance);
|
||||||
|
alt_bld.setPositiveButton(R.string.validate,
|
||||||
|
(dialog, which) -> new Thread(() -> {
|
||||||
|
try {
|
||||||
|
String newInstance = input.getText().toString().trim();
|
||||||
|
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
|
||||||
|
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
||||||
|
editor.commit();
|
||||||
|
if (storeInDb) {
|
||||||
|
newInstance = newInstance.trim().toLowerCase();
|
||||||
|
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
Helper.logoutNoRemoval(activity);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
Intent intent = new Intent(activity, MainActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activity.runOnUiThread(() -> Toasty.error(activity, activity.getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}).start());
|
||||||
|
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
|
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
|
||||||
|
Intent intent = new Intent(activity, InstancePickerActivity.class);
|
||||||
|
if (storeInDb) {
|
||||||
|
activity.startActivityForResult(intent, PICK_INSTANCE_SURF);
|
||||||
|
} else {
|
||||||
|
activity.startActivityForResult(intent, PICK_INSTANCE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = alt_bld.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void setTitleCustom(int titleRId) {
|
private void setTitleCustom(int titleRId) {
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
@ -290,7 +340,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}}).start();
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu);
|
navView.inflateMenu(R.menu.bottom_nav_menu);
|
||||||
@ -590,68 +641,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
alert.show();
|
alert.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
|
||||||
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
|
||||||
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
|
|
||||||
alt_bld.setTitle(R.string.instance_choice);
|
|
||||||
String instance = Helper.getLiveInstance(activity);
|
|
||||||
final EditText input = new EditText(activity);
|
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT);
|
|
||||||
input.setLayoutParams(lp);
|
|
||||||
alt_bld.setView(input);
|
|
||||||
input.setText(instance);
|
|
||||||
alt_bld.setPositiveButton(R.string.validate,
|
|
||||||
(dialog, which) -> new Thread(() -> {
|
|
||||||
try {
|
|
||||||
String newInstance = input.getText().toString().trim();
|
|
||||||
WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
|
|
||||||
if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.PREF_INSTANCE, newInstance);
|
|
||||||
editor.commit();
|
|
||||||
if( storeInDb) {
|
|
||||||
newInstance = newInstance.trim().toLowerCase();
|
|
||||||
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
|
|
||||||
activity.runOnUiThread(() -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
Helper.logoutNoRemoval(activity);
|
|
||||||
});
|
|
||||||
}else {
|
|
||||||
activity.runOnUiThread(() -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
Intent intent = new Intent(activity, MainActivity.class);
|
|
||||||
activity.startActivity(intent);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
activity.runOnUiThread(() -> Toasty.error(activity, activity.getString(R.string.not_valide_instance), Toast.LENGTH_LONG).show());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}).start());
|
|
||||||
alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
||||||
alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
|
|
||||||
Intent intent = new Intent(activity, InstancePickerActivity.class);
|
|
||||||
if(storeInDb) {
|
|
||||||
activity.startActivityForResult(intent, PICK_INSTANCE_SURF);
|
|
||||||
}else{
|
|
||||||
activity.startActivityForResult(intent, PICK_INSTANCE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AlertDialog alert = alt_bld.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
@ -664,15 +653,13 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
editor.commit();
|
editor.commit();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}else if (requestCode == PICK_INSTANCE_SURF && resultCode == Activity.RESULT_OK) {
|
}
|
||||||
if (data != null && data.getData() != null) {
|
}
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
||||||
editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData()));
|
|
||||||
editor.commit();
|
|
||||||
|
|
||||||
finish();
|
|
||||||
}
|
public enum TypeOfConnection {
|
||||||
}
|
UNKNOWN,
|
||||||
|
NORMAL,
|
||||||
|
SURFING
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,20 +17,26 @@ package app.fedilab.fedilabtube;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
|
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
|
||||||
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
|
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
||||||
@ -40,6 +46,8 @@ import static app.fedilab.fedilabtube.MainActivity.showRadioButtonDialogFullInst
|
|||||||
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
||||||
|
|
||||||
private ActivityManageInstancesBinding binding;
|
private ActivityManageInstancesBinding binding;
|
||||||
|
private List<InstanceData.AboutInstance> aboutInstances;
|
||||||
|
private AboutInstanceAdapter aboutInstanceAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -55,7 +63,13 @@ public class ManageInstancesActivity extends AppCompatActivity implements AboutI
|
|||||||
binding.noAction.setVisibility(View.GONE);
|
binding.noAction.setVisibility(View.GONE);
|
||||||
binding.lvInstances.setVisibility(View.GONE);
|
binding.lvInstances.setVisibility(View.GONE);
|
||||||
binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this, true));
|
binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this, true));
|
||||||
|
aboutInstances = new ArrayList<>();
|
||||||
|
aboutInstanceAdapter = new AboutInstanceAdapter(this.aboutInstances);
|
||||||
|
aboutInstanceAdapter.allInstancesRemoved = this;
|
||||||
|
binding.lvInstances.setAdapter(aboutInstanceAdapter);
|
||||||
|
LinearLayoutManager layoutManager
|
||||||
|
= new LinearLayoutManager(ManageInstancesActivity.this);
|
||||||
|
binding.lvInstances.setLayoutManager(layoutManager);
|
||||||
InfoInstanceVM viewModelInfoInstance = new ViewModelProvider(ManageInstancesActivity.this).get(InfoInstanceVM.class);
|
InfoInstanceVM viewModelInfoInstance = new ViewModelProvider(ManageInstancesActivity.this).get(InfoInstanceVM.class);
|
||||||
viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
|
viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
|
||||||
}
|
}
|
||||||
@ -69,6 +83,8 @@ public class ManageInstancesActivity extends AppCompatActivity implements AboutI
|
|||||||
}
|
}
|
||||||
binding.noAction.setVisibility(View.GONE);
|
binding.noAction.setVisibility(View.GONE);
|
||||||
binding.lvInstances.setVisibility(View.VISIBLE);
|
binding.lvInstances.setVisibility(View.VISIBLE);
|
||||||
|
this.aboutInstances.addAll(aboutInstances);
|
||||||
|
aboutInstanceAdapter.notifyItemRangeInserted(0, aboutInstances.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +93,7 @@ public class ManageInstancesActivity extends AppCompatActivity implements AboutI
|
|||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
@ -94,7 +111,13 @@ public class ManageInstancesActivity extends AppCompatActivity implements AboutI
|
|||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode == PICK_INSTANCE_SURF && resultCode == Activity.RESULT_OK) {
|
if (requestCode == PICK_INSTANCE_SURF && resultCode == Activity.RESULT_OK) {
|
||||||
if (data != null && data.getData() != null) {
|
if (data != null && data.getData() != null) {
|
||||||
Helper.logoutNoRemoval(ManageInstancesActivity.this);
|
new Thread(() -> {
|
||||||
|
String newInstance = data.getData().toString().trim().toLowerCase();
|
||||||
|
InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(ManageInstancesActivity.this, newInstance, null).getAboutInstance();
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
new StoredInstanceDAO(ManageInstancesActivity.this, db).insertInstance(aboutInstance, newInstance);
|
||||||
|
runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(ManageInstancesActivity.this)));
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ package app.fedilab.fedilabtube;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -59,8 +60,8 @@ import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
|||||||
|
|
||||||
public class MyAccountActivity extends AppCompatActivity {
|
public class MyAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
ActivityMyAccountSettingsBinding binding;
|
|
||||||
private static final int PICK_IMAGE = 466;
|
private static final int PICK_IMAGE = 466;
|
||||||
|
ActivityMyAccountSettingsBinding binding;
|
||||||
private Uri inputData;
|
private Uri inputData;
|
||||||
private String fileName;
|
private String fileName;
|
||||||
private NotificationSettings notificationSettings;
|
private NotificationSettings notificationSettings;
|
||||||
|
@ -152,6 +152,7 @@ import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_
|
|||||||
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener {
|
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener {
|
||||||
|
|
||||||
public static String video_id;
|
public static String video_id;
|
||||||
|
public static List<String> playedVideos = new ArrayList<>();
|
||||||
private String peertubeInstance, videoUuid;
|
private String peertubeInstance, videoUuid;
|
||||||
private FullScreenMediaController.fullscreen fullscreen;
|
private FullScreenMediaController.fullscreen fullscreen;
|
||||||
private ImageView fullScreenIcon;
|
private ImageView fullScreenIcon;
|
||||||
@ -175,10 +176,19 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
private List<Comment> commentsThread;
|
private List<Comment> commentsThread;
|
||||||
private BroadcastReceiver mPowerKeyReceiver = null;
|
private BroadcastReceiver mPowerKeyReceiver = null;
|
||||||
private boolean isPlayInMinimized;
|
private boolean isPlayInMinimized;
|
||||||
public static List<String> playedVideos = new ArrayList<>();
|
|
||||||
private VideoData.Video nextVideo;
|
private VideoData.Video nextVideo;
|
||||||
private TorrentStream torrentStream;
|
private TorrentStream torrentStream;
|
||||||
private String show_more_content;
|
private String show_more_content;
|
||||||
|
private videoOrientation videoOrientationType;
|
||||||
|
|
||||||
|
public static void hideKeyboard(Activity activity) {
|
||||||
|
if (activity != null && activity.getWindow() != null) {
|
||||||
|
activity.getWindow().getDecorView();
|
||||||
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
assert imm != null;
|
||||||
|
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||||
@ -213,22 +223,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStreamStopped() {}
|
public void onStreamStopped() {
|
||||||
|
|
||||||
enum videoOrientation {
|
|
||||||
LANDSCAPE,
|
|
||||||
PORTRAIT
|
|
||||||
}
|
|
||||||
|
|
||||||
private videoOrientation videoOrientationType;
|
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
|
||||||
if (activity != null && activity.getWindow() != null) {
|
|
||||||
activity.getWindow().getDecorView();
|
|
||||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(INPUT_METHOD_SERVICE);
|
|
||||||
assert imm != null;
|
|
||||||
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -422,7 +417,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.postCommentButton.setOnClickListener(v -> openPostComment(null, 0));
|
binding.postCommentButton.setOnClickListener(v -> openPostComment(null, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void manageVIewVideos(APIResponse apiResponse) {
|
private void manageVIewVideos(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
playVideo();
|
playVideo();
|
||||||
@ -459,7 +453,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewCommentReply(Comment comment, APIResponse apiResponse) {
|
public void manageVIewCommentReply(Comment comment, APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getCommentThreadData() == null) {
|
||||||
if (apiResponse == null || apiResponse.getError() == null)
|
if (apiResponse == null || apiResponse.getError() == null)
|
||||||
@ -618,7 +611,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
@ -676,7 +668,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
this.fullscreen = fullscreen;
|
this.fullscreen = fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageCaptions(APIResponse apiResponse) {
|
public void manageCaptions(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getCaptions() == null || apiResponse.getCaptions().size() == 0) {
|
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getCaptions() == null || apiResponse.getCaptions().size() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -684,7 +675,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
captions = apiResponse.getCaptions();
|
captions = apiResponse.getCaptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageNextVideos(APIResponse apiResponse) {
|
public void manageNextVideos(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || apiResponse.getError() != null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -713,7 +703,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
player.addMediaItem(mediaItem);
|
player.addMediaItem(mediaItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
public void manageVIewVideo(APIResponse apiResponse) {
|
public void manageVIewVideo(APIResponse apiResponse) {
|
||||||
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || (apiResponse.getError() != null) || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
@ -1072,7 +1061,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
change();
|
change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -1153,7 +1141,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
@Override
|
@Override
|
||||||
public void onUserLeaveHint() {
|
public void onUserLeaveHint() {
|
||||||
@ -1175,7 +1162,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (binding.postComment.getVisibility() == View.VISIBLE) {
|
if (binding.postComment.getVisibility() == View.VISIBLE) {
|
||||||
@ -1191,7 +1177,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
|
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
|
||||||
if (isInPictureInPictureMode) {
|
if (isInPictureInPictureMode) {
|
||||||
@ -1205,7 +1190,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void displayResolution() {
|
public void displayResolution() {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
|
||||||
builderSingle.setTitle(R.string.pickup_resolution);
|
builderSingle.setTitle(R.string.pickup_resolution);
|
||||||
@ -1243,7 +1227,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initFullscreenDialog() {
|
private void initFullscreenDialog() {
|
||||||
|
|
||||||
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
||||||
@ -1272,10 +1255,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
fullScreenDialog.show();
|
fullScreenDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void openCommentThread(Comment comment) {
|
public void openCommentThread(Comment comment) {
|
||||||
|
|
||||||
|
|
||||||
@ -1359,7 +1338,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void openPostComment(Comment comment, int position) {
|
public void openPostComment(Comment comment, int position) {
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
binding.replyContent.setVisibility(View.VISIBLE);
|
binding.replyContent.setVisibility(View.VISIBLE);
|
||||||
@ -1610,7 +1588,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addElement(String playlistId, String videoId, APIResponse apiResponse) {
|
public void addElement(String playlistId, String videoId, APIResponse apiResponse) {
|
||||||
if (apiResponse != null && apiResponse.getActionReturn() != null) {
|
if (apiResponse != null && apiResponse.getActionReturn() != null) {
|
||||||
|
|
||||||
@ -1626,8 +1603,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void updateHistory(long position) {
|
private void updateHistory(long position) {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
boolean storeInHistory = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
boolean storeInHistory = sharedpreferences.getBoolean(getString(R.string.set_store_in_history), true);
|
||||||
@ -1648,8 +1623,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.noActionText.setVisibility(View.VISIBLE);
|
binding.noActionText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void playNextVideo() {
|
private void playNextVideo() {
|
||||||
if (nextVideo != null) {
|
if (nextVideo != null) {
|
||||||
Intent intent = new Intent(PeertubeActivity.this, PeertubeActivity.class);
|
Intent intent = new Intent(PeertubeActivity.this, PeertubeActivity.class);
|
||||||
@ -1664,8 +1637,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaItemTransition(MediaItem mediaItem, int reason) {
|
public void onMediaItemTransition(MediaItem mediaItem, int reason) {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
@ -1676,10 +1647,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(ExoPlaybackException error) {
|
public void onPlayerError(ExoPlaybackException error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum videoOrientation {
|
||||||
|
LANDSCAPE,
|
||||||
|
PORTRAIT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
binding.loginInstanceContainer.setVisibility(View.VISIBLE);
|
||||||
binding.titleLoginInstance.setVisibility(View.VISIBLE);
|
binding.titleLoginInstance.setVisibility(View.VISIBLE);
|
||||||
|
@ -66,8 +66,8 @@ import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHA
|
|||||||
public class PeertubeUploadActivity extends AppCompatActivity {
|
public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
private final int PICK_IVDEO = 52378;
|
|
||||||
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
public static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
||||||
|
private final int PICK_IVDEO = 52378;
|
||||||
private Button set_upload_file, set_upload_submit;
|
private Button set_upload_file, set_upload_submit;
|
||||||
private Spinner set_upload_privacy, set_upload_channel;
|
private Spinner set_upload_privacy, set_upload_channel;
|
||||||
private TextView set_upload_file_name;
|
private TextView set_upload_file_name;
|
||||||
|
@ -68,7 +68,7 @@ public interface PeertubeService {
|
|||||||
|
|
||||||
//Instance info
|
//Instance info
|
||||||
@GET("config/about")
|
@GET("config/about")
|
||||||
Call<InstanceData.AboutInstance> configAbout();
|
Call<InstanceData.InstanceInfo> configAbout();
|
||||||
|
|
||||||
@GET("{nodeInfoPath}")
|
@GET("{nodeInfoPath}")
|
||||||
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path(value = "nodeInfoPath", encoded = true) String nodeInfoPath);
|
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path(value = "nodeInfoPath", encoded = true) String nodeInfoPath);
|
||||||
|
@ -599,16 +599,17 @@ public class RetrofitPeertubeAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* About the instance
|
* About the instance
|
||||||
|
*
|
||||||
* @return AboutInstance
|
* @return AboutInstance
|
||||||
*/
|
*/
|
||||||
public InstanceData.AboutInstance getAboutInstance() {
|
public InstanceData.AboutInstance getAboutInstance() {
|
||||||
|
|
||||||
PeertubeService peertubeService = init();
|
PeertubeService peertubeService = init();
|
||||||
Call<InstanceData.AboutInstance> about = peertubeService.configAbout();
|
Call<InstanceData.InstanceInfo> about = peertubeService.configAbout();
|
||||||
try {
|
try {
|
||||||
Response<InstanceData.AboutInstance> response = about.execute();
|
Response<InstanceData.InstanceInfo> response = about.execute();
|
||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
return response.body();
|
return response.body().getInstance();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1058,7 +1059,6 @@ public class RetrofitPeertubeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get video description
|
* Get video description
|
||||||
*
|
*
|
||||||
@ -1073,7 +1073,8 @@ public class RetrofitPeertubeAPI {
|
|||||||
if (response.isSuccessful() && response.body() != null) {
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
return response.body();
|
return response.body();
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,29 +242,21 @@ public class InstanceData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AboutInstance implements Parcelable, Serializable {
|
public static class InstanceInfo {
|
||||||
|
@SerializedName("instance")
|
||||||
|
private AboutInstance instance;
|
||||||
|
|
||||||
@SerializedName("name")
|
public AboutInstance getInstance() {
|
||||||
private String name;
|
return instance;
|
||||||
@SerializedName("shortDescription")
|
|
||||||
private String shortDescription;
|
|
||||||
@SerializedName("description")
|
|
||||||
private String description;
|
|
||||||
@SerializedName("terms")
|
|
||||||
private String terms;
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
|
|
||||||
public AboutInstance(){}
|
|
||||||
|
|
||||||
protected AboutInstance(Parcel in) {
|
|
||||||
name = in.readString();
|
|
||||||
shortDescription = in.readString();
|
|
||||||
description = in.readString();
|
|
||||||
terms = in.readString();
|
|
||||||
host = in.readString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInstance(AboutInstance instance) {
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AboutInstance implements Parcelable, Serializable {
|
||||||
|
|
||||||
public static final Creator<AboutInstance> CREATOR = new Creator<AboutInstance>() {
|
public static final Creator<AboutInstance> CREATOR = new Creator<AboutInstance>() {
|
||||||
@Override
|
@Override
|
||||||
public AboutInstance createFromParcel(Parcel in) {
|
public AboutInstance createFromParcel(Parcel in) {
|
||||||
@ -276,6 +268,26 @@ public class InstanceData {
|
|||||||
return new AboutInstance[size];
|
return new AboutInstance[size];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("shortDescription")
|
||||||
|
private String shortDescription;
|
||||||
|
@SerializedName("description")
|
||||||
|
private String description;
|
||||||
|
@SerializedName("terms")
|
||||||
|
private String terms;
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
public AboutInstance() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AboutInstance(Parcel in) {
|
||||||
|
name = in.readString();
|
||||||
|
shortDescription = in.readString();
|
||||||
|
description = in.readString();
|
||||||
|
terms = in.readString();
|
||||||
|
host = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -9,6 +9,17 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class File implements Parcelable {
|
public class File implements Parcelable {
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<File> CREATOR = new Parcelable.Creator<File>() {
|
||||||
|
@Override
|
||||||
|
public File createFromParcel(Parcel source) {
|
||||||
|
return new File(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File[] newArray(int size) {
|
||||||
|
return new File[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("fileDownloadUrl")
|
@SerializedName("fileDownloadUrl")
|
||||||
private String fileDownloadUrl;
|
private String fileDownloadUrl;
|
||||||
@SerializedName("fileUrl")
|
@SerializedName("fileUrl")
|
||||||
@ -28,6 +39,21 @@ public class File implements Parcelable {
|
|||||||
@SerializedName("torrentUrl")
|
@SerializedName("torrentUrl")
|
||||||
private String torrentUrl;
|
private String torrentUrl;
|
||||||
|
|
||||||
|
public File() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File(Parcel in) {
|
||||||
|
this.fileDownloadUrl = in.readString();
|
||||||
|
this.fileUrl = in.readString();
|
||||||
|
this.fps = in.readInt();
|
||||||
|
this.magnetUri = in.readString();
|
||||||
|
this.metadataUrl = in.readString();
|
||||||
|
this.resolutions = in.readParcelable(Item.class.getClassLoader());
|
||||||
|
this.size = in.readLong();
|
||||||
|
this.torrentDownloadUrl = in.readString();
|
||||||
|
this.torrentUrl = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileDownloadUrl() {
|
public String getFileDownloadUrl() {
|
||||||
return fileDownloadUrl;
|
return fileDownloadUrl;
|
||||||
}
|
}
|
||||||
@ -100,7 +126,6 @@ public class File implements Parcelable {
|
|||||||
this.torrentUrl = torrentUrl;
|
this.torrentUrl = torrentUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -118,31 +143,4 @@ public class File implements Parcelable {
|
|||||||
dest.writeString(this.torrentDownloadUrl);
|
dest.writeString(this.torrentDownloadUrl);
|
||||||
dest.writeString(this.torrentUrl);
|
dest.writeString(this.torrentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public File() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected File(Parcel in) {
|
|
||||||
this.fileDownloadUrl = in.readString();
|
|
||||||
this.fileUrl = in.readString();
|
|
||||||
this.fps = in.readInt();
|
|
||||||
this.magnetUri = in.readString();
|
|
||||||
this.metadataUrl = in.readString();
|
|
||||||
this.resolutions = in.readParcelable(Item.class.getClassLoader());
|
|
||||||
this.size = in.readLong();
|
|
||||||
this.torrentDownloadUrl = in.readString();
|
|
||||||
this.torrentUrl = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<File> CREATOR = new Parcelable.Creator<File>() {
|
|
||||||
@Override
|
|
||||||
public File createFromParcel(Parcel source) {
|
|
||||||
return new File(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File[] newArray(int size) {
|
|
||||||
return new File[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -37,26 +37,14 @@ public class UserSettings {
|
|||||||
return videosHistoryEnabled;
|
return videosHistoryEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVideosHistoryEnabled(Boolean videosHistoryEnabled) {
|
|
||||||
this.videosHistoryEnabled = videosHistoryEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isAutoPlayVideo() {
|
public Boolean isAutoPlayVideo() {
|
||||||
return autoPlayVideo;
|
return autoPlayVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoPlayVideo(Boolean autoPlayVideo) {
|
|
||||||
this.autoPlayVideo = autoPlayVideo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isWebTorrentEnabled() {
|
public Boolean isWebTorrentEnabled() {
|
||||||
return webTorrentEnabled;
|
return webTorrentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWebTorrentEnabled(Boolean webTorrentEnabled) {
|
|
||||||
this.webTorrentEnabled = webTorrentEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getVideoLanguages() {
|
public List<String> getVideoLanguages() {
|
||||||
return videoLanguages;
|
return videoLanguages;
|
||||||
}
|
}
|
||||||
@ -93,26 +81,38 @@ public class UserSettings {
|
|||||||
return videosHistoryEnabled;
|
return videosHistoryEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVideosHistoryEnabled(Boolean videosHistoryEnabled) {
|
||||||
|
this.videosHistoryEnabled = videosHistoryEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getAutoPlayVideo() {
|
public Boolean getAutoPlayVideo() {
|
||||||
return autoPlayVideo;
|
return autoPlayVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAutoPlayVideo(Boolean autoPlayVideo) {
|
||||||
|
this.autoPlayVideo = autoPlayVideo;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getWebTorrentEnabled() {
|
public Boolean getWebTorrentEnabled() {
|
||||||
return webTorrentEnabled;
|
return webTorrentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWebTorrentEnabled(Boolean webTorrentEnabled) {
|
||||||
|
this.webTorrentEnabled = webTorrentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean isAutoPlayNextVideo() {
|
public Boolean isAutoPlayNextVideo() {
|
||||||
return autoPlayNextVideo;
|
return autoPlayNextVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getAutoPlayNextVideo() {
|
||||||
|
return autoPlayNextVideo;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAutoPlayNextVideo(Boolean autoPlayNextVideo) {
|
public void setAutoPlayNextVideo(Boolean autoPlayNextVideo) {
|
||||||
this.autoPlayNextVideo = autoPlayNextVideo;
|
this.autoPlayNextVideo = autoPlayNextVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getAutoPlayNextVideo() {
|
|
||||||
return autoPlayNextVideo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,14 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
@ -35,24 +39,23 @@ import java.util.List;
|
|||||||
|
|
||||||
import app.fedilab.fedilabtube.MainActivity;
|
import app.fedilab.fedilabtube.MainActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
|
||||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||||
import app.fedilab.fedilabtube.databinding.DrawerAboutInstanceBinding;
|
import app.fedilab.fedilabtube.databinding.DrawerAboutInstanceBinding;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
|
||||||
|
|
||||||
public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
private final List<InstanceData.AboutInstance> aboutInstances;
|
private final List<InstanceData.AboutInstance> aboutInstances;
|
||||||
private final AboutInstanceAdapter aboutInstanceAdapter;
|
|
||||||
public AllInstancesRemoved allInstancesRemoved;
|
public AllInstancesRemoved allInstancesRemoved;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public AboutInstanceAdapter(List<InstanceData.AboutInstance> aboutInstances) {
|
public AboutInstanceAdapter(List<InstanceData.AboutInstance> aboutInstances) {
|
||||||
aboutInstanceAdapter = this;
|
|
||||||
this.aboutInstances = aboutInstances;
|
this.aboutInstances = aboutInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +88,17 @@ public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.View
|
|||||||
|
|
||||||
final InstanceData.AboutInstance aboutInstance = aboutInstances.get(i);
|
final InstanceData.AboutInstance aboutInstance = aboutInstances.get(i);
|
||||||
|
|
||||||
holder.binding.aboutInstanceDescription.setText(aboutInstance.getShortDescription());
|
holder.binding.aboutInstanceHost.setText(aboutInstance.getHost());
|
||||||
|
|
||||||
|
SpannableString spannableString;
|
||||||
|
if (aboutInstance.getShortDescription() != null) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(aboutInstance.getShortDescription(), FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(aboutInstance.getShortDescription()));
|
||||||
|
holder.binding.aboutInstanceDescription.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||||
|
}
|
||||||
|
|
||||||
holder.binding.aboutInstanceName.setText(aboutInstance.getName());
|
holder.binding.aboutInstanceName.setText(aboutInstance.getName());
|
||||||
holder.binding.playlistContainer.setOnClickListener(v -> {
|
holder.binding.playlistContainer.setOnClickListener(v -> {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
@ -112,8 +125,10 @@ public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.View
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StoredInstanceDAO(context, db).removeInstance(aboutInstance.getHost());
|
new StoredInstanceDAO(context, db).removeInstance(aboutInstance.getHost());
|
||||||
|
aboutInstances.remove(aboutInstance);
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
|
notifyItemRemoved(i);
|
||||||
if (aboutInstances.size() == 0) {
|
if (aboutInstances.size() == 0) {
|
||||||
allInstancesRemoved.onAllInstancesRemoved();
|
allInstancesRemoved.onAllInstancesRemoved();
|
||||||
}
|
}
|
||||||
@ -128,6 +143,7 @@ public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.View
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
popup.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
private final List<Comment> comments;
|
private final List<Comment> comments;
|
||||||
private final CommentListAdapter commentListAdapter;
|
private final CommentListAdapter commentListAdapter;
|
||||||
|
private final boolean isThread;
|
||||||
public AllCommentRemoved allCommentRemoved;
|
public AllCommentRemoved allCommentRemoved;
|
||||||
boolean isVideoOwner;
|
boolean isVideoOwner;
|
||||||
private Context context;
|
private Context context;
|
||||||
private final boolean isThread;
|
|
||||||
|
|
||||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread) {
|
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread) {
|
||||||
this.comments = comments;
|
this.comments = comments;
|
||||||
|
@ -21,21 +21,6 @@ import androidx.preference.PreferenceScreen;
|
|||||||
import androidx.preference.SeekBarPreference;
|
import androidx.preference.SeekBarPreference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
/* Copyright 2020 Thomas Schneider
|
|
||||||
*
|
|
||||||
* This file is a part of TubeLab
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
||||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
||||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
||||||
* Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
@ -60,6 +45,21 @@ import es.dmoral.toasty.Toasty;
|
|||||||
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
||||||
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
||||||
|
|
||||||
|
/* Copyright 2020 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of TubeLab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -282,6 +282,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
my_account.setIcon(resource);
|
my_account.setIcon(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
@ -307,7 +308,6 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//****** Video mode *******
|
//****** Video mode *******
|
||||||
ListPreference set_video_mode_choice = findPreference(getString(R.string.set_video_mode_choice));
|
ListPreference set_video_mode_choice = findPreference(getString(R.string.set_video_mode_choice));
|
||||||
List<String> array = Arrays.asList(getResources().getStringArray(R.array.settings_video_mode));
|
List<String> array = Arrays.asList(getResources().getStringArray(R.array.settings_video_mode));
|
||||||
|
@ -13,6 +13,7 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.data.CommentData;
|
import app.fedilab.fedilabtube.client.data.CommentData;
|
||||||
|
@ -748,6 +748,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Forward the intent (open an URL) to another app
|
* Forward the intent (open an URL) to another app
|
||||||
|
*
|
||||||
* @param activity Activity
|
* @param activity Activity
|
||||||
* @param i Intent
|
* @param i Intent
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,7 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
@ -23,7 +23,6 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.LoginActivity;
|
import app.fedilab.fedilabtube.LoginActivity;
|
||||||
import app.fedilab.fedilabtube.MainActivity;
|
import app.fedilab.fedilabtube.MainActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
|
@ -266,6 +266,7 @@ public class AccountDAO {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the current user is already stored in data base
|
* Test if the current user is already stored in data base
|
||||||
*
|
*
|
||||||
|
@ -59,6 +59,9 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||||||
static final String COL_UUID = "UUID";
|
static final String COL_UUID = "UUID";
|
||||||
static final String COL_CACHE = "CACHE";
|
static final String COL_CACHE = "CACHE";
|
||||||
static final String COL_DATE = "DATE";
|
static final String COL_DATE = "DATE";
|
||||||
|
static final String COL_USER_INSTANCE = "USER_INSTANCE";
|
||||||
|
static final String TABLE_BOOKMARKED_INSTANCES = "BOOKMARKED_INSTANCES";
|
||||||
|
static final String COL_ABOUT = "ABOUT";
|
||||||
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
|
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
|
||||||
+ COL_USER_ID + " TEXT, " + COL_USERNAME + " TEXT NOT NULL, " + COL_ACCT + " TEXT NOT NULL, "
|
+ COL_USER_ID + " TEXT, " + COL_USERNAME + " TEXT NOT NULL, " + COL_ACCT + " TEXT NOT NULL, "
|
||||||
+ COL_DISPLAYED_NAME + " TEXT NOT NULL, " + COL_LOCKED + " INTEGER NOT NULL, "
|
+ COL_DISPLAYED_NAME + " TEXT NOT NULL, " + COL_LOCKED + " INTEGER NOT NULL, "
|
||||||
@ -82,10 +85,6 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||||||
+ COL_INSTANCE + " TEXT NOT NULL, "
|
+ COL_INSTANCE + " TEXT NOT NULL, "
|
||||||
+ COL_CACHE + " TEXT NOT NULL, "
|
+ COL_CACHE + " TEXT NOT NULL, "
|
||||||
+ COL_DATE + " TEXT NOT NULL)";
|
+ COL_DATE + " TEXT NOT NULL)";
|
||||||
|
|
||||||
static final String COL_USER_INSTANCE = "USER_INSTANCE";
|
|
||||||
static final String TABLE_BOOKMARKED_INSTANCES = "BOOKMARKED_INSTANCES";
|
|
||||||
static final String COL_ABOUT = "ABOUT";
|
|
||||||
private final String CREATE_TABLE_STORED_INSTANCES = "CREATE TABLE "
|
private final String CREATE_TABLE_STORED_INSTANCES = "CREATE TABLE "
|
||||||
+ TABLE_BOOKMARKED_INSTANCES + "("
|
+ TABLE_BOOKMARKED_INSTANCES + "("
|
||||||
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
@ -42,36 +42,6 @@ public class StoredInstanceDAO {
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert instance info in database
|
|
||||||
*
|
|
||||||
* @param aboutInstance AboutInstance
|
|
||||||
* @param targetedInstance String
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean insertInstance(InstanceData.AboutInstance aboutInstance, String targetedInstance) {
|
|
||||||
ContentValues values = new ContentValues();
|
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
|
||||||
String instance = Helper.getLiveInstance(context);
|
|
||||||
|
|
||||||
values.put(Sqlite.COL_USER_ID, userId);
|
|
||||||
values.put(Sqlite.COL_USER_INSTANCE, instance);
|
|
||||||
values.put(Sqlite.COL_ABOUT, aboutInstanceToStringStorage(aboutInstance));
|
|
||||||
values.put(Sqlite.COL_INSTANCE, targetedInstance);
|
|
||||||
//Inserts account
|
|
||||||
try {
|
|
||||||
db.insertOrThrow(Sqlite.TABLE_BOOKMARKED_INSTANCES, null, values);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unserialized AboutInstance
|
* Unserialized AboutInstance
|
||||||
*
|
*
|
||||||
@ -102,6 +72,35 @@ public class StoredInstanceDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert instance info in database
|
||||||
|
*
|
||||||
|
* @param aboutInstance AboutInstance
|
||||||
|
* @param targetedInstance String
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean insertInstance(InstanceData.AboutInstance aboutInstance, String targetedInstance) {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
String instance = Helper.getLiveInstance(context);
|
||||||
|
|
||||||
|
values.put(Sqlite.COL_USER_ID, userId != null ? userId : "_ALL_");
|
||||||
|
values.put(Sqlite.COL_USER_INSTANCE, instance != null ? instance : "_ALL_");
|
||||||
|
values.put(Sqlite.COL_ABOUT, aboutInstanceToStringStorage(aboutInstance));
|
||||||
|
values.put(Sqlite.COL_INSTANCE, targetedInstance);
|
||||||
|
//Inserts account
|
||||||
|
try {
|
||||||
|
db.insertOrThrow(Sqlite.TABLE_BOOKMARKED_INSTANCES, null, values);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert instance info in database
|
* Insert instance info in database
|
||||||
*
|
*
|
||||||
@ -129,7 +128,6 @@ public class StoredInstanceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all Instance in db
|
* Returns all Instance in db
|
||||||
*
|
*
|
||||||
@ -147,7 +145,6 @@ public class StoredInstanceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Method to hydrate an Account from database
|
* Method to hydrate an Account from database
|
||||||
* @param c Cursor
|
* @param c Cursor
|
||||||
@ -184,7 +181,9 @@ public class StoredInstanceDAO {
|
|||||||
List<InstanceData.AboutInstance> aboutInstances = new ArrayList<>();
|
List<InstanceData.AboutInstance> aboutInstances = new ArrayList<>();
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
String aboutInstanceStr = c.getString(c.getColumnIndex(Sqlite.COL_ABOUT));
|
String aboutInstanceStr = c.getString(c.getColumnIndex(Sqlite.COL_ABOUT));
|
||||||
|
String instance = c.getString(c.getColumnIndex(Sqlite.COL_INSTANCE));
|
||||||
InstanceData.AboutInstance aboutInstance = restoreAboutInstanceFromString(aboutInstanceStr);
|
InstanceData.AboutInstance aboutInstance = restoreAboutInstanceFromString(aboutInstanceStr);
|
||||||
|
aboutInstance.setHost(instance);
|
||||||
aboutInstances.add(aboutInstance);
|
aboutInstances.add(aboutInstance);
|
||||||
}
|
}
|
||||||
//Close the cursor
|
//Close the cursor
|
||||||
|
@ -37,17 +37,15 @@ import app.fedilab.fedilabtube.R;
|
|||||||
|
|
||||||
public class MastalabWebChromeClient extends WebChromeClient implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
|
public class MastalabWebChromeClient extends WebChromeClient implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
|
||||||
|
|
||||||
private FrameLayout videoViewContainer;
|
|
||||||
private CustomViewCallback videoViewCallback;
|
|
||||||
|
|
||||||
private ToggledFullscreenCallback toggledFullscreenCallback;
|
|
||||||
|
|
||||||
private final CustomWebview webView;
|
private final CustomWebview webView;
|
||||||
private final View activityNonVideoView;
|
private final View activityNonVideoView;
|
||||||
private final ViewGroup activityVideoView;
|
private final ViewGroup activityVideoView;
|
||||||
private final ProgressBar pbar;
|
private final ProgressBar pbar;
|
||||||
private boolean isVideoFullscreen;
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
private FrameLayout videoViewContainer;
|
||||||
|
private CustomViewCallback videoViewCallback;
|
||||||
|
private ToggledFullscreenCallback toggledFullscreenCallback;
|
||||||
|
private boolean isVideoFullscreen;
|
||||||
|
|
||||||
|
|
||||||
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
||||||
@ -113,7 +111,6 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||||||
public void onShowCustomView(View view, CustomViewCallback callback) {
|
public void onShowCustomView(View view, CustomViewCallback callback) {
|
||||||
if (view instanceof FrameLayout) {
|
if (view instanceof FrameLayout) {
|
||||||
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
||||||
//noinspection ConstantConditions
|
|
||||||
((AppCompatActivity) activity).getSupportActionBar().hide();
|
((AppCompatActivity) activity).getSupportActionBar().hide();
|
||||||
// A video wants to be shown
|
// A video wants to be shown
|
||||||
FrameLayout frameLayout = (FrameLayout) view;
|
FrameLayout frameLayout = (FrameLayout) view;
|
||||||
@ -178,7 +175,6 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||||||
@Override
|
@Override
|
||||||
public void onHideCustomView() {
|
public void onHideCustomView() {
|
||||||
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
if (((AppCompatActivity) activity).getSupportActionBar() != null)
|
||||||
//noinspection ConstantConditions
|
|
||||||
((AppCompatActivity) activity).getSupportActionBar().show();
|
((AppCompatActivity) activity).getSupportActionBar().show();
|
||||||
// This method should be manually called on video end in all cases because it's not always called automatically.
|
// This method should be manually called on video end in all cases because it's not always called automatically.
|
||||||
// This method must be manually called on back key press (from this class' onBackPressed() method).
|
// This method must be manually called on back key press (from this class' onBackPressed() method).
|
||||||
|
@ -61,9 +61,9 @@ import static android.content.Context.NOTIFICATION_SERVICE;
|
|||||||
|
|
||||||
public class NotificationsWorker extends Worker {
|
public class NotificationsWorker extends Worker {
|
||||||
|
|
||||||
private final NotificationManager notificationManager;
|
|
||||||
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
||||||
public static int pendingNotificationID = 1;
|
public static int pendingNotificationID = 1;
|
||||||
|
private final NotificationManager notificationManager;
|
||||||
|
|
||||||
public NotificationsWorker(
|
public NotificationsWorker(
|
||||||
@NonNull Context context,
|
@NonNull Context context,
|
||||||
|
@ -13,7 +13,9 @@ package app.fedilab.fedilabtube.worker;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
import androidx.work.BackoffPolicy;
|
import androidx.work.BackoffPolicy;
|
||||||
import androidx.work.Constraints;
|
import androidx.work.Constraints;
|
||||||
import androidx.work.ExistingPeriodicWorkPolicy;
|
import androidx.work.ExistingPeriodicWorkPolicy;
|
||||||
|
@ -32,21 +32,34 @@
|
|||||||
android:layout_marginBottom="5dp">
|
android:layout_marginBottom="5dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/about_instance_name"
|
android:id="@+id/about_instance_host"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:textSize="18sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:id="@+id/about_instance_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/about_instance_host" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/about_instance_description"
|
android:id="@+id/about_instance_description"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
app:layout_constraintEnd_toStartOf="@+id/instance_more"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/about_instance_name" />
|
app:layout_constraintTop_toBottomOf="@+id/about_instance_name" />
|
||||||
|
Reference in New Issue
Block a user