Improves navigation with tabs in top bar
18
README.md
|
@ -5,17 +5,22 @@ The number of libraries is minimized and it does not use tracking tools. The sou
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
**Multi-accounts management**
|
**Multi-accounts management**
|
||||||
|
|
||||||
* Add accounts from different instances
|
* Add accounts from different instances
|
||||||
* Switch from one account to another by a simple click
|
* Switch from one account to another by a simple click
|
||||||
|
|
||||||
|
|
||||||
**Timelines**
|
**Timelines**
|
||||||
|
|
||||||
* Federated / Local / Home
|
* Federated / Local / Home
|
||||||
* Switch from one timeline to another by using the menu or by swiping the screen.
|
* Switch from one timeline to another by using the menu or by swiping the screen.
|
||||||
* Clicks on toots display the related conversations (context)
|
* Clicks on toots display the related conversations (context)
|
||||||
* Clicks on mentioned accounts display details about these accounts
|
* Clicks on mentioned accounts display details about these accounts
|
||||||
* Clicks on hashtags display toots containing this hashtags
|
* Clicks on hashtags display toots containing this hashtags
|
||||||
|
|
||||||
|
|
||||||
**Actions on toots**
|
**Actions on toots**
|
||||||
|
|
||||||
* Mute an account related to a toot
|
* Mute an account related to a toot
|
||||||
* Block an account related to a toot
|
* Block an account related to a toot
|
||||||
* Report inappropriate toots to administrators
|
* Report inappropriate toots to administrators
|
||||||
|
@ -25,7 +30,9 @@ The number of libraries is minimized and it does not use tracking tools. The sou
|
||||||
* Download media
|
* Download media
|
||||||
* Translation of toots by a simple click (via the Yandex API)
|
* Translation of toots by a simple click (via the Yandex API)
|
||||||
|
|
||||||
|
|
||||||
**Write a toot**
|
**Write a toot**
|
||||||
|
|
||||||
* Add media
|
* Add media
|
||||||
* Change the visibility of the toot
|
* Change the visibility of the toot
|
||||||
* Mention accounts in toots with autocompletion (@ + 2 characters)
|
* Mention accounts in toots with autocompletion (@ + 2 characters)
|
||||||
|
@ -34,27 +41,38 @@ The number of libraries is minimized and it does not use tracking tools. The sou
|
||||||
* Toots which have not been sent are saved (drafts) - can be disabled in settings
|
* Toots which have not been sent are saved (drafts) - can be disabled in settings
|
||||||
* Drafts can be edited/deleted/scheduled
|
* Drafts can be edited/deleted/scheduled
|
||||||
|
|
||||||
|
|
||||||
**Scheduled toots**
|
**Scheduled toots**
|
||||||
|
|
||||||
* Can be edited/deleted/scheduled at another date as long as they have not been sent.
|
* Can be edited/deleted/scheduled at another date as long as they have not been sent.
|
||||||
|
|
||||||
|
|
||||||
**Interaction with accounts**
|
**Interaction with accounts**
|
||||||
|
|
||||||
* Follow/Unfollow/Block/Unblock/Mute/Unmute
|
* Follow/Unfollow/Block/Unblock/Mute/Unmute
|
||||||
* Display details of accounts
|
* Display details of accounts
|
||||||
* Authorize/Reject follow requests (for locked accounts)
|
* Authorize/Reject follow requests (for locked accounts)
|
||||||
|
|
||||||
|
|
||||||
**Searches**
|
**Searches**
|
||||||
* A top bar allows to make researches for accounts/tags/toots
|
* A top bar allows to make researches for accounts/tags/toots
|
||||||
* A click on a tag displays toots containing this tag
|
* A click on a tag displays toots containing this tag
|
||||||
|
|
||||||
|
|
||||||
**Network optimization**
|
**Network optimization**
|
||||||
|
|
||||||
* Load of media: Automatic/WIFI only/Ask
|
* Load of media: Automatic/WIFI only/Ask
|
||||||
* Customization of the number of toots/accounts per load
|
* Customization of the number of toots/accounts per load
|
||||||
|
|
||||||
|
|
||||||
**Notifications**
|
**Notifications**
|
||||||
|
|
||||||
* Notifications for new toots on the home page (could be disabled in settings)
|
* Notifications for new toots on the home page (could be disabled in settings)
|
||||||
* Notifications for new events (could be disabled or filtered in settings)
|
* Notifications for new events (could be disabled or filtered in settings)
|
||||||
|
|
||||||
|
|
||||||
**Built-in browser**
|
**Built-in browser**
|
||||||
|
|
||||||
* Full screen videos
|
* Full screen videos
|
||||||
* Disable JavaScript (default: enabled)
|
* Disable JavaScript (default: enabled)
|
||||||
* Disable third-party cookies (default: disabled)
|
* Disable third-party cookies (default: disabled)
|
||||||
|
|
|
@ -29,6 +29,7 @@ import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
|
@ -54,6 +55,7 @@ import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoByIDAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoByIDAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
|
@ -76,6 +78,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
|
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.NOTIFICATION_INTENT;
|
import static fr.gouv.etalab.mastodon.helper.Helper.NOTIFICATION_INTENT;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.PREF_KEY_ID;
|
import static fr.gouv.etalab.mastodon.helper.Helper.PREF_KEY_ID;
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeUser;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeUser;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.menuAccounts;
|
import static fr.gouv.etalab.mastodon.helper.Helper.menuAccounts;
|
||||||
|
@ -99,6 +102,10 @@ public class MainActivity extends AppCompatActivity
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private ViewPager viewPager;
|
private ViewPager viewPager;
|
||||||
private RelativeLayout main_app_container;
|
private RelativeLayout main_app_container;
|
||||||
|
private Stack<Integer> stackBack = new Stack<>();
|
||||||
|
|
||||||
|
public MainActivity() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -106,7 +113,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
|
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
if( theme == Helper.THEME_LIGHT){
|
if( theme == Helper.THEME_LIGHT){
|
||||||
setTheme(R.style.AppTheme_NoActionBar);
|
setTheme(R.style.AppTheme_NoActionBar);
|
||||||
}else {
|
}else {
|
||||||
|
@ -122,6 +129,17 @@ public class MainActivity extends AppCompatActivity
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if( theme == Helper.THEME_DARK){
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_home_tl,R.color.dark_text);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_users_tl,R.color.dark_text);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_globe_tl,R.color.dark_text);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_notifications_tl,R.color.dark_text);
|
||||||
|
}else {
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_home_tl,R.color.black);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_users_tl,R.color.black);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_globe_tl,R.color.black);
|
||||||
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_notifications_tl,R.color.black);
|
||||||
|
}
|
||||||
Helper.fillMapEmoji(getApplicationContext());
|
Helper.fillMapEmoji(getApplicationContext());
|
||||||
//Here, the user is authenticated
|
//Here, the user is authenticated
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
@ -139,6 +157,14 @@ public class MainActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelected(TabLayout.Tab tab) {
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
viewPager.setCurrentItem(tab.getPosition());
|
viewPager.setCurrentItem(tab.getPosition());
|
||||||
|
if (stackBack.empty())
|
||||||
|
stackBack.push(0);
|
||||||
|
if (stackBack.contains(tab.getPosition())) {
|
||||||
|
stackBack.remove(stackBack.indexOf(tab.getPosition()));
|
||||||
|
stackBack.push(tab.getPosition());
|
||||||
|
} else {
|
||||||
|
stackBack.push(tab.getPosition());
|
||||||
|
}
|
||||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||||
MenuItem item = null;
|
MenuItem item = null;
|
||||||
String fragmentTag = null;
|
String fragmentTag = null;
|
||||||
|
@ -169,6 +195,10 @@ public class MainActivity extends AppCompatActivity
|
||||||
unCheckAllMenuItems(navigationView.getMenu());
|
unCheckAllMenuItems(navigationView.getMenu());
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
}
|
}
|
||||||
|
if( tab.getPosition() < 3 )
|
||||||
|
toot.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
toot.setVisibility(View.GONE);
|
||||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
drawer.closeDrawer(GravityCompat.START);
|
drawer.closeDrawer(GravityCompat.START);
|
||||||
}
|
}
|
||||||
|
@ -180,6 +210,17 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabReselected(TabLayout.Tab tab) {
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
if( viewPager.getVisibility() == View.GONE){
|
||||||
|
viewPager.setVisibility(View.VISIBLE);
|
||||||
|
tabLayout.setVisibility(View.VISIBLE);
|
||||||
|
main_app_container.setVisibility(View.GONE);
|
||||||
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
drawer.closeDrawer(GravityCompat.START);
|
||||||
|
}
|
||||||
|
if( tab.getPosition() <3 )
|
||||||
|
toot.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
toot.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -188,7 +229,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
toolbar_search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
toolbar_search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
toot.setVisibility(View.VISIBLE);
|
|
||||||
//Hide keyboard
|
//Hide keyboard
|
||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(toolbar_search.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(toolbar_search.getWindowToken(), 0);
|
||||||
|
@ -203,24 +243,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Hide/Close the searchview
|
//Hide/Close the searchview
|
||||||
/*toolbar_search.setOnSearchClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if( toolbarTitle.getVisibility() == View.VISIBLE)
|
|
||||||
toolbarTitle.setVisibility(View.GONE);
|
|
||||||
if( pp_actionBar.getVisibility() == View.VISIBLE)
|
|
||||||
pp_actionBar.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
toolbar_search.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
|
||||||
if( hasFocus){
|
|
||||||
toolbarTitle.setVisibility(View.GONE);
|
|
||||||
pp_actionBar.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolbar_search.setOnCloseListener(new SearchView.OnCloseListener() {
|
toolbar_search.setOnCloseListener(new SearchView.OnCloseListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClose() {
|
public boolean onClose() {
|
||||||
|
@ -230,6 +254,18 @@ public class MainActivity extends AppCompatActivity
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
toolbar_search.setOnSearchClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if( toolbar_search.isIconified()){
|
||||||
|
toolbarTitle.setVisibility(View.VISIBLE);
|
||||||
|
pp_actionBar.setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
toolbarTitle.setVisibility(View.GONE);
|
||||||
|
pp_actionBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//Hide the default title
|
//Hide the default title
|
||||||
if( getSupportActionBar() != null)
|
if( getSupportActionBar() != null)
|
||||||
|
@ -296,44 +332,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
if (savedInstanceState == null && !matchingIntent) {
|
if (savedInstanceState == null && !matchingIntent) {
|
||||||
navigationView.setCheckedItem(R.id.nav_home);
|
navigationView.setCheckedItem(R.id.nav_home);
|
||||||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||||
|
toolbarTitle.setText(R.string.home_menu);
|
||||||
}
|
}
|
||||||
//Title and menu selection when back pressed
|
|
||||||
getSupportFragmentManager().addOnBackStackChangedListener(
|
|
||||||
new FragmentManager.OnBackStackChangedListener() {
|
|
||||||
public void onBackStackChanged() {
|
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
|
||||||
if( fm != null && fm.getBackStackEntryCount() > 0) {
|
|
||||||
String fragmentTag = fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName();
|
|
||||||
if( fragmentTag != null) {
|
|
||||||
|
|
||||||
if( tagTile.get(fragmentTag) != null)
|
|
||||||
toolbarTitle.setText(tagTile.get(fragmentTag));
|
|
||||||
if( tagItem.get(fragmentTag) != null) {
|
|
||||||
unCheckAllMenuItems(navigationView.getMenu());
|
|
||||||
if( navigationView.getMenu().findItem(tagItem.get(fragmentTag)) != null)
|
|
||||||
navigationView.getMenu().findItem(tagItem.get(fragmentTag)).setChecked(true);
|
|
||||||
}
|
|
||||||
if( fragmentTag.equals("HOME_TIMELINE") || fragmentTag.equals("LOCAL_TIMELINE") || fragmentTag.equals("PUBLIC_TIMELINE") || fragmentTag.equals("NOTIFICATIONS")){
|
|
||||||
main_app_container.setVisibility(View.GONE);
|
|
||||||
viewPager.setVisibility(View.VISIBLE);
|
|
||||||
tabLayout.setVisibility(View.VISIBLE);
|
|
||||||
}else {
|
|
||||||
main_app_container.setVisibility(View.VISIBLE);
|
|
||||||
viewPager.setVisibility(View.GONE);
|
|
||||||
tabLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//selectTabBar(fragmentTag);
|
|
||||||
if( fragmentTag.equals("HOME_TIMELINE") || fragmentTag.equals("LOCAL_TIMELINE") || fragmentTag.equals("PUBLIC_TIMELINE") || fragmentTag.equals("SCHEDULED")){
|
|
||||||
toot.setVisibility(View.VISIBLE);
|
|
||||||
}else {
|
|
||||||
toot.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unCheckAllMenuItems(@NonNull final Menu menu) {
|
private void unCheckAllMenuItems(@NonNull final Menu menu) {
|
||||||
|
@ -422,7 +422,40 @@ public class MainActivity extends AppCompatActivity
|
||||||
if( !toolbar_search.isIconified()){
|
if( !toolbar_search.isIconified()){
|
||||||
toolbar_search.setIconified(true);
|
toolbar_search.setIconified(true);
|
||||||
}
|
}
|
||||||
super.onBackPressed();
|
if( viewPager.getVisibility() == View.VISIBLE){
|
||||||
|
if (stackBack.size() > 1) {
|
||||||
|
stackBack.pop();
|
||||||
|
viewPager.setCurrentItem(stackBack.lastElement());
|
||||||
|
}else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
viewPager.setVisibility(View.VISIBLE);
|
||||||
|
tabLayout.setVisibility(View.VISIBLE);
|
||||||
|
main_app_container.setVisibility(View.GONE);
|
||||||
|
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||||
|
unCheckAllMenuItems(navigationView.getMenu());
|
||||||
|
toot.setVisibility(View.VISIBLE);
|
||||||
|
switch (viewPager.getCurrentItem()){
|
||||||
|
case 0:
|
||||||
|
toolbarTitle.setText(R.string.home_menu);
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
toolbarTitle.setText(R.string.local_menu);
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
toolbarTitle.setText(R.string.global_menu);
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
toolbarTitle.setText(R.string.notifications);
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -549,7 +582,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
||||||
fragmentTag = "TABLAYOUT_SETTINGS";
|
fragmentTag = "TABLAYOUT_SETTINGS";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, tabLayoutSettingsFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, tabLayoutSettingsFragment, fragmentTag).commit();
|
||||||
|
|
||||||
} else if (id == R.id.nav_favorites) {
|
} else if (id == R.id.nav_favorites) {
|
||||||
toot.setVisibility(View.GONE);
|
toot.setVisibility(View.GONE);
|
||||||
|
@ -558,7 +591,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
statusFragment.setArguments(bundle);
|
statusFragment.setArguments(bundle);
|
||||||
fragmentTag = "FAVOURITES";
|
fragmentTag = "FAVOURITES";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_blocked) {
|
} else if (id == R.id.nav_blocked) {
|
||||||
toot.setVisibility(View.GONE);
|
toot.setVisibility(View.GONE);
|
||||||
accountsFragment = new DisplayAccountsFragment();
|
accountsFragment = new DisplayAccountsFragment();
|
||||||
|
@ -566,7 +599,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
accountsFragment.setArguments(bundle);
|
accountsFragment.setArguments(bundle);
|
||||||
fragmentTag = "BLOCKS";
|
fragmentTag = "BLOCKS";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||||
}else if (id == R.id.nav_muted) {
|
}else if (id == R.id.nav_muted) {
|
||||||
toot.setVisibility(View.GONE);
|
toot.setVisibility(View.GONE);
|
||||||
accountsFragment = new DisplayAccountsFragment();
|
accountsFragment = new DisplayAccountsFragment();
|
||||||
|
@ -574,19 +607,19 @@ public class MainActivity extends AppCompatActivity
|
||||||
accountsFragment.setArguments(bundle);
|
accountsFragment.setArguments(bundle);
|
||||||
fragmentTag = "MUTED";
|
fragmentTag = "MUTED";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||||
}else if (id == R.id.nav_scheduled) {
|
}else if (id == R.id.nav_scheduled) {
|
||||||
toot.setVisibility(View.VISIBLE);
|
toot.setVisibility(View.VISIBLE);
|
||||||
DisplayScheduledTootsFragment displayScheduledTootsFragment = new DisplayScheduledTootsFragment();
|
DisplayScheduledTootsFragment displayScheduledTootsFragment = new DisplayScheduledTootsFragment();
|
||||||
fragmentTag = "SCHEDULED";
|
fragmentTag = "SCHEDULED";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, displayScheduledTootsFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, displayScheduledTootsFragment, fragmentTag).commit();
|
||||||
}else if( id == R.id.nav_follow_request){
|
}else if( id == R.id.nav_follow_request){
|
||||||
toot.setVisibility(View.GONE);
|
toot.setVisibility(View.GONE);
|
||||||
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();
|
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();
|
||||||
fragmentTag = "FOLLOW_REQUEST_SENT";
|
fragmentTag = "FOLLOW_REQUEST_SENT";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, followRequestSentFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, followRequestSentFragment, fragmentTag).commit();
|
||||||
}
|
}
|
||||||
//selectTabBar(fragmentTag);
|
//selectTabBar(fragmentTag);
|
||||||
toolbarTitle.setText(item.getTitle());
|
toolbarTitle.setText(item.getTitle());
|
||||||
|
@ -653,27 +686,25 @@ public class MainActivity extends AppCompatActivity
|
||||||
//Selection comes from another menu, no action to do
|
//Selection comes from another menu, no action to do
|
||||||
DisplayStatusFragment statusFragment;
|
DisplayStatusFragment statusFragment;
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
toot.setVisibility(View.VISIBLE);
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0:
|
case 0:
|
||||||
toot.setVisibility(View.VISIBLE);
|
|
||||||
statusFragment = new DisplayStatusFragment();
|
statusFragment = new DisplayStatusFragment();
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.HOME);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.HOME);
|
||||||
statusFragment.setArguments(bundle);
|
statusFragment.setArguments(bundle);
|
||||||
return statusFragment;
|
return statusFragment;
|
||||||
case 1:
|
case 1:
|
||||||
toot.setVisibility(View.VISIBLE);
|
|
||||||
statusFragment = new DisplayStatusFragment();
|
statusFragment = new DisplayStatusFragment();
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
||||||
statusFragment.setArguments(bundle);
|
statusFragment.setArguments(bundle);
|
||||||
return statusFragment;
|
return statusFragment;
|
||||||
case 2:
|
case 2:
|
||||||
toot.setVisibility(View.VISIBLE);
|
|
||||||
statusFragment = new DisplayStatusFragment();
|
statusFragment = new DisplayStatusFragment();
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||||
statusFragment.setArguments(bundle);
|
statusFragment.setArguments(bundle);
|
||||||
return statusFragment;
|
return statusFragment;
|
||||||
case 3:
|
case 3:
|
||||||
toot.setVisibility(View.GONE);
|
|
||||||
return new DisplayNotificationsFragment();
|
return new DisplayNotificationsFragment();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,18 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.speech.RecognizerIntent;
|
import android.speech.RecognizerIntent;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -57,7 +62,9 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||||
|
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||||
|
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -94,6 +101,7 @@ import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||||
|
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 01/05/2017.
|
* Created by Thomas on 01/05/2017.
|
||||||
|
@ -203,6 +211,27 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
}else {
|
}else {
|
||||||
setTitle(R.string.toot_title);
|
setTitle(R.string.toot_title);
|
||||||
}
|
}
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
||||||
|
ImageLoader imageLoader;
|
||||||
|
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||||
|
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||||
|
imageLoader = ImageLoader.getInstance();
|
||||||
|
imageLoader.loadImage(account.getAvatar(), options, new SimpleImageLoadingListener(){
|
||||||
|
@Override
|
||||||
|
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||||
|
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||||
|
if( getSupportActionBar() != null){
|
||||||
|
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(loadedImage, (int) Helper.convertDpToPixel(25, getApplicationContext()), (int) Helper.convertDpToPixel(25, getApplicationContext()), true));
|
||||||
|
getSupportActionBar().setIcon(ppDrawable);
|
||||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onLoadingFailed(java.lang.String imageUri, android.view.View view, FailReason failReason){
|
||||||
|
|
||||||
|
}});
|
||||||
|
|
||||||
if( sharedContent != null ){ //Shared content
|
if( sharedContent != null ){ //Shared content
|
||||||
if( sharedSubject != null){
|
if( sharedSubject != null){
|
||||||
|
@ -238,9 +267,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(search_validate, new IntentFilter(Helper.SEARCH_VALIDATE_ACCOUNT));
|
LocalBroadcastManager.getInstance(this).registerReceiver(search_validate, new IntentFilter(Helper.SEARCH_VALIDATE_ACCOUNT));
|
||||||
|
|
||||||
FloatingActionButton toot_close_accounts = (FloatingActionButton) findViewById(R.id.toot_close_accounts);
|
FloatingActionButton toot_close_accounts = (FloatingActionButton) findViewById(R.id.toot_close_accounts);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
|
||||||
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
|
||||||
boolean isAccountPrivate = account.isLocked();
|
boolean isAccountPrivate = account.isLocked();
|
||||||
|
|
||||||
FloatingActionButton ic_close = (FloatingActionButton) findViewById(R.id.toot_close_reply);
|
FloatingActionButton ic_close = (FloatingActionButton) findViewById(R.id.toot_close_reply);
|
||||||
|
|
|
@ -109,6 +109,7 @@ import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||||
|
import fr.gouv.etalab.mastodon.activities.TootActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.WebviewActivity;
|
import fr.gouv.etalab.mastodon.activities.WebviewActivity;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
|
@ -896,7 +897,7 @@ public class Helper {
|
||||||
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(25, activity), (int) convertDpToPixel(25, activity), true));
|
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(25, activity), (int) convertDpToPixel(25, activity), true));
|
||||||
toolBar.findViewById(R.id.pp_actionBar).setBackgroundDrawable(ppDrawable);
|
toolBar.findViewById(R.id.pp_actionBar).setBackgroundDrawable(ppDrawable);
|
||||||
}else{
|
}else{
|
||||||
ActionBar supportActionBar = ((MainActivity) activity).getSupportActionBar();
|
ActionBar supportActionBar = ((TootActivity) activity).getSupportActionBar();
|
||||||
if( supportActionBar != null){
|
if( supportActionBar != null){
|
||||||
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(20, activity), (int) convertDpToPixel(20, activity), true));
|
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(20, activity), (int) convertDpToPixel(20, activity), true));
|
||||||
supportActionBar.setIcon(ppDrawable);
|
supportActionBar.setIcon(ppDrawable);
|
||||||
|
|
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 486 B |
After Width: | Height: | Size: 829 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 171 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 243 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 416 B |
|
@ -45,7 +45,7 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/pp_actionBar"
|
android:id="@+id/pp_actionBar"
|
||||||
|
@ -74,29 +74,29 @@
|
||||||
<android.support.design.widget.TabLayout
|
<android.support.design.widget.TabLayout
|
||||||
android:id="@+id/tabLayout"
|
android:id="@+id/tabLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="25dp"
|
||||||
app:tabSelectedTextColor="?attr/colorAccent"
|
app:tabSelectedTextColor="?attr/colorAccent"
|
||||||
>
|
>
|
||||||
<android.support.design.widget.TabItem
|
<android.support.design.widget.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/tab_home"
|
android:id="@+id/tab_home"
|
||||||
android:icon="@drawable/ic_action_home"/>
|
android:icon="@drawable/ic_action_home_tl"/>
|
||||||
<android.support.design.widget.TabItem
|
<android.support.design.widget.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/tab_local"
|
android:id="@+id/tab_local"
|
||||||
android:icon="@drawable/ic_action_users"/>
|
android:icon="@drawable/ic_action_users_tl"/>
|
||||||
<android.support.design.widget.TabItem
|
<android.support.design.widget.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/tab_global"
|
android:id="@+id/tab_global"
|
||||||
android:icon="@drawable/ic_action_globe_menu"/>
|
android:icon="@drawable/ic_action_globe_tl"/>
|
||||||
<android.support.design.widget.TabItem
|
<android.support.design.widget.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/tab_notification"
|
android:id="@+id/tab_notification"
|
||||||
android:icon="@drawable/ic_notifications"/>
|
android:icon="@drawable/ic_notifications_tl"/>
|
||||||
</android.support.design.widget.TabLayout>
|
</android.support.design.widget.TabLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|