-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also update the Contributors.md file
- Loading branch information
Showing
12 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
onebusaway-android/src/main/java/org/onebusaway/android/ui/AboutActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.onebusaway.android.ui; | ||
|
||
import com.google.android.gms.common.GoogleApiAvailability; | ||
|
||
import org.onebusaway.android.R; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.pm.PackageInfo; | ||
import android.content.pm.PackageManager; | ||
import android.os.Bundle; | ||
import android.support.design.widget.CollapsingToolbarLayout; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.widget.TextView; | ||
|
||
/** | ||
* An Activity that displays version, license, and contributor information | ||
*/ | ||
public class AboutActivity extends AppCompatActivity { | ||
|
||
public static void start(Context context) { | ||
Intent intent = new Intent(context, AboutActivity.class); | ||
context.startActivity(intent); | ||
} | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_about); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
CollapsingToolbarLayout toolBarLayout = (CollapsingToolbarLayout) findViewById( | ||
R.id.toolbar_layout); | ||
toolBarLayout.setTitle(getTitle()); | ||
|
||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
|
||
TextView tv = (TextView) findViewById(R.id.about_text); | ||
String versionString = ""; | ||
int versionCode = 0; | ||
try { | ||
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); | ||
versionString = info.versionName; | ||
versionCode = info.versionCode; | ||
} catch (PackageManager.NameNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
StringBuilder builder = new StringBuilder(); | ||
// Version info | ||
builder.append("v") | ||
.append(versionString) | ||
.append(" (") | ||
.append(versionCode) | ||
.append(")\n\n"); | ||
|
||
// Majority of content from string resource | ||
builder.append(getString(R.string.about_text)); | ||
String googleOssLicense = null; | ||
|
||
// License info for Google Play Services, if available | ||
try { | ||
GoogleApiAvailability gaa = GoogleApiAvailability.getInstance(); | ||
googleOssLicense = gaa.getOpenSourceSoftwareLicenseInfo(this); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
if (googleOssLicense != null) { | ||
builder.append(googleOssLicense); | ||
} | ||
|
||
builder.append("\n\n"); | ||
|
||
tv.setText(builder.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="org.onebusaway.android.ui.AboutActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:id="@+id/app_bar" | ||
android:fitsSystemWindows="true" | ||
android:layout_height="@dimen/app_bar_height" | ||
android:layout_width="match_parent" | ||
android:theme="@style/Theme.OneBusAway.AppBarOverlay"> | ||
|
||
<android.support.design.widget.CollapsingToolbarLayout | ||
android:id="@+id/toolbar_layout" | ||
android:fitsSystemWindows="true" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_scrollFlags="scroll|exitUntilCollapsed" | ||
app:contentScrim="?attr/colorPrimary"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_height="?attr/actionBarSize" | ||
android:layout_width="match_parent" | ||
app:layout_collapseMode="pin" | ||
app:popupTheme="@style/Theme.OneBusAway.PopupOverlay"/> | ||
|
||
</android.support.design.widget.CollapsingToolbarLayout> | ||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_about"/> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.v4.widget.NestedScrollView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
tools:showIn="@layout/activity_about" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="org.onebusaway.android.ui.AboutActivity"> | ||
|
||
<TextView | ||
android:id="@+id/about_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/text_margin" | ||
android:autoLink="web"/> | ||
|
||
</android.support.v4.widget.NestedScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- About --> | ||
<resources> | ||
<style name="Theme.OneBusAway.NoActionBar"> | ||
<item name="windowActionBar">false</item> | ||
<item name="windowNoTitle">true</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters