Skip to content

Commit

Permalink
Revert "Merge branch 'master' of https://github.com/appledora/TheMeow"
Browse files Browse the repository at this point in the history
This reverts commit 2a564c5
  • Loading branch information
istiakshihab committed Jul 7, 2019
1 parent 4e6336c commit 38332d2
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</activity>
<activity android:name=".Search.RJ" />
<activity android:name=".Favourites.feedback" />
<activity android:name=".Homenew.HomeNew" />
<activity android:name=".Home.Home" />
<activity android:name=".Mood.Facebook" />
<activity android:name=".credit_page" />
<activity android:name=".ApiRegistration" />
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/com/chameleon/streammusic/ApiLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import android.widget.EditText;
import android.widget.Toast;

import com.chameleon.streammusic.Homenew.HomeNew;
import com.chameleon.streammusic.Home.Home;
import com.chameleon.streammusic.data.model.outer;
import com.chameleon.streammusic.data.remote.ApiUtils;
import com.chameleon.streammusic.data.remote.UserClient;
Expand All @@ -36,12 +36,12 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_main);

mEmailField = findViewById(R.id.entryEmailLog);
mPasswordField = findViewById(R.id.entryPasswordLog);
mEmailField = (EditText) findViewById(R.id.entryEmailLog);
mPasswordField = (EditText) findViewById(R.id.entryPasswordLog);

mLoginButton = findViewById(R.id.buttonLogin);
mRegisterButton = findViewById(R.id.buttonSignUp);
mForgetPasswordButton = findViewById(R.id.buttonForget);
mLoginButton = (Button) findViewById(R.id.buttonLogin);
mRegisterButton = (Button)findViewById(R.id.buttonSignUp);
mForgetPasswordButton = (Button) findViewById(R.id.buttonForget);

mAPIService = ApiUtils.getAPIService();

Expand Down Expand Up @@ -87,7 +87,7 @@ public void onResponse(Call<outer> call, Response<outer> response) {
Log.i("MY :", "post submitted to API." + response.body().getOutput().getToken());
Toast.makeText(ApiLogin.this, "Response Successful!!", Toast.LENGTH_SHORT).show();
//spinner.setVisibility(View.GONE);
Intent intent = new Intent(ApiLogin.this, HomeNew.class);
Intent intent = new Intent(ApiLogin.this, Home.class);
intent.putExtra("token", response.body().getOutput().getToken());
startActivity(intent);
} else {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/chameleon/streammusic/ChatActvity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public void onCreate(Bundle savedInstanceState) {


setContentView(R.layout.activity_chat);
buttonSend = findViewById(R.id.send);
listView = findViewById(R.id.msgview);
buttonSend = (ImageView) findViewById(R.id.send);
listView = (ListView) findViewById(R.id.msgview);
chatArrayAdapter = new ChatArrayAdapter(getApplicationContext(), R.layout.right);
chatText = findViewById(R.id.msg);
chatText = (EditText) findViewById(R.id.msg);

if (ActivityCompat.checkSelfPermission(ChatActvity.this,
Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED | ActivityCompat.checkSelfPermission(ChatActvity.this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}else{
row = inflater.inflate(R.layout.left, parent, false);
}
chatText = row.findViewById(R.id.msgr);
chatText = (TextView) row.findViewById(R.id.msgr);
chatText.setText(chatMessageObj.message);
return row;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Context;
import android.os.Handler;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
Expand All @@ -13,9 +12,8 @@
import android.widget.Button;
import android.widget.TextView;

import com.chameleon.streammusic.Homenew.HomeNew;
import com.chameleon.streammusic.Home.Home;
import com.chameleon.streammusic.R;
import com.chameleon.streammusic.Search.RJ;
import com.chameleon.streammusic.Utils.BottomNavigationViewHelper;
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;

Expand All @@ -29,8 +27,6 @@
import java.util.LinkedList;
import java.util.Queue;

import static com.chameleon.streammusic.Search.RJ.client;


public class feedback extends AppCompatActivity {

Expand Down Expand Up @@ -83,8 +79,8 @@ protected void onCreate(Bundle savedInstanceState) {
if(feedbackLog == null)
{
feedbackLog = "0";
preArtist = HomeNew.curArtist;
preSong = HomeNew.curSong;
preArtist = Home.curArtist;
preSong = Home.curSong;

likeButton.setVisibility(View.VISIBLE);
dislikeButton.setVisibility(View.VISIBLE);
Expand All @@ -97,14 +93,14 @@ protected void onCreate(Bundle savedInstanceState) {
public void run() {

try{
if(feedbackLog.startsWith("0") && !(HomeNew.curGenre.startsWith("RJ") && HomeNew.curGenre.length() == 2))
if(feedbackLog.startsWith("0") && !(Home.curGenre.startsWith("RJ") && Home.curGenre.length() == 2))
{
titleView.setText("You are Listening to:");
buttonTitle.setText("Was this the right time to play this kind of music?");

songName.setText(HomeNew.curSong);
artistName.setText("Artist: " + HomeNew.curArtist);
} else if ( HomeNew.curGenre.startsWith("RJ") && HomeNew.curGenre.length() == 2 ){
songName.setText(Home.curSong);
artistName.setText("Artist: " + Home.curArtist);
} else if ( Home.curGenre.startsWith("RJ") && Home.curGenre.length() == 2 ){
titleView.setText("Now our RJ is Talking");
buttonTitle.setText("");

Expand All @@ -125,20 +121,20 @@ public void run() {
dislikeButton.setVisibility(View.INVISIBLE);
}

if(!(HomeNew.curArtist.contains(preArtist) && HomeNew.curArtist.length() == preArtist.length() && HomeNew.curSong.contains(preSong) && HomeNew.curSong.length() == preSong.length() ))
if(!(Home.curArtist.contains(preArtist) && Home.curArtist.length() == preArtist.length() && Home.curSong.contains(preSong) && Home.curSong.length() == preSong.length() ))
{
System.out.println("song changed");
feedbackLog = "0";

preArtist = HomeNew.curArtist;
preSong = HomeNew.curSong;
preArtist = Home.curArtist;
preSong = Home.curSong;


titleView.setText("You are Listening to:");
buttonTitle.setText("Was this the right time to play this kind of music?");

songName.setText(HomeNew.curSong);
artistName.setText(HomeNew.curArtist);
songName.setText(Home.curSong);
artistName.setText(Home.curArtist);

likeButton.setVisibility(View.VISIBLE);
dislikeButton.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -172,7 +168,7 @@ public void onClick(View v) {
dislikeButton.setVisibility(View.INVISIBLE);

if(T == null || !T.isAlive()) {
client = new ClientThread("<FEEDBACK>"+token+"__"+HomeNew.curSong);
client = new ClientThread("<FEEDBACK>"+token+"__"+ Home.curSong);
T = new Thread(client);
T.start();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chameleon.streammusic.Homenew;
package com.chameleon.streammusic.Home;

import android.content.Context;
import android.content.Intent;
Expand All @@ -25,10 +25,6 @@
import com.chameleon.streammusic.ApiLogin;
import com.chameleon.streammusic.ChatActvity;
import com.chameleon.streammusic.FontsOverride;
import com.chameleon.streammusic.Home.HomeFragment;
import com.chameleon.streammusic.Home.LiveFragment;
import com.chameleon.streammusic.Home.SectionsPagerAdapter;
import com.chameleon.streammusic.Home.TrendingFragment;
import com.chameleon.streammusic.R;
import com.chameleon.streammusic.Utils.BottomNavigationViewHelper;
import com.chameleon.streammusic.credit_page;
Expand All @@ -47,7 +43,7 @@
import retrofit2.Callback;
import retrofit2.Response;

public class HomeNew extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
DrawerLayout drawer;

static final String serverName = "103.84.159.230";
Expand All @@ -59,11 +55,11 @@ public class HomeNew extends AppCompatActivity implements NavigationView.OnNavig
static Socket socket;
final String token = "siojdioajs21839712987391872ahsdhkjshkjdh21983912doiasoidoias";
final String userName = "shuhan";
private static final String TAG = "HomeNew";
private static final String TAG = "Home";
private static final int ACTIVITY_NUM = 0;
String token2;

private Context mContext = HomeNew.this;
private Context mContext = Home.this;
private Button mLogout;
private Button mChat;
private UserClient mAPIService;
Expand All @@ -88,20 +84,20 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

mLogout = findViewById(R.id.buttonLogout);
mChat = findViewById(R.id.buttonChat);
mLogout = (Button)findViewById(R.id.buttonLogout);
mChat = (Button) findViewById(R.id.buttonChat);
mAPIService = ApiUtils.getAPIService();
token2 = getIntent().getStringExtra("token");
buttonFlag = 0;
setupBottomNavigationView();
setupViewPager();

Toolbar toolbar = findViewById(R.id.toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_close, R.string.navigation_drawer_open);
drawer.addDrawerListener(toggle);
Expand All @@ -121,7 +117,7 @@ public void onClick(View view) {
});
FontsOverride.setDefaultFont(this, "MONOSPACE", "doppio_one.ttf");
setupBottomNavigationView();
drawer = findViewById(R.id.drawer_layout);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);


/* final Button button = (Button) findViewById(R.id.floatplay);
Expand Down Expand Up @@ -157,10 +153,10 @@ private void setupViewPager() {
adapter.addFragment(new HomeFragment());
adapter.addFragment(new TrendingFragment());

ViewPager viewPager = findViewById(R.id.container);
ViewPager viewPager = (ViewPager) findViewById(R.id.container);
viewPager.setAdapter(adapter);

TabLayout tabLayout = findViewById(R.id.tabs);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);

tabLayout.getTabAt(0).setText("Live");
Expand All @@ -169,7 +165,7 @@ private void setupViewPager() {
}

private void startChat() {
Intent intent = new Intent(HomeNew.this, ChatActvity.class);
Intent intent = new Intent(Home.this, ChatActvity.class);
startActivity(intent);
}

Expand All @@ -180,21 +176,21 @@ public void onResponse(Call<logoutResponse> call, Response<logoutResponse> respo
System.out.println("Response code =>" + response.code());
Log.i("MY: ", "LOGOUT CLICKED");
if (response.isSuccessful()) {
Toast.makeText(HomeNew.this, "Response Successful!! in general page", Toast.LENGTH_SHORT).show();
Toast.makeText(Home.this, "Response Successful!! in general page", Toast.LENGTH_SHORT).show();
//spinner.setVisibility(View.GONE);
Intent intent = new Intent(HomeNew.this, ApiLogin.class);
Intent intent = new Intent(Home.this, ApiLogin.class);
startActivity(intent);
} else {
//spinner.setVisibility(View.GONE);
Toast.makeText(HomeNew.this, "Response Unsuccessful", Toast.LENGTH_SHORT).show();
Toast.makeText(Home.this, "Response Unsuccessful", Toast.LENGTH_SHORT).show();
}

}

@Override
public void onFailure(Call<logoutResponse> call, Throwable t) {
// spinner.setVisibility(View.GONE);
Toast.makeText(HomeNew.this, "No Internet.", Toast.LENGTH_SHORT).show();
Toast.makeText(Home.this, "No Internet.", Toast.LENGTH_SHORT).show();
t.printStackTrace();
}
});
Expand All @@ -211,7 +207,7 @@ public void onBackPressed() {

private void setupBottomNavigationView() {
Log.d(TAG, "setupBottomNavigationView: setting up BottomNavigationView");
BottomNavigationViewEx bottomNavigationViewEx = findViewById(R.id.bottomNavViewBar);
BottomNavigationViewEx bottomNavigationViewEx = (BottomNavigationViewEx) findViewById(R.id.bottomNavViewBar);
BottomNavigationViewHelper.setupBottomNavigationView(bottomNavigationViewEx);
BottomNavigationViewHelper.enableNavigation(mContext, bottomNavigationViewEx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,86 @@
import android.view.ViewGroup;

import com.chameleon.streammusic.R;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import java.io.IOException;

/**
* Created by HEMAYEET on 1/3/2018.
*/

public class TrendingFragment extends Fragment {
Button b_play;

MediaPlayer mediaPlayer;

boolean prepared = false;
boolean started = false;
String stream = "http://103.84.159.230:8000/sustcast";

private static final String TAG = "Trending Fragment";

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_trending, container, false);


mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
new PlayerTask().execute(stream);

return view;
}

class PlayerTask extends AsyncTask<String, Void, Boolean>{
@Override
protected Boolean doInBackground(String... strings) {

try {
mediaPlayer.setDataSource(strings[0]);
mediaPlayer.prepare();
prepared = true;
} catch (IOException e) {
e.printStackTrace();
}
return prepared;
}

@Override
protected void onPostExecute(Boolean aboolean) {
super.onPostExecute(aboolean);
mediaPlayer.start();

}
}

@Override
public void onPause() {
super.onPause();
if(started) {
mediaPlayer.pause();
}
}
@Override
public void onResume() {
super.onResume();
if(started) {
mediaPlayer.start();
}
}

@Override
public void onDestroy() {
super.onDestroy();
if(prepared){
mediaPlayer.release();
}
}
}
Loading

0 comments on commit 38332d2

Please sign in to comment.