mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-07-08 21:00:29 +03:00
Remove registration for Google flavor
This commit is contained in:
parent
2d38090964
commit
8b42c6d2b6
2 changed files with 22 additions and 18 deletions
|
@ -52,21 +52,21 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
|
||||||
public static List<ChromeCast> chromeCasts;
|
public static List<ChromeCast> chromeCasts;
|
||||||
public static ChromeCast chromeCast;
|
public static ChromeCast chromeCast;
|
||||||
public static boolean chromecastActivated = false;
|
public static boolean chromecastActivated = false;
|
||||||
protected ActivityMainPeertubeBinding binding;
|
protected ActivityMainPeertubeBinding parentBinding;
|
||||||
private BroadcastReceiver manage_chromecast;
|
private BroadcastReceiver manage_chromecast;
|
||||||
private VideoData.Video castedTube;
|
private VideoData.Video castedTube;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityMainPeertubeBinding.inflate(getLayoutInflater());
|
parentBinding = ActivityMainPeertubeBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = parentBinding.getRoot();
|
||||||
setContentView(view);
|
setContentView(view);
|
||||||
ChromeCastsListener chromeCastsListener = this;
|
ChromeCastsListener chromeCastsListener = this;
|
||||||
ChromeCasts.registerListener(chromeCastsListener);
|
ChromeCasts.registerListener(chromeCastsListener);
|
||||||
|
|
||||||
|
|
||||||
binding.castClose.setOnClickListener(v -> {
|
parentBinding.castClose.setOnClickListener(v -> {
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putInt("displayed", 0);
|
b.putInt("displayed", 0);
|
||||||
|
@ -75,12 +75,12 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
|
||||||
sendBroadcast(intentBC);
|
sendBroadcast(intentBC);
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.castTogglePlay.setOnClickListener(v -> {
|
parentBinding.castTogglePlay.setOnClickListener(v -> {
|
||||||
if (chromeCast != null) {
|
if (chromeCast != null) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> binding.castTogglePlay.setVisibility(View.GONE);
|
Runnable myRunnable = () -> parentBinding.castTogglePlay.setVisibility(View.GONE);
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
int icon = -1;
|
int icon = -1;
|
||||||
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||||
|
@ -92,10 +92,10 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
|
||||||
}
|
}
|
||||||
if (icon != -1) {
|
if (icon != -1) {
|
||||||
int finalIcon = icon;
|
int finalIcon = icon;
|
||||||
myRunnable = () -> binding.castTogglePlay.setImageResource(finalIcon);
|
myRunnable = () -> parentBinding.castTogglePlay.setImageResource(finalIcon);
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
}
|
}
|
||||||
myRunnable = () -> binding.castTogglePlay.setVisibility(View.VISIBLE);
|
myRunnable = () -> parentBinding.castTogglePlay.setVisibility(View.VISIBLE);
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -131,14 +131,14 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
|
||||||
if (displayed == 1) {
|
if (displayed == 1) {
|
||||||
chromecastActivated = true;
|
chromecastActivated = true;
|
||||||
if (castedTube != null) {
|
if (castedTube != null) {
|
||||||
binding.castInfo.setVisibility(View.VISIBLE);
|
parentBinding.castInfo.setVisibility(View.VISIBLE);
|
||||||
Helper.loadGiF(PeertubeBaseMainActivity.this, castedTube.getThumbnailPath(), binding.castView);
|
Helper.loadGiF(PeertubeBaseMainActivity.this, castedTube.getThumbnailPath(), parentBinding.castView);
|
||||||
binding.castTitle.setText(castedTube.getTitle());
|
parentBinding.castTitle.setText(castedTube.getTitle());
|
||||||
binding.castDescription.setText(castedTube.getDescription());
|
parentBinding.castDescription.setText(castedTube.getDescription());
|
||||||
}
|
}
|
||||||
} else if (displayed == 0) {
|
} else if (displayed == 0) {
|
||||||
chromecastActivated = false;
|
chromecastActivated = false;
|
||||||
binding.castInfo.setVisibility(View.GONE);
|
parentBinding.castInfo.setVisibility(View.GONE);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
if (chromeCast != null) {
|
if (chromeCast != null) {
|
||||||
|
@ -173,8 +173,8 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
||||||
if (binding.castInfo.getVisibility() == View.GONE) {
|
if (parentBinding.castInfo.getVisibility() == View.GONE) {
|
||||||
binding.castInfo.setVisibility(View.VISIBLE);
|
parentBinding.castInfo.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
|
import app.fedilab.android.BuildConfig;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.FragmentLoginMainBinding;
|
import app.fedilab.android.databinding.FragmentLoginMainBinding;
|
||||||
import app.fedilab.android.mastodon.activities.ProxyActivity;
|
import app.fedilab.android.mastodon.activities.ProxyActivity;
|
||||||
|
@ -149,19 +150,22 @@ public class FragmentLoginMain extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (BuildConfig.FLAVOR.compareTo("playstore") == 0) {
|
||||||
|
binding.noAccountA.setVisibility(View.INVISIBLE);
|
||||||
|
binding.noAccountQ.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
binding.noAccountA.setOnClickListener(v -> Helper.addFragment(
|
binding.noAccountA.setOnClickListener(v -> Helper.addFragment(
|
||||||
getParentFragmentManager(), android.R.id.content, new FragmentLoginJoin(),
|
getParentFragmentManager(), android.R.id.content, new FragmentLoginJoin(),
|
||||||
null, null, FragmentLoginJoin.class.getName()));
|
null, null, FragmentLoginJoin.class.getName()));
|
||||||
|
|
||||||
binding.continueButton.setOnClickListener(v -> {
|
binding.continueButton.setOnClickListener(v -> {
|
||||||
if (binding.loginInstance.getText() == null || binding.loginInstance.getText().toString().length() == 0) {
|
if (binding.loginInstance.getText() == null || binding.loginInstance.getText().toString().isEmpty()) {
|
||||||
binding.loginInstanceLayout.setError(getString(R.string.toast_error_instance));
|
binding.loginInstanceLayout.setError(getString(R.string.toast_error_instance));
|
||||||
binding.loginInstanceLayout.setErrorEnabled(true);
|
binding.loginInstanceLayout.setErrorEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentInstanceLogin = binding.loginInstance.getText().toString().trim().toLowerCase();
|
currentInstanceLogin = binding.loginInstance.getText().toString().trim().toLowerCase();
|
||||||
if (currentInstanceLogin.length() == 0) {
|
if (currentInstanceLogin.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
binding.continueButton.setEnabled(false);
|
binding.continueButton.setEnabled(false);
|
||||||
|
|
Loading…
Reference in a new issue