Fix resolution issue
This commit is contained in:
parent
0d310ff856
commit
005fe00dd2
|
@ -57,6 +57,7 @@ import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -1633,16 +1634,19 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
|
|
||||||
if( intent == null )
|
if( intent == null )
|
||||||
return;
|
return;
|
||||||
|
Log.v(Helper.TAG,"intent: " + intent);
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
String type = intent.getType();
|
String type = intent.getType();
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
String userIdIntent;
|
String userIdIntent;
|
||||||
|
Log.v(Helper.TAG,"action: " + action);
|
||||||
|
Log.v(Helper.TAG,"type: " + type);
|
||||||
|
Log.v(Helper.TAG,"extras: " + extras);
|
||||||
if( extras != null && extras.containsKey(INTENT_ACTION) ){
|
if( extras != null && extras.containsKey(INTENT_ACTION) ){
|
||||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
userIdIntent = extras.getString(PREF_KEY_ID); //Id of the account in the intent
|
userIdIntent = extras.getString(PREF_KEY_ID); //Id of the account in the intent
|
||||||
if (extras.getInt(INTENT_ACTION) == NOTIFICATION_INTENT){
|
if (extras.getInt(INTENT_ACTION) == NOTIFICATION_INTENT){
|
||||||
changeUser(BaseMainActivity.this, userIdIntent, false); //Connects the account which is related to the notification
|
changeUser(BaseMainActivity.this, userIdIntent, true); //Connects the account which is related to the notification
|
||||||
unCheckAllMenuItems(navigationView);
|
unCheckAllMenuItems(navigationView);
|
||||||
if( tabLayout.getTabAt(1) != null)
|
if( tabLayout.getTabAt(1) != null)
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
|
@ -1673,7 +1677,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
tabLayout.setVisibility(View.GONE);
|
tabLayout.setVisibility(View.GONE);
|
||||||
toolbarTitle.setText(instance);
|
toolbarTitle.setText(instance);
|
||||||
}else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){
|
}else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){
|
||||||
changeUser(BaseMainActivity.this, userIdIntent, true); //Connects the account which is related to the notification
|
changeUser(BaseMainActivity.this, userIdIntent, false); //Connects the account which is related to the notification
|
||||||
}else if( extras.getInt(INTENT_ACTION) == BACK_TO_SETTINGS){
|
}else if( extras.getInt(INTENT_ACTION) == BACK_TO_SETTINGS){
|
||||||
unCheckAllMenuItems(navigationView);
|
unCheckAllMenuItems(navigationView);
|
||||||
navigationView.setCheckedItem(R.id.nav_settings);
|
navigationView.setCheckedItem(R.id.nav_settings);
|
||||||
|
@ -1845,8 +1849,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
updateNotifCounter();
|
updateNotifCounter();
|
||||||
updateHomeCounter();
|
updateHomeCounter();
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId);
|
|
||||||
|
|
||||||
//Proceeds to update of the authenticated account
|
//Proceeds to update of the authenticated account
|
||||||
if(Helper.isLoggedIn(getApplicationContext())) {
|
if(Helper.isLoggedIn(getApplicationContext())) {
|
||||||
|
@ -1864,58 +1866,60 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
@Override
|
@Override
|
||||||
public void onStart(){
|
public void onStart(){
|
||||||
super.onStart();
|
super.onStart();
|
||||||
if( receive_federated_data != null)
|
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_federated_data);
|
if (receive_federated_data != null)
|
||||||
receive_federated_data = new BroadcastReceiver() {
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_federated_data);
|
||||||
@Override
|
receive_federated_data = new BroadcastReceiver() {
|
||||||
public void onReceive(Context context, Intent intent) {
|
@Override
|
||||||
Bundle b = intent.getExtras();
|
public void onReceive(Context context, Intent intent) {
|
||||||
assert b != null;
|
Bundle b = intent.getExtras();
|
||||||
userIdService = b.getString("userIdService", null);
|
assert b != null;
|
||||||
if( userIdService != null && userIdService.equals(userId)) {
|
userIdService = b.getString("userIdService", null);
|
||||||
Status status = b.getParcelable("data");
|
if (userIdService != null && userIdService.equals(userId)) {
|
||||||
if (federatedFragment != null) {
|
Status status = b.getParcelable("data");
|
||||||
federatedFragment.refresh(status);
|
if (federatedFragment != null) {
|
||||||
|
federatedFragment.refresh(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
if (receive_home_data != null)
|
||||||
};
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_home_data);
|
||||||
if( receive_home_data != null)
|
receive_home_data = new BroadcastReceiver() {
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_home_data);
|
@Override
|
||||||
receive_home_data = new BroadcastReceiver() {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@Override
|
Bundle b = intent.getExtras();
|
||||||
public void onReceive(Context context, Intent intent) {
|
assert b != null;
|
||||||
Bundle b = intent.getExtras();
|
userIdService = b.getString("userIdService", null);
|
||||||
assert b != null;
|
if (userIdService != null && userIdService.equals(userId)) {
|
||||||
userIdService = b.getString("userIdService", null);
|
Status status = b.getParcelable("data");
|
||||||
if( userIdService != null && userIdService.equals(userId)) {
|
if (homeFragment != null) {
|
||||||
Status status = b.getParcelable("data");
|
homeFragment.refresh(status);
|
||||||
if (homeFragment != null) {
|
}
|
||||||
homeFragment.refresh(status);
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
if (receive_local_data != null)
|
||||||
};
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_local_data);
|
||||||
if( receive_local_data != null)
|
receive_local_data = new BroadcastReceiver() {
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_local_data);
|
@Override
|
||||||
receive_local_data = new BroadcastReceiver() {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@Override
|
Bundle b = intent.getExtras();
|
||||||
public void onReceive(Context context, Intent intent) {
|
assert b != null;
|
||||||
Bundle b = intent.getExtras();
|
userIdService = b.getString("userIdService", null);
|
||||||
assert b != null;
|
if (userIdService != null && userIdService.equals(userId)) {
|
||||||
userIdService = b.getString("userIdService", null);
|
Status status = b.getParcelable("data");
|
||||||
if( userIdService != null && userIdService.equals(userId)) {
|
if (localFragment != null) {
|
||||||
Status status = b.getParcelable("data");
|
localFragment.refresh(status);
|
||||||
if (localFragment != null) {
|
}
|
||||||
localFragment.refresh(status);
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_home_data, new IntentFilter(Helper.RECEIVE_HOME_DATA));
|
LocalBroadcastManager.getInstance(this).registerReceiver(receive_home_data, new IntentFilter(Helper.RECEIVE_HOME_DATA));
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_federated_data, new IntentFilter(Helper.RECEIVE_FEDERATED_DATA));
|
LocalBroadcastManager.getInstance(this).registerReceiver(receive_federated_data, new IntentFilter(Helper.RECEIVE_FEDERATED_DATA));
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_local_data, new IntentFilter(Helper.RECEIVE_LOCAL_DATA));
|
LocalBroadcastManager.getInstance(this).registerReceiver(receive_local_data, new IntentFilter(Helper.RECEIVE_LOCAL_DATA));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,6 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private AppCompatImageView fullScreenIcon;
|
private AppCompatImageView fullScreenIcon;
|
||||||
private TextView resolution;
|
private TextView resolution;
|
||||||
private DefaultTrackSelector trackSelector;
|
private DefaultTrackSelector trackSelector;
|
||||||
private WebView webview_video;
|
|
||||||
private int mode;
|
private int mode;
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +173,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
peertube_description = findViewById(R.id.peertube_description);
|
peertube_description = findViewById(R.id.peertube_description);
|
||||||
peertube_title = findViewById(R.id.peertube_title);
|
peertube_title = findViewById(R.id.peertube_title);
|
||||||
peertube_information_container = findViewById(R.id.peertube_information_container);
|
peertube_information_container = findViewById(R.id.peertube_information_container);
|
||||||
webview_video = findViewById(R.id.webview_video);
|
WebView webview_video = findViewById(R.id.webview_video);
|
||||||
playerView = findViewById(R.id.media_video);
|
playerView = findViewById(R.id.media_video);
|
||||||
|
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
|
@ -215,7 +214,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
FrameLayout webview_container = findViewById(R.id.main_media_frame);
|
FrameLayout webview_container = findViewById(R.id.main_media_frame);
|
||||||
final ViewGroup videoLayout = findViewById(R.id.videoLayout);
|
final ViewGroup videoLayout = findViewById(R.id.videoLayout);
|
||||||
|
|
||||||
MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(PeertubeActivity.this, webview_video, webview_container, videoLayout);
|
MastalabWebChromeClient mastalabWebChromeClient = new MastalabWebChromeClient(PeertubeActivity.this, webview_video, webview_container, videoLayout);
|
||||||
mastalabWebChromeClient.setOnToggledFullscreen(new MastalabWebChromeClient.ToggledFullscreenCallback() {
|
mastalabWebChromeClient.setOnToggledFullscreen(new MastalabWebChromeClient.ToggledFullscreenCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void toggledFullscreen(boolean fullscreen) {
|
public void toggledFullscreen(boolean fullscreen) {
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ public class Helper {
|
||||||
menuAccountsOpened = false;
|
menuAccountsOpened = false;
|
||||||
String userId = account.getId();
|
String userId = account.getId();
|
||||||
Toasty.info(activity, activity.getString(R.string.toast_account_changed, "@" + account.getAcct() + "@" + account.getInstance()), Toast.LENGTH_LONG).show();
|
Toasty.info(activity, activity.getString(R.string.toast_account_changed, "@" + account.getAcct() + "@" + account.getInstance()), Toast.LENGTH_LONG).show();
|
||||||
changeUser(activity, userId, true);
|
changeUser(activity, userId, false);
|
||||||
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1279,7 +1279,7 @@ public class Helper {
|
||||||
* @param activity Activity
|
* @param activity Activity
|
||||||
* @param userID String - the new user id
|
* @param userID String - the new user id
|
||||||
*/
|
*/
|
||||||
public static void changeUser(Activity activity, String userID, boolean checkItem) {
|
public static void changeUser(Activity activity, String userID, boolean notificationIntent) {
|
||||||
|
|
||||||
|
|
||||||
final NavigationView navigationView = activity.findViewById(R.id.nav_view);
|
final NavigationView navigationView = activity.findViewById(R.id.nav_view);
|
||||||
|
@ -1315,6 +1315,8 @@ public class Helper {
|
||||||
editor.commit();
|
editor.commit();
|
||||||
Intent changeAccount = new Intent(activity, MainActivity.class);
|
Intent changeAccount = new Intent(activity, MainActivity.class);
|
||||||
changeAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
changeAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
if( notificationIntent)
|
||||||
|
changeAccount.putExtra(INTENT_ACTION, NOTIFICATION_INTENT);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
activity.startActivity(changeAccount);
|
activity.startActivity(changeAccount);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue