Skip to content

Commit

Permalink
Implemented the splash activity.
Browse files Browse the repository at this point in the history
  • Loading branch information
octacode committed Jul 6, 2017
1 parent 4475c17 commit 35ccb24
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,18 @@
</intent-filter>
</activity>

<activity android:name=".activity.NavigationActivity">
<activity android:name=".activity.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<meta-data
android:name="android.max_aspect"
android:value="2.1" />
</activity>

<activity android:name=".activity.NavigationActivity"/>
<activity android:name=".activity.ServerAppActivity"/>
<activity android:name=".activity.ServerFilesActivity">
<meta-data
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/org/amahi/anywhere/activity/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2014 Amahi
*
* This file is part of Amahi.
*
* Amahi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Amahi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
*/

package org.amahi.anywhere.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivity(new Intent(this, NavigationActivity.class));
finish();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,11 @@ private OnItemViewSelectedListener getDefaultSelectedListener() {
return new OnItemViewSelectedListener() {
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
mBackgroundManager.clearDrawable();
if (item instanceof ServerFile) {
ServerFile serverFile = (ServerFile) item;
if (isImage(serverFile)) {
updateBackground(getImageUri(serverFile).toString());
} else {
mBackgroundManager.clearDrawable();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public MainTVPresenter(Context context, ServerClient serverClient, List<ServerFi
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
mDefaultBackgroundColor =
ContextCompat.getColor(parent.getContext(), R.color.background_primary);
ContextCompat.getColor(parent.getContext(), R.color.background_secondary);
mSelectedBackgroundColor =
ContextCompat.getColor(parent.getContext(), R.color.primary);
ImageCardView cardView = new ImageCardView(parent.getContext()) {
Expand All @@ -93,6 +93,7 @@ public void onBindViewHolder(Presenter.ViewHolder viewHolderArgs, Object item) {
final ServerFile serverFile = (ServerFile) item;
ViewHolder viewHolder = (ViewHolder) viewHolderArgs;
viewHolder.mCardView.setTitleText(serverFile.getName());
viewHolder.mCardView.setInfoAreaBackgroundColor(mDefaultBackgroundColor);
if (isMetadataAvailable(serverFile)) {
View fileView = viewHolder.view;
fileView.setTag(ServerFilesMetadataAdapter.Tags.SHARE, serverFile.getParentShare());
Expand Down
13 changes: 13 additions & 0 deletions src/main/res/drawable/splash_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:drawable="@color/background_secondary"/>

<item>
<bitmap
android:gravity="center"
android:src="@drawable/ic_banner"/>
</item>

</layer-list>
4 changes: 4 additions & 0 deletions src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@
<item name="android:windowBackground">@color/background_primary</item>
<item name="android:textColorPrimaryInverse">@color/primary_text_material_light</item>
</style>

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_page</item>
</style>
</resources>

0 comments on commit 35ccb24

Please sign in to comment.