|
|
@ -119,12 +119,12 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
|
|
|
|
|
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
|
|
|
|
|
|
|
|
FloatingActionButton floatingBtn = findViewById(R.id.floating_btn); |
|
|
|
composeButton = findViewById(R.id.floating_btn); |
|
|
|
ImageButton drawerToggle = findViewById(R.id.drawer_toggle); |
|
|
|
ImageButton drawerToggle = findViewById(R.id.drawer_toggle); |
|
|
|
TabLayout tabLayout = findViewById(R.id.tab_layout); |
|
|
|
TabLayout tabLayout = findViewById(R.id.tab_layout); |
|
|
|
viewPager = findViewById(R.id.pager); |
|
|
|
viewPager = findViewById(R.id.pager); |
|
|
|
|
|
|
|
|
|
|
|
floatingBtn.setOnClickListener(v -> { |
|
|
|
composeButton.setOnClickListener(v -> { |
|
|
|
Intent composeIntent = new Intent(getApplicationContext(), ComposeActivity.class); |
|
|
|
Intent composeIntent = new Intent(getApplicationContext(), ComposeActivity.class); |
|
|
|
startActivity(composeIntent); |
|
|
|
startActivity(composeIntent); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -211,7 +211,6 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
disablePushNotifications(); |
|
|
|
disablePushNotifications(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
composeButton = floatingBtn; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -255,7 +254,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
case KeyEvent.KEYCODE_SEARCH: { |
|
|
|
case KeyEvent.KEYCODE_SEARCH: { |
|
|
|
startActivity(new Intent(this, SearchActivity.class)); |
|
|
|
startActivityWithSlideInAnimation(new Intent(this, SearchActivity.class)); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -331,38 +330,38 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
|
|
|
|
|
|
|
|
if (drawerItemIdentifier == DRAWER_ITEM_EDIT_PROFILE) { |
|
|
|
if (drawerItemIdentifier == DRAWER_ITEM_EDIT_PROFILE) { |
|
|
|
Intent intent = new Intent(MainActivity.this, EditProfileActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, EditProfileActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_FAVOURITES) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_FAVOURITES) { |
|
|
|
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_MUTED_USERS) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_MUTED_USERS) { |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.MUTES); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.MUTES); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_BLOCKED_USERS) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_BLOCKED_USERS) { |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.BLOCKS); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.BLOCKS); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_SEARCH) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_SEARCH) { |
|
|
|
Intent intent = new Intent(MainActivity.this, SearchActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, SearchActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_PREFERENCES) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_PREFERENCES) { |
|
|
|
Intent intent = new Intent(MainActivity.this, PreferencesActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, PreferencesActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_ABOUT) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_ABOUT) { |
|
|
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_LOG_OUT) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_LOG_OUT) { |
|
|
|
logout(); |
|
|
|
logout(); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_FOLLOW_REQUESTS) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_FOLLOW_REQUESTS) { |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, AccountListActivity.class); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.FOLLOW_REQUESTS); |
|
|
|
intent.putExtra("type", AccountListActivity.Type.FOLLOW_REQUESTS); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_SAVED_TOOT) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_SAVED_TOOT) { |
|
|
|
Intent intent = new Intent(MainActivity.this, SavedTootActivity.class); |
|
|
|
Intent intent = new Intent(MainActivity.this, SavedTootActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_LISTS) { |
|
|
|
} else if (drawerItemIdentifier == DRAWER_ITEM_LISTS) { |
|
|
|
startActivity(ListsActivity.newIntent(this)); |
|
|
|
startActivityWithSlideInAnimation(ListsActivity.newIntent(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -390,12 +389,12 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
//open profile when active image was clicked
|
|
|
|
//open profile when active image was clicked
|
|
|
|
if (current && activeAccount != null) { |
|
|
|
if (current && activeAccount != null) { |
|
|
|
Intent intent = AccountActivity.getIntent(this, activeAccount.getAccountId()); |
|
|
|
Intent intent = AccountActivity.getIntent(this, activeAccount.getAccountId()); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
//open LoginActivity to add new account
|
|
|
|
//open LoginActivity to add new account
|
|
|
|
if (profile.getIdentifier() == DRAWER_ITEM_ADD_ACCOUNT) { |
|
|
|
if (profile.getIdentifier() == DRAWER_ITEM_ADD_ACCOUNT) { |
|
|
|
startActivity(LoginActivity.getIntent(this, true)); |
|
|
|
startActivityWithSlideInAnimation(LoginActivity.getIntent(this, true)); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
//change Account
|
|
|
|
//change Account
|
|
|
@ -409,8 +408,8 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(this, MainActivity.class); |
|
|
|
Intent intent = new Intent(this, MainActivity.class); |
|
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
|
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
finish(); |
|
|
|
finishWithSlideOutAnimation(); |
|
|
|
|
|
|
|
|
|
|
|
overridePendingTransition(R.anim.explode, R.anim.explode); |
|
|
|
overridePendingTransition(R.anim.explode, R.anim.explode); |
|
|
|
} |
|
|
|
} |
|
|
@ -439,8 +438,8 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
intent = new Intent(MainActivity.this, MainActivity.class); |
|
|
|
intent = new Intent(MainActivity.this, MainActivity.class); |
|
|
|
} |
|
|
|
} |
|
|
|
startActivity(intent); |
|
|
|
startActivityWithSlideInAnimation(intent); |
|
|
|
finish(); |
|
|
|
finishWithSlideOutAnimation(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.setNegativeButton(android.R.string.no, null) |
|
|
|
.setNegativeButton(android.R.string.no, null) |
|
|
|
.show(); |
|
|
|
.show(); |
|
|
|