Android: Move add project functionality to the options menu. Frees up screen space for the project list.
Before Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 3.0 KiB |
|
@ -17,27 +17,16 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/projectsList"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
</ListView>
|
||||
|
||||
<Button
|
||||
android:visibility="gone"
|
||||
android:id="@+id/add_project_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="10dip"
|
||||
android:text="@string/projects_add_button"
|
||||
android:onClick="addProjectButtonClicked" />
|
||||
|
||||
</RelativeLayout>
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/email_to" android:enabled="true" android:visible="true" android:title="Email To..." android:icon="@drawable/mailw"></item>
|
||||
<item android:id="@+id/email_to" android:enabled="true" android:visible="true" android:title="@string/email_to" android:icon="@drawable/mailw"></item>
|
||||
|
||||
|
||||
</menu>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/projects_add" android:enabled="true" android:visible="true" android:title="@string/projects_add" android:icon="@drawable/ic_menu_add"></item>
|
||||
|
||||
</menu>
|
|
@ -18,10 +18,6 @@
|
|||
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<resources>
|
||||
<!-- project settings -->
|
||||
<string name="project_name">BOINC Test Project</string>
|
||||
<string name="project_url">http://isaac.ssl.berkeley.edu/test/</string>
|
||||
|
||||
<!-- app global -->
|
||||
<string name="app_name">BOINC</string>
|
||||
<string name="autostart_notification_header">BOINC started.</string>
|
||||
|
@ -107,7 +103,7 @@
|
|||
|
||||
<!-- projects tab strings -->
|
||||
<string name="projects_loading">Reading projects…</string>
|
||||
<string name="projects_add_button">+ Add project</string>
|
||||
<string name="projects_add">Add project</string>
|
||||
<string name="projects_delete">Delete project</string>
|
||||
<string name="projects_update">Update project</string>
|
||||
|
||||
|
@ -184,4 +180,8 @@
|
|||
<string name="rpcreason_projectreq">Requested by project</string>
|
||||
<string name="rpcreason_unknown">Unknown reason</string>
|
||||
|
||||
<!-- misc resources -->
|
||||
<string name="email_to">Email to…</string>
|
||||
<string name="send_mail">Send mail…</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -158,7 +158,6 @@ public class EventLogActivity extends FragmentActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
Log.d(TAG, "onCreateOptionsMenu()");
|
||||
|
|
|
@ -39,6 +39,9 @@ import android.os.IBinder;
|
|||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
@ -162,8 +165,31 @@ public class ProjectsActivity extends FragmentActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void addProjectButtonClicked(View view) {
|
||||
Log.d(TAG, "addProjectButtonClicked");
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
Log.d(TAG, "onCreateOptionsMenu()");
|
||||
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.projects_menu, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
Log.d(TAG, "onOptionsItemSelected()");
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.projects_add:
|
||||
onProjectAdd();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void onProjectAdd() {
|
||||
Log.d(TAG, "onProjectAdd()");
|
||||
startActivity(new Intent(this,LoginActivity.class));
|
||||
}
|
||||
|
||||
|
|