Skip to content

Commit

Permalink
settings added;
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelessjolt committed Sep 17, 2018
1 parent 36a6fcf commit bcb1a1e
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 19 deletions.
30 changes: 20 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<activity android:name=".Activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
Expand All @@ -24,9 +25,9 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="https"
android:host="www.youtube.com"
android:pathPrefix="/watch" />
android:pathPrefix="/watch"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand All @@ -35,9 +36,9 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="https"
android:host="m.youtube.com"
android:pathPattern="/watch" />
android:pathPattern="/watch"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand All @@ -46,16 +47,25 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="https"
android:host="youtu.be" />
android:host="youtu.be"
android:scheme="https" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
<action android:name="android.intent.action.SEND" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".Activities.SettingsActivity"
android:label="Settings"
android:parentActivityName=".Activities.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".Activities.MainActivity"/>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import me.harshithgoka.youtubedl.YoutubeDL.Format;
import me.harshithgoka.youtubedl.Adapters.FormatAdapter;
import me.harshithgoka.youtubedl.R;
import me.harshithgoka.youtubedl.UI.RecyclerViewEmptySupport;
import me.harshithgoka.youtubedl.CustomUI.RecyclerViewEmptySupport;
import me.harshithgoka.youtubedl.YoutubeDL.VideoInfo;
import me.harshithgoka.youtubedl.Adapters.VideoInfoAdapter;

Expand Down Expand Up @@ -229,6 +229,8 @@ public boolean onCreateOptionsMenu(Menu menu) {

public void openSettingPage() {
Toast.makeText(getApplicationContext(), "Settings page coming soon!", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package me.harshithgoka.youtubedl.Activities;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import me.harshithgoka.youtubedl.Fragments.SettingsFragment;
import me.harshithgoka.youtubedl.R;

import android.os.Bundle;

public class SettingsActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
getSupportFragmentManager().beginTransaction()
.replace(R.id.settings_content, new SettingsFragment())
.commit();

Toolbar toolbar = findViewById(R.id.settings_toolbar);
setSupportActionBar(toolbar);

ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package me.harshithgoka.youtubedl.UI;
package me.harshithgoka.youtubedl.CustomUI;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

public class RecyclerViewEmptySupport extends RecyclerView {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.harshithgoka.youtubedl.Fragments;


import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.preference.PreferenceFragmentCompat;
import me.harshithgoka.youtubedl.R;

/**
* A simple {@link Fragment} subclass.
*/
public class SettingsFragment extends PreferenceFragmentCompat {


public SettingsFragment() {
// Required empty public constructor
}

@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.preferences, rootKey);
}

}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/historyRecyclerView" />

<me.harshithgoka.youtubedl.UI.RecyclerViewEmptySupport
<me.harshithgoka.youtubedl.CustomUI.RecyclerViewEmptySupport
android:id="@+id/historyRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -122,7 +122,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">

</me.harshithgoka.youtubedl.UI.RecyclerViewEmptySupport>
</me.harshithgoka.youtubedl.CustomUI.RecyclerViewEmptySupport>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
Expand Down
41 changes: 41 additions & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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"
tools:context=".Activities.SettingsActivity">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/settings_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/backgroundColor"
android:padding="@dimen/text_margin">
<TextView
android:id="@+id/settings_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:fontFamily="@font/renner"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
android:text="@string/settings_name"/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/settings_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/formats_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
android:background="@android:color/darker_gray"
app:layout_constraintTop_toBottomOf="@+id/video_title" />

<me.harshithgoka.youtubedl.UI.RecyclerViewEmptySupport
<me.harshithgoka.youtubedl.CustomUI.RecyclerViewEmptySupport
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -63,7 +63,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressBar">

</me.harshithgoka.youtubedl.UI.RecyclerViewEmptySupport>
</me.harshithgoka.youtubedl.CustomUI.RecyclerViewEmptySupport>

<ProgressBar
android:id="@+id/progressBar"
Expand Down
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 @@ -97,4 +97,8 @@
<string name="start_button">Start</string>
<string name="formats_button">All formats</string>
<string name="empty_history">It\'s lonely here, you could download a few videos.</string>

<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="settings_name">Settings</string>
</resources>

0 comments on commit bcb1a1e

Please sign in to comment.