Gitlab@AEI Hannover will go down for maintenance on 2020-09-21 at 4:00 UTC. The service will be unavailable for up to 24 hours. If you have questions about this please contact atlas_admin@aei.mpg.de

Commit 35cb8761 authored by Isira Seneviratne's avatar Isira Seneviratne

Add activity with ViewPager2 and move event log classes to a separate package.

parent 3e99d6ab
<?xml version="1.0" encoding="utf-8"?><!--
This file is part of BOINC.
http://boinc.berkeley.edu
Copyright (C) 2020 University of California
BOINC is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
BOINC 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
-->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.berkeley.boinc"
android:installLocation="internalOnly"> <!-- installation on SD card would break boot receiver -->
package="edu.berkeley.boinc"
android:installLocation="internalOnly">
<!-- installation on SD card would break boot receiver -->
<!-- Add Google Play store metadata informing the store we can run on tablets and other large screen devices -->
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"/>
<!-- Required Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- Features required for Android TV, consoles, and set-top boxes like Nexus Player, OUYA,
Razer Forge TV, Nvidia SHIELD, etc -->
android:xlargeScreens="true" /> <!-- Required Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!--
Features required for Android TV, consoles, and set-top boxes like Nexus Player, OUYA,
Razer Forge TV, Nvidia SHIELD, etc
-->
<!-- Effectively a hint for the Google Play store only and at the Leanback UI Library -->
<uses-feature
android:name="android.software.leanback"
android:required="false"/>
<!-- Implies some sort of D-pad, game controller, joystick, remote control, etc -->
android:required="false" /> <!-- Implies some sort of D-pad, game controller, joystick, remote control, etc -->
<uses-feature
android:name="android.hardware.gamepad"
android:required="false"/>
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false"/>
<!-- Effectively a hint for the Google Play store only -->
android:required="false" /> <!-- Effectively a hint for the Google Play store only -->
<uses-feature
android:name="android.hardware.type.television"
android:required="false"/>
android:required="false" />
<application
android:name=".BOINCApplication"
android:allowBackup="true"
android:banner="@drawable/ic_boinc_logo"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:largeHeap="true"
android:banner="@drawable/ic_boinc_logo"
android:name=".BOINCApplication">
android:theme="@style/AppTheme">
<activity
android:name=".ui.eventlog.EventLogActivity2"
android:label="R.string.menu_eventlog"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="edu.berkeley.boinc.SplashActivity"
android:name=".SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:noHistory="true">
android:noHistory="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
<category android:name="tv.ouya.intent.category.APP"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
<category android:name="tv.ouya.intent.category.APP" />
</intent-filter>
</activity>
<activity
android:name="edu.berkeley.boinc.BOINCActivity"
android:name=".BOINCActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:exported="true"/>
android:launchMode="singleTop" />
<activity
android:name="edu.berkeley.boinc.attach.SelectionListActivity"
android:theme="@style/AppTheme.NoActionBar"/>
android:name=".attach.SelectionListActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="edu.berkeley.boinc.attach.CredentialInputActivity"
android:name=".attach.CredentialInputActivity"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"/>
android:windowSoftInputMode="adjustPan" />
<activity
android:name="edu.berkeley.boinc.attach.BatchProcessingActivity"
android:theme="@style/AppTheme.NoActionBar"/>
android:name=".attach.BatchProcessingActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="edu.berkeley.boinc.attach.BatchConflictListActivity"
android:theme="@style/AppTheme.NoActionBar"/>
<activity android:name="edu.berkeley.boinc.EventLogActivity">
android:name=".attach.BatchConflictListActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".ui.eventlog.EventLogActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="edu.berkeley.boinc.BOINCActivity"/>
android:value="edu.berkeley.boinc.BOINCActivity" />
</activity>
<service
android:name="edu.berkeley.boinc.client.Monitor"
android:process=":remote"/>
<service android:name="edu.berkeley.boinc.attach.ProjectAttachService"/>
android:name=".client.Monitor"
android:process=":remote" />
<service android:name=".attach.ProjectAttachService" />
<receiver android:name="edu.berkeley.boinc.receiver.BootReceiver">
<receiver android:name=".receiver.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name="edu.berkeley.boinc.receiver.PowerConnectedReceiver">
<receiver android:name=".receiver.PowerConnectedReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
</intent-filter>
</receiver>
<receiver android:name="edu.berkeley.boinc.receiver.PackageReplacedReceiver">
<receiver android:name=".receiver.PackageReplacedReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data
android:path="edu.berkeley.boinc"
android:scheme="package"/>
android:scheme="package" />
</intent-filter>
</receiver>
<activity
android:name=".BoincNotExclusiveDialog"
android:theme="@style/Theme.AppCompat.DayNight.Dialog"/>
android:theme="@style/Theme.AppCompat.DayNight.Dialog" />
</application>
</manifest>
</manifest>
\ No newline at end of file
......@@ -45,6 +45,7 @@ import edu.berkeley.boinc.client.ClientStatus
import edu.berkeley.boinc.client.IMonitor
import edu.berkeley.boinc.client.Monitor
import edu.berkeley.boinc.databinding.MainBinding
import edu.berkeley.boinc.ui.eventlog.EventLogActivity
import edu.berkeley.boinc.utils.Logging
import edu.berkeley.boinc.utils.RUN_MODE_AUTO
import edu.berkeley.boinc.utils.RUN_MODE_NEVER
......
......@@ -42,6 +42,7 @@ import edu.berkeley.boinc.client.ClientStatus;
import edu.berkeley.boinc.client.IMonitor;
import edu.berkeley.boinc.client.Monitor;
import edu.berkeley.boinc.databinding.ActivitySplashBinding;
import edu.berkeley.boinc.ui.eventlog.EventLogActivity;
import edu.berkeley.boinc.utils.BOINCUtils;
import edu.berkeley.boinc.utils.Logging;
......
......@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc;
package edu.berkeley.boinc.ui.eventlog;
import android.content.ClipData;
import android.content.ClipboardManager;
......@@ -40,6 +40,7 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import edu.berkeley.boinc.R;
import edu.berkeley.boinc.adapter.ClientLogRecyclerViewAdapter;
import edu.berkeley.boinc.adapter.GuiLogRecyclerViewAdapter;
import edu.berkeley.boinc.client.IMonitor;
......
/*
* This file is part of BOINC.
* http://boinc.berkeley.edu
* Copyright (C) 2020 University of California
*
* BOINC is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* BOINC 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc.ui.eventlog
import android.os.Bundle
import android.view.Menu
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayoutMediator
import edu.berkeley.boinc.R
import edu.berkeley.boinc.databinding.ActivityEventLog2Binding
class EventLogActivity2 : AppCompatActivity() {
private lateinit var binding: ActivityEventLog2Binding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityEventLog2Binding.inflate(layoutInflater)
setContentView(binding.root)
val eventLogPagerAdapter = EventLogPagerAdapter(this)
binding.viewPager.adapter = eventLogPagerAdapter
TabLayoutMediator(binding.tabs, binding.viewPager) { tab, position ->
tab.text = if (position == 0)
getString(R.string.eventlog_client_header)
else
getString(R.string.eventlog_gui_header)
}.attach()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.eventlog_menu, menu)
return true
}
}
......@@ -16,13 +16,13 @@
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc;
package edu.berkeley.boinc.ui.eventlog;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBar.Tab;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.*;
import androidx.appcompat.app.ActionBar.Tab;
public class EventLogActivityTabListener<T extends Fragment> implements ActionBar.TabListener {
......
......@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc
package edu.berkeley.boinc.ui.eventlog
import android.os.Bundle
import android.os.RemoteException
......
......@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc;
package edu.berkeley.boinc.ui.eventlog;
import android.os.Bundle;
import android.util.Log;
......@@ -32,6 +32,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import edu.berkeley.boinc.R;
import edu.berkeley.boinc.adapter.GuiLogRecyclerViewAdapter;
import edu.berkeley.boinc.databinding.EventLogGuiLayoutBinding;
import edu.berkeley.boinc.utils.BOINCUtils;
......
/*
* This file is part of BOINC.
* http://boinc.berkeley.edu
* Copyright (C) 2020 University of California
*
* BOINC is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* BOINC 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc.ui.eventlog
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
class EventLogPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
override fun getItemCount() = 2
override fun createFragment(position: Int): Fragment {
return if (position == 0) EventLogClientFragment() else EventLogGuiFragment()
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.eventlog.EventLogActivity2">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="?actionBarSize"
android:padding="@dimen/appbar_padding"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
\ No newline at end of file
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="appbar_padding">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
</resources>
\ No newline at end of file
......@@ -17,6 +17,7 @@
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<style name="AppBase" parent="Theme.AppCompat.DayNight">
<item name="colorPrimary">#0288d1</item>
<item name="colorPrimaryDark">#005b9f</item>
......@@ -28,7 +29,7 @@
<item name="actionBarStyle">@style/Boinc.ActionBar</item>
</style>
<style name="AppTheme" parent="AppBase"/>
<style name="AppTheme" parent="AppBase" />
<style name="Boinc.ActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@drawable/shape_light_primary_background</item>
......@@ -70,4 +71,8 @@
<style name="DividerDayNight">
<item name="android:divider">@color/light_blue</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment