repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
SW-Team/java-TelegramBot
src/milk/telegram/type/callback/CallbackQuery.java
// Path: src/milk/telegram/type/Identifier.java // public interface Identifier<T>{ // // T getId(); // // } // // Path: src/milk/telegram/type/message/Message.java // public class Message implements Identifier<Integer>{ // // private final int date; // private final int message_id; // // private fi...
import milk.telegram.type.Identifier; import milk.telegram.type.message.Message; import milk.telegram.type.user.User; import org.json.JSONObject;
package milk.telegram.type.callback; public class CallbackQuery implements Identifier<String>{ private final String id; private final User from;
// Path: src/milk/telegram/type/Identifier.java // public interface Identifier<T>{ // // T getId(); // // } // // Path: src/milk/telegram/type/message/Message.java // public class Message implements Identifier<Integer>{ // // private final int date; // private final int message_id; // // private fi...
private final Message message;
SW-Team/java-TelegramBot
src/milk/telegram/type/file/Document.java
// Path: src/milk/telegram/type/file/photo/PhotoSize.java // public class PhotoSize implements Identifier<String>{ // // private final String id; // // private final int width; // private final int height; // // private final Integer size; // // private PhotoSize(JSONObject object){ // t...
import milk.telegram.type.file.photo.PhotoSize; import milk.telegram.type.Identifier; import org.json.JSONObject;
package milk.telegram.type.file; public class Document implements Identifier<String>{ private final String file_id; private final String file_name; private final String mime_type;
// Path: src/milk/telegram/type/file/photo/PhotoSize.java // public class PhotoSize implements Identifier<String>{ // // private final String id; // // private final int width; // private final int height; // // private final Integer size; // // private PhotoSize(JSONObject object){ // t...
private final PhotoSize thumb;
SW-Team/java-TelegramBot
src/milk/telegram/type/reply/InlineKeyboardMarkup.java
// Path: src/milk/telegram/type/inline/InlineKeyboardButton.java // public class InlineKeyboardButton extends JSONObject{ // // public InlineKeyboardButton setText(String text){ // this.put("text", text); // return this; // } // // public InlineKeyboardButton setUrl(String url){ // ...
import milk.telegram.type.inline.InlineKeyboardButton; import org.json.JSONArray;
package milk.telegram.type.reply; public class InlineKeyboardMarkup extends ReplyMarkup{ public InlineKeyboardMarkup(){ this.put("inline_keyboard", new JSONArray()); }
// Path: src/milk/telegram/type/inline/InlineKeyboardButton.java // public class InlineKeyboardButton extends JSONObject{ // // public InlineKeyboardButton setText(String text){ // this.put("text", text); // return this; // } // // public InlineKeyboardButton setUrl(String url){ // ...
public InlineKeyboardButton getButton(int column, int row){
SW-Team/java-TelegramBot
src/milk/telegram/type/reply/ReplyKeyboardMarkup.java
// Path: src/milk/telegram/type/callback/KeyboardButton.java // public class KeyboardButton extends JSONObject{ // // public KeyboardButton setText(String text){ // this.put("text", text); // return this; // } // // public KeyboardButton setRequestContact(boolean request_contact){ // ...
import milk.telegram.type.callback.KeyboardButton; import org.json.JSONArray;
package milk.telegram.type.reply; public class ReplyKeyboardMarkup extends ReplyMarkup{ public ReplyKeyboardMarkup(){ this.put("keyboard", new JSONArray()); } public Boolean getSelective(){ return this.optBoolean("selective"); } public Boolean getResizeKeyboard(){ retur...
// Path: src/milk/telegram/type/callback/KeyboardButton.java // public class KeyboardButton extends JSONObject{ // // public KeyboardButton setText(String text){ // this.put("text", text); // return this; // } // // public KeyboardButton setRequestContact(boolean request_contact){ // ...
public KeyboardButton getButton(int column, int row){
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BasePresenter.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/DataManager.java // public interface DataManager extends PreferencesHelper, DbHelper, ApiHelper { // } // // Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // ...
import android.support.annotation.NonNull; import javax.inject.Inject; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.data.remote.helper.CompositeDisposableHelper;
package mk.petrovski.weathergurumvp.ui.base; /** * Base class that implements the Presenter interface and provides a base implementation for * attachView() and detachView(). It also handles keeping a reference to the mvpView that * can be accessed from the children classes by calling getMvpView(). */ public class...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/DataManager.java // public interface DataManager extends PreferencesHelper, DbHelper, ApiHelper { // } // // Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // ...
DataManager dataManager;
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/weather_models/HourlyModel.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/ValueModel.java // public class ValueModel { // private String value; // // public ValueModel(String value) { // this.value = value; // } // // public String getValue() { // return value; // } // // public vo...
import java.util.List; import mk.petrovski.weathergurumvp.data.remote.model.location_models.ValueModel;
package mk.petrovski.weathergurumvp.data.remote.model.weather_models; /** * Created by Nikola Petrovski on 2/13/2017. */ public class HourlyModel { private String chanceoffog; private String chanceoffrost; private String chanceofhightemp; private String chanceofovercast; private String chanceofrain; pr...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/ValueModel.java // public class ValueModel { // private String value; // // public ValueModel(String value) { // this.value = value; // } // // public String getValue() { // return value; // } // // public vo...
private List<ValueModel> weatherDesc;
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/component/ApplicationComponent.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/WeatherGuruApplication.java // public class WeatherGuruApplication extends Application { // // @Inject CalligraphyConfig calligraphyConfig; // // public static ApplicationComponent applicationComponent; // // @Override public void onCreate() { // super...
import android.content.Context; import dagger.Component; import mk.petrovski.weathergurumvp.WeatherGuruApplication; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.injection.module.ApplicationModule; import mk.petrovski.weathergurumvp.injection.qualifier.ApplicationContext; impor...
package mk.petrovski.weathergurumvp.injection.component; /** * Created by Nikola Petrovski on 2/13/2017. */ @WeatherGuruApplicationScope @Component(modules = ApplicationModule.class) public interface ApplicationComponent {
// Path: app/src/main/java/mk/petrovski/weathergurumvp/WeatherGuruApplication.java // public class WeatherGuruApplication extends Application { // // @Inject CalligraphyConfig calligraphyConfig; // // public static ApplicationComponent applicationComponent; // // @Override public void onCreate() { // super...
void inject(WeatherGuruApplication application);
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/component/ApplicationComponent.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/WeatherGuruApplication.java // public class WeatherGuruApplication extends Application { // // @Inject CalligraphyConfig calligraphyConfig; // // public static ApplicationComponent applicationComponent; // // @Override public void onCreate() { // super...
import android.content.Context; import dagger.Component; import mk.petrovski.weathergurumvp.WeatherGuruApplication; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.injection.module.ApplicationModule; import mk.petrovski.weathergurumvp.injection.qualifier.ApplicationContext; impor...
package mk.petrovski.weathergurumvp.injection.component; /** * Created by Nikola Petrovski on 2/13/2017. */ @WeatherGuruApplicationScope @Component(modules = ApplicationModule.class) public interface ApplicationComponent { void inject(WeatherGuruApplication application); @ApplicationContext Context context()...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/WeatherGuruApplication.java // public class WeatherGuruApplication extends Application { // // @Inject CalligraphyConfig calligraphyConfig; // // public static ApplicationComponent applicationComponent; // // @Override public void onCreate() { // super...
DataManager getDataManager();
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/ApiInterface.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/SearchApiResponseModel.java // public class SearchApiResponseModel extends DataResponseModel { // private ResultModel search_api; // // public ResultModel getSearch_api() { // return search_api; // } // // public void...
import io.reactivex.Observable; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data.remote.model.weather_models.WeatherResponseModel; import retrofit2.http.GET; import retrofit2.http.Query;
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/13/2017. */ public interface ApiInterface { @GET(ApiConsts.LOCATION_SEARCH_API_URL) Observable<SearchApiResponseModel> getLocations( @Query("query") String query, @Query("key") String key, @Query("format") String forma...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/SearchApiResponseModel.java // public class SearchApiResponseModel extends DataResponseModel { // private ResultModel search_api; // // public ResultModel getSearch_api() { // return search_api; // } // // public void...
@GET(ApiConsts.WEATHER_API_URL) Observable<WeatherResponseModel> checkWeather(
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/BaseViewSubscriber.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.observers.DisposableObserver; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.helper.error.InternetConnectionException; import mk.petrovski.weathergurumvp.ui.base.BaseMvpView;
package mk.petrovski.weathergurumvp.data.remote.helper; /** * Created by Nikola Petrovski on 2/22/2017. */ /** * Default DisposableObserver base class to be used whenever you want default error handling */ public class BaseViewSubscriber<V extends BaseMvpView, T> extends DisposableObserver<T> { private V vie...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
private ErrorHandlerHelper errorHandlerHelper;
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/BaseViewSubscriber.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.observers.DisposableObserver; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.helper.error.InternetConnectionException; import mk.petrovski.weathergurumvp.ui.base.BaseMvpView;
package mk.petrovski.weathergurumvp.data.remote.helper; /** * Created by Nikola Petrovski on 2/22/2017. */ /** * Default DisposableObserver base class to be used whenever you want default error handling */ public class BaseViewSubscriber<V extends BaseMvpView, T> extends DisposableObserver<T> { private V vie...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
onError(new InternetConnectionException());
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/weather_models/WeatherModel.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/utils/DateUtils.java // public class DateUtils { // // /** // * Check if some date is the current day // */ // private static boolean isToday(String date) { // return DateTimeComparator.getDateOnlyInstance().compare(new DateTime(), new DateTime(date)...
import java.util.List; import mk.petrovski.weathergurumvp.utils.DateUtils;
package mk.petrovski.weathergurumvp.data.remote.model.weather_models; /** * Created by Nikola Petrovski on 2/13/2017. */ public class WeatherModel { private List<AstronomyModel> astronomy; private String date; private List<HourlyModel> hourly; private String maxtempC; private String maxtempF; private S...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/utils/DateUtils.java // public class DateUtils { // // /** // * Check if some date is the current day // */ // private static boolean isToday(String date) { // return DateTimeComparator.getDateOnlyInstance().compare(new DateTime(), new DateTime(date)...
return DateUtils.getMonthName(date);
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/RxModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // // public CompositeDisposable disposables; // public BaseSchedulerProvider schedulerProvider; // // @Inject public CompositeDisposableHelper(CompositeDisposable...
import dagger.Module; import dagger.Provides; import io.reactivex.disposables.CompositeDisposable; import mk.petrovski.weathergurumvp.data.remote.helper.CompositeDisposableHelper; import mk.petrovski.weathergurumvp.utils.reactive.SchedulerProvider;
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 2/23/2017. */ @Module public class RxModule { @Provides CompositeDisposable getCompositeDisposable() { return new CompositeDisposable(); }
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // // public CompositeDisposable disposables; // public BaseSchedulerProvider schedulerProvider; // // @Inject public CompositeDisposableHelper(CompositeDisposable...
@Provides SchedulerProvider getSchedulerProvider() {
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/RxModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // // public CompositeDisposable disposables; // public BaseSchedulerProvider schedulerProvider; // // @Inject public CompositeDisposableHelper(CompositeDisposable...
import dagger.Module; import dagger.Provides; import io.reactivex.disposables.CompositeDisposable; import mk.petrovski.weathergurumvp.data.remote.helper.CompositeDisposableHelper; import mk.petrovski.weathergurumvp.utils.reactive.SchedulerProvider;
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 2/23/2017. */ @Module public class RxModule { @Provides CompositeDisposable getCompositeDisposable() { return new CompositeDisposable(); } @Provides SchedulerProvider getSchedulerProvider() { return new Sched...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java // public class CompositeDisposableHelper { // // public CompositeDisposable disposables; // public BaseSchedulerProvider schedulerProvider; // // @Inject public CompositeDisposableHelper(CompositeDisposable...
@Provides CompositeDisposableHelper getCompositeDisposableHelper(
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/ApiHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.Observable; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data.remote.model.weather_models.WeatherResponseModel;
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/23/2017. */ public interface ApiHelper { Observable<WeatherResponseModel> weatherApiRequest(String latitude, String longitude);
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
Observable<SearchApiResponseModel> locationsApiRequest(String query);
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/ApiHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.Observable; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data.remote.model.weather_models.WeatherResponseModel;
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/23/2017. */ public interface ApiHelper { Observable<WeatherResponseModel> weatherApiRequest(String latitude, String longitude); Observable<SearchApiResponseModel> locationsApiRequest(String query);
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
ErrorHandlerHelper getErrorHandlerHelper();
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/ApplicationModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
import android.app.Application; import android.content.Context; import dagger.Module; import dagger.Provides; import mk.petrovski.weathergurumvp.R; import mk.petrovski.weathergurumvp.data.AppDataManager; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.data.local.db.DbHelper; impo...
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 2/13/2017. */ @Module(includes = { ContextModule.class, PreferencesModule.class, NetworkModule.class, DatabaseModule.class }) public class ApplicationModule { private final Application application; public Applicati...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
@Provides @WeatherGuruApplicationScope AppDataManager getAppDataManager(
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/ApplicationModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
import android.app.Application; import android.content.Context; import dagger.Module; import dagger.Provides; import mk.petrovski.weathergurumvp.R; import mk.petrovski.weathergurumvp.data.AppDataManager; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.data.local.db.DbHelper; impo...
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 2/13/2017. */ @Module(includes = { ContextModule.class, PreferencesModule.class, NetworkModule.class, DatabaseModule.class }) public class ApplicationModule { private final Application application; public Applicati...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
@ApplicationContext Context context, PreferencesHelper preferencesHelper, DbHelper dbHelper,
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/ApplicationModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
import android.app.Application; import android.content.Context; import dagger.Module; import dagger.Provides; import mk.petrovski.weathergurumvp.R; import mk.petrovski.weathergurumvp.data.AppDataManager; import mk.petrovski.weathergurumvp.data.DataManager; import mk.petrovski.weathergurumvp.data.local.db.DbHelper; impo...
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 2/13/2017. */ @Module(includes = { ContextModule.class, PreferencesModule.class, NetworkModule.class, DatabaseModule.class }) public class ApplicationModule { private final Application application; public Applicati...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/AppDataManager.java // public class AppDataManager implements DataManager { // // private final Context context; // private final DbHelper dbHelper; // private final PreferencesHelper applicationPreferences; // private final ApiHelper apiHelper; // /...
@ApplicationContext Context context, PreferencesHelper preferencesHelper, DbHelper dbHelper,
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/local/db/AppDbHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/LocationModel.java // public class LocationModel { // private List<ValueModel> areaName; // private List<ValueModel> country; // private String latitude; // private String longitude; // private String population; // pri...
import io.reactivex.Observable; import java.util.List; import java.util.concurrent.Callable; import javax.inject.Inject; import mk.petrovski.weathergurumvp.data.remote.model.location_models.LocationModel;
package mk.petrovski.weathergurumvp.data.local.db; /** * Created by Nikola Petrovski on 2/20/2017. */ public class AppDbHelper implements DbHelper { DaoSession daoSession; @Inject public AppDbHelper(DaoSession daoSession) { this.daoSession = daoSession; }
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/location_models/LocationModel.java // public class LocationModel { // private List<ValueModel> areaName; // private List<ValueModel> country; // private String latitude; // private String longitude; // private String population; // pri...
@Override public Observable<Long> addNewCity(final LocationModel location) {
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/error_models/DataResponseModel.java // public class DataResponseModel { // private ErrorModel data; // // public ErrorModel getData() { // return data; // } // // public void setData(ErrorModel data) { // this.data = data; // }...
import android.accounts.NetworkErrorException; import android.content.Context; import android.support.annotation.NonNull; import com.google.gson.JsonSyntaxException; import com.jakewharton.retrofit2.adapter.rxjava2.HttpException; import java.io.IOException; import java.lang.annotation.Annotation; import javax.inject.In...
package mk.petrovski.weathergurumvp.data.remote.helper.error; /** * Created by Nikola Petrovski on 2/22/2017. */ public class ErrorHandlerHelper { Context context; Retrofit retrofit; @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { this.context = context; this.retrofit = retr...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/error_models/DataResponseModel.java // public class DataResponseModel { // private ErrorModel data; // // public ErrorModel getData() { // return data; // } // // public void setData(ErrorModel data) { // this.data = data; // }...
Converter<ResponseBody, DataResponseModel> converter =
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/AppApiHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.Observable; import javax.inject.Inject; import mk.petrovski.weathergurumvp.BuildConfig; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data...
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/23/2017. */ public class AppApiHelper implements ApiHelper { ApiInterface apiInterface;
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
ErrorHandlerHelper errorHandlerHelper;
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/AppApiHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.Observable; import javax.inject.Inject; import mk.petrovski.weathergurumvp.BuildConfig; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data...
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/23/2017. */ public class AppApiHelper implements ApiHelper { ApiInterface apiInterface; ErrorHandlerHelper errorHandlerHelper; final String format = "json"; final String key = BuildConfig.WWO_API_KEY; @Inject publi...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
public Observable<WeatherResponseModel> weatherApiRequest(String latitude, String longitude) {
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/AppApiHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
import io.reactivex.Observable; import javax.inject.Inject; import mk.petrovski.weathergurumvp.BuildConfig; import mk.petrovski.weathergurumvp.data.remote.helper.error.ErrorHandlerHelper; import mk.petrovski.weathergurumvp.data.remote.model.location_models.SearchApiResponseModel; import mk.petrovski.weathergurumvp.data...
package mk.petrovski.weathergurumvp.data.remote; /** * Created by Nikola Petrovski on 2/23/2017. */ public class AppApiHelper implements ApiHelper { ApiInterface apiInterface; ErrorHandlerHelper errorHandlerHelper; final String format = "json"; final String key = BuildConfig.WWO_API_KEY; @Inject publi...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/error/ErrorHandlerHelper.java // public class ErrorHandlerHelper { // // Context context; // Retrofit retrofit; // // @Inject public ErrorHandlerHelper(Context context, Retrofit retrofit) { // this.context = context; // this.retro...
@Override public Observable<SearchApiResponseModel> locationsApiRequest(String query) {
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/data/remote/helper/CompositeDisposableHelper.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/utils/reactive/BaseSchedulerProvider.java // public interface BaseSchedulerProvider { // // @NonNull Scheduler io(); // // @NonNull Scheduler ui(); // // @NonNull Scheduler computation(); // }
import io.reactivex.Observable; import io.reactivex.ObservableSource; import io.reactivex.ObservableTransformer; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Action; import io.reac...
package mk.petrovski.weathergurumvp.data.remote.helper; /** * Created by Nikola Petrovski on 2/22/2017. */ public class CompositeDisposableHelper { public CompositeDisposable disposables;
// Path: app/src/main/java/mk/petrovski/weathergurumvp/utils/reactive/BaseSchedulerProvider.java // public interface BaseSchedulerProvider { // // @NonNull Scheduler io(); // // @NonNull Scheduler ui(); // // @NonNull Scheduler computation(); // } // Path: app/src/main/java/mk/petrovski/weathergurumvp/data/r...
public BaseSchedulerProvider schedulerProvider;
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/utils/AppUtils.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BaseActivity.java // public abstract class BaseActivity extends AppCompatActivity implements BaseMvpView { // // private ActivityFragmentComponent activityFragmentComponent; // private Unbinder unbinder; // private ProgressDialog progressDialog; // ...
import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.view.inputmethod.InputMethodManager; import mk.petrovski.w...
package mk.petrovski.weathergurumvp.utils; /** * Created by Nikola Petrovski on 2/14/2017. */ public class AppUtils { /** * Check for internet connection */ public static boolean isNetworkAvailable(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Con...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BaseActivity.java // public abstract class BaseActivity extends AppCompatActivity implements BaseMvpView { // // private ActivityFragmentComponent activityFragmentComponent; // private Unbinder unbinder; // private ProgressDialog progressDialog; // ...
((BaseActivity) context).getCurrentFocus().getWindowToken(), 0);
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BaseFragment.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/injection/component/ActivityFragmentComponent.java // @ActivityScope // @Component(dependencies = ApplicationComponent.class, modules = ActivityFragmentModule.class) // public interface ActivityFragmentComponent { // // void inject(MainActivity mainActivity); //...
import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v4.app.Fragment; import butterknife.Unbinder; import mk.petrovski.weathergurumvp.injection.component.ActivityFragmentComponent;
@Override public void onError(@StringRes int resId) { if (baseActivity != null) { baseActivity.onError(resId); } } @Override public void onError(String message) { if (baseActivity != null) { baseActivity.onError(message); } } @Override public boolean isNetworkConnected() { r...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/injection/component/ActivityFragmentComponent.java // @ActivityScope // @Component(dependencies = ApplicationComponent.class, modules = ActivityFragmentModule.class) // public interface ActivityFragmentComponent { // // void inject(MainActivity mainActivity); //...
public ActivityFragmentComponent getActivityFragmentComponent() {
nikacotAndroid/Weather-Guru-MVP
app/src/test/java/mk/petrovski/weathergurumvp/data/PreferencesHelperTest.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
import mk.petrovski.weathergurumvp.BuildConfig; import mk.petrovski.weathergurumvp.data.local.preferences.AppPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.CommonPreferencesHelper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robol...
package mk.petrovski.weathergurumvp.data; /** * Created by Nikola Petrovski on 4/3/2017. */ @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 25) public class PreferencesHelperTest {
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
private AppPreferencesHelper appPreferencesHelper;
nikacotAndroid/Weather-Guru-MVP
app/src/test/java/mk/petrovski/weathergurumvp/data/PreferencesHelperTest.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
import mk.petrovski.weathergurumvp.BuildConfig; import mk.petrovski.weathergurumvp.data.local.preferences.AppPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.CommonPreferencesHelper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robol...
package mk.petrovski.weathergurumvp.data; /** * Created by Nikola Petrovski on 4/3/2017. */ @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 25) public class PreferencesHelperTest { private AppPreferencesHelper appPreferencesHelper; @Before public void setUp(){
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
CommonPreferencesHelper commonPreferencesHelper = new CommonPreferencesHelper(
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/PreferencesModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
import android.content.Context; import dagger.Module; import dagger.Provides; import mk.petrovski.weathergurumvp.data.local.preferences.AppPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.CommonPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.PreferencesHelper; im...
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 3/1/2017. */ @Module(includes = ContextModule.class) public class PreferencesModule { @Provides @WeatherGuruApplicationScope CommonPreferencesHelper getPreferencesHelper( @ApplicationContext Context context) { re...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
@Provides @WeatherGuruApplicationScope PreferencesHelper getApplicationPreferences(
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/injection/module/PreferencesModule.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
import android.content.Context; import dagger.Module; import dagger.Provides; import mk.petrovski.weathergurumvp.data.local.preferences.AppPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.CommonPreferencesHelper; import mk.petrovski.weathergurumvp.data.local.preferences.PreferencesHelper; im...
package mk.petrovski.weathergurumvp.injection.module; /** * Created by Nikola Petrovski on 3/1/2017. */ @Module(includes = ContextModule.class) public class PreferencesModule { @Provides @WeatherGuruApplicationScope CommonPreferencesHelper getPreferencesHelper( @ApplicationContext Context context) { re...
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/preferences/AppPreferencesHelper.java // public class AppPreferencesHelper implements PreferencesHelper { // // private static final String PREF_KEY_IS_LOGGED_IN = "PREF_KEY_IS_LOGGED_IN"; // private static final String PREF_KEY_USER_NAME = "PREF_KE...
return new AppPreferencesHelper(commonPreferencesHelper);
nikacotAndroid/Weather-Guru-MVP
app/src/main/java/mk/petrovski/weathergurumvp/ui/main/MainMvpPresenter.java
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/db/CityDetailsModel.java // @Entity(nameInDb = "city") public class CityDetailsModel { // // @Id(autoincrement = true) private Long id; // // private String areaName; // private String country; // private String latitude; // private String lo...
import mk.petrovski.weathergurumvp.data.local.db.CityDetailsModel; import mk.petrovski.weathergurumvp.ui.base.Presenter;
package mk.petrovski.weathergurumvp.ui.main; /** * Created by Nikola Petrovski on 2/14/2017. */ public interface MainMvpPresenter<V extends MainMvpView> extends Presenter<V> { void setDrawerCities(); void setUserInfo();
// Path: app/src/main/java/mk/petrovski/weathergurumvp/data/local/db/CityDetailsModel.java // @Entity(nameInDb = "city") public class CityDetailsModel { // // @Id(autoincrement = true) private Long id; // // private String areaName; // private String country; // private String latitude; // private String lo...
void selectCity(CityDetailsModel city);
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/StatusDialogCreator.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Status.java // class StatusIterator implements Iterator<Status> { // //Start on online instead of offline since it is weird to set you own status to offline when you are online. // private int current = STATUS_ONLINE; // private Status status; // ...
import com.attentec.Status.StatusIterator; import java.util.ArrayList; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.util.Log; import android.view.LayoutInflater; import android.view...
/*** * Copyright (c) 2010 Attentec AB, http://www.attentec.se * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Status.java // class StatusIterator implements Iterator<Status> { // //Start on online instead of offline since it is weird to set you own status to offline when you are online. // private int current = STATUS_ONLINE; // private Status status; // ...
StatusIterator statusIterator = mStatus.getIterator();
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/Status.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Login.java // public static class LoginException extends Exception { // /** // * // */ // private static final long serialVersionUID = 1L; // // /** // * No message constructor. // */ // public LoginException() { // // } // ...
import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Observable; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import android.content.Context; import android.content.SharedPreferences; import android.util.Lo...
// save the status in preferences sp.edit().putString(STATUS_CUSTOM_MESSAGE, mCustomMessage).putInt(STATUS, mStatus).commit(); //Sent to server return sendToServer(sp, ctx); } /** * Send status to server. * @param sp Shared Preferences where username and phonekey are stored. * @param ctx calling conte...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Login.java // public static class LoginException extends Exception { // /** // * // */ // private static final long serialVersionUID = 1L; // // /** // * No message constructor. // */ // public LoginException() { // // } // ...
} catch (LoginException e) {
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/CloseToYou.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java // public interface ServiceUpdateUIListener { // /** Tell UI to update. */ // void updateUI(); // // /** End UI Activity. */ // void endActivity(); // }
import java.io.ByteArrayInputStream; import java.text.ParseException; import java.util.Date; import android.app.Dialog; import android.content.SharedPreferences; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import a...
/*** * Copyright (c) 2010 Attentec AB, http://www.attentec.se * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requi...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java // public interface ServiceUpdateUIListener { // /** Tell UI to update. */ // void updateUI(); // // /** End UI Activity. */ // void endActivity(); // } // Path: at.attentec.com/android/at.attentec.client/src/com/att...
AttentecService.setCloseToYouUpdateListener(new ServiceUpdateUIListener() {
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/ContactsActivity.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java // public interface ServiceUpdateUIListener { // /** Tell UI to update. */ // void updateUI(); // // /** End UI Activity. */ // void endActivity(); // }
import java.io.ByteArrayInputStream; import java.text.ParseException; import java.util.Date; import java.util.Observable; import java.util.Observer; import android.app.AlertDialog; import android.app.Dialog; import android.app.ListActivity; import android.content.BroadcastReceiver; import android.content.Conte...
}); statusBarCustomMessageBlock.setOnClickListener(new OnClickListener() { public void onClick(final View view) { showSetCustomStatus(); } }); //Setup database dbh = new DatabaseAdapter(this); dbh.open(); contactCursor = dbh.getContent(orderMode); startManagingCursor(contac...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java // public interface ServiceUpdateUIListener { // /** Tell UI to update. */ // void updateUI(); // // /** End UI Activity. */ // void endActivity(); // } // Path: at.attentec.com/android/at.attentec.client/src/com/att...
AttentecService.setContactsUpdateListener(new ServiceUpdateUIListener() {
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java // public abstract static class LocationResult { // /** // * Call back with the found location. // * @param location found location // */ // public abstract void gotLocation(Location location); // } // // Path: at.a...
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import j...
Log.d(TAG, "Old locUpEn: " + previousLocationUpdateEnabled + " new locUpEn: " + PreferencesHelper.getLocationUpdateEnabled(ctx)); if (PreferencesHelper.getLocationUpdateEnabled(ctx) != previousLocationUpdateEnabled) { //remove the old notifications mNM.cancelAll(); //show the new one showNotificati...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java // public abstract static class LocationResult { // /** // * Call back with the found location. // * @param location found location // */ // public abstract void gotLocation(Location location); // } // // Path: at.a...
private LocationResult locationResult = new LocationResult() {
at-attentec/at.attentec
at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java // public abstract static class LocationResult { // /** // * Call back with the found location. // * @param location found location // */ // public abstract void gotLocation(Location location); // } // // Path: at.a...
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import j...
Date d = new Date(); SharedPreferences.Editor editor = sp.edit(); editor.putFloat("latitude", lat.floatValue()); editor.putFloat("longitude", lng.floatValue()); editor.putLong("location_updated_at", d.getTime() / DevelopmentSettings.MILLISECONDS_IN_SECOND); editor.commit(); //check if w...
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java // public abstract static class LocationResult { // /** // * Call back with the found location. // * @param location found location // */ // public abstract void gotLocation(Location location); // } // // Path: at.a...
} catch (LoginException e) {
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/details/CommentAction.java
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
import com.intellij.openapi.project.Project; import com.jetbrains.crucible.model.Comment; import com.jetbrains.crucible.model.Review; import org.jetbrains.annotations.NotNull;
package com.jetbrains.crucible.ui.toolWindow.details; /** * @author Kirill Likhodedov */ public abstract class CommentAction { @NotNull protected final Project myProject;
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
@NotNull protected final Review myReview;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/details/CommentAction.java
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
import com.intellij.openapi.project.Project; import com.jetbrains.crucible.model.Comment; import com.jetbrains.crucible.model.Review; import org.jetbrains.annotations.NotNull;
package com.jetbrains.crucible.ui.toolWindow.details; /** * @author Kirill Likhodedov */ public abstract class CommentAction { @NotNull protected final Project myProject; @NotNull protected final Review myReview;
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
@NotNull protected final Comment myComment;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/details/GeneralCommentsTree.java
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
import com.intellij.openapi.project.Project; import com.jetbrains.crucible.model.Comment; import com.jetbrains.crucible.model.Review; import org.jetbrains.annotations.NotNull; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel;
package com.jetbrains.crucible.ui.toolWindow.details; /** * @author Kirill Likhodedov */ public class GeneralCommentsTree extends CommentsTree { public GeneralCommentsTree(@NotNull Project project, @NotNull Review review, @NotNull DefaultTreeModel model) { super(project, review, model, null, null); } @...
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
for (Comment comment : review.getGeneralComments()) {
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/CrucibleToolWindowFactory.java
// Path: src/com/jetbrains/crucible/utils/CrucibleBundle.java // public class CrucibleBundle { // private static Reference<ResourceBundle> ourBundle; // // @NonNls // private static final String BUNDLE = "com.jetbrains.crucible.utils.CrucibleBundle"; // // private CrucibleBundle() {} // // public...
import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentFactory; import com.intellij.ui.content.ContentManager; i...
package com.jetbrains.crucible.ui.toolWindow; /** * User: ktisha */ public class CrucibleToolWindowFactory implements ToolWindowFactory, DumbAware { @Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { final ContentManager contentManager = toolWindow.getContentManager(); ...
// Path: src/com/jetbrains/crucible/utils/CrucibleBundle.java // public class CrucibleBundle { // private static Reference<ResourceBundle> ourBundle; // // @NonNls // private static final String BUNDLE = "com.jetbrains.crucible.utils.CrucibleBundle"; // // private CrucibleBundle() {} // // public...
createContent(cruciblePanel, CrucibleBundle.message("crucible.main.name"), false);
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleSession.java
// Path: src/com/jetbrains/crucible/connection/exceptions/CrucibleApiLoginException.java // public class CrucibleApiLoginException extends CrucibleApiException { // // public CrucibleApiLoginException(String message) { // super(message); // } // // public CrucibleApiLoginException(String message, Throwable ...
import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.crucible.connection.exceptions.CrucibleApiLoginException; import com.jetbrains.crucible.model.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.List; import java.util.Map;
package com.jetbrains.crucible.connection; /** * User : ktisha */ public interface CrucibleSession { String REVIEW_SERVICE = "/rest-service/reviews-v1"; String REVIEW_ITEMS = "/reviewitems"; String DETAIL_REVIEW_INFO = "/details"; String VERSION = "/versionInfo"; String AUTH_SERVICE = "/rest-service/auth...
// Path: src/com/jetbrains/crucible/connection/exceptions/CrucibleApiLoginException.java // public class CrucibleApiLoginException extends CrucibleApiException { // // public CrucibleApiLoginException(String message) { // super(message); // } // // public CrucibleApiLoginException(String message, Throwable ...
void login() throws CrucibleApiLoginException;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/model/Review.java
// Path: src/com/jetbrains/crucible/connection/CrucibleManager.java // public class CrucibleManager { // private final Project myProject; // private final Map<String, CrucibleSession> mySessions = new HashMap<String, CrucibleSession>(); // // private static final Logger LOG = Logger.getInstance(CrucibleManager.c...
import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.ContainerUtil; import com.jetbrains.crucible.connection.CrucibleManager; import org.jetbrains.annotation...
@NotNull public List<Comment> getGeneralComments() { return myGeneralComments; } @NotNull public List<Comment> getComments() { return myComments; } @NotNull public Set<ReviewItem> getReviewItems() { return myItems; } public void addReviewItem(@NotNull final ReviewItem item) { myIt...
// Path: src/com/jetbrains/crucible/connection/CrucibleManager.java // public class CrucibleManager { // private final Project myProject; // private final Map<String, CrucibleSession> mySessions = new HashMap<String, CrucibleSession>(); // // private static final Logger LOG = Logger.getInstance(CrucibleManager.c...
final Map<String,VirtualFile> hash = CrucibleManager.getInstance(project).getRepoHash();
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/configuration/CrucibleConfigurable.java
// Path: src/com/jetbrains/crucible/connection/CrucibleTestConnectionTask.java // public class CrucibleTestConnectionTask extends Task.Modal { // private static final int CHECK_CANCEL_INTERVAL = 500; // private static final Logger LOG = Logger.getInstance(CrucibleTestConnectionTask.class.getName()); // // public...
import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.util.text.StringUtil; i...
package com.jetbrains.crucible.configuration; /** * User: ktisha */ public class CrucibleConfigurable implements SearchableConfigurable { private JPanel myMainPanel; private JTextField myServerField; private JTextField myUsernameField; private JPasswordField myPasswordField; private JButton myTestButton;...
// Path: src/com/jetbrains/crucible/connection/CrucibleTestConnectionTask.java // public class CrucibleTestConnectionTask extends Task.Modal { // private static final int CHECK_CANCEL_INTERVAL = 500; // private static final Logger LOG = Logger.getInstance(CrucibleTestConnectionTask.class.getName()); // // public...
final Task.Modal testConnectionTask = new CrucibleTestConnectionTask(ProjectManager.getInstance().getDefaultProject());
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/model/ReviewItem.java
// Path: src/com/jetbrains/crucible/vcs/VcsUtils.java // public class VcsUtils { // // private VcsUtils() { // } // // @Nullable // public static CommittedChangeList loadRevisions(@NotNull final Project project, final VcsRevisionNumber number, final FilePath filePath) { // final CommittedChangeList[] list...
import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.AbstractVcs; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.jetb...
package com.jetbrains.crucible.model; /** * * User : ktisha */ public class ReviewItem { private String myId; private String myPath; private String myRepo; private Set<String> myRevisions = new HashSet<String>(); public ReviewItem(@NotNull final String id, @NotNull final String path, @Nullable final S...
// Path: src/com/jetbrains/crucible/vcs/VcsUtils.java // public class VcsUtils { // // private VcsUtils() { // } // // @Nullable // public static CommittedChangeList loadRevisions(@NotNull final Project project, final VcsRevisionNumber number, final FilePath filePath) { // final CommittedChangeList[] list...
final CommittedChangeList changeList = VcsUtils.loadRevisions(project, revisionNumber, path);
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleSessionImpl.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.google.gson.*; import com.intellij.dvcs.repo.VcsRepositoryManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.SLRUCache; import com.jet...
@NotNull @Override public String createValue(String relativeUrl) { return doDownloadFile(relativeUrl); } private String doDownloadFile(String relativeUrl) { String url = getHostUrl() + relativeUrl; final GetMethod method = new GetMethod(url); try { executeHttpMethod(...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
public void login() throws CrucibleApiLoginException {
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleSessionImpl.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.google.gson.*; import com.intellij.dvcs.repo.VcsRepositoryManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.SLRUCache; import com.jet...
public CrucibleSessionImpl(@NotNull final Project project) { myProject = project; initSSLCertPolicy(); } private void initSSLCertPolicy() { EasySSLProtocolSocketFactory secureProtocolSocketFactory = new EasySSLProtocolSocketFactory(); Protocol.registerProtocol("https", new Protocol("https", (Prot...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
catch (CrucibleApiException e) {
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleSessionImpl.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.google.gson.*; import com.intellij.dvcs.repo.VcsRepositoryManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.SLRUCache; import com.jet...
final HttpClient client = new HttpClient(); HttpConnectionManagerParams params = client.getHttpConnectionManager().getParams(); params.setConnectionTimeout(CONNECTION_TIMEOUT); //set connection timeout (how long it takes to connect to remote host) params.setSoTimeout(CONNECTION_TIMEOUT); //set socket ti...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
return CrucibleSettings.getInstance().USERNAME;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleSessionImpl.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.google.gson.*; import com.intellij.dvcs.repo.VcsRepositoryManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.SLRUCache; import com.jet...
} return null; } @Nullable public Comment postComment(@NotNull final Comment comment, boolean isGeneral, @NotNull final String reviewId) { String url = getHostUrl() + REVIEW_SERVICE + "/" + reviewId; final String parentCommentId = comment.getParentCommentId(); f...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
UiUtils.showBalloon(myProject, "Sorry, comment wasn't added:\n" + errorMessage, MessageType.ERROR);
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/details/VersionedCommentsTree.java
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FilePath; import com.jetbrains.crucible.model.Comment; import com.jetbrains.crucible.model.Review; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swi...
package com.jetbrains.crucible.ui.toolWindow.details; /** * @author Kirill Likhodedov */ public class VersionedCommentsTree extends CommentsTree { private VersionedCommentsTree(@NotNull Project project, @NotNull Review review, @NotNull DefaultTreeModel model, @Nullable Editor edi...
// Path: src/com/jetbrains/crucible/model/Comment.java // public class Comment { // // @NotNull private final User myAuthor; // @NotNull private final String myMessage; // private boolean myDraft; // // private String myLine; // private String myReviewItemId; // private String myPermId; // private Strin...
public static CommentsTree create(@NotNull Project project, @NotNull Review review, @NotNull Comment comment,
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/tree/CrucibleFilterNode.java
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
import com.intellij.ui.treeStructure.SimpleNode; import com.intellij.ui.treeStructure.SimpleTree; import com.jetbrains.crucible.model.CrucibleFilter; import com.jetbrains.crucible.ui.toolWindow.CrucibleReviewModel; import org.jetbrains.annotations.NotNull;
package com.jetbrains.crucible.ui.toolWindow.tree; /** * Created by Dmitry on 14.12.2014. */ public class CrucibleFilterNode extends SimpleNode { private final CrucibleReviewModel myReviewModel;
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
private final CrucibleFilter myFilter;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleTestConnector.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.intellij.openapi.project.Project; import com.jetbrains.crucible.configuration.CrucibleSettings; import com.jetbrains.crucible.connection.exceptions.CrucibleApiException; import org.jetbrains.annotations.Nullable; import java.net.MalformedURLException; import java.net.URL;
package com.jetbrains.crucible.connection; /** * User : ktisha */ public class CrucibleTestConnector { public enum ConnectionState { NOT_FINISHED, SUCCEEDED, FAILED, INTERRUPTED, } private ConnectionState myConnectionState = ConnectionState.NOT_FINISHED; private Exception myException; p...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
catch (CrucibleApiException e) {
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/connection/CrucibleTestConnector.java
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
import com.intellij.openapi.project.Project; import com.jetbrains.crucible.configuration.CrucibleSettings; import com.jetbrains.crucible.connection.exceptions.CrucibleApiException; import org.jetbrains.annotations.Nullable; import java.net.MalformedURLException; import java.net.URL;
public ConnectionState getConnectionState() { return myConnectionState; } public void run() { try { testConnect(); if (myConnectionState != ConnectionState.INTERRUPTED && myConnectionState != ConnectionState.FAILED) { myConnectionState = ConnectionState.SUCCEEDED; } } ca...
// Path: src/com/jetbrains/crucible/configuration/CrucibleSettings.java // @State(name = "CrucibleSettings", // storages = { // @Storage(file = "$APP_CONFIG$" + "/crucibleConnector.xml") // } // ) // public class CrucibleSettings implements PersistentStateComponent<CrucibleSettings> { // public...
final String url = CrucibleSettings.getInstance().SERVER_URL;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/tree/CrucibleRootNode.java
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
import com.intellij.ui.treeStructure.SimpleNode; import com.jetbrains.crucible.model.CrucibleFilter; import com.jetbrains.crucible.ui.toolWindow.CrucibleReviewModel; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List;
package com.jetbrains.crucible.ui.toolWindow.tree; /** * User : ktisha */ public class CrucibleRootNode extends SimpleNode { private static final String NAME = "All My Reviews";
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
private final CrucibleReviewModel myReviewModel;
ktisha/Crucible4IDEA
src/com/jetbrains/crucible/ui/toolWindow/tree/CrucibleRootNode.java
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
import com.intellij.ui.treeStructure.SimpleNode; import com.jetbrains.crucible.model.CrucibleFilter; import com.jetbrains.crucible.ui.toolWindow.CrucibleReviewModel; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List;
package com.jetbrains.crucible.ui.toolWindow.tree; /** * User : ktisha */ public class CrucibleRootNode extends SimpleNode { private static final String NAME = "All My Reviews"; private final CrucibleReviewModel myReviewModel; private final List<SimpleNode> myChildren = new ArrayList<SimpleNode>(); publi...
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java // public enum CrucibleFilter { // // Inbox // ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer. // ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user...
for (CrucibleFilter filter : CrucibleFilter.values()) {
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/interceptor/InterceptorChainImpl.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
import com.vincan.medialoader.tinyhttpd.request.Request; import com.vincan.medialoader.tinyhttpd.response.Response; import com.vincan.medialoader.tinyhttpd.response.ResponseException; import java.io.IOException; import java.util.List;
package com.vincan.medialoader.tinyhttpd.interceptor; /** * 拦截器链实现 * * @author vincanyang */ public class InterceptorChainImpl implements Interceptor.Chain { private List<Interceptor> mInterceptors; private int mIndex;
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
private Request mRequest;
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/interceptor/InterceptorChainImpl.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
import com.vincan.medialoader.tinyhttpd.request.Request; import com.vincan.medialoader.tinyhttpd.response.Response; import com.vincan.medialoader.tinyhttpd.response.ResponseException; import java.io.IOException; import java.util.List;
package com.vincan.medialoader.tinyhttpd.interceptor; /** * 拦截器链实现 * * @author vincanyang */ public class InterceptorChainImpl implements Interceptor.Chain { private List<Interceptor> mInterceptors; private int mIndex; private Request mRequest;
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
private Response mResponse;
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/interceptor/InterceptorChainImpl.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
import com.vincan.medialoader.tinyhttpd.request.Request; import com.vincan.medialoader.tinyhttpd.response.Response; import com.vincan.medialoader.tinyhttpd.response.ResponseException; import java.io.IOException; import java.util.List;
package com.vincan.medialoader.tinyhttpd.interceptor; /** * 拦截器链实现 * * @author vincanyang */ public class InterceptorChainImpl implements Interceptor.Chain { private List<Interceptor> mInterceptors; private int mIndex; private Request mRequest; private Response mResponse; ...
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
public void proceed(Request request, Response response) throws ResponseException, IOException {
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/utils/Util.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpConstants.java // public final class HttpConstants { // // public final static String CRLF = "\r\n"; // // public final static String SP = " "; // // public final static String COLON = ":"; // // public static final String C...
import android.text.TextUtils; import android.util.Base64; import android.webkit.MimeTypeMap; import com.vincan.medialoader.tinyhttpd.HttpConstants; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.security.InvalidKeyException; import java.security...
throw new NullPointerException(object.getClass().getSimpleName() + " cann't be null"); } } return object; } public static String encode(String url) { try { return URLEncoder.encode(url, CHARSET_DEFAULT); } catch (UnsupportedEncodi...
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpConstants.java // public final class HttpConstants { // // public final static String CRLF = "\r\n"; // // public final static String SP = " "; // // public final static String COLON = ":"; // // public static final String C...
sb.append("?").append(HttpConstants.PARAM_SIGN).append("=%s");
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/data/file/BufferRAFileDataSource.java
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // }
import com.vincan.medialoader.data.file.cleanup.DiskLruCache; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile;
package com.vincan.medialoader.data.file; /** * {@link BufferedRandomAccessFile}实现 * * @author vincanyang */ public class BufferRAFileDataSource extends BaseFileDataSource { private static final String TEMP_POSTFIX = ".tmp"; private BufferedRandomAccessFile mRandomAccessFile;
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // } // Path: lib...
public BufferRAFileDataSource(File file, DiskLruCache diskLruStorage) throws IOException {
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/codec/HttpResponseEncoder.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpConstants.java // public final class HttpConstants { // // public final static String CRLF = "\r\n"; // // public final static String SP = " "; // // public final static String COLON = ":"; // // public static final String C...
import com.vincan.medialoader.tinyhttpd.HttpConstants; import com.vincan.medialoader.tinyhttpd.response.HttpResponse; import java.io.IOException; import java.util.Map;
package com.vincan.medialoader.tinyhttpd.codec; /** * {@link HttpResponse}的编码器 * * @author vincanyang */ public class HttpResponseEncoder implements ResponseEncoder<HttpResponse> { @Override public byte[] encode(HttpResponse response) throws IOException { StringBuilder sb = new Stri...
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpConstants.java // public final class HttpConstants { // // public final static String CRLF = "\r\n"; // // public final static String SP = " "; // // public final static String COLON = ":"; // // public static final String C...
sb.append(response.protocol().toString()).append(HttpConstants.SP).append(response.status().toString());
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/data/file/RandomAcessFileDataSource.java
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // } // // Path: l...
import com.vincan.medialoader.data.file.cleanup.DiskLruCache; import com.vincan.medialoader.utils.LogUtil; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile;
package com.vincan.medialoader.data.file; /** * {@link RandomAccessFile}实现 * * @author vincanyang */ public class RandomAcessFileDataSource extends BaseFileDataSource { private static final String TEMP_POSTFIX = ".tmp"; private RandomAccessFile mRandomAccessFile;
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // } // // Path: l...
public RandomAcessFileDataSource(File file, DiskLruCache diskLruStorage) {
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/data/file/RandomAcessFileDataSource.java
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // } // // Path: l...
import com.vincan.medialoader.data.file.cleanup.DiskLruCache; import com.vincan.medialoader.utils.LogUtil; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile;
package com.vincan.medialoader.data.file; /** * {@link RandomAccessFile}实现 * * @author vincanyang */ public class RandomAcessFileDataSource extends BaseFileDataSource { private static final String TEMP_POSTFIX = ".tmp"; private RandomAccessFile mRandomAccessFile; public RandomAcessF...
// Path: library/src/main/java/com/vincan/medialoader/data/file/cleanup/DiskLruCache.java // public interface DiskLruCache { // // void save(String url, File file); // // File get(String url); // // void remove(String url); // // void close(); // // void clear(); // } // // Path: l...
LogUtil.e(e);
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/data/file/naming/Md5FileNameCreator.java
// Path: library/src/main/java/com/vincan/medialoader/utils/Util.java // public final class Util { // // public static final String LOCALHOST = "127.0.0.1";//不建议使用localhost,因为需要访问网络 // // public static final int DEFAULT_BUFFER_SIZE = 8192;//8 * 1024 // // public static final String CHARSET_DEFAULT ...
import android.text.TextUtils; import com.vincan.medialoader.utils.Util;
package com.vincan.medialoader.data.file.naming; /** * 使用图片URL地址的 MD5编码来进行生成缓存的文件名称 * * @author vincanyang */ public class Md5FileNameCreator implements FileNameCreator { @Override public String create(String url) {
// Path: library/src/main/java/com/vincan/medialoader/utils/Util.java // public final class Util { // // public static final String LOCALHOST = "127.0.0.1";//不建议使用localhost,因为需要访问网络 // // public static final int DEFAULT_BUFFER_SIZE = 8192;//8 * 1024 // // public static final String CHARSET_DEFAULT ...
String extension = Util.getExtensionFromUrl(url);
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpHeaders.java // public class HttpHeaders extends LinkedHashMap<String, String> { // // private static final Pattern HEADER_RANGE_PATTERN = Pattern.compile("bytes=(\\d*)-"); // // public interface Names { // String RANGE = "Range"...
import com.vincan.medialoader.tinyhttpd.HttpHeaders; import com.vincan.medialoader.tinyhttpd.HttpVersion;
package com.vincan.medialoader.tinyhttpd.request; /** * 请求接口 * * @author vincanyang */ public interface Request { HttpMethod method(); String url();
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpHeaders.java // public class HttpHeaders extends LinkedHashMap<String, String> { // // private static final Pattern HEADER_RANGE_PATTERN = Pattern.compile("bytes=(\\d*)-"); // // public interface Names { // String RANGE = "Range"...
HttpVersion protocol();
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpHeaders.java // public class HttpHeaders extends LinkedHashMap<String, String> { // // private static final Pattern HEADER_RANGE_PATTERN = Pattern.compile("bytes=(\\d*)-"); // // public interface Names { // String RANGE = "Range"...
import com.vincan.medialoader.tinyhttpd.HttpHeaders; import com.vincan.medialoader.tinyhttpd.HttpVersion;
package com.vincan.medialoader.tinyhttpd.request; /** * 请求接口 * * @author vincanyang */ public interface Request { HttpMethod method(); String url(); HttpVersion protocol();
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpHeaders.java // public class HttpHeaders extends LinkedHashMap<String, String> { // // private static final Pattern HEADER_RANGE_PATTERN = Pattern.compile("bytes=(\\d*)-"); // // public interface Names { // String RANGE = "Range"...
HttpHeaders headers();
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/response/Response.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpVersion.java // public enum HttpVersion { // // HTTP_1_0("HTTP/1.0"), // // HTTP_1_1("HTTP/1.1"), // // HTTP_2("H2"); // // private final String version; // // HttpVersion(String version) { // this.version = version; //...
import com.vincan.medialoader.tinyhttpd.HttpVersion; import com.vincan.medialoader.tinyhttpd.HttpHeaders; import java.io.IOException;
package com.vincan.medialoader.tinyhttpd.response; /** * 响应接口 * * @author vincanyang */ public interface Response { HttpStatus status(); void setStatus(HttpStatus status);
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpVersion.java // public enum HttpVersion { // // HTTP_1_0("HTTP/1.0"), // // HTTP_1_1("HTTP/1.1"), // // HTTP_2("H2"); // // private final String version; // // HttpVersion(String version) { // this.version = version; //...
HttpVersion protocol();
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/response/Response.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpVersion.java // public enum HttpVersion { // // HTTP_1_0("HTTP/1.0"), // // HTTP_1_1("HTTP/1.1"), // // HTTP_2("H2"); // // private final String version; // // HttpVersion(String version) { // this.version = version; //...
import com.vincan.medialoader.tinyhttpd.HttpVersion; import com.vincan.medialoader.tinyhttpd.HttpHeaders; import java.io.IOException;
package com.vincan.medialoader.tinyhttpd.response; /** * 响应接口 * * @author vincanyang */ public interface Response { HttpStatus status(); void setStatus(HttpStatus status); HttpVersion protocol();
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/HttpVersion.java // public enum HttpVersion { // // HTTP_1_0("HTTP/1.0"), // // HTTP_1_1("HTTP/1.1"), // // HTTP_2("H2"); // // private final String version; // // HttpVersion(String version) { // this.version = version; //...
HttpHeaders headers();
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/interceptor/Interceptor.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
import com.vincan.medialoader.tinyhttpd.request.Request; import com.vincan.medialoader.tinyhttpd.response.Response; import com.vincan.medialoader.tinyhttpd.response.ResponseException; import java.io.IOException;
package com.vincan.medialoader.tinyhttpd.interceptor; /** * 拦截器 * * @author wencanyang */ public interface Interceptor { void intercept(Chain chain) throws ResponseException, IOException; /** * 拦截器链 */ interface Chain {
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
Request request();
yangwencan2002/MediaLoader
library/src/main/java/com/vincan/medialoader/tinyhttpd/interceptor/Interceptor.java
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
import com.vincan.medialoader.tinyhttpd.request.Request; import com.vincan.medialoader.tinyhttpd.response.Response; import com.vincan.medialoader.tinyhttpd.response.ResponseException; import java.io.IOException;
package com.vincan.medialoader.tinyhttpd.interceptor; /** * 拦截器 * * @author wencanyang */ public interface Interceptor { void intercept(Chain chain) throws ResponseException, IOException; /** * 拦截器链 */ interface Chain { Request request();
// Path: library/src/main/java/com/vincan/medialoader/tinyhttpd/request/Request.java // public interface Request { // // HttpMethod method(); // // String url(); // // HttpVersion protocol(); // // HttpHeaders headers(); // // String getParam(String name); // } // // Path: library/...
Response response();
yangwencan2002/MediaLoader
library/src/test/java/com/vincan/medialoader/data/file/naming/FileNameCreatorTest.java
// Path: library/src/main/java/com/vincan/medialoader/utils/Util.java // public final class Util { // // public static final String LOCALHOST = "127.0.0.1";//不建议使用localhost,因为需要访问网络 // // public static final int DEFAULT_BUFFER_SIZE = 8192;//8 * 1024 // // public static final String CHARSET_DEFAULT ...
import com.vincan.medialoader.BuildConfig; import com.vincan.medialoader.utils.Util; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail;
package com.vincan.medialoader.data.file.naming; /** * {@link FileNameCreator} * * @author vincanyang */ @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class) public class FileNameCreatorTest { @Test(expected = NullPointerException.class) public void testAssertNullUrl() throws Ex...
// Path: library/src/main/java/com/vincan/medialoader/utils/Util.java // public final class Util { // // public static final String LOCALHOST = "127.0.0.1";//不建议使用localhost,因为需要访问网络 // // public static final int DEFAULT_BUFFER_SIZE = 8192;//8 * 1024 // // public static final String CHARSET_DEFAULT ...
String expected = Util.getMD5(url) + ".mp4";
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java // public final class ImagingKitUtils { // // // not to be instantiated // private ImagingKitUtils() {} // // // /** // * Clamps a value to the range [0,255]. // * Returns 0 for values less than 0, 255 for values greate...
import java.util.Spliterator; import java.util.function.Consumer; import hageldave.imagingkit.core.util.ImagingKitUtils; import java.awt.Dimension; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; import java.awt.image.DirectColorModel; import java.awt.image.Ra...
* @since 1.0 */ public Pixel getPixel(int x, int y){ return new Pixel(this, x,y); } /** * Copies specified area of this Img to the specified destination Img * at specified destination coordinates. If destination Img is null a new * Img with the areas size will be created and the destination coordinates ...
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java // public final class ImagingKitUtils { // // // not to be instantiated // private ImagingKitUtils() {} // // // /** // * Clamps a value to the range [0,255]. // * Returns 0 for values less than 0, 255 for values greate...
ImagingKitUtils.requireAreaInImageBounds(x, y, w, h, this);
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java // public static double clamp_0_1(double val){ // return Math.max(0.0, Math.min(val, 1.0)); // }
import static hageldave.imagingkit.core.util.ImagingKitUtils.clamp_0_1; import java.util.Objects; import java.util.Spliterator; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Stream;
* @param pixelSpliterator the {@code Spliterator<Pixel>} to which the * returned spliterator delegates to. * @return a spliterator with float[] elements consisting of normalized RGB channels. * * @since 1.4 */ public static PixelConvertingSpliterator<PixelBase, double[]> getDoubletArrayElementSpliterator( ...
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagingKitUtils.java // public static double clamp_0_1(double val){ // return Math.max(0.0, Math.min(val, 1.0)); // } // Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java import static hageldave.imagingk...
clamp_0_1(array[0]),
hageldave/ImagingKit
ImagingKit_Core/src/test/java/hageldave/imagingkit/core/util/BufferedImageFactoryTest.java
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java // public class BufferedImageFactory { // // private BufferedImageFactory(){} // // /** // * shortcut for get(img, BufferedImage.TYPE_INT_ARGB). // * @param img to be copied to BufferedImage of type INT_ARGB // * ...
import java.awt.Dimension; import java.awt.image.BufferedImage; import static org.junit.Assert.*; import org.junit.Test; import hageldave.imagingkit.core.util.BufferedImageFactory;
package hageldave.imagingkit.core.util; public class BufferedImageFactoryTest { @Test public void testAll() {
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java // public class BufferedImageFactory { // // private BufferedImageFactory(){} // // /** // * shortcut for get(img, BufferedImage.TYPE_INT_ARGB). // * @param img to be copied to BufferedImage of type INT_ARGB // * ...
BufferedImage bimg = BufferedImageFactory.getINT_ARGB(1, 2);
hageldave/ImagingKit
ImagingKit_Core/src/test/java/hageldave/imagingkit/core/ImgTest.java
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java // public static interface PixelConverter<P extends PixelBase, T> { // /** // * Allocates a new element for the PixelConvertingSpliterator // * (will be called once per split) // * @return element, probably in uninit...
import static org.junit.Assert.*; import java.awt.Color; import java.awt.Dimension; import java.awt.image.BufferedImage; import java.util.Iterator; import java.util.LinkedList; import java.util.Spliterator; import java.util.function.BiFunction; import java.util.function.Consumer; import org.junit.Test; import hageldave...
assertEquals((x+1)%2, img.getValue(x, y)); } img.fill(0); img.stream(100,200,1000,1000).filter(px->{return px.getX() % 2 == 0;}).forEach(px->{px.setValue(1);}); for(int y = 0; y < 2000; y++) for(int x = 0; x < 3000; x++){ if(x < 100 || y < 200 || x >=100+1000 || y >= 200+1000){ assertEquals(...
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java // public static interface PixelConverter<P extends PixelBase, T> { // /** // * Allocates a new element for the PixelConvertingSpliterator // * (will be called once per split) // * @return element, probably in uninit...
public PixelConverter<PixelBase, Color[]> getConverter() {
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageSaver.java
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java // public class BufferedImageFactory { // // private BufferedImageFactory(){} // // /** // * shortcut for get(img, BufferedImage.TYPE_INT_ARGB). // * @param img to be copied to BufferedImage of type INT_ARGB // * ...
import javax.imageio.ImageIO; import hageldave.imagingkit.core.util.BufferedImageFactory; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream;
/* * Copyright 2017 David Haegele * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publis...
// Path: ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java // public class BufferedImageFactory { // // private BufferedImageFactory(){} // // /** // * shortcut for get(img, BufferedImage.TYPE_INT_ARGB). // * @param img to be copied to BufferedImage of type INT_ARGB // * ...
rImg = BufferedImageFactory.get(image, BufferedImage.TYPE_INT_RGB);
jawher/moulder-j
src/test/java/moulder/moulds/PrependerTest.java
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // }
import moulder.Value; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import org.mockito.InOrder; import java.io.StringReader; import java.util.List; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import stati...
package moulder.moulds; public class PrependerTest extends BaseMoulderTest { @Test public void test() throws Exception {
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // } // Path: src/test/java/moulder/moulds/PrependerTest.java import moulder.Value; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; ...
Value<Iterable<Node>> content = mock(Value.class);
jawher/moulder-j
src/main/java/moulder/values/ValueFieldExtractor.java
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // }
import moulder.Value; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method;
package moulder.values; public class ValueFieldExtractor<T, S> extends ValueTransformer<S, T> { private Method m;
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // } // Path: src/main/java/moulder/values/ValueFieldExtractor.java import moulder.Value; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.b...
public ValueFieldExtractor(Value<S> delegate, String field,
jawher/moulder-j
src/main/java/moulder/moulds/ChildAppender.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.HtmlValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.List;
package moulder.moulds; /** * A moulder that appends content to its input element's children * * @author jawher * */ public class ChildAppender implements Moulder { private Value<Iterable<Node>> content; /** * * @param content * the nodes that are to be appended to the input element's *...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new HtmlValue(html));
jawher/moulder-j
src/test/java/moulder/moulds/ForEachTest.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.values.SeqValue; import moulder.values.SimpleBox; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import java.io.StringReader; import java.util.Arrays; import java.util.List; import static...
package moulder.moulds; public class ForEachTest extends BaseMoulderTest { @Test public void test() throws Exception { List<Integer> list = Arrays.asList(4, 2);
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
final SimpleBox<Integer> sb = new SimpleBox<Integer>();
jawher/moulder-j
src/test/java/moulder/moulds/ForEachTest.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.values.SeqValue; import moulder.values.SimpleBox; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import java.io.StringReader; import java.util.Arrays; import java.util.List; import static...
package moulder.moulds; public class ForEachTest extends BaseMoulderTest { @Test public void test() throws Exception { List<Integer> list = Arrays.asList(4, 2); final SimpleBox<Integer> sb = new SimpleBox<Integer>();
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
ForEach<Integer> f = new ForEach<Integer>(sb, new SeqValue<Integer>(list), new Moulder() {
jawher/moulder-j
src/test/java/moulder/moulds/ForEachTest.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.values.SeqValue; import moulder.values.SimpleBox; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import java.io.StringReader; import java.util.Arrays; import java.util.List; import static...
package moulder.moulds; public class ForEachTest extends BaseMoulderTest { @Test public void test() throws Exception { List<Integer> list = Arrays.asList(4, 2); final SimpleBox<Integer> sb = new SimpleBox<Integer>();
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
ForEach<Integer> f = new ForEach<Integer>(sb, new SeqValue<Integer>(list), new Moulder() {
jawher/moulder-j
src/test/java/moulder/moulds/RemoveCssClassMoulderTest.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import java.io.StringReader; import java.util.List; import moulder.Moulder; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test;
package moulder.moulds; public class RemoveCssClassMoulderTest extends BaseMoulderTest { @Test public void noClass() throws Exception { final String bodyHtml = "<tag>text</tag>"; final String cssClass = "ss"; final String expected = "<tag>text\n</tag>"; test(bodyHtml, css...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
Moulder moulder = new RemoveCssClassMoulder(cssClass);
jawher/moulder-j
src/main/java/moulder/moulds/AttrModifier.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.SimpleValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.List;
package moulder.moulds; /** * A moulder that adds/modifies/removes an attribute to its input element * * @author jawher * */ public class AttrModifier implements Moulder { private Value<String> attr; private Value<String> value; /** * * @param attr * a value that returns the attribute na...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new SimpleValue<String>(attr), value);
jawher/moulder-j
src/main/java/moulder/moulds/AddCssClassMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import moulder.Moulder; import moulder.Value; import moulder.values.SimpleValue;
package moulder.moulds; /** * Moulder, which adds a CSS class if it's not already present. */ public class AddCssClassMoulder implements Moulder { private final Value<String> value; /** * @param value * a value that returns the CSS class */ public AddCssClassMoulder(Value<S...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new SimpleValue<String>(cssClass));
jawher/moulder-j
src/main/java/moulder/moulds/Replacer.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.HtmlValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.List;
package moulder.moulds; /** * A moulder that replaces its input element with the supplied content * * @author jawher */ public class Replacer implements Moulder { private Value<Iterable<Node>> content; /** * @param content the nodes to replace the input element with */ public Replacer(Valu...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new HtmlValue(html));
jawher/moulder-j
src/main/java/moulder/moulds/SubMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Moulder; import moulder.MoulderChain; import moulder.Registry; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.JsoupHelper; import moulder.moulds.helpers.MouldersApplier; import...
package moulder.moulds; /** * A moulder that can be configured to select children of its input element an * apply other moulders on them * * @author jawher */ public class SubMoulder implements Moulder { private final Registry registry = new Registry(); /** * Registers a number of moulders to be...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
public MoulderChain select(String selector) {
jawher/moulder-j
src/main/java/moulder/moulds/SubMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Moulder; import moulder.MoulderChain; import moulder.Registry; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.JsoupHelper; import moulder.moulds.helpers.MouldersApplier; import...
package moulder.moulds; /** * A moulder that can be configured to select children of its input element an * apply other moulders on them * * @author jawher */ public class SubMoulder implements Moulder { private final Registry registry = new Registry(); /** * Registers a number of moulders to be...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
final Element copy = JsoupHelper.copy(element);
jawher/moulder-j
src/main/java/moulder/moulds/SubMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Moulder; import moulder.MoulderChain; import moulder.Registry; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.JsoupHelper; import moulder.moulds.helpers.MouldersApplier; import...
package moulder.moulds; /** * A moulder that can be configured to select children of its input element an * apply other moulders on them * * @author jawher */ public class SubMoulder implements Moulder { private final Registry registry = new Registry(); /** * Registers a number of moulders to be...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
for (TemplatorConfig c : registry.getConfig()) {
jawher/moulder-j
src/main/java/moulder/moulds/SubMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Moulder; import moulder.MoulderChain; import moulder.Registry; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.JsoupHelper; import moulder.moulds.helpers.MouldersApplier; import...
package moulder.moulds; /** * A moulder that can be configured to select children of its input element an * apply other moulders on them * * @author jawher */ public class SubMoulder implements Moulder { private final Registry registry = new Registry(); /** * Registers a number of moulders to be...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
Collection<Node> oes = MouldersApplier.applyMoulders(c.templators, Arrays.<Node>asList(e));
jawher/moulder-j
src/test/java/moulder/moulds/ReplacerTest.java
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // }
import moulder.Value; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import org.mockito.InOrder; import java.io.StringReader; import java.util.List; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import stati...
package moulder.moulds; public class ReplacerTest extends BaseMoulderTest { @Test public void test() throws Exception {
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // } // Path: src/test/java/moulder/moulds/ReplacerTest.java import moulder.Value; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; i...
Value<Iterable<Node>> content = mock(Value.class);
jawher/moulder-j
src/main/java/moulder/moulds/ChildPrepender.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.HtmlValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.Collections; import java.util.List;
package moulder.moulds; /** * A moulder that prepends content to its input element's children * * @author jawher * */ public class ChildPrepender implements Moulder { private Value<Iterable<Node>> content; /** * * @param content * the nodes that are to be prepended to the input element's ...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new HtmlValue(html));
jawher/moulder-j
src/test/java/moulder/moulds/SubMoulderTest.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.junit.Test; import org.mockito.ArgumentCaptor; import java.io.StringReader; import java.util.Arrays; import java.util.List; import static org.custommonkey.xmlunit.XMLA...
package moulder.moulds; public class SubMoulderTest extends BaseMoulderTest { @Test public void test() throws Exception { Document document = Jsoup .parseBodyFragment("<html><body><outer a='v'><a>test</a></outer></body></html>"); Element element = document.getElementsByTag(...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
Moulder moulder = mock(Moulder.class);
jawher/moulder-j
src/main/java/moulder/moulds/IfMoulder.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.SimpleValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.List;
package moulder.moulds; /** * A moulder that depending on a boolean value will invoke one of two other * moulder * * @author jawher * */ public class IfMoulder implements Moulder { private Value<Boolean> condition; private Moulder thenMoulder; private Moulder elseMoulder; /** * * @param condition ...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this.condition = new SimpleValue<Boolean>(condition);
jawher/moulder-j
src/main/java/moulder/moulds/Appender.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.HtmlValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.List;
package moulder.moulds; /** * A moulder that appends content to its input element * * @author jawher * */ public class Appender implements Moulder { private Value<Iterable<Node>> content; /** * * @param content * the nodes that are to be appended after the input element. */ public Appe...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new HtmlValue(html));
jawher/moulder-j
src/main/java/moulder/moulds/Remover.java
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
import moulder.Moulder; import moulder.Value; import moulder.values.SimpleValue; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import java.util.ArrayList; import java.util.Collections; import java.util.List;
package moulder.moulds; /** * A moulder that removes its input element from the resuling document * * @author jawher */ public class Remover implements Moulder { private final Value<Boolean> remove; /** * Creates a remover that removes its input element from the resulting * document */ ...
// Path: src/main/java/moulder/Moulder.java // public interface Moulder { // /** // * This is where a moulder can process the input element to generate its // * result. // * // * @param element the element and its associated data to process // * @return the list of nodes and their associate...
this(new SimpleValue<Boolean>(true));
jawher/moulder-j
src/test/java/moulder/values/ValueTransformerTest.java
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // }
import moulder.Value; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*;
package moulder.values; public class ValueTransformerTest { @Test public void testTransform() {
// Path: src/main/java/moulder/Value.java // public interface Value<T> { // /** // * // * @return the generated value // */ // T get(); // } // Path: src/test/java/moulder/values/ValueTransformerTest.java import moulder.Value; import org.junit.Test; import static org.junit.Assert.assertEquals; import static ...
Value<String> v = mock(Value.class);
jawher/moulder-j
src/main/java/moulder/MoulderShop.java
// Path: src/main/java/moulder/Registry.java // public static final class TemplatorConfig { // public final String selector; // public final List<Moulder> templators; // // public TemplatorConfig(String selector, List<Moulder> templators) { // this.selector = selector; // this.templators = ...
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.MouldersApplier; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jso...
package moulder; public class MoulderShop { private final Registry registry = new Registry(); public MoulderChain select(String selector) { List<Moulder> moulders = new ArrayList<Moulder>(); registry.register(selector, moulders); return new MoulderChain(moulders); } public...
// Path: src/main/java/moulder/Registry.java // public static final class TemplatorConfig { // public final String selector; // public final List<Moulder> templators; // // public TemplatorConfig(String selector, List<Moulder> templators) { // this.selector = selector; // this.templators = ...
for (TemplatorConfig c : registry.getConfig()) {
jawher/moulder-j
src/main/java/moulder/MoulderShop.java
// Path: src/main/java/moulder/Registry.java // public static final class TemplatorConfig { // public final String selector; // public final List<Moulder> templators; // // public TemplatorConfig(String selector, List<Moulder> templators) { // this.selector = selector; // this.templators = ...
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import moulder.Registry.TemplatorConfig; import moulder.moulds.helpers.MouldersApplier; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jso...
package moulder; public class MoulderShop { private final Registry registry = new Registry(); public MoulderChain select(String selector) { List<Moulder> moulders = new ArrayList<Moulder>(); registry.register(selector, moulders); return new MoulderChain(moulders); } public...
// Path: src/main/java/moulder/Registry.java // public static final class TemplatorConfig { // public final String selector; // public final List<Moulder> templators; // // public TemplatorConfig(String selector, List<Moulder> templators) { // this.selector = selector; // this.templators = ...
Collection<Node> oes = MouldersApplier.applyMoulders(c.templators, Arrays.<Node>asList(e));