Skip to content

Commit

Permalink
AbsTractGithubFragment: fall back to default url
Browse files Browse the repository at this point in the history
if there is no url in buid.prop then app will use default url to show list
  • Loading branch information
androidlover5842 committed Jan 12, 2017
1 parent 163d055 commit b948a45
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand All @@ -27,6 +28,7 @@ abstract public class AbstractGithubFragment extends ListFragment
private AbstractGithubAdapter mAdapter;
private String mTargetURL;
private JSONArray mAwaitedList;
private String TAG="AbsreacrGithubFragment";

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState)
Expand Down Expand Up @@ -140,6 +142,13 @@ public void run()
{
final StringBuilder result = new StringBuilder();

if (!isUrlValid(mTargetURL))
{
mTargetURL="https://raw.githubusercontent.com/Grace5921/OtaUpdater/master/updater-old-release.json";
Log.e(TAG,"no url found in build.prop using default url");
}
Log.i(TAG,"Url = "+mTargetURL);

HttpRequest httpRequest = HttpRequest.get(mTargetURL);
httpRequest.receive(result);

Expand All @@ -154,4 +163,8 @@ public void run()
}
}.start();
}
private boolean isUrlValid(String password) {
return password.length() > 4;
}

}

0 comments on commit b948a45

Please sign in to comment.