Changes tab position for notifications
This commit is contained in:
parent
2b65bff6c3
commit
a6f2bc38d1
|
@ -172,17 +172,17 @@ public class MainActivity extends AppCompatActivity
|
||||||
fragmentTag = "HOME_TIMELINE";
|
fragmentTag = "HOME_TIMELINE";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
fragmentTag = "NOTIFICATIONS";
|
||||||
|
item = navigationView.getMenu().findItem(R.id.nav_notification);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
fragmentTag = "LOCAL_TIMELINE";
|
fragmentTag = "LOCAL_TIMELINE";
|
||||||
item = navigationView.getMenu().findItem(R.id.nav_local);
|
item = navigationView.getMenu().findItem(R.id.nav_local);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
item = navigationView.getMenu().findItem(R.id.nav_global);
|
item = navigationView.getMenu().findItem(R.id.nav_global);
|
||||||
fragmentTag = "PUBLIC_TIMELINE";
|
fragmentTag = "PUBLIC_TIMELINE";
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
fragmentTag = "NOTIFICATIONS";
|
|
||||||
item = navigationView.getMenu().findItem(R.id.nav_notification);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if( item != null){
|
if( item != null){
|
||||||
toolbarTitle.setText(item.getTitle());
|
toolbarTitle.setText(item.getTitle());
|
||||||
|
@ -401,7 +401,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
if (extras.getInt(INTENT_ACTION) == NOTIFICATION_INTENT){
|
if (extras.getInt(INTENT_ACTION) == NOTIFICATION_INTENT){
|
||||||
changeUser(MainActivity.this, userIdIntent, false); //Connects the account which is related to the notification
|
changeUser(MainActivity.this, userIdIntent, false); //Connects the account which is related to the notification
|
||||||
unCheckAllMenuItems(navigationView);
|
unCheckAllMenuItems(navigationView);
|
||||||
tabLayout.getTabAt(3).select();
|
tabLayout.getTabAt(1).select();
|
||||||
matchingIntent = true;
|
matchingIntent = true;
|
||||||
}else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){
|
}else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){
|
||||||
changeUser(MainActivity.this, userIdIntent, true); //Connects the account which is related to the notification
|
changeUser(MainActivity.this, userIdIntent, true); //Connects the account which is related to the notification
|
||||||
|
@ -471,16 +471,16 @@ public class MainActivity extends AppCompatActivity
|
||||||
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
toolbarTitle.setText(R.string.notifications);
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_notification).setChecked(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
toolbarTitle.setText(R.string.local_menu);
|
toolbarTitle.setText(R.string.local_menu);
|
||||||
navigationView.getMenu().findItem(R.id.nav_local).setChecked(true);
|
navigationView.getMenu().findItem(R.id.nav_local).setChecked(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
toolbarTitle.setText(R.string.global_menu);
|
|
||||||
navigationView.getMenu().findItem(R.id.nav_global).setChecked(true);
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
toolbarTitle.setText(R.string.notifications);
|
toolbarTitle.setText(R.string.global_menu);
|
||||||
navigationView.getMenu().findItem(R.id.nav_notification).setChecked(true);
|
navigationView.getMenu().findItem(R.id.nav_global).setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,15 +648,15 @@ public class MainActivity extends AppCompatActivity
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
tabLayout.getTabAt(0).select();
|
tabLayout.getTabAt(0).select();
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.nav_local) {
|
} else if( id == R.id.nav_notification){
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
tabLayout.getTabAt(1).select();
|
tabLayout.getTabAt(1).select();
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.nav_global) {
|
}else if (id == R.id.nav_local) {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
tabLayout.getTabAt(2).select();
|
tabLayout.getTabAt(2).select();
|
||||||
return true;
|
return true;
|
||||||
} else if( id == R.id.nav_notification){
|
} else if (id == R.id.nav_global) {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
tabLayout.getTabAt(3).select();
|
tabLayout.getTabAt(3).select();
|
||||||
return true;
|
return true;
|
||||||
|
@ -787,18 +787,19 @@ public class MainActivity extends AppCompatActivity
|
||||||
statusFragment.setArguments(bundle);
|
statusFragment.setArguments(bundle);
|
||||||
return statusFragment;
|
return statusFragment;
|
||||||
case 1:
|
case 1:
|
||||||
|
return new DisplayNotificationsFragment();
|
||||||
|
|
||||||
|
case 2:
|
||||||
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 3:
|
||||||
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:
|
|
||||||
return new DisplayNotificationsFragment();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -93,6 +93,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:icon="@drawable/ic_action_home_tl"/>
|
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.support.design.widget.TabItem
|
||||||
android:id="@+id/tab_local"
|
android:id="@+id/tab_local"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -105,11 +111,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:icon="@drawable/ic_action_globe_tl"/>
|
android:icon="@drawable/ic_action_globe_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.TabLayout>
|
</android.support.design.widget.TabLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
|
@ -86,21 +86,25 @@
|
||||||
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_tl"/>
|
android:icon="@drawable/ic_action_home_tl"/>
|
||||||
<android.support.design.widget.TabItem
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/tab_local"
|
|
||||||
android:icon="@drawable/ic_action_users_tl"/>
|
|
||||||
<android.support.design.widget.TabItem
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/tab_global"
|
|
||||||
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_tl"/>
|
android:icon="@drawable/ic_notifications_tl"/>
|
||||||
|
|
||||||
|
<android.support.design.widget.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/tab_local"
|
||||||
|
android:icon="@drawable/ic_action_users_tl"/>
|
||||||
|
|
||||||
|
<android.support.design.widget.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/tab_global"
|
||||||
|
android:icon="@drawable/ic_action_globe_tl"/>
|
||||||
|
|
||||||
</android.support.design.widget.TabLayout>
|
</android.support.design.widget.TabLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
Loading…
Reference in New Issue