Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Replace usage dialogue box with New Usage Activity #65

Merged
merged 1 commit into from Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -96,6 +96,7 @@ limitations under the License.
android:label="@string/image_zoom"
android:exported="true"
/>
<activity android:name=".ui.usage.UsageActivity" />
</application>

</manifest>
Expand Up @@ -18,14 +18,14 @@
*/
package org.apache.taverna.mobile.ui;


import org.apache.taverna.mobile.R;
import org.apache.taverna.mobile.data.DataManager;
import org.apache.taverna.mobile.data.local.PreferencesHelper;
import org.apache.taverna.mobile.ui.anouncements.AnnouncementFragment;
import org.apache.taverna.mobile.ui.favouriteworkflow.FavouriteWorkflowsFragment;
import org.apache.taverna.mobile.ui.login.LoginActivity;
import org.apache.taverna.mobile.ui.myworkflows.MyWorkflowFragment;
import org.apache.taverna.mobile.ui.usage.UsageActivity;
import org.apache.taverna.mobile.ui.workflow.WorkflowFragment;
import org.apache.taverna.mobile.utils.ActivityUtils;

Expand Down Expand Up @@ -163,10 +163,9 @@ public boolean onNavigationItemSelected(MenuItem menuItem) {

case R.id.nav_usage:

dialog.setCanceledOnTouchOutside(true);
dialog.setTitle(getString(R.string.title_nav_usage));
dialog.setContentView(R.layout.usage_layout);
dialog.show();
Intent intent = new Intent(DashboardActivity.this,
UsageActivity.class);
startActivity(intent);
mDrawerLayout.closeDrawers();
return true;

Expand Down
@@ -0,0 +1,62 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.taverna.mobile.ui.usage;

import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import org.apache.taverna.mobile.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class UsageActivity extends AppCompatActivity {

@BindView(R.id.toolbar)
Toolbar mToolbar;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_usage);
ButterKnife.bind(this);

setSupportActionBar(mToolbar);
ActionBar actionbar = getSupportActionBar();

if (actionbar != null) {
actionbar.setHomeButtonEnabled(true);
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setTitle(R.string.title_usage);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
178 changes: 178 additions & 0 deletions app/src/main/res/layout/activity_usage.xml
@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<include
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
layout="@layout/appbar"/>

<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/usageLinearLayoutPadding">

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/usageCardViewPaddingBotton">

<TextView
android:id="@+id/usage_login_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="@dimen/cardTitleTopPadding"
android:text="@string/usage_intro"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/usageCardTitleTextSize" />

<TextView
android:id="@+id/usage_login_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/usageCardContentMarginTop"
android:fontFamily="sans-serif-condensed"
android:paddingBottom="@dimen/usageContentPaddingBottom"
android:paddingLeft="@dimen/usageContentPaddingLeft"
android:paddingRight="@dimen/usageContentPaddingRight"
android:text="@string/usage_login_accounts"
android:textColor="@color/colorBlack"
android:textSize="@dimen/usageContentTextSize" />

</android.support.v7.widget.CardView>

<Space
android:layout_width="match_parent"
android:layout_height="@dimen/usageCardSpaceHeight" />

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/usageCardViewPaddingBotton">

<TextView
android:id="@+id/usage_dashboard_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="@dimen/cardTitleTopPadding"
android:text="@string/usage_dashboard"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/usageCardTitleTextSize" />

<TextView
android:id="@+id/usage_dashboard_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/usageCardContentMarginTop"
android:fontFamily="sans-serif-condensed"
android:paddingBottom="@dimen/usageContentPaddingBottom"
android:paddingLeft="@dimen/usageContentPaddingLeft"
android:paddingRight="@dimen/usageContentPaddingRight"
android:text="@string/usage_dashboard_Text"
android:textColor="@color/colorBlack"
android:textSize="@dimen/usageContentTextSize" />

</android.support.v7.widget.CardView>

<Space
android:layout_width="match_parent"
android:layout_height="@dimen/usageCardSpaceHeight" />

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/usageCardViewPaddingBotton">

<TextView
android:id="@+id/usage_menu_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="@dimen/cardTitleTopPadding"
android:text="@string/usage_menus"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/usageCardTitleTextSize" />

<TextView
android:id="@+id/menu_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/usageCardContentMarginTop"
android:fontFamily="sans-serif-condensed"
android:paddingBottom="@dimen/usageContentPaddingBottom"
android:paddingLeft="@dimen/usageContentPaddingLeft"
android:paddingRight="@dimen/usageContentPaddingRight"
android:text="@string/usage_menu_Text"
android:textColor="@color/colorBlack"
android:textSize="@dimen/usageContentTextSize" />

</android.support.v7.widget.CardView>

<Space
android:layout_width="match_parent"
android:layout_height="@dimen/usageCardSpaceHeight" />

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/usageCardViewPaddingBotton">

<TextView
android:id="@+id/workflow_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="@dimen/cardTitleTopPadding"
android:text="@string/usage_detail"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/usageCardTitleTextSize" />

<TextView
android:id="@+id/workflow_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/usageCardContentMarginTop"
android:fontFamily="sans-serif-condensed"
android:paddingBottom="@dimen/usageContentPaddingLeft"
android:paddingLeft="@dimen/usageContentPaddingRight"
android:paddingRight="@dimen/usageContentPaddingRight"
android:text="@string/usage_detail_text"
android:textColor="@color/colorBlack"
android:textSize="@dimen/usageContentTextSize" />

</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

</LinearLayout>

109 changes: 0 additions & 109 deletions app/src/main/res/layout/usage_layout.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Expand Up @@ -16,6 +16,7 @@
limitations under the License.
-->
<resources>
<color name="colorBlack">#000000</color>
<color name="colorPrimary">#2196F3</color>
<color name="colorPrimaryDark">#2196F3</color>
<color name="colorAccent">#FF4081</color>
Expand Down