Skip to content

Commit

Permalink
issue dhis2#11 About Fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth7 committed Mar 5, 2016
1 parent bc0a17c commit a1c1483
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.hisp.dhis.android.dashboard.api.models.UserAccount;
import org.hisp.dhis.android.dashboard.api.persistence.loaders.DbLoader;
import org.hisp.dhis.android.dashboard.api.persistence.loaders.Query;
import org.hisp.dhis.android.dashboard.ui.fragments.AboutFragment;
import org.hisp.dhis.android.dashboard.ui.fragments.AccountFragment;
import org.hisp.dhis.android.dashboard.ui.fragments.SettingsFragment;
import org.hisp.dhis.android.dashboard.ui.fragments.dashboard.DashboardContainerFragment;
Expand Down Expand Up @@ -124,6 +125,9 @@ public boolean onNavigationItemSelected(MenuItem menuItem) {
attachFragmentDelayed(new SettingsFragment());
break;
}
case R.id.menu_about_item: {
attachFragment(new AboutFragment());
}
/* case R.id.menu_about_item: {
getDhisController().invalidateSession();
startActivity(new Intent(this, LauncherActivity.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package org.hisp.dhis.android.dashboard.ui.fragments;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import org.hisp.dhis.android.dashboard.BuildConfig;
import org.hisp.dhis.android.dashboard.R;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
* Created by siddharthsingh on 05/03/16.
*/
public class AboutFragment extends BaseFragment {
@Bind(R.id.toolbar)
Toolbar mToolbar;
TextView mVersionNumber,mWebsite,mEmail;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_about, container, false);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
ButterKnife.bind(this, view);
mToolbar.setNavigationIcon(R.mipmap.ic_menu);
mToolbar.setTitle(R.string.about);
mVersionNumber=(TextView) view.findViewById(R.id.version_textview);
mWebsite=(TextView) view.findViewById(R.id.website_textview);
mEmail=(TextView) view.findViewById(R.id.email_textview);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleNavigationDrawer();
}
});
mVersionNumber.setText("version" + " " + BuildConfig.VERSION_NAME);
mWebsite.setClickable(true);
mWebsite.setMovementMethod(LinkMovementMethod.getInstance());
String text = "<a href='https://www.dhis2.org'> Visit Website </a>";
mWebsite.setText(Html.fromHtml(text));
mEmail.setText(Html.fromHtml("<a href=\"mailto:dhis2mobileteam@gmail.com\">Send Feedback</a>"));
mEmail.setMovementMethod(LinkMovementMethod.getInstance());
}

@OnClick(R.id.check_for_update_button)
@SuppressWarnings("unused")
public void onClick() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=org.hisp.dhis.android.dashboard"));
startActivity(intent);
}
}
Binary file added app/src/main/res/drawable-hdpi/ic_dhis_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_dhis_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/ic_dhis_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxhdpi/ic_dhis_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions app/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2015, University of Oslo
~
~ All rights reserved.
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~ Redistributions of source code must retain the above copyright notice, this
~ list of conditions and the following disclaimer.
~
~ Redistributions in binary form must reproduce the above copyright notice,
~ this list of conditions and the following disclaimer in the documentation
~ and/or other materials provided with the distribution.
~ Neither the name of the HISP project nor the names of its contributors may
~ be used to endorse or promote products derived from this software without
~ specific prior written permission.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/ic_dhis_logo"
android:paddingTop="120dp"
android:paddingBottom="30dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/version_textview"
android:paddingBottom="30dp"
android:layout_below="@+id/imageView"

android:gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/website_textview"
android:paddingBottom="30dp"
android:layout_below="@+id/version_textview"
android:gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:paddingBottom="45dp"
android:id="@+id/email_textview"
android:layout_below="@+id/website_textview"
android:gravity="center" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/check_for_update"
android:id="@+id/check_for_update_button"
android:layout_below="@+id/email_textview"
android:layout_alignParentBottom="true"
android:background="@drawable/button_blue_selector"
android:textColor="@color/white"
android:layout_alignParentStart="true"
android:layout_marginTop="70dp"
/>

</RelativeLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/menu/menu_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
android:id="@+id/menu_settings_item"
android:icon="@mipmap/ic_settings"
android:title="@string/settings"/>
<!-- <item
<item
android:id="@+id/menu_about_item"
android:icon="@mipmap/ic_about"
android:title="@string/about"/> -->
android:title="@string/about"/>
</group>

</menu>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,8 @@
<string name="email">Email</string>
<string name="phone_number">Phone number</string>
<!-- END Account -->

<!-- START About -->
<string name="check_for_update">Check for Updates</string>
<!-- END About -->
</resources>

1 comment on commit a1c1483

@arazabishov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siddharth7 Great work and thank you for contribution.

The only thing which I would like to ask you is to re-submit the pull-request. I see that you first added AboutFragment with related resources, then removed it and added again. It is a little bit confusing and also pollutes commit history.

Also, could you please do not touch LoginActivity entry in manifest? It was already fixed by another student and will cause conflicts.

Please sign in to comment.