mirror of
https://github.com/gsantner/dandelion
synced 2024-12-25 20:38:05 +01:00
Added lorem ipsum and some more visual tweaks to AboutActivity
This commit is contained in:
parent
50f5a79c30
commit
c62f38e693
7 changed files with 138 additions and 29 deletions
|
@ -10,40 +10,34 @@ import android.support.v4.app.FragmentPagerAdapter;
|
|||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.dfa.diaspora_android.App;
|
||||
import com.github.dfa.diaspora_android.R;
|
||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||
|
||||
public class AboutActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* The {@link android.support.v4.view.PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a
|
||||
* {@link FragmentPagerAdapter} derivative, which will keep every
|
||||
* loaded fragment in memory. If this becomes too memory intensive, it
|
||||
* may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
private ViewPager mViewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AboutActivity.this.onBackPressed();
|
||||
}
|
||||
});
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
// primary sections of the activity.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
|
@ -75,9 +69,8 @@ public class AboutActivity extends AppCompatActivity {
|
|||
if(isAdded()) {
|
||||
try {
|
||||
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||
|
||||
packageName.setText(pInfo.packageName);
|
||||
appVersion.setText(getString(R.string.fragment_about__app_version, pInfo.versionName+ " ("+pInfo.versionCode+")"));
|
||||
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName+ " ("+pInfo.versionCode+")"));
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -114,8 +107,25 @@ public class AboutActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_about, container, false);
|
||||
((TextView) rootView.findViewById(R.id.debug_text)).setText("Debug");
|
||||
View rootView = inflater.inflate(R.layout.fragment_debug, container, false);
|
||||
TextView packageName = (TextView) rootView.findViewById(R.id.fragment_debug__package_name);
|
||||
TextView appVersion = (TextView) rootView.findViewById(R.id.fragment_debug__app_version);
|
||||
TextView podDomain = (TextView) rootView.findViewById(R.id.fragment_debug__pod_domain);
|
||||
|
||||
if(isAdded()) {
|
||||
try {
|
||||
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||
AppSettings settings = ((App) getActivity().getApplication()).getSettings();
|
||||
|
||||
packageName.setText(pInfo.packageName);
|
||||
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName+ " ("+pInfo.versionCode+")"));
|
||||
podDomain.setText(getString(R.string.fragment_debug__pod_domain, settings.getPodDomain()));
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
|
13
app/src/main/res/drawable/ic_arrow_back_white_24px.xml
Normal file
13
app/src/main/res/drawable/ic_arrow_back_white_24px.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:pathData="M0 0h24v24H0z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
|
||||
</vector>
|
|
@ -14,14 +14,26 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity$AboutFragment">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -13,10 +12,16 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--Vertical padding-->
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/activity_vertical_margin" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/debug_text"
|
||||
android:id="@+id/fragment_about__app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/diaspora_for_android"
|
||||
style="@android:style/TextAppearance.DeviceDefault.Large"/>
|
||||
|
||||
|
@ -29,5 +34,16 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/fragment_about__app_version"/>
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/lorem_ipsum"/>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
|
50
app/src/main/res/layout/fragment_debug.xml
Normal file
50
app/src/main/res/layout/fragment_debug.xml
Normal file
|
@ -0,0 +1,50 @@
|
|||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity$DebugFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--Vertical padding-->
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/activity_vertical_margin" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_debug__section_app"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fragment_debug__section_app"
|
||||
style="@android:style/TextAppearance.DeviceDefault.Large"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/fragment_debug__package_name"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/fragment_debug__app_version"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_debug__section_pod"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fragment_debug__section_pod"
|
||||
style="@android:style/TextAppearance.DeviceDefault.Large"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/fragment_debug__pod_domain"/>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
|
@ -5,7 +5,6 @@
|
|||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity$LicenseFragment">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -13,11 +12,16 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--Vertical Padding-->
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/activity_vertical_margin" />
|
||||
|
||||
<com.github.dfa.diaspora_android.ui.HtmlTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/fragment_license__license_content"
|
||||
android:text="@string/fragment_license__license_content"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:linksClickable="true"
|
||||
android:autoLink="web"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -133,8 +133,12 @@
|
|||
<string name="about_activity__title_about_app">About</string>
|
||||
<string name="about_activity__title_about_license">License</string>
|
||||
<string name="about_activity__title_debug_info">Debugging</string>
|
||||
<string name="fragment_about__app_version">App Version: %1$s</string>
|
||||
<string name="fragment_about__package_name">Package Name: %1$s</string>
|
||||
<string name="fragment_debug__section_app">Application</string>
|
||||
<string name="fragment_debug__section_pod">Diaspora Pod</string>
|
||||
<string name="fragment_debug__app_version">App Version: %1$s</string>
|
||||
<string name="fragment_debug__package_name">Package Name: %1$s</string>
|
||||
<string name="fragment_debug__pod_domain">Pod Domain: %1$s</string>
|
||||
<string name="lorem_ipsum" translatable="false">Auch gibt es niemanden, der den Schmerz an sich liebt, sucht oder wünscht, nur, weil er Schmerz ist, es sei denn, es kommt zu zufälligen Umständen, in denen Mühen und Schmerz ihm große Freude bereiten können. Um ein triviales Beispiel zu nehmen, wer von uns unterzieht sich je anstrengender körperlicher Betätigung, außer um Vorteile daraus zu ziehen? Aber wer hat irgend ein Recht, einen Menschen zu tadeln, der die Entscheidung trifft, eine Freude zu genießen, die keine unangenehmen Folgen hat, oder einen, der Schmerz vermeidet, welcher keine daraus resultierende Freude nach sich zieht? Auch gibt es niemanden, der den Schmerz an sich liebt, sucht oder wünscht, nur, weil er Schmerz ist, es sei denn, es kommt zu zufälligen Umständen, in denen Mühen und Schmerz ihm große Freude bereiten können. Um ein triviales Beispiel zu nehmen, wer von uns unterzieht sich je anstrengender körperlicher Betätigung, außer um Vorteile daraus zu ziehen? Aber wer hat irgend ein Recht, einen Menschen zu tadeln, der die Entscheidung trifft, eine Freude zu genießen, die keine unangenehmen Folgen hat, oder einen, der Schmerz vermeidet, welcher keine daraus resultierende Freude nach sich zieht?</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue