This commit is contained in:
tom79 2019-06-13 17:55:21 +02:00
parent fe60c17fa3
commit 02efb85d06
5 changed files with 260 additions and 0 deletions

View File

@ -128,6 +128,11 @@
<data android:pathPattern=".*\\.fedilab" />
</intent-filter>
</activity>
<activity android:name="app.fedilab.android.activities.MastodonRegisterActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="app.fedilab.android.activities.LoginActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"

View File

@ -0,0 +1,108 @@
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
package app.fedilab.android.activities;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import java.util.HashMap;
import java.util.Map;
import app.fedilab.android.R;
import app.fedilab.android.helper.Helper;
/**
* Created by Thomas on 13/06/2019.
* Register activity class
*/
public class MastodonRegisterActivity extends BaseActivity {
private Map<String, String> createMap() {
Map<String,String> categories = new HashMap<>();
categories.put("general", getString(R.string.category_general));
categories.put("regional", getString(R.string.category_regional));
categories.put("art", getString(R.string.category_art));
categories.put("journalism", getString(R.string.category_journalism));
categories.put("activism", getString(R.string.category_activism));
categories.put("lgbt", "LGBTQ+");
categories.put("games", getString(R.string.category_games));
categories.put("tech", getString(R.string.category_tech));
categories.put("adult", getString(R.string.category_adult));
categories.put("furry", getString(R.string.category_furry));
categories.put("food", getString(R.string.category_food));
return categories;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
switch (theme){
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme);
break;
case Helper.THEME_DARK:
setTheme(R.style.AppThemeDark);
break;
case Helper.THEME_BLACK:
setTheme(R.style.AppThemeBlack);
break;
default:
setTheme(R.style.AppThemeDark);
}
setContentView(R.layout.activity_login);
ActionBar actionBar = getSupportActionBar();
if( actionBar != null ) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
assert inflater != null;
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.simple_bar, null);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
toolbar_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar_title.setText(R.string.add_account);
if (theme == Helper.THEME_LIGHT){
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
Helper.colorizeToolbar(toolbar, R.color.black, MastodonRegisterActivity.this);
}
}
}
@Override
protected void onResume(){
super.onResume();
}
}

View File

@ -0,0 +1,91 @@
package app.fedilab.android.client.Entities;
/* Copyright 2019 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
public class InstanceReg {
private String domain;
private String version;
private String description;
private String language;
private String category;
private String proxied_thumbnail;
private int total_users;
private int last_week_users;
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getProxied_thumbnail() {
return proxied_thumbnail;
}
public void setProxied_thumbnail(String proxied_thumbnail) {
this.proxied_thumbnail = proxied_thumbnail;
}
public int getTotal_users() {
return total_users;
}
public void setTotal_users(int total_users) {
this.total_users = total_users;
}
public int getLast_week_users() {
return last_week_users;
}
public void setLast_week_users(int last_week_users) {
this.last_week_users = last_week_users;
}
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Thomas Schneider
This file is a part of Fedilab
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with Fedilab; if not,
see <http://www.gnu.org/licenses>.
-->
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- category -->
<TextView
android:gravity="center"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/category"/>
<com.jaredrummler.materialspinner.MaterialSpinner
android:textSize="16sp"
android:id="@+id/reg_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/reg_category_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>

View File

@ -991,6 +991,16 @@
<string name="mention_status">Mention the status</string>
<string name="action_news">News</string>
<string name="set_display_news_from_fedilab">Display news from Fedilab\'s account</string>
<string name="category_general">General</string>
<string name="category_regional">Regional</string>
<string name="category_art">Art</string>
<string name="category_journalism">Journalism</string>
<string name="category_activism">Activism</string>
<string name="category_games">Gaming</string>
<string name="category_tech">Technology</string>
<string name="category_adult">Adult content</string>
<string name="category_furry">Furry</string>
<string name="category_food">Food</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>
<item quantity="other">%d votes</item>