Skip to content

Commit c068f08

Browse files
author
Soofe
committed
Fixed some typos and removed unused imports.
1 parent b7c0a77 commit c068f08

11 files changed

Lines changed: 55 additions & 94 deletions

app/src/main/java/org/schabi/newpipe/ActionBarHandler.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package org.schabi.newpipe;
22

3-
import android.app.DownloadManager;
43
import android.content.Context;
54
import android.content.DialogInterface;
65
import android.content.Intent;
76
import android.content.SharedPreferences;
87
import android.net.Uri;
98
import android.os.Bundle;
10-
import android.preference.Preference;
119
import android.preference.PreferenceManager;
1210
import android.support.v4.view.MenuItemCompat;
1311
import android.support.v7.app.ActionBar;
@@ -19,8 +17,6 @@
1917
import android.view.MenuItem;
2018
import android.widget.ArrayAdapter;
2119

22-
import java.io.File;
23-
2420
/**
2521
* Created by Christian Schabesberger on 18.08.15.
2622
*
@@ -48,7 +44,7 @@ public class ActionBarHandler {
4844
private static ActionBarHandler handler = null;
4945

5046
private Context context = null;
51-
private String webisteUrl = "";
47+
private String websiteUrl = "";
5248
private AppCompatActivity activity;
5349
private VideoInfo.VideoStream[] videoStreams = null;
5450
private VideoInfo.AudioStream audioStream = null;
@@ -64,7 +60,7 @@ public static ActionBarHandler getHandler() {
6460
return handler;
6561
}
6662

67-
class ForamatItemSelectListener implements ActionBar.OnNavigationListener {
63+
class FormatItemSelectListener implements ActionBar.OnNavigationListener {
6864
@Override
6965
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
7066
selectFormatItem((int)itemId);
@@ -98,7 +94,7 @@ public void setStreams(VideoInfo.VideoStream[] videoStreams, VideoInfo.AudioStre
9894
if(activity != null) {
9995
ActionBar ab = activity.getSupportActionBar();
10096
ab.setListNavigationCallbacks(itemAdapter
101-
,new ForamatItemSelectListener());
97+
,new FormatItemSelectListener());
10298
ab.setSelectedNavigationItem(defaultResolutionPos);
10399
}
104100

@@ -114,9 +110,9 @@ public void setStreams(VideoInfo.VideoStream[] videoStreams, VideoInfo.AudioStre
114110
}
115111
} else if(preferedFormat.equals("m4a")){
116112
for(VideoInfo.AudioStream s : audioStreams) {
117-
Log.d(TAG, VideoInfo.getMimeById(s.format) + " : " + Integer.toString(s.bandWidth));
113+
Log.d(TAG, VideoInfo.getMimeById(s.format) + " : " + Integer.toString(s.bandwidth));
118114
if(s.format == VideoInfo.I_M4A &&
119-
(audioStream == null || audioStream.bandWidth > s.bandWidth)) {
115+
(audioStream == null || audioStream.bandwidth > s.bandwidth)) {
120116
audioStream = s;
121117
Log.d(TAG, "last choosen");
122118
}
@@ -162,7 +158,7 @@ public boolean onItemSelected(MenuItem item, Context context) {
162158
if(!videoTitle.isEmpty()) {
163159
Intent intent = new Intent();
164160
intent.setAction(Intent.ACTION_SEND);
165-
intent.putExtra(Intent.EXTRA_TEXT, webisteUrl);
161+
intent.putExtra(Intent.EXTRA_TEXT, websiteUrl);
166162
intent.setType("text/plain");
167163
context.startActivity(Intent.createChooser(intent, context.getString(R.string.shareDialogTitle)));
168164
}
@@ -192,7 +188,7 @@ public boolean onItemSelected(MenuItem item, Context context) {
192188
}
193189

194190
public void setVideoInfo(String websiteUrl, String videoTitle) {
195-
this.webisteUrl = websiteUrl;
191+
this.websiteUrl = websiteUrl;
196192
this.videoTitle = videoTitle;
197193
}
198194

@@ -239,7 +235,7 @@ public void onClick(DialogInterface dialog, int which) {
239235
Intent intent = new Intent(context, PlayVideoActivity.class);
240236
intent.putExtra(PlayVideoActivity.VIDEO_TITLE, videoTitle);
241237
intent.putExtra(PlayVideoActivity.STREAM_URL, videoStreams[selectedStream].url);
242-
intent.putExtra(PlayVideoActivity.VIDEO_URL, webisteUrl);
238+
intent.putExtra(PlayVideoActivity.VIDEO_URL, websiteUrl);
243239
context.startActivity(intent);
244240
}
245241
}
@@ -267,7 +263,7 @@ public void openInBrowser() {
267263
if(!videoTitle.isEmpty()) {
268264
Intent intent = new Intent();
269265
intent.setAction(Intent.ACTION_VIEW);
270-
intent.setData(Uri.parse(webisteUrl));
266+
intent.setData(Uri.parse(websiteUrl));
271267

272268
context.startActivity(Intent.createChooser(intent, context.getString(R.string.chooseBrowser)));
273269
}
@@ -278,7 +274,7 @@ public void playWithKodi() {
278274
try {
279275
Intent intent = new Intent(Intent.ACTION_VIEW);
280276
intent.setPackage(KORE_PACKET);
281-
intent.setData(Uri.parse(webisteUrl.replace("https", "http")));
277+
intent.setData(Uri.parse(websiteUrl.replace("https", "http")));
282278
context.startActivity(intent);
283279
} catch (Exception e) {
284280
e.printStackTrace();

app/src/main/java/org/schabi/newpipe/Extractor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.schabi.newpipe;
22

3-
import android.graphics.Bitmap;
4-
53
/**
64
* Created by Christian Schabesberger on 10.08.15.
75
*

app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import android.content.SharedPreferences;
66
import android.content.pm.ActivityInfo;
77
import android.content.res.Configuration;
8-
import android.content.res.Resources;
98
import android.media.MediaPlayer;
109
import android.net.Uri;
1110
import android.os.Build;
@@ -19,15 +18,11 @@
1918
import android.view.Menu;
2019
import android.view.MenuInflater;
2120
import android.view.MenuItem;
22-
import android.view.Surface;
2321
import android.view.View;
2422
import android.view.WindowManager;
2523
import android.widget.Button;
26-
import android.widget.FrameLayout;
27-
import android.widget.LinearLayout;
2824
import android.widget.MediaController;
2925
import android.widget.ProgressBar;
30-
import android.widget.SeekBar;
3126
import android.widget.VideoView;
3227

3328
/**
@@ -84,7 +79,7 @@ protected void onCreate(Bundle savedInstanceState) {
8479
setContentView(R.layout.activity_play_video);
8580

8681
isLandscape = checkIfLandscape();
87-
hasSoftKeys = checkIfhasSoftKeys();
82+
hasSoftKeys = checkIfHasSoftKeys();
8883

8984
actionBar = getSupportActionBar();
9085
actionBar.setDisplayHomeAsUpEnabled(true);
@@ -203,10 +198,10 @@ public void onConfigurationChanged(Configuration config) {
203198

204199
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
205200
isLandscape = true;
206-
adjustMediaControllMetrics();
201+
adjustMediaControlMetrics();
207202
} else if (config.orientation == Configuration.ORIENTATION_PORTRAIT){
208203
isLandscape = false;
209-
adjustMediaControllMetrics();
204+
adjustMediaControlMetrics();
210205
}
211206
}
212207

@@ -229,7 +224,7 @@ private void showUi() {
229224
uiIsHidden = false;
230225
mediaController.show(100000);
231226
actionBar.show();
232-
adjustMediaControllMetrics();
227+
adjustMediaControlMetrics();
233228
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
234229
Handler handler = new Handler();
235230
handler.postDelayed(new Runnable() {
@@ -259,7 +254,7 @@ private void hideUi() {
259254
WindowManager.LayoutParams.FLAG_FULLSCREEN);
260255
}
261256

262-
private void adjustMediaControllMetrics() {
257+
private void adjustMediaControlMetrics() {
263258
MediaController.LayoutParams mediaControllerLayout
264259
= new MediaController.LayoutParams(MediaController.LayoutParams.MATCH_PARENT,
265260
MediaController.LayoutParams.WRAP_CONTENT);
@@ -274,7 +269,7 @@ private void adjustMediaControllMetrics() {
274269
mediaController.setLayoutParams(mediaControllerLayout);
275270
}
276271

277-
private boolean checkIfhasSoftKeys(){
272+
private boolean checkIfHasSoftKeys(){
278273
if(Build.VERSION.SDK_INT >= 17) {
279274
return getNavigationBarHeight() != 0 || getNavigationBarWidth() != 0;
280275
} else {

app/src/main/java/org/schabi/newpipe/SearchEngine.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.schabi.newpipe;
22

3-
import android.graphics.Bitmap;
4-
53
import java.util.Vector;
64

75
/**

app/src/main/java/org/schabi/newpipe/VideoInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ public VideoStream(String url, int format, String res) {
110110
}
111111

112112
public static class AudioStream {
113-
public AudioStream(String url, int format, int bandWidth, int samplingRate) {
113+
public AudioStream(String url, int format, int bandwidth, int samplingRate) {
114114
this.url = url; this.format = format;
115-
this.bandWidth = bandWidth; this.samplingRate = samplingRate;
115+
this.bandwidth = bandwidth; this.samplingRate = samplingRate;
116116
}
117117
public String url = "";
118118
public int format = -1;
119-
public int bandWidth = -1;
119+
public int bandwidth = -1;
120120
public int samplingRate = -1;
121121

122122
}

app/src/main/java/org/schabi/newpipe/VideoItemDetailActivity.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
package org.schabi.newpipe;
22

3-
import android.content.ContentProviderOperation;
4-
import android.content.res.Configuration;
5-
import android.os.Build;
6-
import android.preference.PreferenceManager;
7-
import android.support.v7.app.ActionBar;
8-
import android.support.v7.app.AppCompatActivity;
93
import android.content.Intent;
104
import android.os.Bundle;
5+
import android.preference.PreferenceManager;
116
import android.support.v4.app.NavUtils;
12-
import android.util.DisplayMetrics;
13-
import android.util.Log;
7+
import android.support.v7.app.AppCompatActivity;
148
import android.view.Menu;
159
import android.view.MenuInflater;
1610
import android.view.MenuItem;
17-
import android.view.WindowManager;
18-
19-
import org.schabi.newpipe.youtube.YoutubeExtractor;
2011

2112

2213
/**

app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,23 @@
33
import android.app.Activity;
44
import android.graphics.Bitmap;
55
import android.graphics.BitmapFactory;
6-
import android.media.Image;
76
import android.os.Bundle;
87
import android.os.Handler;
98
import android.preference.PreferenceManager;
109
import android.support.design.widget.FloatingActionButton;
1110
import android.support.v4.app.Fragment;
12-
import android.support.v7.app.ActionBar;
1311
import android.text.Html;
1412
import android.text.method.LinkMovementMethod;
1513
import android.util.DisplayMetrics;
1614
import android.util.Log;
1715
import android.view.LayoutInflater;
1816
import android.view.View;
1917
import android.view.ViewGroup;
20-
import android.widget.GridLayout;
2118
import android.widget.ImageView;
22-
import android.widget.ListView;
2319
import android.widget.ProgressBar;
2420
import android.widget.RelativeLayout;
2521
import android.widget.TextView;
2622

27-
2823
import java.net.URL;
2924
import java.util.Vector;
3025

@@ -216,7 +211,7 @@ public void updateInfo(VideoInfo info) {
216211
thumbnailView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.not_available_monkey));
217212
break;
218213
default:
219-
Log.e(TAG, "Video Availeble Status not known.");
214+
Log.e(TAG, "Video Available Status not known.");
220215
}
221216

222217
if(autoPlayEnabled) {

app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22

33
import android.content.Context;
44
import android.content.Intent;
5-
import android.content.res.Configuration;
6-
import android.os.Build;
75
import android.os.Bundle;
8-
import android.os.Environment;
9-
import android.preference.PreferenceManager;
106
import android.support.v7.app.AppCompatActivity;
11-
import android.util.DisplayMetrics;
12-
import android.util.Log;
7+
import android.support.v7.widget.SearchView;
138
import android.view.Menu;
149
import android.view.MenuInflater;
1510
import android.view.MenuItem;
1611
import android.view.View;
17-
import android.view.WindowManager;
1812
import android.view.inputmethod.InputMethodManager;
19-
import android.support.v7.widget.SearchView;
2013
import android.widget.ImageView;
2114

2215
/**

app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import android.widget.Toast;
1414

1515
import java.net.URL;
16-
import java.util.List;
1716
import java.util.Vector;
1817

1918

@@ -54,14 +53,14 @@ public class VideoItemListFragment extends ListFragment {
5453

5554
private class ResultRunnable implements Runnable {
5655
private SearchEngine.Result result;
57-
private int reuqestId;
56+
private int requestId;
5857
public ResultRunnable(SearchEngine.Result result, int requestId) {
5958
this.result = result;
60-
this.reuqestId = requestId;
59+
this.requestId = requestId;
6160
}
6261
@Override
6362
public void run() {
64-
updateListOnResult(result, reuqestId);
63+
updateListOnResult(result, requestId);
6564
}
6665
}
6766

@@ -213,7 +212,7 @@ private void updateList(Vector<VideoInfoItem> list) {
213212
loadThumbsThread = new Thread(loadThumbsRunnable);
214213
loadThumbsThread.start();
215214
} catch(java.lang.IllegalStateException e) {
216-
Log.w(TAG, "Trying to set value while activity is not existing anymore.");
215+
Log.w(TAG, "Trying to set value while activity doesn't anymore.");
217216
} catch(Exception e) {
218217
e.printStackTrace();
219218
}
@@ -230,7 +229,7 @@ public void terminateThreads() {
230229
}
231230
if(searchThread != null) {
232231
searchRunnable.terminate();
233-
// No need to join, since we don't realy terminate the thread. We just demand
232+
// No need to join, since we don't really terminate the thread. We just demand
234233
// it to post its result runnable into the gui main loop.
235234
}
236235
}

0 commit comments

Comments
 (0)