Skip to content

Commit fe8d095

Browse files
committed
Improvement of Code Quality-2
1 parent b69d05b commit fe8d095

25 files changed

Lines changed: 13 additions & 137 deletions

source-code/app/src/main/java/org/buildmlearn/toolkit/activity/HomeActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
public class HomeActivity extends AppCompatActivity
2020
implements NavigationDrawerFragment.NavigationDrawerCallbacks {
2121

22-
private CharSequence mTitle;
2322
private Section currentSection;
2423

2524
/**
@@ -39,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
3938
*/
4039
NavigationDrawerFragment mNavigationDrawerFragment = (NavigationDrawerFragment)
4140
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
42-
mTitle = getTitle();
41+
CharSequence mTitle = getTitle();
4342

4443
// Set up the drawer.
4544
mNavigationDrawerFragment.setUp(

source-code/app/src/main/java/org/buildmlearn/toolkit/templates/VideoCollectionTemplate.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ public class VideoCollectionTemplate implements TemplateInterface {
4545
private static final String YOUTUBE_SHORT = "youtu.be";
4646
private static final String DAILYMOTION = "dailymotion";
4747
private static final String VIMEO = "vimeo";
48-
private final String JSON_TITLE = "title";
49-
private final String JSON_DESCRIPTION = "description";
50-
private final String JSON_THUMBNAIL_URL = "thumbnail_url";
51-
private final String META_PROPERTY_TITLE = "meta[property=og:title]";
52-
private final String META_PROPERTY_DESCRIPTION = "meta[property=og:description]";
53-
private final String META_PROPERTY_THUMBNAIL_URL = "meta[property=og:image]";
54-
private final String META_CONTENT = "content";
55-
private final String USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36";
56-
private final int TIMEOUT_LIMIT = 60000;
57-
private final String DAILYMOTION_OEMBED_LINK = "http://www.dailymotion.com/services/oembed?url=";
58-
private final String VIMEO_OEMBED_LINK = "https://vimeo.com/api/oembed.json?url=";
5948
private final String TEMPLATE_NAME = "VideoCollection Template";
6049
transient private VideoCollectionAdapter adapter;
6150
private ArrayList<VideoModel> videoData;
@@ -187,13 +176,15 @@ private String convertLink(String link) {
187176
link = "https://" + link;
188177
}
189178

179+
String DAILYMOTION_OEMBED_LINK = "http://www.dailymotion.com/services/oembed?url=";
190180
return DAILYMOTION_OEMBED_LINK + link;
191181

192182
} else if (link.contains(VIMEO)) {
193183
if (!(link.contains("http:") || link.contains("https:"))) {
194184
link = "https://" + link;
195185
}
196186

187+
String VIMEO_OEMBED_LINK = "https://vimeo.com/api/oembed.json?url=";
197188
return VIMEO_OEMBED_LINK + link;
198189
}
199190

@@ -390,18 +381,24 @@ protected String doInBackground(String... params) {
390381

391382
if (BASE_URL.contains(YOUTUBE + ".com")) {
392383
try {
384+
int TIMEOUT_LIMIT = 60000;
385+
String USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36";
393386
org.jsoup.nodes.Document document = Jsoup.connect(BASE_URL)
394387
.timeout(TIMEOUT_LIMIT)
395388
.userAgent(USER_AGENT)
396389
.ignoreContentType(true)
397390
.get();
398391

392+
String META_PROPERTY_TITLE = "meta[property=og:title]";
399393
Elements titleElem = document.select(META_PROPERTY_TITLE);
394+
String META_CONTENT = "content";
400395
String title = titleElem.attr(META_CONTENT);
401396

397+
String META_PROPERTY_DESCRIPTION = "meta[property=og:description]";
402398
Elements descriptionElem = document.select(META_PROPERTY_DESCRIPTION);
403399
String description = descriptionElem.attr(META_CONTENT);
404400

401+
String META_PROPERTY_THUMBNAIL_URL = "meta[property=og:image]";
405402
Elements thumbnailElem = document.select(META_PROPERTY_THUMBNAIL_URL);
406403
String thumbnail_url = thumbnailElem.attr(META_CONTENT);
407404

@@ -476,8 +473,11 @@ protected void onPostExecute(String result) {
476473

477474
try {
478475
JSONObject json = new JSONObject(result);
476+
String JSON_TITLE = "title";
479477
String title = json.getString(JSON_TITLE);
478+
String JSON_DESCRIPTION = "description";
480479
String description = json.getString(JSON_DESCRIPTION);
480+
String JSON_THUMBNAIL_URL = "thumbnail_url";
481481
String thumbnail_url = json.getString(JSON_THUMBNAIL_URL);
482482

483483
if (position.equals("-1")) {

source-code/app/src/main/java/org/buildmlearn/toolkit/utilities/SignerThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public class SignerThread extends Thread {
7878
private static boolean needRemoveLib;
7979
private static String newPackageFullName;
8080
private static boolean changed;
81-
private final String signatureAlgorithm = "SHA1withRSA";
8281
private final ToolkitApplication toolkit;
8382
private final Context context;
8483
private final String assetsApk;
@@ -225,6 +224,7 @@ public void run() {
225224
Log.d(TAG, "Final APK: " + finalApk);
226225
}
227226

227+
String signatureAlgorithm = "SHA1withRSA";
228228
CustomKeySigner.signZip(zipSigner, keystoreFile.getAbsolutePath(), keyPass,
229229
keyDetails.getAlias(), aliasPass, signatureAlgorithm, inputFile, finalApk);
230230

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)