Removes bottom bar
This commit is contained in:
parent
b800dab0d3
commit
02675ecdb7
|
@ -28,6 +28,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
|
@ -52,7 +53,6 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.view.MenuItem;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
@ -117,6 +117,7 @@ import android.support.v4.app.FragmentStatePagerAdapter;
|
|||
public abstract class BaseMainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener, OnUpdateAccountInfoInterface, OnRetrieveMetaDataInterface, OnRetrieveInstanceInterface {
|
||||
|
||||
private FloatingActionButton toot;
|
||||
private HashMap<String, String> tagTile = new HashMap<>();
|
||||
private HashMap<String, Integer> tagItem = new HashMap<>();
|
||||
private TextView toolbarTitle;
|
||||
|
@ -141,7 +142,6 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
private Intent streamingIntent;
|
||||
public static String lastHomeId = null, lastNotificationId = null;
|
||||
boolean notif_follow, notif_add, notif_mention, notif_share, show_boosts, show_replies;
|
||||
private Toolbar toolbarBottom;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -179,7 +179,6 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
Helper.fillMapEmoji(getApplicationContext());
|
||||
//Here, the user is authenticated
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbarBottom = findViewById(R.id.toolbarBottom);
|
||||
setSupportActionBar(toolbar);
|
||||
toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||
toolbar_search = toolbar.findViewById(R.id.toolbar_search);
|
||||
|
@ -403,6 +402,10 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
Helper.switchLayout(BaseMainActivity.this);
|
||||
if( tab.getPosition() != 1 )
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
else
|
||||
toot.setVisibility(View.GONE);
|
||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
}
|
||||
|
@ -421,6 +424,10 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
}
|
||||
if( tab.getPosition() != 1 )
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
else
|
||||
toot.setVisibility(View.GONE);
|
||||
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, tab.getPosition());
|
||||
switch (tab.getPosition()){
|
||||
case 0:
|
||||
|
@ -481,7 +488,7 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
if (muteFrag != null && muteFrag.isVisible()) {
|
||||
muteFrag.scrollToTop();
|
||||
}
|
||||
//Scroll to top when top bar is clicked (THEME_MENU only)
|
||||
//Scroll to top when top bar is clicked (THEME_MENU only)
|
||||
} else {
|
||||
int pos = tabLayout.getSelectedTabPosition();
|
||||
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, pos);
|
||||
|
@ -519,12 +526,12 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
return false;
|
||||
|
@ -543,12 +550,12 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
//your code here
|
||||
|
@ -562,17 +569,17 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
}else {
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -583,7 +590,7 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
//Defines the current locale of the device in a static variable
|
||||
currentLocale = Helper.currentLocale(getApplicationContext());
|
||||
|
||||
ImageButton toot = findViewById(R.id.toot);
|
||||
toot = findViewById(R.id.toot);
|
||||
toot.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -775,12 +782,12 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
@ -964,10 +971,11 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
Helper.switchLayout(BaseMainActivity.this);
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||
unCheckAllMenuItems(navigationView);
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
//Manages theme for icon colors
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
|
@ -996,6 +1004,11 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
changeDrawableColor(getApplicationContext(), R.drawable.ic_remove_red_eye,R.color.white);
|
||||
changeDrawableColor(getApplicationContext(), R.drawable.ic_translate,R.color.white);
|
||||
}
|
||||
switch (viewPager.getCurrentItem()){
|
||||
case 1:
|
||||
toot.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1153,15 +1166,17 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
toolbarBottom.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
if (id == R.id.nav_settings) {
|
||||
toot.setVisibility(View.GONE);
|
||||
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
||||
fragmentTag = "TABLAYOUT_SETTINGS";
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, tabLayoutSettingsFragment, fragmentTag).commit();
|
||||
|
||||
} else if (id == R.id.nav_favorites) {
|
||||
toot.setVisibility(View.GONE);
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.FAVOURITES);
|
||||
statusFragment.setArguments(bundle);
|
||||
|
@ -1169,6 +1184,7 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||
} else if (id == R.id.nav_blocked) {
|
||||
toot.setVisibility(View.GONE);
|
||||
accountsFragment = new DisplayAccountsFragment();
|
||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.BLOCKED);
|
||||
accountsFragment.setArguments(bundle);
|
||||
|
@ -1176,6 +1192,7 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||
}else if (id == R.id.nav_muted) {
|
||||
toot.setVisibility(View.GONE);
|
||||
accountsFragment = new DisplayAccountsFragment();
|
||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.MUTED);
|
||||
accountsFragment.setArguments(bundle);
|
||||
|
@ -1183,16 +1200,19 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||
}else if (id == R.id.nav_scheduled) {
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
DisplayScheduledTootsFragment displayScheduledTootsFragment = new DisplayScheduledTootsFragment();
|
||||
fragmentTag = "SCHEDULED";
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, displayScheduledTootsFragment, fragmentTag).commit();
|
||||
}else if (id == R.id.nav_drafts) {
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
DisplayDraftsFragment displayDraftsFragment = new DisplayDraftsFragment();
|
||||
fragmentTag = "DRAFTS";
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, displayDraftsFragment, fragmentTag).commit();
|
||||
}else if( id == R.id.nav_follow_request){
|
||||
toot.setVisibility(View.GONE);
|
||||
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();
|
||||
fragmentTag = "FOLLOW_REQUEST_SENT";
|
||||
fragmentManager.beginTransaction()
|
||||
|
@ -1296,7 +1316,7 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
//Remove the search bar
|
||||
if( !toolbar_search.isIconified() ) {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
toolbarBottom.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbar_search.setIconified(true);
|
||||
}
|
||||
//Selection comes from another menu, no action to do
|
||||
|
@ -1311,15 +1331,15 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
notificationsFragment = new DisplayNotificationsFragment();
|
||||
return notificationsFragment;
|
||||
}else if( position == 2 && display_local) {
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if(position == 2){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if (position == 3){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
|
@ -1439,4 +1459,4 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
private static void activityPaused() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -40,19 +40,18 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
app:popupTheme="?attr/popupOverlay">
|
||||
<ImageView
|
||||
android:id="@+id/iconbar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:id="@+id/toolbar_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="end"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
|
@ -65,6 +64,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:id="@+id/toolbar_title" />
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"
|
||||
/>
|
||||
<android.support.v7.widget.SearchView
|
||||
android:background="@null"
|
||||
android:id="@+id/toolbar_search"
|
||||
|
@ -78,7 +86,6 @@
|
|||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<android.support.v4.view.ViewPager
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -104,46 +111,13 @@
|
|||
tools:context="fr.gouv.etalab.mastodon.activities.MainActivity"
|
||||
>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbarBottom"
|
||||
android:layout_width="match_parent"
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/toot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:layout_gravity="bottom"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
app:popupTheme="?attr/popupOverlay">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/toot"
|
||||
android:layout_width="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:background="@color/transparent"
|
||||
app:srcCompat="@drawable/ic_edit"
|
||||
android:contentDescription="@string/toot_it"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/ic_edit" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
|
|
Loading…
Reference in New Issue