Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Neamar/KISS
Browse files Browse the repository at this point in the history
  • Loading branch information
Neamar committed Jul 17, 2016
2 parents 31d230d + 1c21eed commit a7b58fc
Show file tree
Hide file tree
Showing 9 changed files with 789 additions and 56 deletions.
695 changes: 674 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions app/src/main/java/fr/neamar/kiss/DataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ public void removeShortcuts(String packageName) {
}
}


public void removeFromExcluded(String packageName) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.context);
String excluded = prefs.getString("excluded-apps-list", "");
prefs.edit().putString("excluded-apps-list", excluded.replaceAll(packageName + ";", "")).apply();
}

/**
* Return all applications
*
Expand Down
53 changes: 40 additions & 13 deletions app/src/main/java/fr/neamar/kiss/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import android.widget.Toast;

import java.util.ArrayList;
import java.util.regex.Pattern;

import fr.neamar.kiss.adapter.RecordAdapter;
import fr.neamar.kiss.broadcast.IncomingCallHandler;
Expand All @@ -52,10 +53,10 @@
import fr.neamar.kiss.searcher.QueryInterface;
import fr.neamar.kiss.searcher.QuerySearcher;
import fr.neamar.kiss.searcher.Searcher;
import fr.neamar.kiss.ui.KeyboardScrollHider;
import fr.neamar.kiss.utils.PackageManagerUtils;
import fr.neamar.kiss.ui.BlockableListView;
import fr.neamar.kiss.ui.BottomPullEffectView;
import fr.neamar.kiss.ui.KeyboardScrollHider;
import fr.neamar.kiss.utils.PackageManagerUtils;

public class MainActivity extends Activity implements QueryInterface, KeyboardScrollHider.KeyboardHandler {

Expand All @@ -76,8 +77,13 @@ public class MainActivity extends Activity implements QueryInterface, KeyboardSc
/**
* InputType with spellcheck and swiping
*/
private final static int SPELLCHECK_ENABLED_TYPE = InputType.TYPE_CLASS_TEXT |
private final static int SPELLCHECK_ENABLED_INPUT_TYPE = InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
/**
* default InputType
*/
private final static int DEFAULT_INPUT_TYPE = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
/**
* Adapter to display records
*/
Expand All @@ -91,6 +97,10 @@ public class MainActivity extends Activity implements QueryInterface, KeyboardSc
* View for the Search text
*/
private EditText searchEditText;
/**
* Whether or not Search text should be spell checked (affects inputType)
*/
private boolean searchEditTextSpellcheck;
private final Runnable displayKeyboardRunnable = new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -203,8 +213,7 @@ public void onReceive(Context context, Intent intent) {
this.list.setAdapter(this.adapter);

this.list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
{
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
adapter.onClick(position, v);
}
});
Expand All @@ -213,7 +222,7 @@ public void onItemClick(AdapterView<?> parent, View v, int position, long id)
public void onChanged() {
super.onChanged();

if(adapter.isEmpty()) {
if (adapter.isEmpty()) {
listContainer.setVisibility(View.GONE);
listEmpty.setVisibility(View.VISIBLE);
} else {
Expand All @@ -233,10 +242,13 @@ public void afterTextChanged(Editable s) {
s.delete(0, 1);
}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}

public void onTextChanged(CharSequence s, int start, int before, int count) {
updateRecords(s.toString());
String text = s.toString();
adjustInputType(text);
updateRecords(text);
displayClearOnInput();
}
});
Expand Down Expand Up @@ -273,10 +285,9 @@ public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id)
);
this.hider.start();

// Enable swiping
if (prefs.getBoolean("enable-spellcheck", false)) {
searchEditText.setInputType(SPELLCHECK_ENABLED_TYPE);
}
// Check whether user enabled spell check and adjust input type accordingly
searchEditTextSpellcheck = prefs.getBoolean("enable-spellcheck", false);
adjustInputType(null);

//enable/disable phone/sms broadcast receiver
PackageManagerUtils.enableComponent(this, IncomingSmsHandler.class, prefs.getBoolean("enable-sms-history", false));
Expand All @@ -289,6 +300,22 @@ public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id)
applyDesignTweaks();
}

private void adjustInputType(String currentText) {
int currentInputType = searchEditText.getInputType();
int requiredInputType;

if (currentText != null && Pattern.matches("[+]\\d+", currentText)) {
requiredInputType = InputType.TYPE_CLASS_PHONE;
} else if (searchEditTextSpellcheck) {
requiredInputType = SPELLCHECK_ENABLED_INPUT_TYPE;
} else {
requiredInputType = DEFAULT_INPUT_TYPE;
}
if (currentInputType != requiredInputType) {
searchEditText.setInputType(requiredInputType);
}
}

/**
* Apply some tweaks to the design, depending on the current SDK version
*/
Expand Down Expand Up @@ -631,7 +658,7 @@ public void retrieveFavorites() {

if (favoritesPojo.size() == 0) {
int noFavCnt = prefs.getInt("no-favorites-tip", 0);
if (noFavCnt<3) {
if (noFavCnt < 3) {
Toast toast = Toast.makeText(MainActivity.this, getString(R.string.no_favorites), Toast.LENGTH_SHORT);
toast.show();
prefs.edit().putInt("no-favorites-tip", ++noFavCnt).commit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public void onReceive(Context ctx, Intent intent) {
String packageName = intent.getData().getSchemeSpecificPart();

KissApplication.getDataHandler(ctx).removeShortcuts(packageName);

KissApplication.getDataHandler(ctx).removeFromExcluded(packageName);
}

KissApplication.resetIconsHandler(ctx);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ast/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,5 @@
<string name="search_desc">Habilita la gueta pente Google, DuckDuckGo, Bing, etc...</string>
<string name="ui_excluded_apps_not_found">Nun s\'escluyeron aplicaciones</string>
<string name="ui_excluded_apps_dialog_title">Deseleiciona les aplicaciones que te prestaría incluyir</string>
<string name="ui_excluded_apps">Ver/Editar les tos aplicaciones escluyíes</string>
</resources>
10 changes: 9 additions & 1 deletion app/src/main/res/values-ro/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@
<item>alphabetical</item>
<item>invertedAlphabetical</item>
</string-array>
</resources>
<string-array name="historyModeEntries">
<item>Cele mai recente primele</item>
<item>Cele mai frecvent utilizate primele</item>
</string-array>
<string-array name="historyModeValues">
<item>recency</item>
<item>frecency</item>
</string-array>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@
<string name="ui_excluded_apps_dialog_title">Перевыбрать приложения которые вы хотите передобавить</string>
<string name="ui_excluded_apps_not_found">Исключённых приложений нет</string>
<string name="search_providers_title">Выбор поставщиков веб-поиска</string>
<string name="history_mode_name">Режим истории</string>
<string name="history_mode_desc">Выбор режима отображения истории</string>
</resources>
75 changes: 54 additions & 21 deletions app/src/main/res/values-sr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='UTF-8'?>
<resources>

<string name="app_name">КИС покретач</string>
<string name="activity_setting">Поставке</string>
<string name="ui_search_hint">Тражите апликације, контакте…</string>
<string name="ui_item_search">%1$s Тражите “%2$s”</string>
<string name="ui_item_phone">Позив “%s”</string>
<string name="ui_item_phone">Позови “%s”</string>
<string name="ui_item_contact_hint_message">Порука</string>
<string name="ui_item_contact_hint_call">Позив</string>
<string name="ui_item_contact_hint_call">Позови</string>

<string name="title_ui">Поставке сучеља</string>
<string name="title_history">Поставке историјата</string>
<string name="title_ui">Корисничко сучеље</string>
<string name="title_history">Историјат</string>
<string name="title_providers">Избор услуга</string>
<string name="menu_settings">Поставке уређаја</string>
<string name="no_favorites">Још нема омиљених. Користите апликацију и биће додата у омиљене.</string>
<string name="no_favorites">Још нема омиљених. Додајте их дугим додиром.</string>

<string name="ui_empty_1">Почните претрагом било чега</string>
<string name="ui_empty_1_sub">Апликације, контакти, поставке</string>
<string name="ui_empty_2">Увек видите ваш историјат.</string>
<string name="ui_empty_1_sub">Апликације, контакти, поставке</string>
<string name="ui_empty_2">Увек видите ваш историјат</string>
<string name="ui_empty_2_sub">За бржи приступ</string>
<string name="ui_empty_3">Брзи приступ најчешће коришћеним апликацијама</string>
<string name="ui_empty_3_sub">КИС покретач учи ваше навике</string>

<string name="toggles_name">Прекидачи</string>
<string name="toggles_name">Прекидачи (бежични, блутут…)</string>

<string name="aliases_name">Псеудоними</string>

<string name="contacts_name">Контакти</string>

<string name="search_name">Гугл претрага</string>
<string name="search_name">Веб претрага</string>

<string name="settings_name">Поставке</string>
<string name="settings_name">Поставке уређаја</string>

<string name="phone_name">Телефон</string>
<string name="phone_name">Бројеви телефона</string>

<string name="stub_application">Име апликације</string>
<string name="stub_contact">Име контакта</string>
Expand All @@ -41,11 +41,11 @@
<string name="stub_toggle">Поставка за измену</string>
<string name="stub_phone">Позови +381 12 34 56 78</string>
<string name="main_menu">Мени</string>
<string name="main_clear">Очисти текст</string>
<string name="main_clear">Очисти поље претраге</string>
<string name="main_kiss">Приказуј списак апликација и омиљено</string>
<string name="main_kiss_back">Приказуј историјат</string>
<string name="reset_name">Ресетуј историјат</string>
<string name="keyboard_name">Приказуј тастатуру</string>
<string name="keyboard_name">Приказуј тастатуру по покретању</string>
<string name="spellcheck_name">Омогући проверу правописа</string>

<string name="alias_phone">dial,biraj,zovi,pozovi,šalji,poruka,telefon,бирај,зови,позови,шаљи,порука,телефон</string>
Expand All @@ -66,13 +66,46 @@
<string name="toggle_silent">Тихо</string>
<string name="toggle_data">Мрежни интернет</string>
<string name="menu_wallpaper">Ажурирај тапет</string>
<string name="application_not_found">Опс… Не могу да покренем апликацију.</string>
<string name="application_not_found">Опс… Не могу да покренем ту апликацију.</string>
<string name="history_erased">Историјат обрисан.</string>
<string name="alias_clock">clock,alarm,timer,stopwatch</string>
<string name="alias_clock">сат,аларм,тајмер,штоперица</string>

<string name="removed_item">Делетед</string>
<string name="menu_remove">Извадите из историје</string>
<string name="menu_app_details">детаилс</string>
<string name="menu_app_uninstall">унинсталл</string>
<string name="removed_item">Уклоњено</string>
<string name="menu_remove">Уклони из историјата</string>
<string name="menu_app_details">Подаци о апликацији</string>
<string name="menu_app_uninstall">Уклони</string>

</resources>
<string name="title_advanced">Напредне поставке</string>
<string name="toggles_on">%s активиран/а</string>
<string name="toggles_off">%s деактивиран/а</string>

<string name="shortcuts_name">Пречице</string>

<string name="root_mode_name">Корени режим</string>
<string name="root_mode_error">Не могу да добијем корене привилегије.</string>
<string name="settings_nfc">НФЦ</string>
<string name="settings_tethering">Тетеринг</string>
<string name="toggle_torch">Бакља</string>
<string name="toggle_sync">Синхронизација</string>
<string name="toggle_autorotate">Ауторотација</string>
<string name="restart_name">Поново покрени КИС</string>
<string name="items_title">%d ставки</string>

<string name="history_mode_name">Режим историјата</string>
<string name="icons_pack_default_name">Системске иконе</string>

<string name="favorites_erased">Омиљене обрисане.</string>
<string name="menu_favorites_add">Додај у омиљене</string>
<string name="excluded_app_list_erased"/>
<string name="menu_app_hibernate">Хибернирај</string>

<string name="menu_contact_copy_phone">Копирај број телефона</string>
<string name="menu_phone_create">Направи контакт</string>

<string name="toast_favorites_added">%s је додат/а у омиљене</string>

<string name="icons_pack_name">Иконе теме (ADW.Launcher)</string>
<string name="icons_hide_desc">Корисно на спорим уређајима</string>
<string name="icons_hide_main">Сакриј иконе апликација</string>
<string name="portrait_title">Присили усправни режим</string>
</resources>
File renamed without changes.

0 comments on commit a7b58fc

Please sign in to comment.