mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 12:18:59 +00:00
[#26] - First version of About Screen.
This commit is contained in:
parent
c876ac27d8
commit
66de7ea08f
4 changed files with 192 additions and 3 deletions
98
Habitica/res/layout/fragment_about.xml
Normal file
98
Habitica/res/layout/fragment_about.xml
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="30dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/twitter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:text="\@habitica"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/webSite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="www.habitica.com"
|
||||
android:autoLink="web"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wiki"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="http://habitica.wikia.com/"
|
||||
android:autoLink="web"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/lineDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:layout_marginTop="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sourceCodeLink"
|
||||
android:layout_width="347dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Habitica is an open Source Code and you can find the code clicking here"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="30sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/googlePlayStoreButton"
|
||||
android:layout_width="248dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="RATE OUR APP"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/giveUsFeedback"
|
||||
android:layout_width="253dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Give us Feedback! :-)"
|
||||
android:textSize="@dimen/abc_text_size_title_material"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20sp" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
|
|
@ -109,6 +109,7 @@
|
|||
<string name="update_btn">Update</string>
|
||||
|
||||
<string name="about.title">About</string>
|
||||
<string name="about.libraries">Libraries</string>
|
||||
<string name="about.versionhistory">Version history</string>
|
||||
<!-- Network Errors -->
|
||||
<string name="network_error_title">Connection Error</string>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import android.view.MenuItem;
|
|||
import com.github.porokoro.paperboy.ItemTypeBuilder;
|
||||
import com.github.porokoro.paperboy.PaperboyBuilder;
|
||||
import com.github.porokoro.paperboy.ViewTypes;
|
||||
import com.habitrpg.android.habitica.ui.fragments.AboutFragment;
|
||||
import com.mikepenz.aboutlibraries.Libs;
|
||||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
|
||||
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||
|
||||
final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), 2);
|
||||
final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), 3);
|
||||
pager.setAdapter(adapter);
|
||||
pager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||
|
||||
|
|
@ -101,6 +102,9 @@ public class AboutActivity extends AppCompatActivity {
|
|||
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
||||
return new AboutFragment();
|
||||
case 1:
|
||||
Fragment tab1 = new LibsBuilder()
|
||||
//Pass the fields of your application to the lib so it can find all external lib information
|
||||
.withFields(R.string.class.getFields())
|
||||
|
|
@ -115,7 +119,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
.fragment();
|
||||
|
||||
return tab1;
|
||||
case 1:
|
||||
case 2:
|
||||
PaperboyBuilder builder = new PaperboyBuilder(AboutActivity.this)
|
||||
.setViewType(ViewTypes.HEADER)
|
||||
.setFile("paperboy/changelog.json");
|
||||
|
|
@ -136,8 +140,12 @@ public class AboutActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
if (position == 0)
|
||||
if (position == 0){
|
||||
return getString(R.string.about_title);
|
||||
}else if(position == 1){
|
||||
return getString(R.string.about_libraries);
|
||||
}
|
||||
|
||||
|
||||
return getString(R.string.about_versionhistory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by franzejr on 04/11/15.
|
||||
*/
|
||||
public class AboutFragment extends Fragment {
|
||||
|
||||
private String androidSourceCodeLink = "https://github.com/HabitRPG/habitrpg-android/";
|
||||
private String twitterLink = "https://twitter.com/habitica";
|
||||
|
||||
@OnClick(R.id.sourceCodeLink)
|
||||
public void openSourceCodePage(){
|
||||
openBrowserLink(androidSourceCodeLink);
|
||||
}
|
||||
|
||||
@OnClick(R.id.twitter)
|
||||
public void openTwitterPage(){
|
||||
openBrowserLink(twitterLink);
|
||||
}
|
||||
|
||||
@OnClick(R.id.giveUsFeedback)
|
||||
public void sendEmailAction(){
|
||||
sendEmail();
|
||||
}
|
||||
|
||||
|
||||
@OnClick(R.id.googlePlayStoreButton)
|
||||
public void openGooglePlay(){
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("market://details?id=com.example.android"));
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private View view;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view == null)
|
||||
view = inflater.inflate(R.layout.fragment_about, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
ButterKnife.inject(this, view);
|
||||
}
|
||||
|
||||
private void openBrowserLink(String url){
|
||||
Uri uriUrl = Uri.parse(url);
|
||||
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
|
||||
startActivity(launchBrowser);
|
||||
}
|
||||
|
||||
private void sendEmail() {
|
||||
Intent emailIntent = new Intent(Intent.ACTION_SEND);
|
||||
emailIntent.setData(Uri.parse("mailto:"));
|
||||
emailIntent.setType("text/plain");
|
||||
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"mobile@habitica.com"});
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Habitica Feedback");
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, "MESSAGE");
|
||||
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue