Layout improvements for tablets
This commit is contained in:
parent
166b472727
commit
7cd7b0e2e5
|
@ -223,10 +223,12 @@ public class MainActivity extends AppCompatActivity
|
|||
case 0:
|
||||
item = navigationView.getMenu().findItem(R.id.nav_home);
|
||||
fragmentTag = "HOME_TIMELINE";
|
||||
updateHomeCounter(0);
|
||||
break;
|
||||
case 1:
|
||||
fragmentTag = "NOTIFICATIONS";
|
||||
item = navigationView.getMenu().findItem(R.id.nav_notification);
|
||||
updateNotifCounter(0);
|
||||
break;
|
||||
case 2:
|
||||
fragmentTag = "LOCAL_TIMELINE";
|
||||
|
@ -995,8 +997,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if( account != null){
|
||||
String last_refresh = sharedpreferences.getString(Helper.LAST_BUBBLE_REFRESH + account.getId(), null);
|
||||
Date last_refresh_date = Helper.stringToDate(getApplicationContext(), last_refresh);
|
||||
//TODO: replace by TimeUnit.MINUTES.toMillis(5)
|
||||
if (last_refresh_date == null || new Date().getTime() - last_refresh_date.getTime() >= TimeUnit.SECONDS.toMillis(30)) {
|
||||
if (last_refresh_date == null || new Date().getTime() - last_refresh_date.getTime() >= TimeUnit.SECONDS.toMillis(120)) {
|
||||
if( homeFragment != null && notificationsFragment != null){
|
||||
homeFragment.update();
|
||||
notificationsFragment.update();
|
||||
|
|
|
@ -211,6 +211,8 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
((MainActivity)context).updateNotifCounter(countData);
|
||||
}
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, max_id);
|
||||
editor.apply();
|
||||
}else {
|
||||
new_max_id = apiResponse.getMax_id();
|
||||
notificationsTemp = notifications;
|
||||
|
@ -219,6 +221,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
|
||||
private void manageNotifications(List<Notification> notifications, String max_id){
|
||||
flag_loading = (max_id == null );
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if( !swiped && firstLoad && (notifications == null || notifications.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
|
@ -240,7 +243,6 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
flag_loading = notifications != null && notifications.size() < notificationPerPage;
|
||||
//Store last notification id to avoid to notify for those that have been already seen
|
||||
if( notifications != null && notifications.size() > 0) {
|
||||
//acct is null as userId when used in Fragment, data need to be retrieved via shared preferences and db
|
||||
|
|
|
@ -273,6 +273,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
((MainActivity)context).updateHomeCounter(countData);
|
||||
}
|
||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID+ userId,max_id);
|
||||
editor.apply();
|
||||
}else {
|
||||
new_max_id = apiResponse.getMax_id();
|
||||
statusesTemp = statuses;
|
||||
|
|
|
@ -79,43 +79,16 @@
|
|||
android:gravity="end"/>
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabSelectedTextColor="?attr/colorAccent">
|
||||
|
||||
<android.support.design.widget.TabItem
|
||||
android:id="@+id/tab_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/ic_action_home_tl"/>
|
||||
|
||||
<android.support.design.widget.TabItem
|
||||
android:id="@+id/tab_notification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/ic_notifications_tl"/>
|
||||
|
||||
<android.support.design.widget.TabItem
|
||||
android:id="@+id/tab_local"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/ic_action_users_tl"/>
|
||||
|
||||
<android.support.design.widget.TabItem
|
||||
android:id="@+id/tab_global"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/ic_action_globe_tl"/>
|
||||
|
||||
|
||||
</android.support.design.widget.TabLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017 Thomas Schneider
|
||||
|
||||
This file is a part of Mastalab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp" />
|
||||
<TextView
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:id="@+id/tab_counter"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:minWidth="30dp"
|
||||
android:minHeight="30dp"
|
||||
android:textColor="@color/mastodonC1"
|
||||
android:background="@drawable/shape_counter"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue