WIP on listview selectors

Adds tablet support in manifest
This commit is contained in:
bg45
2017-03-03 17:35:24 -05:00
parent e833d0c5f1
commit 4e06f6834f
5 changed files with 17 additions and 8 deletions

View File

@@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wismna.geoffroy.donext"> package="com.wismna.geoffroy.donext">
<supports-screens
android:largeScreens="true"
android:smallScreens="true">
</supports-screens>
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
@@ -14,7 +18,7 @@
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>

View File

@@ -104,12 +104,16 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
} }
else if (tabs instanceof ListView) { else if (tabs instanceof ListView) {
ListView listView = (ListView) tabs; ListView listView = (ListView) tabs;
//listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, taskLists));
listView.setAdapter(new ArrayAdapter<>(this, R.layout.list_tasklist_item, taskLists)); listView.setAdapter(new ArrayAdapter<>(this, R.layout.list_tasklist_item, taskLists));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mViewPager.setCurrentItem(position); mViewPager.setCurrentItem(position);
//view.setSelected(true); view.setSelected(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
parent.setElevation(10);
}
} }
}); });
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorAccent" android:state_selected="true" /> <item android:drawable="@android:color/background_light" android:state_activated="true" />
<item android:drawable="@android:color/black" /> <item android:drawable="@color/common_google_signin_btn_text_light_focused" />
</selector> </selector>

View File

@@ -41,12 +41,15 @@
android:id="@+id/tabs" android:id="@+id/tabs"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.2" /> android:layout_weight="0.2"
android:listSelector="@drawable/tasklist_select"/>
<com.wismna.geoffroy.donext.widgets.NonSwipeableViewPager <com.wismna.geoffroy.donext.widgets.NonSwipeableViewPager
android:id="@+id/container" android:id="@+id/container"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8" android:layout_weight="0.8"
android:elevation="10dp"
android:background="@android:color/background_light"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout> </LinearLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@@ -4,6 +4,4 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="20dp" android:padding="20dp"
android:textSize="20sp" android:textSize="20sp" />
android:textColor="@drawable/tasklist_select"
android:duplicateParentState="true" />