tweak layout for large screens

This commit is contained in:
Felix 2017-09-19 00:26:44 +02:00
parent 78c72204d5
commit d900201aa1
8 changed files with 32 additions and 8 deletions

View file

@ -14,7 +14,7 @@
android:name=".ChaosflixApplication"
android:theme="@style/Base.Theme.AppCompat.Light">
<activity android:name=".touch.activities.ConferencesActivity"
android:icon="@drawable/icon"
android:icon="@drawable/icon_notext"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

View file

@ -1,5 +1,6 @@
package de.nicidienase.chaosflix.touch;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
@ -9,6 +10,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import de.nicidienase.chaosflix.R;
import de.nicidienase.chaosflix.common.entities.recording.Conference;
import de.nicidienase.chaosflix.common.entities.recording.ConferencesWrapper;
import de.nicidienase.chaosflix.touch.fragments.ConferenceFragment;
@ -19,11 +21,13 @@ import de.nicidienase.chaosflix.touch.fragments.ConferenceFragment;
public class ConferenceGroupsFragmentPager extends FragmentPagerAdapter {
private static final String TAG = ConferenceGroupsFragmentPager.class.getSimpleName();
private final Context mContext;
private List<String> orderedConferencesList = new ArrayList<>();
private Map<String, List<Conference>> mConferenceMap;
public ConferenceGroupsFragmentPager(FragmentManager fm) {
public ConferenceGroupsFragmentPager(Context context, FragmentManager fm) {
super(fm);
this.mContext = context;
}
@Override
@ -41,9 +45,7 @@ public class ConferenceGroupsFragmentPager extends FragmentPagerAdapter {
@Override
public CharSequence getPageTitle(int position) {
String string = ConferencesWrapper.getStringForTag(orderedConferencesList.get(position));
Log.d(TAG,string);
return string;
return ConferencesWrapper.getStringForTag(orderedConferencesList.get(position));
}
public void setContent(Map<String, List<Conference>> conferenceMap) {
@ -61,4 +63,10 @@ public class ConferenceGroupsFragmentPager extends FragmentPagerAdapter {
}
}
}
@Override
public float getPageWidth(int position) {
int integer = mContext.getResources().getInteger(R.integer.num_columns);
return 1f/integer;
}
}

View file

@ -34,7 +34,7 @@ public class ConferencesActivity extends TouchBaseActivity implements Conference
.observeOn(AndroidSchedulers.mainThread())
.subscribe(conferencesWrapper -> {
ConferenceGroupsFragmentPager fragmentPager
= new ConferenceGroupsFragmentPager(getSupportFragmentManager());
= new ConferenceGroupsFragmentPager(ConferencesActivity.this,getSupportFragmentManager());
fragmentPager.setContent(conferencesWrapper.getConferencesBySeries());
ViewPager pager = (ViewPager) findViewById(R.id.viewpager);

View file

@ -25,8 +25,8 @@
<ImageView
android:id="@+id/imageView"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_width="@dimen/thumbnail_size"
android:layout_height="@dimen/thumbnail_size"
app:srcCompat="@drawable/default_background"/>
<LinearLayout

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="thumbnail_size">120dp</dimen>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="num_columns">3</integer>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="thumbnail_size">64dp</dimen>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="num_columns">1</integer>
</resources>