From c1a2cf0f47e7a6e1309f1a73aa8053c900cb5c94 Mon Sep 17 00:00:00 2001 From: Defend Date: Fri, 10 Feb 2017 21:40:27 +0300 Subject: [PATCH] Last commit before making global changes! --- .../defend/defdevteam/tstu/MainActivity.java | 41 ------------------- .../ru/defend/defdevteam/tstu/OldParser.java | 28 +++++++++++++ .../defend/defdevteam/tstu/WebActivity.java | 40 +++--------------- 3 files changed, 33 insertions(+), 76 deletions(-) create mode 100644 app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java b/app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java index d5b9e5f..bb28ed5 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java @@ -28,7 +28,6 @@ public class MainActivity extends AppCompatActivity { final String PASSWORD = "password"; final String CHECK = "check"; public CheckBox check; - static public List subs; @@ -43,7 +42,6 @@ public class MainActivity extends AppCompatActivity { //onFeedReaderComplete(); } - //TODO: Проверка авторизации здеся, хотя как ее тут пилить, когда ее нету лооол! void saveForms() { sPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sPref.edit(); @@ -70,35 +68,6 @@ public class MainActivity extends AppCompatActivity { } } - - public class subsAdapter extends ArrayAdapter { - public subsAdapter(Context context) { - super(context, android.R.layout.simple_list_item_multiple_choice, subs); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - groupList group = getItem(position); - - if(convertView == null){ - convertView = LayoutInflater.from(getContext()).inflate(android.R.layout.simple_list_item_multiple_choice, null); - } - ((TextView) convertView.findViewById(android.R.id.text1)).setText(group.name); - return convertView; - } - } - - - - public class groupList { - public String name, rate; - public groupList(String name, String rate){ - this.name = name; - this.rate = rate; - } - } - - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -107,16 +76,6 @@ public class MainActivity extends AppCompatActivity { password = (EditText) findViewById(R.id.passEdit); check = (CheckBox) findViewById(R.id.save); loadForms(); - //TODO: убрать потом - subs = new ArrayList(); - subs.add(new groupList("test","test")); - subs.add(new groupList("test","test")); - subs.add(new groupList("test","test")); - subs.add(new groupList("test","test")); - setContentView(R.layout.subscriptions); - ArrayAdapter subsL = new subsAdapter(this); - ListView subsList = (ListView) findViewById(R.id.subsList); - subsList.setAdapter(subsL); } @Override diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java b/app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java new file mode 100644 index 0000000..190a795 --- /dev/null +++ b/app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java @@ -0,0 +1,28 @@ +package ru.defend.defdevteam.tstu; + +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Created by itsmy on 10.02.2017. + */ + +public class OldParser { + + public static StringBuffer removeUTFCharacters(String data){ + Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})"); + Matcher m = p.matcher(data); + StringBuffer buf = new StringBuffer(data.length()); + while (m.find()) { + String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16)); + m.appendReplacement(buf, Matcher.quoteReplacement(ch)); + } + m.appendTail(buf); + return buf; + } + + public ArrayList parseGroup(){ + return null; + } +} diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java b/app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java index cef5676..4d8ba7c 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java @@ -144,16 +144,6 @@ public class WebActivity extends AppCompatActivity final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); -// toolbar.setNavigationOnClickListener( -// new View.OnClickListener() { -// @Override -// public void onClick(View view) { -// Log.d("Toolbar","Hmmm..."); -// if(drawer.isDrawerOpen(GravityCompat.START)){ -// drawer.openDrawer(GravityCompat.START); -// } -// } -// }); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); @@ -161,8 +151,6 @@ public class WebActivity extends AppCompatActivity MainA = getIntent(); - - browser = (WebView) findViewById(R.id.webView); browser.setWebViewClient(new MyWebViewClient()); browserSet = browser.getSettings(); @@ -187,7 +175,6 @@ public class WebActivity extends AppCompatActivity navigationView.getMenu().getItem(1).setChecked(true); myToolbar.setTitle(R.string.title_profile); - feedController = new FeedController(this, 1); AuthURL = "http://web-iais.admin.tstu.ru:7777/zion/f?p=stud_main"; @@ -276,18 +263,6 @@ public class WebActivity extends AppCompatActivity - public static StringBuffer removeUTFCharacters(String data){ - Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})"); - Matcher m = p.matcher(data); - StringBuffer buf = new StringBuffer(data.length()); - while (m.find()) { - String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16)); - m.appendReplacement(buf, Matcher.quoteReplacement(ch)); - } - m.appendTail(buf); - return buf; - } - public void loadSite () { browser.loadUrl(AuthURL); } @@ -455,6 +430,10 @@ public class WebActivity extends AppCompatActivity groupList.setAdapter(groupL); } + public void fillGroup(ArrayList group){ + + } + public void fillFaculty(){ faculty = new ArrayList(); String n,r; @@ -480,7 +459,6 @@ public class WebActivity extends AppCompatActivity } - //TODO: Переделать к хуям позор ниже public void fillAll(){ String s; String s2 = GroupRateHTML; @@ -508,14 +486,6 @@ public class WebActivity extends AppCompatActivity positionFaculty.setText("Место в институте: " + s2); } - public void buttonRefresh (View v) { - getHTML(); - } - - public void buttonLogout (View v) { - finish(); - } - @TargetApi(19) public void getHTML(){ @@ -532,7 +502,7 @@ public class WebActivity extends AppCompatActivity public void encodeHTML(){ if(siteBuf != null){ - siteBuf = removeUTFCharacters(siteBuf).toString(); + siteBuf = OldParser.removeUTFCharacters(siteBuf).toString(); Log.d("Response html","Загружена страница "+cutLine("","",siteBuf)); Log.i("encodeHTML",siteBuf); }