mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fab in landscape (#2559)
* fix fab in landscape orientation * fixes fax in landscape orientation
This commit is contained in:
parent
80225360f8
commit
32752c2d1e
2 changed files with 18 additions and 2 deletions
|
|
@ -13,6 +13,8 @@ import android.widget.GridView;
|
|||
import android.widget.ListAdapter;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.content.res.Configuration;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
|
@ -46,6 +48,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
|
|||
FloatingActionButton fabGallery;
|
||||
@BindView(R.id.noContributionsYet)
|
||||
TextView noContributionsYet;
|
||||
@BindView(R.id.fab_layout)
|
||||
LinearLayout fab_layout;
|
||||
|
||||
@Inject @Named("default_preferences") BasicKvStore basicKvStore;
|
||||
@Inject @Named("direct_nearby_upload_prefs") JsonKvStore directKvStore;
|
||||
|
|
@ -76,6 +80,17 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
|
|||
setListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// check orientation
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
fab_layout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
fab_layout.setOrientation(LinearLayout.VERTICAL);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeAnimations() {
|
||||
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
|
||||
fab_close = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_close);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fab_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
|
@ -55,7 +56,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:tint="@color/button_blue"
|
||||
android:visibility="invisible"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="@color/main_background_light"
|
||||
app:elevation="6dp"
|
||||
app:fabSize="mini"
|
||||
|
|
@ -69,7 +70,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:tint="@color/button_blue"
|
||||
android:visibility="invisible"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="@color/main_background_light"
|
||||
app:elevation="6dp"
|
||||
app:fabSize="mini"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue